Skip to content

Commit

Permalink
feat(payment): PAYPAL-4550 added force reload of paypal client to avo…
Browse files Browse the repository at this point in the history
…id initializaing with wrong intent value
  • Loading branch information
bc-nick committed Aug 14, 2024
1 parent 456e2bf commit 8b39cfa
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ describe('PayPalCommerceAlternativeMethodsPaymentStrategy', () => {

expect(paypalCommerceIntegrationService.loadPayPalSdk).toHaveBeenCalledWith(
defaultMethodId,
undefined,
undefined,
true,
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ export default class PayPalCommerceAlternativeMethodsPaymentStrategy implements
return;
}

await this.paypalCommerceIntegrationService.loadPayPalSdk(methodId);
await this.paypalCommerceIntegrationService.loadPayPalSdk(
methodId,
undefined,
undefined,
true,
);

this.loadingIndicatorContainer = paypalOptions.container.split('#')[1];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class PayPalCommerceScriptLoader {
const scriptQuery = new URLSearchParams(options).toString();
const scriptSrc = `${paypalSdkUrl}?${scriptQuery}`;

await this.scriptLoader.loadScript(scriptSrc, { async: true, attributes });
await this.scriptLoader.loadScript(scriptSrc, { async: true, attributes }, forceLoad);
}

if (!this.window.paypal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ describe('PayPalCommerceCustomerStrategy', () => {
it('loads paypal sdk with provided method id', async () => {
await strategy.initialize(initializationOptions);

expect(paypalCommerceIntegrationService.loadPayPalSdk).toHaveBeenCalledWith(methodId);
expect(paypalCommerceIntegrationService.loadPayPalSdk).toHaveBeenCalledWith(
methodId,
undefined,
undefined,
true,
);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ export default class PayPalCommerceCustomerStrategy implements CustomerStrategy
await this.paymentIntegrationService.loadPaymentMethod(methodId);
}

await this.paypalCommerceIntegrationService.loadPayPalSdk(methodId);
await this.paypalCommerceIntegrationService.loadPayPalSdk(
methodId,
undefined,
undefined,
true,
);

this.renderButton(methodId, paypalcommerce);
}
Expand Down

0 comments on commit 8b39cfa

Please sign in to comment.