judokit-react-native 4.1.3 → 4.2.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/JudoKit-ReactNative.podspec +42 -0
- package/LICENSE +1 -2
- package/README.md +106 -119
- package/android/build.gradle +65 -202
- package/android/gradle.properties +6 -1
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/judopay/judokit/reactnative/Extensions.kt +382 -0
- package/android/src/main/java/com/judopay/judokit/reactnative/Helpers.kt +653 -0
- package/android/src/main/java/com/judopay/judokit/reactnative/JudoActivityEventListener.kt +49 -0
- package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativeModule.kt +238 -0
- package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativePackage.kt +16 -0
- package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.h +1 -1
- package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.m +2 -2
- package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.h +1 -1
- package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.m +1 -1
- package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.h +1 -1
- package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.m +3 -3
- package/ios/{Classes/RNJudo.h → JudoKitReactNative.h} +12 -6
- package/ios/{Classes/RNJudo.m → JudoKitReactNative.mm} +83 -81
- package/ios/{Classes/RNTypes.h → RNTypes.h} +8 -2
- package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.h +1 -1
- package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.m +105 -4
- package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.h +14 -14
- package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.m +46 -25
- package/lib/commonjs/index.js +268 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/judo-kit/index.js +212 -0
- package/lib/commonjs/judo-kit/index.js.map +1 -0
- package/lib/commonjs/types/index.js +267 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/judo-apple-pay-configuration.js +49 -0
- package/lib/commonjs/types/judo-apple-pay-configuration.js.map +1 -0
- package/lib/commonjs/types/judo-configuration.js +71 -0
- package/lib/commonjs/types/judo-configuration.js.map +1 -0
- package/lib/commonjs/types/judo-google-pay-configuration.js +28 -0
- package/lib/commonjs/types/judo-google-pay-configuration.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/judo-kit/index.js +205 -0
- package/lib/module/judo-kit/index.js.map +1 -0
- package/lib/module/types/index.js +8 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/judo-apple-pay-configuration.js +43 -0
- package/lib/module/types/judo-apple-pay-configuration.js.map +1 -0
- package/lib/module/types/judo-configuration.js +65 -0
- package/lib/module/types/judo-configuration.js.map +1 -0
- package/lib/module/types/judo-google-pay-configuration.js +22 -0
- package/lib/module/types/judo-google-pay-configuration.js.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/judo-kit/index.d.ts +86 -0
- package/lib/typescript/src/judo-kit/index.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +4 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts +75 -0
- package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts.map +1 -0
- package/lib/typescript/src/types/judo-configuration.d.ts +236 -0
- package/lib/typescript/src/types/judo-configuration.d.ts.map +1 -0
- package/lib/typescript/src/types/judo-google-pay-configuration.d.ts +42 -0
- package/lib/typescript/src/types/judo-google-pay-configuration.d.ts.map +1 -0
- package/package.json +158 -79
- package/src/index.tsx +50 -0
- package/src/judo-kit/index.ts +262 -0
- package/src/types/index.ts +53 -0
- package/src/types/judo-apple-pay-configuration.ts +85 -0
- package/src/types/judo-configuration.ts +263 -0
- package/src/types/judo-google-pay-configuration.ts +47 -0
- package/JudoPay.tsx +0 -334
- package/RNJudopay.podspec +0 -24
- package/android/src/main/java/com/reactlibrary/Extensions.kt +0 -372
- package/android/src/main/java/com/reactlibrary/Helpers.kt +0 -606
- package/android/src/main/java/com/reactlibrary/JudoReactNativeActivityEventListener.kt +0 -48
- package/android/src/main/java/com/reactlibrary/JudoReactNativeModule.kt +0 -257
- package/android/src/main/java/com/reactlibrary/JudoReactNativePBBAManager.kt +0 -52
- package/android/src/main/java/com/reactlibrary/JudoReactNativePackage.kt +0 -14
- package/components/JudoPBBAButton.ts +0 -2
- package/ios/.xcode.env +0 -11
- package/ios/Classes/Views/RNPBBAButtonManager.m +0 -42
- package/ios/Classes/Wrappers/RNPBBAWrappers.h +0 -40
- package/ios/Classes/Wrappers/RNPBBAWrappers.m +0 -57
- package/ios/Podfile +0 -44
- package/ios/Podfile.lock +0 -572
- package/ios/RNJudo.xcodeproj/project.pbxproj +0 -703
- package/ios/RNJudo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- package/ios/RNJudo.xcodeproj/xcshareddata/xcschemes/RNJudo.xcscheme +0 -97
- package/ios/RNJudo.xcworkspace/contents.xcworkspacedata +0 -10
- package/ios/RNJudoTests/Info.plist +0 -22
- package/ios/RNJudoTests/MockConfiguration.json +0 -114
- package/ios/RNJudoTests/NSDictionaryConvertTests.m +0 -475
- package/ios/RNJudoTests/RNApplePayWrappersTests.m +0 -770
- package/ios/RNJudoTests/RNJudoTests.m +0 -37
- package/ios/RNJudoTests/RNMocks.h +0 -54
- package/ios/RNJudoTests/RNMocks.m +0 -55
- package/ios/RNJudoTests/RNPBBAWrappersTests.m +0 -121
- package/ios/RNJudoTests/RNThemeTests.m +0 -576
- package/ios/RNJudoTests/RNWrappersTests.m +0 -947
- package/types/JudoApplePayTypes.tsx +0 -59
- package/types/JudoGooglePayTypes.tsx +0 -47
- package/types/JudoPBBATypes.tsx +0 -7
- package/types/JudoTypes.tsx +0 -251
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
JudoAuthorization,
|
|
3
|
+
JudoConfiguration,
|
|
4
|
+
JudoResponse,
|
|
5
|
+
JudoTransactionMode,
|
|
6
|
+
JudoTransactionType,
|
|
7
|
+
} from '../types';
|
|
8
|
+
|
|
9
|
+
import { version as packageVersion } from '../../package.json';
|
|
10
|
+
import { NativeModules, Platform } from 'react-native';
|
|
11
|
+
|
|
12
|
+
const LINKING_ERROR =
|
|
13
|
+
`The package 'judokit-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
14
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
15
|
+
'- You rebuilt the app after installing the package\n' +
|
|
16
|
+
'- You are not using Expo Go\n';
|
|
17
|
+
|
|
18
|
+
const JudoKitReactNative = NativeModules.JudoKitReactNative
|
|
19
|
+
? NativeModules.JudoKitReactNative
|
|
20
|
+
: new Proxy(
|
|
21
|
+
{},
|
|
22
|
+
{
|
|
23
|
+
get() {
|
|
24
|
+
throw new Error(LINKING_ERROR);
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// TODO: Rename this to `JudoKit`.
|
|
30
|
+
export class JudoPay {
|
|
31
|
+
//------------------------------------------------------------------
|
|
32
|
+
// Private properties
|
|
33
|
+
//------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
private readonly authorization: JudoAuthorization;
|
|
36
|
+
|
|
37
|
+
//------------------------------------------------------------------
|
|
38
|
+
// Public properties
|
|
39
|
+
//------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* This property is used to toggle the sandbox environment on and off.
|
|
43
|
+
* You can use the sandbox environment to test our SDK features.
|
|
44
|
+
*/
|
|
45
|
+
public isSandboxed = true;
|
|
46
|
+
|
|
47
|
+
//------------------------------------------------------------------
|
|
48
|
+
// Initializers
|
|
49
|
+
//------------------------------------------------------------------
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The designated initializer that is used to configure the JudoPay session, based
|
|
53
|
+
* on a provided object that implements the JudoAuthorization interface.
|
|
54
|
+
*
|
|
55
|
+
* @param authorization - can be either a JudoBasicAuthorization (token & secret) or
|
|
56
|
+
* a JudoSessionAuthorization (token & payment session) instance.
|
|
57
|
+
*/
|
|
58
|
+
constructor(authorization: JudoAuthorization) {
|
|
59
|
+
this.authorization = authorization;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//------------------------------------------------------------------
|
|
63
|
+
// SDK Features
|
|
64
|
+
//------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A method used to verify if ApplePay is supported for given configuration object
|
|
68
|
+
*
|
|
69
|
+
* This needs to be invoked before invoking ApplePay transactions.
|
|
70
|
+
*
|
|
71
|
+
* @returns an asynchronous boolean value that indicates if ApplePay is available.
|
|
72
|
+
*/
|
|
73
|
+
public isApplePayAvailableWithConfiguration(
|
|
74
|
+
configuration: JudoConfiguration
|
|
75
|
+
): Promise<boolean> {
|
|
76
|
+
const params = this.generateJudoParameters(configuration);
|
|
77
|
+
return JudoKitReactNative.isApplePayAvailableWithConfiguration(params);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A method for invoking the Judo UI for card transactions.
|
|
82
|
+
* Supported operations - payments, pre-auths, register card, save card, check card.
|
|
83
|
+
*
|
|
84
|
+
* @param type - a JudoTransactionType value that defines the transaction type.
|
|
85
|
+
* @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
|
|
86
|
+
*
|
|
87
|
+
* @returns an asynchronous JudoResponse object, containing the transaction results.
|
|
88
|
+
*/
|
|
89
|
+
public async invokeTransaction(
|
|
90
|
+
type: JudoTransactionType,
|
|
91
|
+
configuration: JudoConfiguration
|
|
92
|
+
): Promise<JudoResponse> {
|
|
93
|
+
const params = {
|
|
94
|
+
...this.generateTransactionTypeParameters(type, configuration),
|
|
95
|
+
packageVersion,
|
|
96
|
+
};
|
|
97
|
+
return JudoKitReactNative.invokeTransaction(params);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public async fetchTransactionDetails(
|
|
101
|
+
receiptId: string
|
|
102
|
+
): Promise<JudoResponse> {
|
|
103
|
+
const params = {
|
|
104
|
+
authorization: this.generateAuthorizationParameters(),
|
|
105
|
+
sandboxed: this.isSandboxed,
|
|
106
|
+
receiptId,
|
|
107
|
+
packageVersion,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return JudoKitReactNative.fetchTransactionDetails(params);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A method for completing a payment/pre-auth transaction using a saved card token.
|
|
115
|
+
*
|
|
116
|
+
* @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
|
|
117
|
+
* @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
|
|
118
|
+
* @param cardToken - the saved card token string.
|
|
119
|
+
* @param securityCode - the saved card token security code.
|
|
120
|
+
* @param cardholderName - the saved card token cardholder name.
|
|
121
|
+
* @param cardScheme - the saved card token scheme name.
|
|
122
|
+
*
|
|
123
|
+
* @returns an asynchronous JudoResponse object, containing the transaction results.
|
|
124
|
+
*/
|
|
125
|
+
public async performTokenTransaction(
|
|
126
|
+
mode: JudoTransactionMode,
|
|
127
|
+
configuration: JudoConfiguration,
|
|
128
|
+
cardToken: string,
|
|
129
|
+
securityCode: string | undefined | null,
|
|
130
|
+
cardholderName: string | undefined | null,
|
|
131
|
+
cardScheme: string
|
|
132
|
+
): Promise<JudoResponse> {
|
|
133
|
+
const params = {
|
|
134
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
135
|
+
...{
|
|
136
|
+
cardToken,
|
|
137
|
+
securityCode,
|
|
138
|
+
cardholderName,
|
|
139
|
+
cardScheme,
|
|
140
|
+
},
|
|
141
|
+
packageVersion,
|
|
142
|
+
};
|
|
143
|
+
return JudoKitReactNative.performTokenTransaction(params);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A method for invoking Apple Pay transactions.
|
|
148
|
+
* For this transaction to work, the required JudoApplePayConfiguration parameters must be present as part of
|
|
149
|
+
* the JudoConfiguration object passed to the method.
|
|
150
|
+
*
|
|
151
|
+
* @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
|
|
152
|
+
* @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
|
|
153
|
+
*
|
|
154
|
+
* @returns an asynchronous JudoResponse object, containing the transaction results.
|
|
155
|
+
*/
|
|
156
|
+
public async invokeApplePay(
|
|
157
|
+
mode: JudoTransactionMode,
|
|
158
|
+
configuration: JudoConfiguration
|
|
159
|
+
): Promise<JudoResponse> {
|
|
160
|
+
const params = {
|
|
161
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
162
|
+
packageVersion,
|
|
163
|
+
};
|
|
164
|
+
return JudoKitReactNative.invokeApplePay(params);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A method for invoking Google Pay transactions.
|
|
169
|
+
* For this transaction to work, the required JudoGooglePayConfiguration parameters must be present as part of
|
|
170
|
+
* the JudoConfiguration object passed to the method.
|
|
171
|
+
*
|
|
172
|
+
* @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
|
|
173
|
+
* @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
|
|
174
|
+
*
|
|
175
|
+
* @returns an asynchronous JudoResponse object, containing the transaction results.
|
|
176
|
+
*/
|
|
177
|
+
public async invokeGooglePay(
|
|
178
|
+
mode: JudoTransactionMode,
|
|
179
|
+
configuration: JudoConfiguration
|
|
180
|
+
): Promise<JudoResponse> {
|
|
181
|
+
const params = {
|
|
182
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
183
|
+
packageVersion,
|
|
184
|
+
};
|
|
185
|
+
return JudoKitReactNative.invokeGooglePay(params);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* A method for invoking the Judo wallet, allowing users to pay with their preferred payment method.
|
|
190
|
+
* (Cards, Apple Pay/Google Pay, iDEAL)
|
|
191
|
+
*
|
|
192
|
+
* @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
|
|
193
|
+
* @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
|
|
194
|
+
*
|
|
195
|
+
* @returns an asynchronous JudoResponse object, containing the transaction results.
|
|
196
|
+
*/
|
|
197
|
+
public async invokePaymentMethodScreen(
|
|
198
|
+
mode: JudoTransactionMode,
|
|
199
|
+
configuration: JudoConfiguration
|
|
200
|
+
): Promise<JudoResponse> {
|
|
201
|
+
const params = {
|
|
202
|
+
...this.generateTransactionModeParameters(mode, configuration),
|
|
203
|
+
packageVersion,
|
|
204
|
+
};
|
|
205
|
+
return JudoKitReactNative.invokePaymentMethodScreen(params);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
//------------------------------------------------------------------
|
|
209
|
+
// Private helper methods
|
|
210
|
+
//------------------------------------------------------------------
|
|
211
|
+
|
|
212
|
+
private readonly generateJudoParameters = (
|
|
213
|
+
configuration: JudoConfiguration
|
|
214
|
+
): Record<string, any> => {
|
|
215
|
+
return {
|
|
216
|
+
authorization: this.generateAuthorizationParameters(),
|
|
217
|
+
sandboxed: this.isSandboxed,
|
|
218
|
+
configuration: configuration,
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
private readonly generateTransactionTypeParameters = (
|
|
223
|
+
type: JudoTransactionType,
|
|
224
|
+
configuration: JudoConfiguration
|
|
225
|
+
): Record<string, any> => {
|
|
226
|
+
return {
|
|
227
|
+
authorization: this.generateAuthorizationParameters(),
|
|
228
|
+
sandboxed: this.isSandboxed,
|
|
229
|
+
transactionType: type,
|
|
230
|
+
configuration: configuration,
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
private readonly generateTransactionModeParameters = (
|
|
235
|
+
mode: JudoTransactionMode,
|
|
236
|
+
configuration: JudoConfiguration
|
|
237
|
+
): Record<string, any> => {
|
|
238
|
+
return {
|
|
239
|
+
authorization: this.generateAuthorizationParameters(),
|
|
240
|
+
sandboxed: this.isSandboxed,
|
|
241
|
+
transactionMode: mode,
|
|
242
|
+
configuration: configuration,
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
private readonly generateAuthorizationParameters = (): Record<
|
|
247
|
+
string,
|
|
248
|
+
any
|
|
249
|
+
> => {
|
|
250
|
+
if (this.authorization.secret) {
|
|
251
|
+
return {
|
|
252
|
+
token: this.authorization.token,
|
|
253
|
+
secret: this.authorization.secret,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return {
|
|
258
|
+
token: this.authorization.token,
|
|
259
|
+
paymentSession: this.authorization.paymentSession,
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ChallengeRequestIndicator,
|
|
3
|
+
ScaExemption,
|
|
4
|
+
JudoTransactionType,
|
|
5
|
+
JudoTransactionMode,
|
|
6
|
+
JudoTransactionResult,
|
|
7
|
+
JudoThreeDSButtonType,
|
|
8
|
+
JudoPaymentMethod,
|
|
9
|
+
JudoCardNetwork,
|
|
10
|
+
// type exports
|
|
11
|
+
JudoConfiguration,
|
|
12
|
+
NetworkTimeout,
|
|
13
|
+
JudoAmount,
|
|
14
|
+
JudoReference,
|
|
15
|
+
JudoAddress,
|
|
16
|
+
JudoThreeDSToolbarCustomization,
|
|
17
|
+
JudoThreeDSLabelCustomization,
|
|
18
|
+
JudoThreeDSTextBoxCustomization,
|
|
19
|
+
JudoThreeDSButtonCustomization,
|
|
20
|
+
JudoThreeDSUIConfiguration,
|
|
21
|
+
JudoUIConfiguration,
|
|
22
|
+
JudoTheme,
|
|
23
|
+
JudoAccountDetails,
|
|
24
|
+
JudoCardDetails,
|
|
25
|
+
JudoConsumer,
|
|
26
|
+
JudoResponse,
|
|
27
|
+
JudoAuthorization,
|
|
28
|
+
} from './judo-configuration';
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
JudoPaymentSummaryItemType,
|
|
32
|
+
JudoMerchantCapability,
|
|
33
|
+
JudoContactField,
|
|
34
|
+
JudoShippingType,
|
|
35
|
+
JudoReturnedInfo,
|
|
36
|
+
// type exports
|
|
37
|
+
JudoPaymentSummaryItem,
|
|
38
|
+
JudoShippingMethod,
|
|
39
|
+
JudoApplePayConfiguration,
|
|
40
|
+
JudoApplePayRecurringPaymentRequest,
|
|
41
|
+
JudoRecurringPaymentSummaryItem,
|
|
42
|
+
JudoCalendarUnit,
|
|
43
|
+
} from './judo-apple-pay-configuration';
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
JudoGooglePayEnvironment,
|
|
47
|
+
JudoAddressFormat,
|
|
48
|
+
JudoBillingAddressParameters,
|
|
49
|
+
JudoShippingAddressParameters,
|
|
50
|
+
JudoGooglePayPriceStatus,
|
|
51
|
+
JudoCheckoutOption,
|
|
52
|
+
JudoGooglePayConfiguration,
|
|
53
|
+
} from './judo-google-pay-configuration';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export enum JudoPaymentSummaryItemType {
|
|
2
|
+
Final,
|
|
3
|
+
Pending,
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface JudoPaymentSummaryItem {
|
|
7
|
+
label: string;
|
|
8
|
+
amount: string;
|
|
9
|
+
type?: JudoPaymentSummaryItemType;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum JudoMerchantCapability {
|
|
13
|
+
ThreeDS = 1 << 0,
|
|
14
|
+
EMV = 1 << 1,
|
|
15
|
+
Credit = 1 << 2,
|
|
16
|
+
Debit = 1 << 3,
|
|
17
|
+
All = 1 << 4,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export enum JudoContactField {
|
|
21
|
+
PostalAddress = 1 << 0,
|
|
22
|
+
Phone = 1 << 1,
|
|
23
|
+
Email = 1 << 2,
|
|
24
|
+
Name = 1 << 3,
|
|
25
|
+
All = 1 << 4,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface JudoShippingMethod {
|
|
29
|
+
identifier: string;
|
|
30
|
+
detail: string;
|
|
31
|
+
label: string;
|
|
32
|
+
amount: string;
|
|
33
|
+
type: JudoPaymentSummaryItemType;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export enum JudoShippingType {
|
|
37
|
+
Shipping,
|
|
38
|
+
Delivery,
|
|
39
|
+
StorePickup,
|
|
40
|
+
ServicePickup,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export enum JudoReturnedInfo {
|
|
44
|
+
BillingDetails = 1 << 0,
|
|
45
|
+
ShippingDetails = 1 << 1,
|
|
46
|
+
All = 1 << 2,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export enum JudoCalendarUnit {
|
|
50
|
+
Year = 1,
|
|
51
|
+
Month,
|
|
52
|
+
Day,
|
|
53
|
+
Hour,
|
|
54
|
+
Minute,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface JudoRecurringPaymentSummaryItem
|
|
58
|
+
extends JudoPaymentSummaryItem {
|
|
59
|
+
startDate?: string;
|
|
60
|
+
endDate?: string;
|
|
61
|
+
intervalUnit?: JudoCalendarUnit;
|
|
62
|
+
intervalCount?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface JudoApplePayRecurringPaymentRequest {
|
|
66
|
+
paymentDescription: string;
|
|
67
|
+
managementURL: string;
|
|
68
|
+
regularBilling: JudoRecurringPaymentSummaryItem;
|
|
69
|
+
trialBilling?: JudoRecurringPaymentSummaryItem;
|
|
70
|
+
billingAgreement?: string;
|
|
71
|
+
tokenNotificationURL?: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface JudoApplePayConfiguration {
|
|
75
|
+
merchantId: string;
|
|
76
|
+
countryCode: string;
|
|
77
|
+
paymentSummaryItems: JudoPaymentSummaryItem[];
|
|
78
|
+
merchantCapabilities?: JudoMerchantCapability;
|
|
79
|
+
requiredBillingContactFields?: JudoContactField;
|
|
80
|
+
requiredShippingContactFields?: JudoContactField;
|
|
81
|
+
shippingMethods?: JudoShippingMethod[];
|
|
82
|
+
shippingType?: JudoShippingType;
|
|
83
|
+
returnedInfo?: JudoReturnedInfo;
|
|
84
|
+
recurringPaymentRequest?: JudoApplePayRecurringPaymentRequest;
|
|
85
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { JudoApplePayConfiguration } from './judo-apple-pay-configuration';
|
|
2
|
+
import { JudoGooglePayConfiguration } from './judo-google-pay-configuration';
|
|
3
|
+
|
|
4
|
+
export interface JudoConfiguration {
|
|
5
|
+
judoId: string;
|
|
6
|
+
amount: JudoAmount;
|
|
7
|
+
reference: JudoReference;
|
|
8
|
+
cardAddress?: JudoAddress;
|
|
9
|
+
uiConfiguration?: JudoUIConfiguration;
|
|
10
|
+
paymentMethods?: JudoPaymentMethod;
|
|
11
|
+
supportedCardNetworks?: JudoCardNetwork;
|
|
12
|
+
primaryAccountDetails?: JudoAccountDetails;
|
|
13
|
+
applePayConfiguration?: JudoApplePayConfiguration;
|
|
14
|
+
googlePayConfiguration?: JudoGooglePayConfiguration;
|
|
15
|
+
isInitialRecurringPayment?: boolean;
|
|
16
|
+
networkTimeout?: NetworkTimeout;
|
|
17
|
+
challengeRequestIndicator?: ChallengeRequestIndicator;
|
|
18
|
+
scaExemption?: ScaExemption;
|
|
19
|
+
mobileNumber?: string;
|
|
20
|
+
phoneCountryCode?: string;
|
|
21
|
+
emailAddress?: string;
|
|
22
|
+
threeDSTwoMaxTimeout?: number;
|
|
23
|
+
threeDSTwoMessageVersion?: string;
|
|
24
|
+
isDelayedAuthorisation?: boolean;
|
|
25
|
+
recommendationConfiguration?: JudoRecommendationConfiguration;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface JudoRecommendationConfiguration {
|
|
29
|
+
url: string;
|
|
30
|
+
rsaPublicKey: string;
|
|
31
|
+
timeout?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export enum ChallengeRequestIndicator {
|
|
35
|
+
NoPreference = 'noPreference',
|
|
36
|
+
NoChallenge = 'noChallenge',
|
|
37
|
+
ChallengePreferred = 'challengePreferred',
|
|
38
|
+
ChallengeAsMandate = 'challengeAsMandate',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export enum ScaExemption {
|
|
42
|
+
LowValue = 'lowValue',
|
|
43
|
+
SecureCorporate = 'secureCorporate',
|
|
44
|
+
TrustedBeneficiary = 'trustedBeneficiary',
|
|
45
|
+
TransactionRiskAnalysis = 'transactionRiskAnalysis',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface NetworkTimeout {
|
|
49
|
+
connectTimeout?: number;
|
|
50
|
+
readTimeout?: number;
|
|
51
|
+
writeTimeout?: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export enum JudoTransactionType {
|
|
55
|
+
Payment = 1,
|
|
56
|
+
PreAuth = 2,
|
|
57
|
+
RegisterCard = 3,
|
|
58
|
+
CheckCard = 4,
|
|
59
|
+
SaveCard = 5,
|
|
60
|
+
Unknown = -1,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export enum JudoTransactionMode {
|
|
64
|
+
Payment,
|
|
65
|
+
PreAuth,
|
|
66
|
+
ServerToServer,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export enum JudoTransactionResult {
|
|
70
|
+
Error,
|
|
71
|
+
Success,
|
|
72
|
+
Declined,
|
|
73
|
+
Unknown = -1,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface JudoAmount {
|
|
77
|
+
value: string;
|
|
78
|
+
currency: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface JudoReference {
|
|
82
|
+
consumerReference: string;
|
|
83
|
+
paymentReference?: string;
|
|
84
|
+
metadata?: Record<string, string>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface JudoAddress {
|
|
88
|
+
line1?: string;
|
|
89
|
+
line2?: string;
|
|
90
|
+
line3?: string;
|
|
91
|
+
postCode?: string;
|
|
92
|
+
town?: string;
|
|
93
|
+
countryCode?: number;
|
|
94
|
+
state?: string;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface JudoThreeDSToolbarCustomization {
|
|
98
|
+
backgroundColor?: string;
|
|
99
|
+
headerText?: string;
|
|
100
|
+
buttonText?: string;
|
|
101
|
+
textFontName?: string;
|
|
102
|
+
textColor?: string;
|
|
103
|
+
textFontSize?: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface JudoThreeDSLabelCustomization {
|
|
107
|
+
headingTextFontName?: string;
|
|
108
|
+
headingTextColor?: string;
|
|
109
|
+
headingTextFontSize?: number;
|
|
110
|
+
textFontName?: string;
|
|
111
|
+
textColor?: string;
|
|
112
|
+
textFontSize?: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface JudoThreeDSTextBoxCustomization {
|
|
116
|
+
borderWidth?: number;
|
|
117
|
+
borderColor?: string;
|
|
118
|
+
cornerRadius?: number;
|
|
119
|
+
textFontName?: string;
|
|
120
|
+
textColor?: string;
|
|
121
|
+
textFontSize?: number;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export enum JudoThreeDSButtonType {
|
|
125
|
+
SUBMIT = 'SUBMIT',
|
|
126
|
+
CONTINUE = 'CONTINUE',
|
|
127
|
+
NEXT = 'NEXT',
|
|
128
|
+
CANCEL = 'CANCEL',
|
|
129
|
+
RESEND = 'RESEND',
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface JudoThreeDSButtonCustomization {
|
|
133
|
+
backgroundColor?: string;
|
|
134
|
+
cornerRadius?: number;
|
|
135
|
+
textFontName?: string;
|
|
136
|
+
textColor?: string;
|
|
137
|
+
textFontSize?: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface JudoThreeDSUIConfiguration {
|
|
141
|
+
buttonCustomizations?: Partial<
|
|
142
|
+
Record<JudoThreeDSButtonType, JudoThreeDSButtonCustomization>
|
|
143
|
+
>;
|
|
144
|
+
toolbarCustomization?: JudoThreeDSToolbarCustomization;
|
|
145
|
+
labelCustomization?: JudoThreeDSLabelCustomization;
|
|
146
|
+
textBoxCustomization?: JudoThreeDSTextBoxCustomization;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface JudoUIConfiguration {
|
|
150
|
+
isAVSEnabled?: boolean;
|
|
151
|
+
shouldPaymentMethodsDisplayAmount?: boolean;
|
|
152
|
+
shouldPaymentButtonDisplayAmount?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated This export is deprecated. Please use `shouldAskForCSC` instead.
|
|
155
|
+
*/
|
|
156
|
+
shouldPaymentMethodsVerifySecurityCode?: boolean;
|
|
157
|
+
shouldAskForBillingInformation?: boolean;
|
|
158
|
+
theme?: JudoTheme;
|
|
159
|
+
threeDSUIConfiguration?: JudoThreeDSUIConfiguration;
|
|
160
|
+
shouldAskForCSC?: boolean;
|
|
161
|
+
shouldAskForCardholderName?: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface JudoTheme {
|
|
165
|
+
largeTitleFont: string;
|
|
166
|
+
largeTitleSize: number;
|
|
167
|
+
titleFont: string;
|
|
168
|
+
titleSize: number;
|
|
169
|
+
headlineFont: string;
|
|
170
|
+
headlineSize: number;
|
|
171
|
+
headlineLightFont: string;
|
|
172
|
+
headlineLightSize: number;
|
|
173
|
+
bodyFont: string;
|
|
174
|
+
bodySize: number;
|
|
175
|
+
bodyBoldFont: string;
|
|
176
|
+
bodyBoldSize: number;
|
|
177
|
+
captionFont: string;
|
|
178
|
+
captionSize: number;
|
|
179
|
+
captionBoldFont: string;
|
|
180
|
+
captionBoldSize: number;
|
|
181
|
+
jpBlackColor: string;
|
|
182
|
+
jpDarkGrayColor: string;
|
|
183
|
+
jpGrayColor: string;
|
|
184
|
+
jpLightGrayColor: string;
|
|
185
|
+
jpRedColor: string;
|
|
186
|
+
jpWhiteColor: string;
|
|
187
|
+
buttonColor: string;
|
|
188
|
+
buttonTitleColor: string;
|
|
189
|
+
backButtonImage: string;
|
|
190
|
+
buttonCornerRadius: number;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export enum JudoPaymentMethod {
|
|
194
|
+
Card = 1 << 0,
|
|
195
|
+
ApplePay = 1 << 1,
|
|
196
|
+
GooglePay = 1 << 2,
|
|
197
|
+
iDEAL = 1 << 3,
|
|
198
|
+
All = 1 << 5,
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export enum JudoCardNetwork {
|
|
202
|
+
Visa = 1 << 0,
|
|
203
|
+
Mastercard = 1 << 1,
|
|
204
|
+
Maestro = 1 << 2,
|
|
205
|
+
Amex = 1 << 3,
|
|
206
|
+
ChinaUnionPay = 1 << 4,
|
|
207
|
+
JCB = 1 << 5,
|
|
208
|
+
Discover = 1 << 6,
|
|
209
|
+
DinersClub = 1 << 7,
|
|
210
|
+
All = 1 << 8,
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface JudoAccountDetails {
|
|
214
|
+
name?: string;
|
|
215
|
+
accountNumber?: string;
|
|
216
|
+
dateOfBirth?: string;
|
|
217
|
+
postCode?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface JudoCardDetails {
|
|
221
|
+
cardLastFour?: string;
|
|
222
|
+
endDate?: string;
|
|
223
|
+
cardToken?: string;
|
|
224
|
+
cardNetwork?: JudoCardNetwork;
|
|
225
|
+
bank?: string;
|
|
226
|
+
cardCategory?: string;
|
|
227
|
+
cardCountry?: string;
|
|
228
|
+
cardFunding?: string;
|
|
229
|
+
cardScheme?: string;
|
|
230
|
+
cardHolderName?: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface JudoConsumer {
|
|
234
|
+
consumerReference?: string;
|
|
235
|
+
consumerToken?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface JudoResponse {
|
|
239
|
+
receiptId?: string;
|
|
240
|
+
yourPaymentReference?: string;
|
|
241
|
+
type?: JudoTransactionType;
|
|
242
|
+
createdAt?: string;
|
|
243
|
+
result?: JudoTransactionResult;
|
|
244
|
+
message?: string;
|
|
245
|
+
judoId?: string;
|
|
246
|
+
merchantName?: string;
|
|
247
|
+
appearsOnStatementAs?: string;
|
|
248
|
+
originalAmount?: string;
|
|
249
|
+
netAmount?: string;
|
|
250
|
+
amount?: string;
|
|
251
|
+
currency?: string;
|
|
252
|
+
cardDetails?: JudoCardDetails;
|
|
253
|
+
consumerResponse?: JudoConsumer;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface JudoAuthorization {
|
|
257
|
+
token: string;
|
|
258
|
+
/**
|
|
259
|
+
* @deprecated This authentication method is deprecated, please use payment session instead.
|
|
260
|
+
*/
|
|
261
|
+
secret?: string;
|
|
262
|
+
paymentSession?: string;
|
|
263
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export enum JudoGooglePayEnvironment {
|
|
2
|
+
TEST,
|
|
3
|
+
PRODUCTION,
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export enum JudoAddressFormat {
|
|
7
|
+
MIN,
|
|
8
|
+
FULL,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface JudoBillingAddressParameters {
|
|
12
|
+
addressFormat: JudoAddressFormat;
|
|
13
|
+
isPhoneNumberRequired: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface JudoShippingAddressParameters {
|
|
17
|
+
allowedCountryCodes?: string[];
|
|
18
|
+
isPhoneNumberRequired: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum JudoGooglePayPriceStatus {
|
|
22
|
+
FINAL,
|
|
23
|
+
ESTIMATED,
|
|
24
|
+
NOT_CURRENTLY_KNOWN,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export enum JudoCheckoutOption {
|
|
28
|
+
DEFAULT,
|
|
29
|
+
COMPLETE_IMMEDIATE_PURCHASE,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface JudoGooglePayConfiguration {
|
|
33
|
+
environment: JudoGooglePayEnvironment;
|
|
34
|
+
merchantName?: string;
|
|
35
|
+
countryCode: string;
|
|
36
|
+
transactionId?: string;
|
|
37
|
+
totalPriceStatus: JudoGooglePayPriceStatus;
|
|
38
|
+
totalPriceLabel?: string;
|
|
39
|
+
checkoutOption?: JudoCheckoutOption;
|
|
40
|
+
isEmailRequired?: boolean;
|
|
41
|
+
isBillingAddressRequired: boolean;
|
|
42
|
+
billingAddressParameters?: JudoBillingAddressParameters;
|
|
43
|
+
isShippingAddressRequired: boolean;
|
|
44
|
+
shippingAddressParameters?: JudoShippingAddressParameters;
|
|
45
|
+
allowPrepaidCards?: boolean;
|
|
46
|
+
allowCreditCards?: boolean;
|
|
47
|
+
}
|