Skip to content

Commit

Permalink
feat(payment): PAYPAL-4069 renamed braintree accelerated checkout shi…
Browse files Browse the repository at this point in the history
…pping strategy files
  • Loading branch information
andriiVitvitskyi1990 committed Apr 25, 2024
1 parent 88c03ba commit 39c3eec
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
BraintreeFastlaneCardComponent,
BraintreeFastlaneCardComponentOptions,
BraintreeInitializationData,
isBraintreeAcceleratedCheckoutCustomer,
isBraintreeFastlaneCustomer,
} from '@bigcommerce/checkout-sdk/braintree-utils';
import {
Address,
Expand Down Expand Up @@ -300,7 +300,7 @@ export default class BraintreeFastlanePaymentStrategy implements PaymentStrategy
const customer = state.getCustomerOrThrow();
const features = state.getStoreConfigOrThrow().checkoutSettings.features;
const paymentProviderCustomer = state.getPaymentProviderCustomer();
const braintreePaymentProviderCustomer = isBraintreeAcceleratedCheckoutCustomer(
const braintreePaymentProviderCustomer = isBraintreeFastlaneCustomer(
paymentProviderCustomer,
)
? paymentProviderCustomer
Expand Down Expand Up @@ -338,7 +338,7 @@ export default class BraintreeFastlanePaymentStrategy implements PaymentStrategy
private isPayPalFastlaneInstrument(instrumentId: string): boolean {
const state = this.paymentIntegrationService.getState();
const paymentProviderCustomer = state.getPaymentProviderCustomerOrThrow();
const braintreePaymentProviderCustomer = isBraintreeAcceleratedCheckoutCustomer(
const braintreePaymentProviderCustomer = isBraintreeFastlaneCustomer(
paymentProviderCustomer,
)
? paymentProviderCustomer
Expand Down
2 changes: 1 addition & 1 deletion packages/braintree-utils/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { default as getValidBraintreeFastlaneStyles } from './get-valid-braintree-fastlane-styles';
export { default as isBraintreeAcceleratedCheckoutCustomer } from './is-braintree-accelerated-checkout-customer';
export { default as isBraintreeFastlaneCustomer } from './is-braintree-fastlane-customer';
export { default as isBraintreeConnectWindow } from './is-braintree-connect-window';
export { default as isBraintreeError } from './is-braintree-error';
export { default as isBraintreeFastlaneWindow } from './is-braintree-fastlane-window';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isBraintreeAcceleratedCheckoutCustomer from './is-braintree-accelerated-checkout-customer';
import isBraintreeFastlaneCustomer from './is-braintree-fastlane-customer';

describe('isBraintreeAcceleratedCheckoutCustomer', () => {
it('returns true if payment provider customer is Braintree related', () => {
Expand All @@ -8,14 +8,14 @@ describe('isBraintreeAcceleratedCheckoutCustomer', () => {
instruments: [],
};

expect(isBraintreeAcceleratedCheckoutCustomer(paymentProviderCustomer)).toBe(true);
expect(isBraintreeFastlaneCustomer(paymentProviderCustomer)).toBe(true);
});

it('returns false if payment provider customer is not Braintree related', () => {
const paymentProviderCustomer = {
stripeLinkAuthenticationState: true,
};

expect(isBraintreeAcceleratedCheckoutCustomer(paymentProviderCustomer)).toBe(false);
expect(isBraintreeFastlaneCustomer(paymentProviderCustomer)).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
PayPalConnectCustomer,
} from '@bigcommerce/checkout-sdk/payment-integration-api';

export default function isBraintreeAcceleratedCheckoutCustomer(
export default function isBraintreeFastlaneCustomer(
customer?: PaymentProviderCustomer,
): customer is PayPalConnectCustomer {
if (!customer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { some } from 'lodash';

import {
BraintreeIntegrationService,
isBraintreeAcceleratedCheckoutCustomer,
isBraintreeFastlaneCustomer,
} from '@bigcommerce/checkout-sdk/braintree-utils';
import { PaymentMethodFailedError } from '@bigcommerce/checkout-sdk/payment-integration-api';

Expand Down Expand Up @@ -274,7 +274,7 @@ export default class BraintreeCreditCardPaymentStrategy implements PaymentStrate
private _shouldInitializeBraintreeConnect() {
const state = this._store.getState();
const paymentProviderCustomer = state.paymentProviderCustomer.getPaymentProviderCustomer();
const braintreePaymentProviderCustomer = isBraintreeAcceleratedCheckoutCustomer(
const braintreePaymentProviderCustomer = isBraintreeFastlaneCustomer(
paymentProviderCustomer,
)
? paymentProviderCustomer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Registry } from '../common/registry';
import createShippingStrategyRegistry from './create-shipping-strategy-registry';
import { ShippingStrategy } from './strategies';
import { AmazonPayV2ShippingStrategy } from './strategies/amazon-pay-v2';
import { BraintreeAcceleratedCheckoutShippingStrategy } from './strategies/braintree';
import { BraintreeFastlaneShippingStrategy } from './strategies/braintree';
import { PayPalCommerceFastlaneShippingStrategy } from './strategies/paypal-commerce';

describe('CreateShippingStrategyRegistry', () => {
Expand All @@ -28,7 +28,7 @@ describe('CreateShippingStrategyRegistry', () => {
it('can instantiate braintree accelerated checkout', () => {
const shippingStrategy = registry.get('braintreeacceleratedcheckout');

expect(shippingStrategy).toBeInstanceOf(BraintreeAcceleratedCheckoutShippingStrategy);
expect(shippingStrategy).toBeInstanceOf(BraintreeFastlaneShippingStrategy);
});

it('can instantiate paypal commerce fastlane shipping strategy', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import ConsignmentRequestSender from './consignment-request-sender';
import ShippingStrategyActionCreator from './shipping-strategy-action-creator';
import { ShippingStrategy } from './strategies';
import { AmazonPayV2ShippingStrategy } from './strategies/amazon-pay-v2';
import { BraintreeAcceleratedCheckoutShippingStrategy } from './strategies/braintree';
import { BraintreeFastlaneShippingStrategy } from './strategies/braintree';
import { DefaultShippingStrategy } from './strategies/default';
import { PayPalCommerceFastlaneShippingStrategy } from './strategies/paypal-commerce';
import { StripeUPEShippingStrategy } from './strategies/stripe-upe';
Expand Down Expand Up @@ -80,7 +80,7 @@ export default function createShippingStrategyRegistry(
registry.register(
'braintreeacceleratedcheckout',
() =>
new BraintreeAcceleratedCheckoutShippingStrategy(
new BraintreeFastlaneShippingStrategy(
store,
billingAddressActionCreator,
consignmentActionCreator,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/shipping/shipping-request-options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestOptions } from '../common/http-request';

import { AmazonPayV2ShippingInitializeOptions } from './strategies/amazon-pay-v2';
import { BraintreeAcceleratedCheckoutInitializeOptions } from './strategies/braintree';
import { BraintreeFastlaneShippingInitializeOptions } from './strategies/braintree';
import { PayPalCommerceFastlaneShippingInitializeOptions } from './strategies/paypal-commerce';
import { StripeUPEShippingInitializeOptions } from './strategies/stripe-upe';

Expand Down Expand Up @@ -45,7 +45,7 @@ export interface ShippingInitializeOptions<T = {}> extends ShippingRequestOption
* The options that are required to initialize the shipping step of checkout
* when using Braintree Fastlane.
*/
braintreefastlane?: BraintreeAcceleratedCheckoutInitializeOptions;
braintreefastlane?: BraintreeFastlaneShippingInitializeOptions;

/**
* The options that are required to initialize the shipping step of checkout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BraintreeConnectStylesOption } from '@bigcommerce/checkout-sdk/braintree-utils';
import { BraintreeFastlaneStylesOption } from '@bigcommerce/checkout-sdk/braintree-utils';

/**
* A set of options that are required to initialize the shipping step of
Expand All @@ -12,5 +12,5 @@ export default interface BraintreeFastlaneShippingInitializeOptions {
* because they will be provided to PayPal library only for the first strategy initialization
* no matter what strategy was initialised first
*/
styles?: BraintreeConnectStylesOption;
styles?: BraintreeFastlaneStylesOption;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { PaymentProviderCustomerActionCreator } from '../../../payment-provider-
import ConsignmentActionCreator from '../../consignment-action-creator';
import { getFlatRateOption } from '../../internal-shipping-options.mock';

import BraintreeAcceleratedCheckoutShippingStrategy from './braintree-accelerated-checkout-shipping-strategy';
import BraintreeFastlaneShippingStrategy from './braintree-fastlane-shipping-strategy';

const BRAINTREE_AXO_METHOD_ID = 'braintreeacceleratedcheckout';

Expand Down Expand Up @@ -56,7 +56,7 @@ class ConsignmentActionCreatorMock {
selectShippingOption() {}
}

describe('BraintreeAcceleratedCheckoutShippingStrategy', () => {
describe('BraintreeFastlaneShippingStrategy', () => {
let store: CheckoutStore;
let billingAddressActionCreator: BillingAddressActionCreatorMock;
let consignmentActionCreator: ConsignmentActionCreatorMock;
Expand Down Expand Up @@ -109,7 +109,7 @@ describe('BraintreeAcceleratedCheckoutShippingStrategy', () => {
untrustedShippingCardVerificationMode: 'cvv',
};
const createStrategy = () => {
return new BraintreeAcceleratedCheckoutShippingStrategy(
return new BraintreeFastlaneShippingStrategy(
store,
billingAddressActionCreator as unknown as BillingAddressActionCreator,
consignmentActionCreator as unknown as ConsignmentActionCreator,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
BraintreeFastlaneStylesOption,
BraintreeFastlaneVaultedInstrument,
BraintreeIntegrationService,
isBraintreeAcceleratedCheckoutCustomer,
isBraintreeConnectProfileData,
isBraintreeFastlaneCustomer,
isBraintreeFastlaneProfileData,
} from '@bigcommerce/checkout-sdk/braintree-utils';
import { BrowserStorage } from '@bigcommerce/checkout-sdk/storage';
Expand All @@ -34,7 +34,7 @@ import ConsignmentActionCreator from '../../consignment-action-creator';
import { ShippingInitializeOptions, ShippingRequestOptions } from '../../shipping-request-options';
import ShippingStrategy from '../shipping-strategy';

export default class BraintreeAcceleratedCheckoutShippingStrategy implements ShippingStrategy {
export default class BraintreeFastlaneShippingStrategy implements ShippingStrategy {
private _browserStorage: BrowserStorage;

constructor(
Expand Down Expand Up @@ -103,7 +103,7 @@ export default class BraintreeAcceleratedCheckoutShippingStrategy implements Shi
const features = state.config.getStoreConfigOrThrow().checkoutSettings.features;
const paypalFastlaneSessionId = this._browserStorage.getItem('sessionId');
const paymentProviderCustomer = state.paymentProviderCustomer.getPaymentProviderCustomer();
const braintreePaymentProviderCustomer = isBraintreeAcceleratedCheckoutCustomer(
const braintreePaymentProviderCustomer = isBraintreeFastlaneCustomer(
paymentProviderCustomer,
)
? paymentProviderCustomer
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/shipping/strategies/braintree/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as BraintreeAcceleratedCheckoutInitializeOptions } from './braintree-accelerated-checkout-shipping-initialize-options';
export { default as BraintreeAcceleratedCheckoutShippingStrategy } from './braintree-accelerated-checkout-shipping-strategy';
export { default as BraintreeFastlaneShippingInitializeOptions } from './braintree-fastlane-shipping-initialize-options';
export { default as BraintreeFastlaneShippingStrategy } from './braintree-fastlane-shipping-strategy';

0 comments on commit 39c3eec

Please sign in to comment.