Skip to content

Commit f2be41a

Browse files
feat(payment): PAYPAL-5717 Added AppSwitch to PPCP button strategy
1 parent 23a5b24 commit f2be41a

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

packages/paypal-commerce-integration/src/paypal-commerce/paypal-commerce-button-strategy.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ describe('PayPalCommerceButtonStrategy', () => {
496496
expect(paypalCommerceIntegrationService.createOrder).toHaveBeenCalledWith(
497497
'paypalcommerce',
498498
{
499-
userAgent: 'Mozilla/5.0 (darwin) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/16.7.0',
499+
userAgent:
500+
'Mozilla/5.0 (darwin) AppleWebKit/537.36 (KHTML, like Gecko) jsdom/16.7.0',
500501
},
501502
);
502503
});

packages/paypal-commerce-integration/src/paypal-commerce/paypal-commerce-button-strategy.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ export default class PayPalCommerceButtonStrategy implements CheckoutButtonStrat
107107

108108
const defaultCallbacks = {
109109
...(this.isPaypalCommerceAppSwitchEnabled() && { appSwitchWhenAvailable: true }),
110-
createOrder: () => this.paypalCommerceIntegrationService.createOrder(
111-
'paypalcommerce',
112-
...(this.isPaypalCommerceAppSwitchEnabled() ? [{ userAgent: userAgent }] : [])
113-
),
110+
createOrder: () =>
111+
this.paypalCommerceIntegrationService.createOrder(
112+
'paypalcommerce',
113+
...(this.isPaypalCommerceAppSwitchEnabled() ? [{ userAgent }] : []),
114+
),
114115
onApprove: ({ orderID }: ApproveCallbackPayload) =>
115116
this.paypalCommerceIntegrationService.tokenizePayment(methodId, orderID),
116117
};
@@ -140,10 +141,7 @@ export default class PayPalCommerceButtonStrategy implements CheckoutButtonStrat
140141
const paypalButton = paypalSdk.Buttons(buttonRenderOptions);
141142

142143
if (paypalButton.isEligible()) {
143-
if (
144-
paypalButton.hasReturned?.() &&
145-
this.isPaypalCommerceAppSwitchEnabled()
146-
) {
144+
if (paypalButton.hasReturned?.() && this.isPaypalCommerceAppSwitchEnabled()) {
147145
paypalButton.resume?.();
148146
} else {
149147
paypalButton.render(`#${containerId}`);

0 commit comments

Comments
 (0)