Skip to content

feat(payment): PI-4031 Change how payment_method_category parameter i… #2890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bc-sebastianszafraniec
Copy link
Contributor

@bc-sebastianszafraniec bc-sebastianszafraniec commented Jun 5, 2025

…s passed to Klarna

What?

Adjusting payment_method_category to the new requirements requested by Klarna.
BE part - https://github.com/bigcommerce/bigpay/pull/9155

Also improved test coverage to meet 80% requirement

Zrzut ekranu 2025-06-12 o 17 20 54

Testing / Proof

Tested manually

Klarna.mov

@bigcommerce/team-checkout @bigcommerce/team-payments

@bc-sebastianszafraniec bc-sebastianszafraniec changed the title feat(payment): PI-4031 Change how payment_method_category parameter i… [TEST] feat(payment): PI-4031 Change how payment_method_category parameter i… Jun 5, 2025
@bcsnyk
Copy link
Contributor

bcsnyk commented Jun 5, 2025

🎉 Snyk checks have passed. No issues have been found so far.

code/snyk check is complete. No issues have been found. (View Details)

@bc-sebastianszafraniec bc-sebastianszafraniec changed the title [TEST] feat(payment): PI-4031 Change how payment_method_category parameter i… feat(payment): PI-4031 Change how payment_method_category parameter i… Jun 5, 2025
@bc-sebastianszafraniec bc-sebastianszafraniec changed the title feat(payment): PI-4031 Change how payment_method_category parameter i… [TEST] feat(payment): PI-4031 Change how payment_method_category parameter i… Jun 5, 2025
@bc-sebastianszafraniec bc-sebastianszafraniec changed the title [TEST] feat(payment): PI-4031 Change how payment_method_category parameter i… feat(payment): PI-4031 Change how payment_method_category parameter i… Jun 5, 2025
@bc-sebastianszafraniec bc-sebastianszafraniec marked this pull request as ready for review June 5, 2025 12:44
@bc-sebastianszafraniec bc-sebastianszafraniec requested a review from a team as a code owner June 5, 2025 12:44
@bc-sebastianszafraniec bc-sebastianszafraniec force-pushed the PI-4031 branch 3 times, most recently from 356a420 to c92122e Compare June 6, 2025 09:07
Copy link
Contributor

@PavlenkoM PavlenkoM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! And thanks for test coverage improvement!

@@ -105,7 +105,7 @@ export default class KlarnaV2PaymentStrategy {

await this.klarnav2TokenUpdater.klarnaOrderInitialization(cartId, clientToken);

const { authorization_token: authorizationToken } = await this.authorizeOrThrow(methodId);
const { authorization_token: authorizationToken } = await this.authorizeOrThrow(methodId, gatewayId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { authorization_token: authorizationToken } = await this.authorizeOrThrow(methodId, gatewayId);
const paymentMethodСategory = this.isKlarnaSingleRadioButtonEnabled() ? gatewayId : methodId;
const { authorization_token: authorizationToken } = await this.authorizeOrThrow(paymentMethodСategory);

@@ -228,7 +228,7 @@ export default class KlarnaV2PaymentStrategy {
return klarnaAddress;
}

private async authorizeOrThrow(methodId: string): Promise<KlarnaAuthorizationResponse> {
private async authorizeOrThrow(methodId: string, gatewayId: string): Promise<KlarnaAuthorizationResponse> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private async authorizeOrThrow(methodId: string, gatewayId: string): Promise<KlarnaAuthorizationResponse> {
private async authorizeOrThrow(paymentMethodСategory: string): Promise<KlarnaAuthorizationResponse> {

@@ -245,7 +245,7 @@ export default class KlarnaV2PaymentStrategy {
}

this.klarnaPayments.authorize(
{ payment_method_category: methodId },
{ payment_method_category: this.isKlarnaSingleRadioButtonEnabled() ? gatewayId : methodId },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{ payment_method_category: this.isKlarnaSingleRadioButtonEnabled() ? gatewayId : methodId },
{ payment_method_category: paymentMethodСategory },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants