@primer-io/react-native 0.15.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -24
- package/android/build.gradle +7 -2
- package/android/gradle.properties +3 -3
- package/android/src/main/java/com/primerioreactnative/PrimerRN.kt +118 -148
- package/android/src/main/java/com/primerioreactnative/PrimerRNEventListener.kt +212 -127
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerCheckoutDataRN.kt +12 -0
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerClientSessionRN.kt +54 -0
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerErrorRN.kt +3 -7
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerEvents.kt +13 -0
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerPaymentInstrumentTokenRN.kt +4 -4
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerPaymentMethodDataRN.kt +8 -0
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerSettingsRN.kt +43 -125
- package/android/src/main/java/com/primerioreactnative/extensions/Payment.kt +6 -0
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerAddress.kt +15 -0
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerCheckoutData.kt +7 -0
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerClientSession.kt +15 -0
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerCustomer.kt +13 -0
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerLineItem.kt +8 -0
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerOrder.kt +6 -0
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerPaymentMethodData.kt +7 -0
- package/android/src/main/java/com/primerioreactnative/utils/ErrorHelper.kt +1 -3
- package/android/src/main/java/com/primerioreactnative/utils/JsonConverter.kt +45 -0
- package/android/src/main/java/com/primerioreactnative/utils/PrimerImplementedRNCallbacks.kt +16 -6
- package/ios/DataModels/ImplementedRNCallbacks.swift +31 -0
- package/ios/DataModels/PrimerErrorRN.swift +0 -17
- package/ios/DataModels/PrimerSettingsRN.swift +70 -147
- package/ios/DataModels/PrimerThemeRN.swift +1 -10
- package/ios/{Pods/Manifest.lock → Podfile.lock} +1 -1
- package/ios/RNTPrimer.m +26 -12
- package/ios/RNTPrimer.swift +295 -249
- package/ios/ReactNative.xcodeproj/project.pbxproj +14 -14
- package/lib/commonjs/Primer.js +201 -150
- package/lib/commonjs/Primer.js.map +1 -1
- package/lib/commonjs/RNPrimer.js +102 -41
- package/lib/commonjs/RNPrimer.js.map +1 -1
- package/lib/commonjs/index.js +117 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/Primer.js +6 -0
- package/lib/commonjs/models/{action-request.js.map → Primer.js.map} +0 -0
- package/lib/commonjs/models/PrimerCheckoutData.js +9 -0
- package/lib/commonjs/models/PrimerCheckoutData.js.map +1 -0
- package/lib/commonjs/models/PrimerCheckoutPaymentMethodData.js +2 -0
- package/lib/commonjs/models/{client-session-actions-request.js.map → PrimerCheckoutPaymentMethodData.js.map} +0 -0
- package/lib/commonjs/models/PrimerClientSession.js +2 -0
- package/lib/commonjs/models/{primer-callbacks.js.map → PrimerClientSession.js.map} +0 -0
- package/lib/commonjs/models/{utils/countryCode.js → PrimerCountryCode.js} +1 -1
- package/lib/commonjs/models/PrimerCountryCode.js.map +1 -0
- package/lib/commonjs/models/{utils/currencyCode.js → PrimerCurrencyCode.js} +1 -1
- package/lib/commonjs/models/PrimerCurrencyCode.js.map +1 -0
- package/lib/commonjs/models/PrimerError.js +28 -0
- package/lib/commonjs/models/PrimerError.js.map +1 -0
- package/lib/commonjs/models/PrimerPaymentMethodTokenData.js +14 -0
- package/lib/commonjs/models/PrimerPaymentMethodTokenData.js.map +1 -0
- package/lib/commonjs/models/PrimerSessionIntent.js +14 -0
- package/lib/commonjs/models/PrimerSessionIntent.js.map +1 -0
- package/lib/commonjs/models/PrimerSettings.js +6 -0
- package/lib/commonjs/models/{primer-config.js.map → PrimerSettings.js.map} +0 -0
- package/lib/commonjs/models/PrimerTheme.js +2 -0
- package/lib/commonjs/models/{primer-request.js.map → PrimerTheme.js.map} +0 -0
- package/lib/commonjs/utils/index.js +1 -1
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/Primer.js +201 -137
- package/lib/module/Primer.js.map +1 -1
- package/lib/module/RNPrimer.js +102 -41
- package/lib/module/RNPrimer.js.map +1 -1
- package/lib/module/index.js +9 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/Primer.js +2 -0
- package/lib/{commonjs/models/primer-settings.js.map → module/models/Primer.js.map} +0 -0
- package/lib/module/models/PrimerCheckoutData.js +7 -0
- package/lib/module/models/PrimerCheckoutData.js.map +1 -0
- package/lib/module/models/PrimerCheckoutPaymentMethodData.js +2 -0
- package/lib/{commonjs/models/primer-theme.js.map → module/models/PrimerCheckoutPaymentMethodData.js.map} +0 -0
- package/lib/module/models/PrimerClientSession.js +2 -0
- package/lib/{commonjs/models/primer.js.map → module/models/PrimerClientSession.js.map} +0 -0
- package/lib/module/models/{utils/countryCode.js → PrimerCountryCode.js} +1 -1
- package/lib/module/models/PrimerCountryCode.js.map +1 -0
- package/lib/module/models/{utils/currencyCode.js → PrimerCurrencyCode.js} +1 -1
- package/lib/module/models/PrimerCurrencyCode.js.map +1 -0
- package/lib/module/models/PrimerError.js +19 -0
- package/lib/module/models/PrimerError.js.map +1 -0
- package/lib/module/models/PrimerPaymentMethodTokenData.js +7 -0
- package/lib/module/models/PrimerPaymentMethodTokenData.js.map +1 -0
- package/lib/module/models/PrimerSessionIntent.js +7 -0
- package/lib/module/models/PrimerSessionIntent.js.map +1 -0
- package/lib/module/models/PrimerSettings.js +2 -0
- package/lib/module/models/{action-request.js.map → PrimerSettings.js.map} +0 -0
- package/lib/module/models/PrimerTheme.js +2 -0
- package/lib/module/models/{client-session-actions-request.js.map → PrimerTheme.js.map} +0 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/Primer.d.ts +2 -15
- package/lib/typescript/RNPrimer.d.ts +16 -9
- package/lib/typescript/index.d.ts +9 -3
- package/lib/typescript/models/Primer.d.ts +26 -0
- package/lib/typescript/models/PrimerCheckoutData.d.ts +15 -0
- package/lib/typescript/models/PrimerCheckoutPaymentMethodData.d.ts +5 -0
- package/lib/typescript/models/PrimerClientSession.d.ts +45 -0
- package/lib/typescript/models/{utils/countryCode.d.ts → PrimerCountryCode.d.ts} +1 -1
- package/lib/typescript/models/{utils/currencyCode.d.ts → PrimerCurrencyCode.d.ts} +1 -1
- package/lib/typescript/models/PrimerError.d.ts +11 -0
- package/lib/typescript/models/PrimerPaymentMethodTokenData.d.ts +116 -0
- package/lib/typescript/models/PrimerSessionIntent.d.ts +4 -0
- package/lib/typescript/models/PrimerSettings.d.ts +73 -0
- package/lib/typescript/models/{primer-theme.d.ts → PrimerTheme.d.ts} +1 -1
- package/lib/typescript/utils/index.d.ts +1 -1
- package/package.json +1 -1
- package/primer-io-react-native.podspec +1 -1
- package/src/Primer.ts +228 -172
- package/src/RNPrimer.ts +135 -51
- package/src/index.tsx +33 -6
- package/src/models/Primer.ts +35 -0
- package/src/models/PrimerCheckoutData.ts +18 -0
- package/src/models/PrimerCheckoutPaymentMethodData.ts +5 -0
- package/src/models/PrimerClientSession.ts +53 -0
- package/src/models/{utils/countryCode.ts → PrimerCountryCode.ts} +1 -1
- package/src/models/{utils/currencyCode.ts → PrimerCurrencyCode.ts} +1 -1
- package/src/models/PrimerError.ts +20 -0
- package/src/models/PrimerPaymentMethodTokenData.ts +130 -0
- package/src/models/PrimerSessionIntent.ts +4 -0
- package/src/models/PrimerSettings.ts +93 -0
- package/src/models/{primer-theme.ts → PrimerTheme.ts} +1 -1
- package/src/utils/index.ts +1 -1
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerEventsRN.kt +0 -11
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerIntentRN.kt +0 -80
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerOnClientSessionActionsRequestRN.kt +0 -65
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerRequestRN.kt +0 -9
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerThemeRN.kt +0 -51
- package/android/src/main/java/com/primerioreactnative/utils/PrimerEventQueueRN.kt +0 -30
- package/ios/DataModels/PrimerIntentRN.swift +0 -10
- package/ios/DataModels/PrimerRequestRN.swift +0 -14
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +0 -344
- package/ios/Pods/Pods.xcodeproj/xcuserdata/aladintaleb.xcuserdatad/xcschemes/Pods-ReactNative.xcscheme +0 -60
- package/ios/Pods/Pods.xcodeproj/xcuserdata/aladintaleb.xcuserdatad/xcschemes/xcschememanagement.plist +0 -16
- package/ios/Pods/Target Support Files/Pods-ReactNative/Pods-ReactNative-acknowledgements.markdown +0 -3
- package/ios/Pods/Target Support Files/Pods-ReactNative/Pods-ReactNative-acknowledgements.plist +0 -29
- package/ios/Pods/Target Support Files/Pods-ReactNative/Pods-ReactNative-dummy.m +0 -5
- package/ios/Pods/Target Support Files/Pods-ReactNative/Pods-ReactNative.debug.xcconfig +0 -8
- package/ios/Pods/Target Support Files/Pods-ReactNative/Pods-ReactNative.release.xcconfig +0 -8
- package/ios/ReactNative.xcworkspace/xcuserdata/aladintaleb.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/commonjs/models/action-request.js +0 -2
- package/lib/commonjs/models/client-session-actions-request.js +0 -2
- package/lib/commonjs/models/payment-instrument-token.js +0 -30
- package/lib/commonjs/models/payment-instrument-token.js.map +0 -1
- package/lib/commonjs/models/primer-callbacks.js +0 -2
- package/lib/commonjs/models/primer-config.js +0 -2
- package/lib/commonjs/models/primer-error.js +0 -4
- package/lib/commonjs/models/primer-error.js.map +0 -1
- package/lib/commonjs/models/primer-intent.js +0 -4
- package/lib/commonjs/models/primer-intent.js.map +0 -1
- package/lib/commonjs/models/primer-request.js +0 -2
- package/lib/commonjs/models/primer-settings.js +0 -2
- package/lib/commonjs/models/primer-theme.js +0 -2
- package/lib/commonjs/models/primer.js +0 -2
- package/lib/commonjs/models/utils/countryCode.js.map +0 -1
- package/lib/commonjs/models/utils/currencyCode.js.map +0 -1
- package/lib/commonjs/models/utils/redirectScheme.js +0 -4
- package/lib/commonjs/models/utils/redirectScheme.js.map +0 -1
- package/lib/module/models/action-request.js +0 -2
- package/lib/module/models/client-session-actions-request.js +0 -2
- package/lib/module/models/payment-instrument-token.js +0 -28
- package/lib/module/models/payment-instrument-token.js.map +0 -1
- package/lib/module/models/primer-callbacks.js +0 -2
- package/lib/module/models/primer-callbacks.js.map +0 -1
- package/lib/module/models/primer-config.js +0 -2
- package/lib/module/models/primer-config.js.map +0 -1
- package/lib/module/models/primer-error.js +0 -2
- package/lib/module/models/primer-error.js.map +0 -1
- package/lib/module/models/primer-intent.js +0 -2
- package/lib/module/models/primer-intent.js.map +0 -1
- package/lib/module/models/primer-request.js +0 -2
- package/lib/module/models/primer-request.js.map +0 -1
- package/lib/module/models/primer-settings.js +0 -2
- package/lib/module/models/primer-settings.js.map +0 -1
- package/lib/module/models/primer-theme.js +0 -2
- package/lib/module/models/primer-theme.js.map +0 -1
- package/lib/module/models/primer.js +0 -2
- package/lib/module/models/primer.js.map +0 -1
- package/lib/module/models/utils/countryCode.js.map +0 -1
- package/lib/module/models/utils/currencyCode.js.map +0 -1
- package/lib/module/models/utils/redirectScheme.js +0 -2
- package/lib/module/models/utils/redirectScheme.js.map +0 -1
- package/lib/typescript/models/action-request.d.ts +0 -10
- package/lib/typescript/models/client-session-actions-request.d.ts +0 -15
- package/lib/typescript/models/payment-instrument-token.d.ts +0 -76
- package/lib/typescript/models/primer-callbacks.d.ts +0 -10
- package/lib/typescript/models/primer-config.d.ts +0 -44
- package/lib/typescript/models/primer-error.d.ts +0 -8
- package/lib/typescript/models/primer-intent.d.ts +0 -13
- package/lib/typescript/models/primer-request.d.ts +0 -7
- package/lib/typescript/models/primer-settings.d.ts +0 -65
- package/lib/typescript/models/primer.d.ts +0 -33
- package/lib/typescript/models/utils/redirectScheme.d.ts +0 -3
- package/src/models/action-request.ts +0 -12
- package/src/models/client-session-actions-request.ts +0 -21
- package/src/models/payment-instrument-token.ts +0 -109
- package/src/models/primer-callbacks.ts +0 -14
- package/src/models/primer-config.ts +0 -55
- package/src/models/primer-error.ts +0 -19
- package/src/models/primer-intent.ts +0 -49
- package/src/models/primer-request.ts +0 -7
- package/src/models/primer-settings.ts +0 -73
- package/src/models/primer.ts +0 -41
- package/src/models/utils/redirectScheme.ts +0 -5
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare type PrimerError = IPrimerError;
|
|
2
|
-
interface IPrimerError {
|
|
3
|
-
name: PrimerErrorType;
|
|
4
|
-
description?: String;
|
|
5
|
-
}
|
|
6
|
-
declare const errors: readonly ["ParseJsonFailed", "InitFailed", "CheckoutFlowFailed", "TokenizationFailed", "clientTokenNotConfigured", "settingsNotConfigured", "invalidPrimerIntent", "noIosViewController"];
|
|
7
|
-
declare type PrimerErrorType = typeof errors[number];
|
|
8
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const paymentMethods: readonly ["ADYEN_ALIPAY", "ADYEN_DOTPAY", "ADYEN_GIROPAY", "ADYEN_IDEAL", "ADYEN_MOBILEPAY", "ADYEN_SOFORT", "ADYEN_TRUSTLY", "ADYEN_TWINT", "ADYEN_VIPPS", "APAYA", "APPLE_PAY", "ATOME", "BUCKAROO_BANCONTACT", "BUCKAROO_EPS", "BUCKAROO_GIROPAY", "BUCKAROO_IDEAL", "BUCKAROO_SOFORT", "GOCARDLESS", "GOOGLE_PAY", "HOOLAH", "KLARNA", "MOLLIE_BANCONTACT", "MOLLIE_IDEAL", "PAY_NL_BANCONTACT", "PAY_NL_GIROPAY", "PAY_NL_IDEAL", "PAY_NL_PAYCONIQ", "PAYMENT_CARD", "PAYPAL", "XFERS_PAYNOW"];
|
|
2
|
-
export declare type SinglePrimerPaymentMethod = typeof paymentMethods[number];
|
|
3
|
-
export interface AnyPrimerPaymentMethodIntent {
|
|
4
|
-
vault: boolean;
|
|
5
|
-
paymentMethod: SinglePrimerPaymentMethod;
|
|
6
|
-
}
|
|
7
|
-
export declare type PrimerPaymentMethodIntent = ISinglePrimerPaymentMethodIntent;
|
|
8
|
-
interface ISinglePrimerPaymentMethodIntent {
|
|
9
|
-
vault: boolean;
|
|
10
|
-
paymentMethod: SinglePrimerPaymentMethod;
|
|
11
|
-
}
|
|
12
|
-
export declare type PrimerIntent = ISinglePrimerPaymentMethodIntent | AnyPrimerPaymentMethodIntent;
|
|
13
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { CountryCode } from './utils/countryCode';
|
|
2
|
-
import type { CurrencyCode } from './utils/currencyCode';
|
|
3
|
-
export declare type PrimerSettings = IPrimerSettings;
|
|
4
|
-
interface IPrimerSettings {
|
|
5
|
-
order?: IOrder;
|
|
6
|
-
business?: IBusiness;
|
|
7
|
-
customer?: ICustomer;
|
|
8
|
-
options?: IOptions;
|
|
9
|
-
}
|
|
10
|
-
interface IOrder {
|
|
11
|
-
id?: string;
|
|
12
|
-
amount?: number;
|
|
13
|
-
currency?: CurrencyCode;
|
|
14
|
-
countryCode?: CountryCode;
|
|
15
|
-
items?: IOrderItem[];
|
|
16
|
-
shipping?: IAddress;
|
|
17
|
-
}
|
|
18
|
-
interface IOrderItem {
|
|
19
|
-
name: string;
|
|
20
|
-
amount: number;
|
|
21
|
-
quantity: number;
|
|
22
|
-
isPending?: boolean;
|
|
23
|
-
}
|
|
24
|
-
interface IBusiness {
|
|
25
|
-
name?: string;
|
|
26
|
-
registrationNumber?: string;
|
|
27
|
-
email?: string;
|
|
28
|
-
phone?: string;
|
|
29
|
-
address?: IAddress;
|
|
30
|
-
}
|
|
31
|
-
interface ICustomer {
|
|
32
|
-
id?: string;
|
|
33
|
-
firstName?: string;
|
|
34
|
-
lastName?: string;
|
|
35
|
-
email?: string;
|
|
36
|
-
phone?: string;
|
|
37
|
-
billing?: IAddress;
|
|
38
|
-
}
|
|
39
|
-
interface IOptions {
|
|
40
|
-
isResultScreenEnabled?: boolean;
|
|
41
|
-
isLoadingScreenEnabled?: boolean;
|
|
42
|
-
isFullScreenEnabled?: boolean;
|
|
43
|
-
is3DSOnVaultingEnabled?: boolean;
|
|
44
|
-
is3DSDevelopmentModeEnabled?: boolean;
|
|
45
|
-
locale?: string;
|
|
46
|
-
ios?: IIosOptions;
|
|
47
|
-
android?: IAndroidOptions;
|
|
48
|
-
}
|
|
49
|
-
interface IIosOptions {
|
|
50
|
-
urlScheme?: string;
|
|
51
|
-
urlSchemeIdentifier?: string;
|
|
52
|
-
merchantIdentifier?: string;
|
|
53
|
-
}
|
|
54
|
-
interface IAndroidOptions {
|
|
55
|
-
redirectScheme?: string;
|
|
56
|
-
}
|
|
57
|
-
interface IAddress {
|
|
58
|
-
line1?: String;
|
|
59
|
-
line2?: String;
|
|
60
|
-
postalCode?: String;
|
|
61
|
-
state?: String;
|
|
62
|
-
city?: String;
|
|
63
|
-
country?: CountryCode;
|
|
64
|
-
}
|
|
65
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { IPrimerConfig } from './primer-config';
|
|
2
|
-
import type { PrimerPaymentMethodIntent } from './primer-intent';
|
|
3
|
-
export interface IPrimer {
|
|
4
|
-
/**
|
|
5
|
-
* Launch Primer's Universal Checkout
|
|
6
|
-
* This will enable users to generate a payment instrument token with any configured payment method.
|
|
7
|
-
* The token is returned to the app through `onTokenizeSuccess` listener. Use this token with Primer's
|
|
8
|
-
* Payment API to capture or authorize a payment.
|
|
9
|
-
* @param token Primer client token in Base64 format generated with a Primer API key.
|
|
10
|
-
* @param config Configuration object for the SDK. Use this to set listeners, theme,
|
|
11
|
-
* and payment method specific settings.
|
|
12
|
-
*/
|
|
13
|
-
showUniversalCheckout(token: string | null, config: IPrimerConfig): void;
|
|
14
|
-
/**
|
|
15
|
-
* Launch Primer's Vault Manager.
|
|
16
|
-
* This will enable users to save new payment methods without performing a checkout.
|
|
17
|
-
* @param token Primer client token in Base64 format generated with a Primer API key.
|
|
18
|
-
* @param config Configuration object for the SDK. Use this to set listeners, theme,
|
|
19
|
-
* and payment method specific settings.
|
|
20
|
-
*/
|
|
21
|
-
showVaultManager(token: string | null, config: IPrimerConfig): void;
|
|
22
|
-
/**
|
|
23
|
-
* Launch checkout with a specific payment method
|
|
24
|
-
* @param token Primer client token in Base64 format generated with a Primer API key.
|
|
25
|
-
* @param intent Intent object for specifying payment method and toggle vaulting.
|
|
26
|
-
* @param config Configuration for the SDK.
|
|
27
|
-
*/
|
|
28
|
-
showPaymentMethod(token: string | null, intent: PrimerPaymentMethodIntent, config: IPrimerConfig): void;
|
|
29
|
-
/**
|
|
30
|
-
* remove all listeners & callbacks.
|
|
31
|
-
*/
|
|
32
|
-
dispose(): void;
|
|
33
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type ClientSessionActionsRequest = IClientSessionActionsRequest;
|
|
2
|
-
|
|
3
|
-
interface IClientSessionActionsRequest {
|
|
4
|
-
actions: ClientSessionAction[];
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
type ClientSessionAction = IClientSessionAction;
|
|
8
|
-
|
|
9
|
-
interface IClientSessionAction {
|
|
10
|
-
type:
|
|
11
|
-
| 'SELECT_PAYMENT_METHOD'
|
|
12
|
-
| 'UNSELECT_PAYMENT_METHOD'
|
|
13
|
-
| 'SET_BILLING_ADDRESS';
|
|
14
|
-
paymentMethodType?: string;
|
|
15
|
-
network?: string;
|
|
16
|
-
params?: IActionParams;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface IActionParams {
|
|
20
|
-
billingAddress: Record<string, string | null>;
|
|
21
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export interface IPaymentMethodToken<T, U extends PaymentInstrumentType> {
|
|
2
|
-
token: string;
|
|
3
|
-
analyticsId: string;
|
|
4
|
-
tokenType: TokenType;
|
|
5
|
-
paymentInstrumentData: T;
|
|
6
|
-
paymentInstrumentType: U;
|
|
7
|
-
threeDSecureAuthentication: Nullable<ThreeDSAuthenticationData>;
|
|
8
|
-
vaultData: Nullable<VaultData>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
enum PaymentInstrumentType {
|
|
12
|
-
CARD = 'PAYMENT_CARD',
|
|
13
|
-
APPLE_PAY = 'APPLE_PAY',
|
|
14
|
-
GOOGLE_PAY = 'GOOGLE_PAY',
|
|
15
|
-
PAYPAL = 'PAYPAL_ORDER',
|
|
16
|
-
PAYPAL_VAULTED = 'PAYPAL_BILLING_AGREEMENT',
|
|
17
|
-
GO_CARDLESS = 'GOCARDLESS',
|
|
18
|
-
PAY_NL_IDEAL = 'PAY_NL_IDEAL',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
enum TokenType {
|
|
22
|
-
SINGLE_USE = 'SINGLE_USE',
|
|
23
|
-
MULTI_USE = 'MULTI_USE',
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface VaultData {
|
|
27
|
-
customerId: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface ThreeDSAuthenticationData {
|
|
31
|
-
responseCode: ThreeDSecureStatus;
|
|
32
|
-
reasonCode?: string;
|
|
33
|
-
reasonText?: string;
|
|
34
|
-
protocolVersion: string;
|
|
35
|
-
challengeIssued: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
enum ThreeDSecureStatus {
|
|
39
|
-
SUCCESS = 'AUTH_SUCCESS',
|
|
40
|
-
FAILED = 'AUTH_FAILED',
|
|
41
|
-
SKIPPED = 'SKIPPED',
|
|
42
|
-
CHALLENGE = 'CHALLENGE',
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type Nullable<T> = T | null;
|
|
46
|
-
|
|
47
|
-
export type PaymentInstrumentToken =
|
|
48
|
-
| PaymentCardToken
|
|
49
|
-
| PayPalBillingAgreementToken
|
|
50
|
-
| GoCardlessToken
|
|
51
|
-
| IdealPayToken
|
|
52
|
-
| IPaymentMethodToken<any, any>;
|
|
53
|
-
|
|
54
|
-
type PaymentCardToken = IPaymentMethodToken<
|
|
55
|
-
PaymentCardDetails,
|
|
56
|
-
PaymentInstrumentType.CARD
|
|
57
|
-
>;
|
|
58
|
-
|
|
59
|
-
type PayPalBillingAgreementToken = IPaymentMethodToken<
|
|
60
|
-
PayPalBillingAgreementDetails,
|
|
61
|
-
PaymentInstrumentType.PAYPAL_VAULTED
|
|
62
|
-
>;
|
|
63
|
-
|
|
64
|
-
type GoCardlessToken = IPaymentMethodToken<
|
|
65
|
-
GoCardlessDetails,
|
|
66
|
-
PaymentInstrumentType.GO_CARDLESS
|
|
67
|
-
>;
|
|
68
|
-
|
|
69
|
-
type IdealPayToken = IPaymentMethodToken<
|
|
70
|
-
Record<string, never>,
|
|
71
|
-
PaymentInstrumentType.PAY_NL_IDEAL
|
|
72
|
-
>;
|
|
73
|
-
|
|
74
|
-
interface PaymentCardDetails {
|
|
75
|
-
last4Digits: string;
|
|
76
|
-
cardholderName: string;
|
|
77
|
-
network: string;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
interface PayPalBillingAgreementDetails {
|
|
81
|
-
paypalBillingAgreementId: string;
|
|
82
|
-
externalPayerInfo?: ExternalPayerInfo;
|
|
83
|
-
shippingAddress?: BillingAddress;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
interface GoCardlessDetails {
|
|
87
|
-
gocardlessMandateId: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface ExternalPayerInfo {
|
|
91
|
-
externalPayerId: string;
|
|
92
|
-
firstName?: string;
|
|
93
|
-
lastName?: string;
|
|
94
|
-
email?: string;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
interface BillingAddress {
|
|
98
|
-
firstName: string;
|
|
99
|
-
lastName: string;
|
|
100
|
-
addressLine1: string;
|
|
101
|
-
addressLine2?: string;
|
|
102
|
-
addressLine3?: string;
|
|
103
|
-
city: string;
|
|
104
|
-
state?: string;
|
|
105
|
-
countryCode: Alpha2CountryCode;
|
|
106
|
-
postalCode: string;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
type Alpha2CountryCode = 'ES' | 'FR' | 'GB' | 'DE' | 'PL' | 'IT';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IPrimerError } from 'src/RNPrimer';
|
|
2
|
-
import type { IClientSessionAction } from 'src/Primer';
|
|
3
|
-
import type { PaymentInstrumentToken } from './payment-instrument-token';
|
|
4
|
-
import type { PrimerResumeHandler } from './primer-request';
|
|
5
|
-
|
|
6
|
-
// Not implemented
|
|
7
|
-
// export type OnClientTokenCallback = (resumeHandler: PrimerResumeHandler) => void;
|
|
8
|
-
|
|
9
|
-
export type OnClientSessionActionsCallback = (clientSessionActions: IClientSessionAction[], resumeHandler: PrimerResumeHandler | null) => void;
|
|
10
|
-
export type OnTokenizeSuccessCallback = (paymentInstrument: PaymentInstrumentToken, resumeHandler: PrimerResumeHandler) => void;
|
|
11
|
-
export type OnTokenAddedToVaultCallback = (paymentInstrument: PaymentInstrumentToken) => void;
|
|
12
|
-
export type OnResumeCallback = (resumeToken: string, resumeHandler: PrimerResumeHandler | null) => void;
|
|
13
|
-
export type OnPrimerErrorCallback = (err: IPrimerError, resumeHandler: PrimerResumeHandler) => void;
|
|
14
|
-
export type OnDismissCallback = () => void;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { IClientSessionAction } from 'src/Primer';
|
|
2
|
-
import type { IPrimerError } from 'src/RNPrimer';
|
|
3
|
-
import type { PaymentInstrumentToken } from './payment-instrument-token';
|
|
4
|
-
import type { PrimerResumeHandler } from './primer-request';
|
|
5
|
-
import type { PrimerSettings } from './primer-settings';
|
|
6
|
-
import type { PrimerTheme } from './primer-theme';
|
|
7
|
-
|
|
8
|
-
export interface IPrimerConfig {
|
|
9
|
-
/**
|
|
10
|
-
* Include data for different payment methods (e.g. amount or business details)
|
|
11
|
-
*/
|
|
12
|
-
settings?: PrimerSettings;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Set colors and dimensions for the Primer UI.
|
|
16
|
-
*/
|
|
17
|
-
theme?: PrimerTheme;
|
|
18
|
-
|
|
19
|
-
// onClientTokenCallback?: (resumeHandler: PrimerResumeHandler) => void;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Use this callback to grab a Primer payment instrument and complete a payment.
|
|
23
|
-
*/
|
|
24
|
-
onTokenizeSuccess?: (paymentInstrument: PaymentInstrumentToken, resumeHandler: PrimerResumeHandler) => void;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Use this callback to grab a Primer payment instrument and complete a payment.
|
|
28
|
-
*/
|
|
29
|
-
onVaultSuccess?: (paymentInstrument: PaymentInstrumentToken) => void;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Use this callback to resume a PENDING payment with the token provided.
|
|
33
|
-
*/
|
|
34
|
-
onResumeSuccess?: (resumeToken: string, resumeHandler: PrimerResumeHandler | null) => void;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Use this callback to perform some action when a payment instrument was saved to Primer.
|
|
38
|
-
*/
|
|
39
|
-
onTokenAddedToVault?: (paymentInstrument: PaymentInstrumentToken) => void;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Use this callback to perform some action when the Primer UI is dismissed.
|
|
43
|
-
*/
|
|
44
|
-
onDismiss?: () => void;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Use this callback to perform some action when the SDK throws an error.
|
|
48
|
-
*/
|
|
49
|
-
onError?: (err: IPrimerError, resumeHandler: PrimerResumeHandler) => void;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Use this callback to perform actions on payment methods, like surcharging.
|
|
53
|
-
*/
|
|
54
|
-
onClientSessionActions?: (clientSessionActions: IClientSessionAction[], resumeHandler: PrimerResumeHandler | null) => void;
|
|
55
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type PrimerError = IPrimerError;
|
|
2
|
-
|
|
3
|
-
interface IPrimerError {
|
|
4
|
-
name: PrimerErrorType;
|
|
5
|
-
description?: String;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const errors = [
|
|
9
|
-
'ParseJsonFailed',
|
|
10
|
-
'InitFailed',
|
|
11
|
-
'CheckoutFlowFailed',
|
|
12
|
-
'TokenizationFailed',
|
|
13
|
-
'clientTokenNotConfigured',
|
|
14
|
-
'settingsNotConfigured',
|
|
15
|
-
'invalidPrimerIntent',
|
|
16
|
-
'noIosViewController',
|
|
17
|
-
] as const;
|
|
18
|
-
|
|
19
|
-
type PrimerErrorType = typeof errors[number];
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const paymentMethods = [
|
|
2
|
-
'ADYEN_ALIPAY',
|
|
3
|
-
'ADYEN_DOTPAY',
|
|
4
|
-
'ADYEN_GIROPAY',
|
|
5
|
-
'ADYEN_IDEAL',
|
|
6
|
-
'ADYEN_MOBILEPAY',
|
|
7
|
-
'ADYEN_SOFORT',
|
|
8
|
-
'ADYEN_TRUSTLY',
|
|
9
|
-
'ADYEN_TWINT',
|
|
10
|
-
'ADYEN_VIPPS',
|
|
11
|
-
'APAYA',
|
|
12
|
-
'APPLE_PAY',
|
|
13
|
-
'ATOME',
|
|
14
|
-
'BUCKAROO_BANCONTACT',
|
|
15
|
-
'BUCKAROO_EPS',
|
|
16
|
-
'BUCKAROO_GIROPAY',
|
|
17
|
-
'BUCKAROO_IDEAL',
|
|
18
|
-
'BUCKAROO_SOFORT',
|
|
19
|
-
'GOCARDLESS',
|
|
20
|
-
'GOOGLE_PAY',
|
|
21
|
-
'HOOLAH',
|
|
22
|
-
'KLARNA',
|
|
23
|
-
'MOLLIE_BANCONTACT',
|
|
24
|
-
'MOLLIE_IDEAL',
|
|
25
|
-
'PAY_NL_BANCONTACT',
|
|
26
|
-
'PAY_NL_GIROPAY',
|
|
27
|
-
'PAY_NL_IDEAL',
|
|
28
|
-
'PAY_NL_PAYCONIQ',
|
|
29
|
-
'PAYMENT_CARD',
|
|
30
|
-
'PAYPAL',
|
|
31
|
-
'XFERS_PAYNOW',
|
|
32
|
-
] as const;
|
|
33
|
-
|
|
34
|
-
export type SinglePrimerPaymentMethod = typeof paymentMethods[number];
|
|
35
|
-
export interface AnyPrimerPaymentMethodIntent {
|
|
36
|
-
vault: boolean;
|
|
37
|
-
paymentMethod: SinglePrimerPaymentMethod;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type PrimerPaymentMethodIntent = ISinglePrimerPaymentMethodIntent;
|
|
41
|
-
|
|
42
|
-
interface ISinglePrimerPaymentMethodIntent {
|
|
43
|
-
vault: boolean;
|
|
44
|
-
paymentMethod: SinglePrimerPaymentMethod;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type PrimerIntent =
|
|
48
|
-
| ISinglePrimerPaymentMethodIntent
|
|
49
|
-
| AnyPrimerPaymentMethodIntent;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { CountryCode } from './utils/countryCode';
|
|
2
|
-
import type { CurrencyCode } from './utils/currencyCode';
|
|
3
|
-
|
|
4
|
-
export type PrimerSettings = IPrimerSettings;
|
|
5
|
-
interface IPrimerSettings {
|
|
6
|
-
order?: IOrder;
|
|
7
|
-
business?: IBusiness;
|
|
8
|
-
customer?: ICustomer;
|
|
9
|
-
options?: IOptions;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface IOrder {
|
|
13
|
-
id?: string;
|
|
14
|
-
amount?: number;
|
|
15
|
-
currency?: CurrencyCode;
|
|
16
|
-
countryCode?: CountryCode;
|
|
17
|
-
items?: IOrderItem[];
|
|
18
|
-
shipping?: IAddress;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface IOrderItem {
|
|
22
|
-
name: string;
|
|
23
|
-
amount: number;
|
|
24
|
-
quantity: number;
|
|
25
|
-
isPending?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface IBusiness {
|
|
29
|
-
name?: string;
|
|
30
|
-
registrationNumber?: string;
|
|
31
|
-
email?: string;
|
|
32
|
-
phone?: string;
|
|
33
|
-
address?: IAddress;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface ICustomer {
|
|
37
|
-
id?: string;
|
|
38
|
-
firstName?: string;
|
|
39
|
-
lastName?: string;
|
|
40
|
-
email?: string;
|
|
41
|
-
phone?: string;
|
|
42
|
-
billing?: IAddress;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface IOptions {
|
|
46
|
-
isResultScreenEnabled?: boolean;
|
|
47
|
-
isLoadingScreenEnabled?: boolean;
|
|
48
|
-
isFullScreenEnabled?: boolean;
|
|
49
|
-
is3DSOnVaultingEnabled?: boolean;
|
|
50
|
-
is3DSDevelopmentModeEnabled?: boolean;
|
|
51
|
-
locale?: string;
|
|
52
|
-
ios?: IIosOptions;
|
|
53
|
-
android?: IAndroidOptions;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
interface IIosOptions {
|
|
57
|
-
urlScheme?: string;
|
|
58
|
-
urlSchemeIdentifier?: string;
|
|
59
|
-
merchantIdentifier?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
interface IAndroidOptions {
|
|
63
|
-
redirectScheme?: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
interface IAddress {
|
|
67
|
-
line1?: String;
|
|
68
|
-
line2?: String;
|
|
69
|
-
postalCode?: String;
|
|
70
|
-
state?: String;
|
|
71
|
-
city?: String;
|
|
72
|
-
country?: CountryCode;
|
|
73
|
-
}
|
package/src/models/primer.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { IPrimerConfig } from './primer-config';
|
|
2
|
-
import type { PrimerPaymentMethodIntent } from './primer-intent';
|
|
3
|
-
|
|
4
|
-
export interface IPrimer {
|
|
5
|
-
/**
|
|
6
|
-
* Launch Primer's Universal Checkout
|
|
7
|
-
* This will enable users to generate a payment instrument token with any configured payment method.
|
|
8
|
-
* The token is returned to the app through `onTokenizeSuccess` listener. Use this token with Primer's
|
|
9
|
-
* Payment API to capture or authorize a payment.
|
|
10
|
-
* @param token Primer client token in Base64 format generated with a Primer API key.
|
|
11
|
-
* @param config Configuration object for the SDK. Use this to set listeners, theme,
|
|
12
|
-
* and payment method specific settings.
|
|
13
|
-
*/
|
|
14
|
-
showUniversalCheckout(token: string | null, config: IPrimerConfig): void;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Launch Primer's Vault Manager.
|
|
18
|
-
* This will enable users to save new payment methods without performing a checkout.
|
|
19
|
-
* @param token Primer client token in Base64 format generated with a Primer API key.
|
|
20
|
-
* @param config Configuration object for the SDK. Use this to set listeners, theme,
|
|
21
|
-
* and payment method specific settings.
|
|
22
|
-
*/
|
|
23
|
-
showVaultManager(token: string | null, config: IPrimerConfig): void;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Launch checkout with a specific payment method
|
|
27
|
-
* @param token Primer client token in Base64 format generated with a Primer API key.
|
|
28
|
-
* @param intent Intent object for specifying payment method and toggle vaulting.
|
|
29
|
-
* @param config Configuration for the SDK.
|
|
30
|
-
*/
|
|
31
|
-
showPaymentMethod(
|
|
32
|
-
token: string | null,
|
|
33
|
-
intent: PrimerPaymentMethodIntent,
|
|
34
|
-
config: IPrimerConfig
|
|
35
|
-
): void;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* remove all listeners & callbacks.
|
|
39
|
-
*/
|
|
40
|
-
dispose(): void;
|
|
41
|
-
}
|