Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding config props to stories #2802

Merged
merged 12 commits into from
Aug 26, 2024
Merged
2 changes: 1 addition & 1 deletion packages/lib/src/components/Card/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export interface CardConfiguration extends UIElementProps {
*
* - merchant set config option
*/
minimumExpiryDate?: string[];
minimumExpiryDate?: string;

/**
* When in Dropin this is the name shown in the paymentMethods list
Expand Down
16 changes: 15 additions & 1 deletion packages/lib/storybook/config/paymentsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,21 @@ const paymentsConfig = {
additionalData: {
// Force response code. See https://docs.adyen.com/development-resources/test-cards/result-code-testing/adyen-response-codes
// RequestedTestAcquirerResponseCode: 2,
allow3DS2: true
// allow3DS2: true,
/**
* To force threeds2InMDFlow:
* comment out "allow3DS2" & comment in the following 2 lines:
*/
// threeDS2InMDFlow: true,
// executeThreeD: true
},
// Ready for v69+ - lose any additionalData 3DS2 related lines e.g. allow3DS2: true
authenticationData: {
attemptAuthentication: 'always',
// To force MDFlow: comment out below, and just keep line above
threeDSRequestData: {
nativeThreeDS: 'preferred'
}
},
shopperEmail: 'test-shopper@storytel.com',
shopperIP: '172.30.0.1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async function createSessionsCheckout({ showPayButton, countryCode, shopperLocal

const checkout = await AdyenCheckout({
clientKey: process.env.CLIENT_KEY,
environment: process.env.CLIENT_ENV,
environment: process.env.CLIENT_ENV as any,
session,
showPayButton,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export const Default: BancontactStory = {
args: {
componentConfiguration: {
_disableClickToPay: true
}
},
countryCode: 'BE'
}
};

Expand Down
44 changes: 43 additions & 1 deletion packages/lib/storybook/stories/cards/Card.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getStoryContextCheckout } from '../../utils/get-story-context-checkout'
import { CardConfiguration } from '../../../src/components/Card/types';
import { Card } from '../../../src';
import { Container } from '../Container';
import { searchFunctionExample } from '../../../../playground/src/utils';

type CardStory = StoryConfiguration<CardConfiguration>;

Expand All @@ -22,7 +23,35 @@ export const Default: CardStory = {
render: createComponent,
args: {
componentConfiguration: {
_disableClickToPay: true
_disableClickToPay: true,
autoFocus: true,
// brands: ['mc'],
// brandsConfiguration: { visa: { icon: 'http://localhost:3000/nocard.svg', name: 'altVisa' } },
challengeWindowSize: '02',
// configuration: {socialSecurityNumberMode: 'auto'}
// data: {
// holderName: 'J. Smith'
// },
disableIOSArrowKeys: false,
// disclaimerMessage,
// doBinLookup: false,
enableStoreDetails: false,
// exposeExpiryDate: true,
forceCompat: false,
hasHolderName: false,
holderNameRequired: false,
hideCVC: false,
// keypadFix: false,
legacyInputMode: false,
maskSecurityCode: false,
minimumExpiryDate: null, // e.g. '11/24'
// name: '', // Affects Dropin only
placeholders: {}, // e.g. { holderName: 'B Bob' }
positionHolderNameOnTop: false,
showBrandIcon: true,
showContextualElement: true
// showPayButton: false,
// styles: { base: { fontWeight: 300 } },
}
}
};
Expand All @@ -34,6 +63,7 @@ export const WithAVS: CardStory = {
_disableClickToPay: true,
billingAddressRequired: true,
billingAddressAllowedCountries: ['US', 'CA', 'GB'],
// billingAddressRequiredFields: ['postalCode', 'country'],
data: {
billingAddress: {
street: 'Virginia Street',
Expand All @@ -59,6 +89,17 @@ export const WithPartialAVS: CardStory = {
}
};

export const WithAVSAddressLookup: CardStory = {
render: createComponent,
args: {
componentConfiguration: {
_disableClickToPay: true,
billingAddressRequired: true,
onAddressLookup: searchFunctionExample
}
}
};

export const WithInstallments: CardStory = {
render: createComponent,
args: {
Expand All @@ -82,6 +123,7 @@ export const KCP: CardStory = {
render: createComponent,
args: {
componentConfiguration: {
...{ brands: ['mc', 'visa', 'amex', 'bcmc', 'maestro', 'korean_local_card'] },
_disableClickToPay: true,
// Set koreanAuthenticationRequired AND countryCode so KCP fields show at start
// Just set koreanAuthenticationRequired if KCP fields should only show if korean_local_card entered
Expand Down
1 change: 1 addition & 0 deletions packages/lib/storybook/stories/dropin/Dropin.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const meta: MetaConfiguration<DropinConfiguration> = {
componentConfiguration: {
showRadioButton: false,
instantPaymentTypes: ['googlepay'],
showRemovePaymentMethodButton: false,
paymentMethodsConfiguration: {
googlepay: {
buttonType: 'plain'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { MetaConfiguration, PaymentMethodStoryProps, StoryConfiguration } from '
import { getStoryContextCheckout } from '../../utils/get-story-context-checkout';
import { Container } from '../Container';
import { IssuerListConfiguration } from '../../../src/components/helpers/IssuerListContainer/types';
import { Dotpay } from '../../../src';
import { OnlineBankingPL } from '../../../src';

type DotpayStory = StoryConfiguration<IssuerListConfiguration>;
type OnlineBankingPLStory = StoryConfiguration<IssuerListConfiguration>;

const meta: MetaConfiguration<IssuerListConfiguration> = {
title: 'IssuerList/Dotpay'
title: 'IssuerList/OnlineBankingPL'
};

export const Default: DotpayStory = {
export const Default: OnlineBankingPLStory = {
render: (args: PaymentMethodStoryProps<IssuerListConfiguration>, context) => {
const { componentConfiguration } = args;
const checkout = getStoryContextCheckout(context);
const dotpay = new Dotpay(checkout, componentConfiguration);
return <Container element={dotpay} />;
const onlineBankingPL = new OnlineBankingPL(checkout, componentConfiguration);
return <Container element={onlineBankingPL} />;
},
args: {
countryCode: 'PL'
Expand Down
Loading