Skip to content

Commit

Permalink
fix(payment): PI-1718 Klarna config request fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PavlenkoM committed Mar 20, 2024
1 parent 0b48d7b commit 11fa886
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export default class KlarnaV2PaymentStrategy {
}

// #1 - old request
const state = this.paymentIntegrationService.getState();
// const state = this.paymentIntegrationService.getState();
// const cartId = state.getCartOrThrow().id;
// const params = { params: cartId };

Expand All @@ -156,7 +156,9 @@ export default class KlarnaV2PaymentStrategy {
// });

// #2 - new with params
const { method } = state.getPaymentMethodOrThrow(methodId);
const { method } = this.paymentIntegrationService
.getState()
.getPaymentMethodOrThrow(methodId);

await this.paymentIntegrationService.loadPaymentMethod(gatewayId, {
...options,
Expand All @@ -175,7 +177,9 @@ export default class KlarnaV2PaymentStrategy {

return new Promise<KlarnaLoadResponse>((resolve) => {
const state = this.paymentIntegrationService.getState();
const paymentMethod = state.getPaymentMethodOrThrow(methodId);
const paymentMethod = state.getPaymentMethodOrThrow(methodId, gatewayId);

console.log('*** paymentMethod', paymentMethod);

if (!this.klarnaPayments || !paymentMethod.clientToken) {
throw new NotInitializedError(NotInitializedErrorType.PaymentNotInitialized);
Expand Down

0 comments on commit 11fa886

Please sign in to comment.