Skip to content

Commit 1f7ad64

Browse files
feat(payment): Added PPCP FL 3DS
1 parent 1715a74 commit 1f7ad64

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/paypal-commerce-integration/src/paypal-commerce-fastlane/paypal-commerce-fastlane-payment-strategy.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ describe('PayPalCommerceFastlanePaymentStrategy', () => {
433433

434434
expect(paypalCommerceRequestSender.createOrder).toHaveBeenCalledWith(methodId, {
435435
cartId: cart.id,
436+
fastlaneToken: 'paypal_fastlane_instrument_id_nonce',
436437
});
437438

438439
const paypalFastlaneComponent = await paypalFastlane.FastlaneCardComponent({});
@@ -474,6 +475,7 @@ describe('PayPalCommerceFastlanePaymentStrategy', () => {
474475

475476
expect(paypalCommerceRequestSender.createOrder).toHaveBeenCalledWith(methodId, {
476477
cartId: cart.id,
478+
fastlaneToken: mockedInstrumentId,
477479
});
478480

479481
expect(paymentIntegrationService.submitOrder).toHaveBeenCalledWith({}, undefined);

packages/paypal-commerce-integration/src/paypal-commerce-fastlane/paypal-commerce-fastlane-payment-strategy.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { LiabilityShiftEnum } from '../paypal-commerce-types';
3535
export default class PaypalCommerceFastlanePaymentStrategy implements PaymentStrategy {
3636
private paypalComponentMethods?: PayPalFastlaneCardComponentMethods;
3737
private paypalFastlaneSdk?: any; // TODO: FIX
38+
private threeDSVerificationMethod?: string;
3839

3940
constructor(
4041
private paymentIntegrationService: PaymentIntegrationService,
@@ -90,6 +91,8 @@ export default class PaypalCommerceFastlanePaymentStrategy implements PaymentStr
9091
const { isDeveloperModeApplicable, isFastlaneStylingEnabled } =
9192
paymentMethod.initializationData || {};
9293

94+
this.threeDSVerificationMethod = paymentMethod.initializationData?.threeDSVerificationMethod;
95+
9396
this.paypalFastlaneSdk = await this.paypalCommerceSdk.getPayPalFastlaneSdk(
9497
paymentMethod,
9598
cart.currency.code,
@@ -382,14 +385,14 @@ export default class PaypalCommerceFastlanePaymentStrategy implements PaymentStr
382385
const threeDomainSecureComponent = this.paypalFastlaneSdk?.ThreeDomainSecureClient;
383386

384387
if (!threeDomainSecureComponent) {
385-
throw new Error(); // TODO: add Payment client error
388+
throw new PaymentMethodClientUnavailableError();
386389
}
387390

388391
const threeDomainSecureParameters = {
389392
amount: order.orderAmount.toString(),
390393
currency: cart.currency.code,
391394
nonce,
392-
threeDSRequested: true, // TODO: Sets SCA_ALWAYS in the eligibility API request, otherwise defaults to SCA_WHEN_REQUIRED
395+
threeDSRequested: this.threeDSVerificationMethod || 'SCA_WHEN_REQUIRED',
393396
transactionContext: {
394397
experience_context: {
395398
locale: 'en-US',

packages/paypal-commerce-utils/src/paypal-commerce-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface PayPalCommerceInitializationData {
3939
shouldRunAcceleratedCheckout?: boolean; // TODO: remove when PPCP Fastlane A/B test will be finished
4040
paymentButtonStyles?: Record<string, PayPalButtonStyleOptions>;
4141
paypalBNPLConfiguration?: PayPalBNPLConfigurationItem[];
42+
threeDSVerificationMethod?: string;
4243
}
4344

4445
/**

0 commit comments

Comments
 (0)