mirror of
https://github.com/valitydev/checkout.git
synced 2024-11-06 02:25:18 +00:00
Deep link test (#355)
This commit is contained in:
parent
053324b44a
commit
32e8cc4092
@ -32,6 +32,7 @@ it('should return resolved init config', () => {
|
||||
skipUserInteraction: false,
|
||||
theme: null,
|
||||
paymentFlow: null,
|
||||
deepLink: null,
|
||||
};
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
@ -33,6 +33,7 @@ export const resolveInitConfig = (userConfig: Partial<InitConfig>): InitConfig =
|
||||
isExternalIDIncluded,
|
||||
theme,
|
||||
paymentFlow,
|
||||
deepLink,
|
||||
} = userConfig;
|
||||
return {
|
||||
...resolvedIntegrationType,
|
||||
@ -52,5 +53,6 @@ export const resolveInitConfig = (userConfig: Partial<InitConfig>): InitConfig =
|
||||
isExternalIDIncluded: setDefault(resolveBoolean(isExternalIDIncluded), true),
|
||||
theme: resolveString(theme),
|
||||
paymentFlow: resolveObject(paymentFlow),
|
||||
deepLink: resolveString(deepLink),
|
||||
};
|
||||
};
|
||||
|
@ -20,6 +20,7 @@ export type InitConfig = {
|
||||
skipUserInteraction?: boolean;
|
||||
isExternalIDIncluded?: boolean;
|
||||
paymentFlow?: object;
|
||||
deepLink?: string;
|
||||
};
|
||||
|
||||
export type ThemeConfig = Record<string, any>;
|
||||
|
@ -43,4 +43,5 @@ export const toInitContext = (initConfig: InitConfig): InitContext => ({
|
||||
metadata: initConfig.metadata,
|
||||
recurring: initConfig.recurring,
|
||||
paymentFlow: toPaymentFlow(initConfig.paymentFlow),
|
||||
deepLink: initConfig.deepLink,
|
||||
});
|
||||
|
@ -49,6 +49,7 @@ export type InitContext = {
|
||||
readonly cancelUrl?: string;
|
||||
readonly metadata?: Record<string, any>;
|
||||
readonly recurring?: boolean;
|
||||
readonly deepLink?: string;
|
||||
};
|
||||
|
||||
export type CommonPaymentModel = {
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
PaymentModelContext,
|
||||
ViewModelContext,
|
||||
} from 'checkout/contexts';
|
||||
import { isNil } from 'checkout/utils';
|
||||
|
||||
import { CardHolderFormControl } from './CardHolderFormControl';
|
||||
import { CardNumberFormControl } from './CardNumberFormControl';
|
||||
@ -44,6 +45,8 @@ export function CardForm() {
|
||||
|
||||
const isSecureCode = isSecureCodeAvailable(watch('cardNumber'));
|
||||
|
||||
const deepLink = initContext?.deepLink;
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<VStack align="stretch" spacing={5}>
|
||||
@ -72,6 +75,16 @@ export function CardForm() {
|
||||
{l['form.button.pay.label']} {viewAmount}
|
||||
</Button>
|
||||
</LightMode>
|
||||
{!isNil(deepLink) && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
// window.open(deepLink, '_self');
|
||||
window.location.replace(deepLink);
|
||||
}}
|
||||
>
|
||||
Go to deep link
|
||||
</Button>
|
||||
)}
|
||||
</VStack>
|
||||
</form>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user