@fat-zebra/sdk 1.4.12 → 1.4.14
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/.jest/setup-env-vars.js +0 -1
- package/dist/click_to_pay/index.d.ts +28 -0
- package/dist/click_to_pay/index.js +50 -0
- package/dist/click_to_pay/types.d.ts +13 -0
- package/dist/local/fatzebra.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +18 -1
- package/dist/react/url.js +0 -3
- package/dist/sca/index.d.ts +1 -1
- package/dist/sca/index.js +26 -10
- package/dist/sca/scenarios/enrollment.d.ts +2 -1
- package/dist/sca/scenarios/enrollment.js +11 -1
- package/dist/sca/scenarios/validation.d.ts +2 -1
- package/dist/sca/scenarios/validation.js +11 -1
- package/dist/sca/types.d.ts +2 -2
- package/dist/shared/api-gateway-client.js +6 -1
- package/dist/shared/post-message-client.js +2 -0
- package/dist/shared/types.d.ts +1 -1
- package/dist/src/applepay/applepay.js +198 -0
- package/dist/src/applepay/applepay.js.map +1 -0
- package/dist/src/applepay/clients/apple-pay-client.js +66 -0
- package/dist/src/applepay/clients/apple-pay-client.js.map +1 -0
- package/dist/src/applepay/clients/paynow-client.js +96 -0
- package/dist/src/applepay/clients/paynow-client.js.map +1 -0
- package/dist/src/applepay/index.js +6 -0
- package/dist/src/applepay/index.js.map +1 -0
- package/dist/src/click_to_pay/index.js +88 -0
- package/dist/src/click_to_pay/index.js.map +1 -0
- package/dist/src/click_to_pay/types.js +3 -0
- package/dist/src/click_to_pay/types.js.map +1 -0
- package/dist/src/hpp/hpp.js +230 -0
- package/dist/src/hpp/hpp.js.map +1 -0
- package/dist/src/hpp/hpp.test.js +135 -0
- package/dist/src/hpp/hpp.test.js.map +1 -0
- package/dist/src/hpp/index.js +6 -0
- package/dist/src/hpp/index.js.map +1 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/main.js +243 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/main.test.js +236 -0
- package/dist/src/main.test.js.map +1 -0
- package/dist/src/paypal/paypal-button.js +311 -0
- package/dist/src/paypal/paypal-button.js.map +1 -0
- package/dist/src/paypal/paypal-button.test.js +41 -0
- package/dist/src/paypal/paypal-button.test.js.map +1 -0
- package/dist/src/paypal/paypal-checkout.js +111 -0
- package/dist/src/paypal/paypal-checkout.js.map +1 -0
- package/dist/src/paypal/paypal-checkout.test.js +167 -0
- package/dist/src/paypal/paypal-checkout.test.js.map +1 -0
- package/dist/src/paypal/types.js +9 -0
- package/dist/src/paypal/types.js.map +1 -0
- package/dist/src/paypal/validation.js +73 -0
- package/dist/src/paypal/validation.js.map +1 -0
- package/dist/src/react/VerifyCard.js +29 -0
- package/dist/src/react/VerifyCard.js.map +1 -0
- package/dist/src/react/index.js +11 -0
- package/dist/src/react/index.js.map +1 -0
- package/dist/src/react/submitForm.js +13 -0
- package/dist/src/react/submitForm.js.map +1 -0
- package/dist/src/react/url.js +60 -0
- package/dist/src/react/url.js.map +1 -0
- package/dist/src/react/url.test.js +88 -0
- package/dist/src/react/url.test.js.map +1 -0
- package/dist/src/react/useFatZebra.js +119 -0
- package/dist/src/react/useFatZebra.js.map +1 -0
- package/dist/src/sca/cardinal.js +110 -0
- package/dist/src/sca/cardinal.js.map +1 -0
- package/dist/src/sca/eci-mappings.js +63 -0
- package/dist/src/sca/eci-mappings.js.map +1 -0
- package/dist/src/sca/eci-mappings.test.js +31 -0
- package/dist/src/sca/eci-mappings.test.js.map +1 -0
- package/dist/src/sca/index.js +363 -0
- package/dist/src/sca/index.js.map +1 -0
- package/dist/src/sca/index.test.js +620 -0
- package/dist/src/sca/index.test.js.map +1 -0
- package/dist/src/sca/scenarios/enrollment.js +161 -0
- package/dist/src/sca/scenarios/enrollment.js.map +1 -0
- package/dist/src/sca/scenarios/index.js +8 -0
- package/dist/src/sca/scenarios/index.js.map +1 -0
- package/dist/src/sca/scenarios/validation.js +139 -0
- package/dist/src/sca/scenarios/validation.js.map +1 -0
- package/dist/src/sca/types.js +57 -0
- package/dist/src/sca/types.js.map +1 -0
- package/dist/src/shared/api-gateway-client.js +184 -0
- package/dist/src/shared/api-gateway-client.js.map +1 -0
- package/dist/src/shared/bridge-client.js +24 -0
- package/dist/src/shared/bridge-client.js.map +1 -0
- package/dist/src/shared/constants.js +19 -0
- package/dist/src/shared/constants.js.map +1 -0
- package/dist/src/shared/env.development.js +12 -0
- package/dist/src/shared/env.development.js.map +1 -0
- package/dist/src/shared/env.js +46 -0
- package/dist/src/shared/env.js.map +1 -0
- package/dist/src/shared/envs/local.js +12 -0
- package/dist/src/shared/envs/local.js.map +1 -0
- package/dist/src/shared/envs/production.js +12 -0
- package/dist/src/shared/envs/production.js.map +1 -0
- package/dist/src/shared/envs/sandbox.js +12 -0
- package/dist/src/shared/envs/sandbox.js.map +1 -0
- package/dist/src/shared/envs/staging.js +12 -0
- package/dist/src/shared/envs/staging.js.map +1 -0
- package/dist/src/shared/event-manager.js +14 -0
- package/dist/src/shared/event-manager.js.map +1 -0
- package/dist/src/shared/post-message-client.js +107 -0
- package/dist/src/shared/post-message-client.js.map +1 -0
- package/dist/src/shared/post-message-client.test.js +58 -0
- package/dist/src/shared/post-message-client.test.js.map +1 -0
- package/dist/src/shared/types.js +47 -0
- package/dist/src/shared/types.js.map +1 -0
- package/dist/src/shared/types.test.js +55 -0
- package/dist/src/shared/types.test.js.map +1 -0
- package/dist/src/shared/util.js +96 -0
- package/dist/src/shared/util.js.map +1 -0
- package/dist/src/shared/util.test.js +148 -0
- package/dist/src/shared/util.test.js.map +1 -0
- package/dist/src/validation/index.js +12 -0
- package/dist/src/validation/index.js.map +1 -0
- package/dist/src/validation/schemas/click-to-pay/load-params.json +34 -0
- package/dist/src/validation/schemas/click-to-pay/options.json +23 -0
- package/dist/src/validation/schemas/click-to-pay/payment-intent.json +42 -0
- package/dist/src/validation/schemas/customer.json +38 -0
- package/dist/src/validation/schemas/hpp-load-params.json +40 -0
- package/dist/src/validation/schemas/hpp-options.json +48 -0
- package/dist/src/validation/schemas/payment-intent.json +48 -0
- package/dist/src/validation/schemas/payment-method.json +83 -0
- package/dist/src/validation/schemas/verify-card-options.json +15 -0
- package/dist/src/validation/schemas/verify-card-params.json +24 -0
- package/dist/src/validation/validation-helper.js +10 -0
- package/dist/src/validation/validation-helper.js.map +1 -0
- package/dist/src/validation/validation-helper.test.js +34 -0
- package/dist/src/validation/validation-helper.test.js.map +1 -0
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js +19 -0
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js.map +1 -0
- package/dist/src/validation/validators/hpp-load-params-validator.js +21 -0
- package/dist/src/validation/validators/hpp-load-params-validator.js.map +1 -0
- package/dist/src/validation/validators/hpp-load-params-validator.test.js +56 -0
- package/dist/src/validation/validators/hpp-load-params-validator.test.js.map +1 -0
- package/dist/src/validation/validators/verify-card-params-validator.js +23 -0
- package/dist/src/validation/validators/verify-card-params-validator.js.map +1 -0
- package/dist/tests/helpers/api-gateway-mock.js +37 -0
- package/dist/tests/helpers/api-gateway-mock.js.map +1 -0
- package/dist/validation/index.d.ts +1 -0
- package/dist/validation/index.js +1 -0
- package/dist/validation/schemas/click-to-pay/load-params.json +34 -0
- package/dist/validation/schemas/click-to-pay/options.json +23 -0
- package/dist/validation/schemas/click-to-pay/payment-intent.json +42 -0
- package/dist/validation/schemas/hpp-options.json +93 -45
- package/dist/validation/validators/click-to-pay-load-params-validator.d.ts +3 -0
- package/dist/validation/validators/click-to-pay-load-params-validator.js +12 -0
- package/package.json +1 -1
- package/dist/clicktopay/index.js +0 -50
- package/dist/sandbox/fatzebra.js.LICENSE.txt +0 -1
- /package/dist/{clicktopay/index.d.ts → click_to_pay/types.js} +0 -0
package/dist/main.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Customer, PaymentIntent, PaymentMethod, PublicEvent } from './shared/ty
|
|
|
2
2
|
import { HppLoadParams } from './hpp';
|
|
3
3
|
import { PayPalConfig } from './paypal/types';
|
|
4
4
|
import { ChallengeWindowSize } from './sca/types';
|
|
5
|
+
import { HppClickToPayParams } from './click_to_pay/types';
|
|
5
6
|
export interface FZConfig {
|
|
6
7
|
username: string;
|
|
7
8
|
test?: boolean;
|
|
@@ -31,6 +32,7 @@ export default class FatZebra {
|
|
|
31
32
|
cardDidTokenize(headless: HTMLIFrameElement, callback: (data: any) => void): void;
|
|
32
33
|
verifyCard(params: VerifyCardParams): Promise<void>;
|
|
33
34
|
renderPaymentsPage(params: HppLoadParams): void;
|
|
35
|
+
renderClickToPay(params: HppClickToPayParams): void;
|
|
34
36
|
checkout(): void;
|
|
35
37
|
setupPayPal(config: PayPalConfig): void;
|
|
36
38
|
on(event: PublicEvent, callback: (e: any) => void): void;
|
package/dist/main.js
CHANGED
|
@@ -13,10 +13,11 @@ import { BridgeEvent, PaymentMethodType, PublicEvent, } from './shared/types';
|
|
|
13
13
|
import { LocalStorageAccessTokenKey } from './shared/constants';
|
|
14
14
|
import { emit, on } from './shared/event-manager';
|
|
15
15
|
import * as bridge from './shared/bridge-client';
|
|
16
|
-
import { validateHppLoadParams, validateVerifyCardParams, toHumanizedErrors, } from './validation';
|
|
16
|
+
import { validateHppLoadParams, validateVerifyCardParams, toHumanizedErrors, validateClickToPayLoadParams, } from './validation';
|
|
17
17
|
import GatewayClient from './shared/api-gateway-client';
|
|
18
18
|
import { Hpp } from './hpp';
|
|
19
19
|
import { PayPalCheckout } from './paypal/paypal-checkout';
|
|
20
|
+
import ClickToPay from './click_to_pay';
|
|
20
21
|
export default class FatZebra {
|
|
21
22
|
constructor(config) {
|
|
22
23
|
this.fzConfig = config;
|
|
@@ -121,6 +122,22 @@ export default class FatZebra {
|
|
|
121
122
|
});
|
|
122
123
|
window.HPP.load(params);
|
|
123
124
|
}
|
|
125
|
+
renderClickToPay(params) {
|
|
126
|
+
const valid = validateClickToPayLoadParams(params);
|
|
127
|
+
if (!valid) {
|
|
128
|
+
emit(PublicEvent.VALIDATION_ERROR, {
|
|
129
|
+
errors: toHumanizedErrors(validateClickToPayLoadParams.errors),
|
|
130
|
+
data: null
|
|
131
|
+
});
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
window.HPP = new ClickToPay({
|
|
135
|
+
paymentIntent: params.paymentIntent,
|
|
136
|
+
username: this.fzConfig.username,
|
|
137
|
+
test: this.fzConfig.test,
|
|
138
|
+
});
|
|
139
|
+
window.HPP.load(params);
|
|
140
|
+
}
|
|
124
141
|
checkout() {
|
|
125
142
|
window.HPP.purchase();
|
|
126
143
|
}
|
package/dist/react/url.js
CHANGED
|
@@ -9,9 +9,6 @@ const generatePaymentURL = (values, environment) => {
|
|
|
9
9
|
"postmessage",
|
|
10
10
|
"hide_card_holder",
|
|
11
11
|
"hide_button",
|
|
12
|
-
"return_path",
|
|
13
|
-
"card_types",
|
|
14
|
-
"surcharge_enabled",
|
|
15
12
|
"sca_enabled",
|
|
16
13
|
];
|
|
17
14
|
const environmentConfig = env[environment || Environment.sandbox];
|
package/dist/sca/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare class Sca {
|
|
|
29
29
|
private successCallback;
|
|
30
30
|
private failureCallback;
|
|
31
31
|
private environmentConfig;
|
|
32
|
-
constructor({ gatewayClient, successCallback, failureCallback
|
|
32
|
+
constructor({ gatewayClient, successCallback, failureCallback }: ScaConfig);
|
|
33
33
|
loadScript(): void;
|
|
34
34
|
get cardinal(): CardinalManager;
|
|
35
35
|
set cardinal(cardinal: CardinalManager);
|
package/dist/sca/index.js
CHANGED
|
@@ -14,12 +14,14 @@ import { CardinalManager, } from './cardinal';
|
|
|
14
14
|
import { emit, } from '../shared/event-manager';
|
|
15
15
|
import { toFzSli } from './eci-mappings';
|
|
16
16
|
import env, { Environment } from "../shared/env";
|
|
17
|
+
import { failedEnrollmentRequestScenario } from './scenarios/enrollment';
|
|
18
|
+
import { failedValidationRequestScenario } from './scenarios/validation';
|
|
17
19
|
class Sca {
|
|
18
|
-
constructor({ gatewayClient, successCallback, failureCallback
|
|
20
|
+
constructor({ gatewayClient, successCallback, failureCallback }) {
|
|
19
21
|
this.gatewayClient = gatewayClient;
|
|
20
22
|
this.successCallback = successCallback;
|
|
21
23
|
this.failureCallback = failureCallback;
|
|
22
|
-
this.environmentConfig = env[environment || Environment.sandbox];
|
|
24
|
+
this.environmentConfig = env[gatewayClient.environment || Environment.sandbox];
|
|
23
25
|
}
|
|
24
26
|
loadScript() {
|
|
25
27
|
if (!document.getElementById("songbird-script")) {
|
|
@@ -59,7 +61,15 @@ class Sca {
|
|
|
59
61
|
}
|
|
60
62
|
run(config) {
|
|
61
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
|
|
64
|
+
try {
|
|
65
|
+
if (!this._cardinal) {
|
|
66
|
+
this._cardinal = new CardinalManager();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
this.reportFailure(`FatZebra.3DS: Failed to setup 3DS provider.`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
63
73
|
// Persist states until next 3DS run.
|
|
64
74
|
this.paymentIntent = config.paymentIntent;
|
|
65
75
|
this.bin = config.bin;
|
|
@@ -82,6 +92,7 @@ class Sca {
|
|
|
82
92
|
this.sessionId = paymentsSetupCompleteResponse.sessionId;
|
|
83
93
|
// Register handler. Called after OTP is entered on challenge prompt.
|
|
84
94
|
this._cardinal.onPaymentValidated((data, error) => __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
var _a;
|
|
85
96
|
if (typeof error == 'string') {
|
|
86
97
|
this.reportFailure(`FatZebra.3DS: Validation failed. ${error}.`);
|
|
87
98
|
return;
|
|
@@ -114,7 +125,8 @@ class Sca {
|
|
|
114
125
|
this.reportSuccess(`FatZebra.3DS: 3DS success - ${scenario.description}.`, threedsData);
|
|
115
126
|
}
|
|
116
127
|
else {
|
|
117
|
-
|
|
128
|
+
const failureMessage = [scenario.description, (_a = scenario.outcome) === null || _a === void 0 ? void 0 : _a.errorCode].filter(Boolean).join(' - ');
|
|
129
|
+
this.reportFailure(`FatZebra.3DS: 3DS error - ${failureMessage}`, {
|
|
118
130
|
errorCode: scenario.outcome.errorCode,
|
|
119
131
|
});
|
|
120
132
|
}
|
|
@@ -188,6 +200,7 @@ class Sca {
|
|
|
188
200
|
return properties;
|
|
189
201
|
}
|
|
190
202
|
handleEnrollmentResult(enrollSCAResponse) {
|
|
203
|
+
var _a;
|
|
191
204
|
const threedsData = threedsResponseData(enrollSCAResponse);
|
|
192
205
|
const scenario = getEnrollmentResult(enrollSCAResponse);
|
|
193
206
|
if (scenario.outcome.authenticationType === 'challenge') {
|
|
@@ -198,7 +211,8 @@ class Sca {
|
|
|
198
211
|
this.reportSuccess(`FatZebra.3DS: 3DS success - ${scenario.description}.`, threedsData);
|
|
199
212
|
}
|
|
200
213
|
else {
|
|
201
|
-
|
|
214
|
+
const failureMessage = [scenario.description, (_a = scenario.outcome) === null || _a === void 0 ? void 0 : _a.errorCode].filter(Boolean).join(' - ');
|
|
215
|
+
this.reportFailure(`FatZebra.3DS: 3DS error - ${failureMessage}`, { errorCode: scenario.outcome.errorCode });
|
|
202
216
|
}
|
|
203
217
|
}
|
|
204
218
|
}
|
|
@@ -211,27 +225,29 @@ const threedsResponseData = (response) => {
|
|
|
211
225
|
sli: toFzSli(response.eci),
|
|
212
226
|
xid: response.xid,
|
|
213
227
|
ver: response.enrolled,
|
|
214
|
-
|
|
215
|
-
|
|
228
|
+
directory_server_txn_id: response.directory_server_txn_id,
|
|
229
|
+
threeds_version: response.version,
|
|
216
230
|
};
|
|
217
231
|
};
|
|
218
232
|
const getEnrollmentResult = (enrollment) => {
|
|
219
|
-
|
|
233
|
+
const result = enrollmentScenarios.find((item) => {
|
|
220
234
|
return item.reasonCode === enrollment.reason_code &&
|
|
221
235
|
item.veresEnrolled === enrollment.enrolled &&
|
|
222
236
|
item.pares === enrollment.pares &&
|
|
223
237
|
item.threedsVersion === getMajor3dsVersion(enrollment.version);
|
|
224
238
|
});
|
|
239
|
+
return result || failedEnrollmentRequestScenario;
|
|
225
240
|
};
|
|
226
241
|
const getValidationResult = (validation) => {
|
|
227
|
-
|
|
242
|
+
const result = validationScenarios.find((item) => {
|
|
228
243
|
return item.reasonCode === validation.reason_code &&
|
|
229
244
|
item.pares === validation.pares &&
|
|
230
245
|
item.threedsVersion === getMajor3dsVersion(validation.version);
|
|
231
246
|
});
|
|
247
|
+
return result || failedValidationRequestScenario;
|
|
232
248
|
};
|
|
233
249
|
// 3DS versioning follows SEMVER format. The first charactor is the major version number.
|
|
234
250
|
const getMajor3dsVersion = (original) => {
|
|
235
|
-
return original[0];
|
|
251
|
+
return original === null || original === void 0 ? void 0 : original[0];
|
|
236
252
|
};
|
|
237
253
|
export default Sca;
|
|
@@ -11,6 +11,7 @@ interface EnrollmentScenario {
|
|
|
11
11
|
errorCode?: string;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
declare const failedEnrollmentRequestScenario: EnrollmentScenario;
|
|
14
15
|
declare const enrollmentScenarios: EnrollmentScenario[];
|
|
15
|
-
export { enrollmentScenarios };
|
|
16
|
+
export { enrollmentScenarios, failedEnrollmentRequestScenario };
|
|
16
17
|
export type { EnrollmentScenario };
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { ScaErrorCode, VEResEnrolled, PARes } from '../types';
|
|
2
|
+
const failedEnrollmentRequestScenario = {
|
|
3
|
+
description: 'Enrollment Request Failed',
|
|
4
|
+
threedsVersion: null,
|
|
5
|
+
reasonCode: null,
|
|
6
|
+
veresEnrolled: null,
|
|
7
|
+
pares: null,
|
|
8
|
+
outcome: {
|
|
9
|
+
success: false, // no liability shift
|
|
10
|
+
},
|
|
11
|
+
};
|
|
2
12
|
const enrollmentScenarios = [
|
|
3
13
|
/***************************************************************/
|
|
4
14
|
/********************** 3DS2 scenarios *************************/
|
|
@@ -143,4 +153,4 @@ const enrollmentScenarios = [
|
|
|
143
153
|
}
|
|
144
154
|
},
|
|
145
155
|
];
|
|
146
|
-
export { enrollmentScenarios };
|
|
156
|
+
export { enrollmentScenarios, failedEnrollmentRequestScenario };
|
|
@@ -11,6 +11,7 @@ interface ValidationScenario {
|
|
|
11
11
|
errorCode?: string;
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
+
declare const failedValidationRequestScenario: ValidationScenario;
|
|
14
15
|
declare const validationScenarios: ValidationScenario[];
|
|
15
|
-
export { validationScenarios };
|
|
16
|
+
export { validationScenarios, failedValidationRequestScenario };
|
|
16
17
|
export type { ValidationScenario };
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { ScaErrorCode, PARes } from '../types';
|
|
2
|
+
const failedValidationRequestScenario = {
|
|
3
|
+
description: 'Validation Request Failed',
|
|
4
|
+
threedsVersion: null,
|
|
5
|
+
reasonCode: null,
|
|
6
|
+
veresEnrolled: null,
|
|
7
|
+
pares: null,
|
|
8
|
+
outcome: {
|
|
9
|
+
success: false, // no liability shift
|
|
10
|
+
},
|
|
11
|
+
};
|
|
2
12
|
const validationScenarios = [
|
|
3
13
|
/***************************************************************/
|
|
4
14
|
/********************** 3DS2 scenarios *************************/
|
|
@@ -121,4 +131,4 @@ const validationScenarios = [
|
|
|
121
131
|
}
|
|
122
132
|
},
|
|
123
133
|
];
|
|
124
|
-
export { validationScenarios };
|
|
134
|
+
export { validationScenarios, failedValidationRequestScenario };
|
package/dist/sca/types.d.ts
CHANGED
|
@@ -55,7 +55,12 @@ class GatewayClient {
|
|
|
55
55
|
}
|
|
56
56
|
validateSCA(data) {
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
return this.client.post("/sca/validation", data)
|
|
58
|
+
return this.client.post("/sca/validation", data).then((response) => response).catch(err => {
|
|
59
|
+
if (err.response && err.response.status == 422) {
|
|
60
|
+
return err.response;
|
|
61
|
+
}
|
|
62
|
+
throw err;
|
|
63
|
+
});
|
|
59
64
|
});
|
|
60
65
|
}
|
|
61
66
|
getCard(data) {
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { NODE_ENV } from '../shared/types';
|
|
11
|
+
import env from './env';
|
|
11
12
|
const domain = process.env.PAYNOW_BASE_URL;
|
|
12
13
|
// NODE_ENV is introduced to PostMessageClient purely for the purpose of bypassing security
|
|
13
14
|
// check on the postMessage event between parent and child frames. Unforunately there is
|
|
@@ -17,6 +18,7 @@ class PostMessageClient {
|
|
|
17
18
|
this.channel = config.channel;
|
|
18
19
|
this.fzEnv = process.env.NODE_ENV;
|
|
19
20
|
this.target = config.target;
|
|
21
|
+
this.domain = env[this.fzEnv];
|
|
20
22
|
}
|
|
21
23
|
// Handle event messages that conform to PostMessage format.
|
|
22
24
|
setEventListeners(handlers) {
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export type PaymentConfig = {
|
|
|
98
98
|
};
|
|
99
99
|
export type OptionalUrlValues = {
|
|
100
100
|
hide_card_holder?: boolean;
|
|
101
|
+
hide_button?: boolean;
|
|
101
102
|
return_path?: string;
|
|
102
103
|
card_types?: Array<string>;
|
|
103
104
|
surcharge_enabled?: string;
|
|
@@ -105,7 +106,6 @@ export type OptionalUrlValues = {
|
|
|
105
106
|
css?: string;
|
|
106
107
|
css_signature?: string;
|
|
107
108
|
tokenize_only?: boolean;
|
|
108
|
-
hide_button?: boolean;
|
|
109
109
|
};
|
|
110
110
|
declare global {
|
|
111
111
|
interface Window {
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
+
exports.ApplePay = void 0;
|
|
74
|
+
var apple_pay_client_1 = require("./clients/apple-pay-client");
|
|
75
|
+
var payNow = __importStar(require("./clients/paynow-client"));
|
|
76
|
+
var post_message_client_1 = require("../shared/post-message-client");
|
|
77
|
+
var channel = 'applepay';
|
|
78
|
+
var fzPayNowDomain = process.env.PAYNOW_BASE_URL;
|
|
79
|
+
var ApplePay = /** @class */ (function () {
|
|
80
|
+
function ApplePay(config) {
|
|
81
|
+
this.iframe = config.iframe;
|
|
82
|
+
this.postMessageClient = new post_message_client_1.PostMessageClient({
|
|
83
|
+
channel: 'applepay',
|
|
84
|
+
target: this.iframe
|
|
85
|
+
});
|
|
86
|
+
this.registerEventListener();
|
|
87
|
+
this.checkApplePayEligibilty();
|
|
88
|
+
this.notifyApplePayEligibiity();
|
|
89
|
+
}
|
|
90
|
+
ApplePay.prototype.checkApplePayEligibilty = function () {
|
|
91
|
+
if ((0, apple_pay_client_1.getEligibilty)()) {
|
|
92
|
+
this.canMakePayments = true;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
ApplePay.prototype.notifyApplePayEligibiity = function () {
|
|
96
|
+
var message = {
|
|
97
|
+
channel: channel,
|
|
98
|
+
subject: 'eligibility',
|
|
99
|
+
data: {
|
|
100
|
+
canMakePayments: this.canMakePayments
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
this.postMessageClient.send(message);
|
|
104
|
+
};
|
|
105
|
+
ApplePay.prototype.registerEventListener = function () {
|
|
106
|
+
var _this = this;
|
|
107
|
+
this.postMessageClient.setEventListeners({
|
|
108
|
+
'paymentrequest': function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (_a.label) {
|
|
111
|
+
case 0: return [4 /*yield*/, this.purchase(data)];
|
|
112
|
+
case 1:
|
|
113
|
+
_a.sent();
|
|
114
|
+
return [2 /*return*/];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}); }
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
ApplePay.prototype.purchase = function (request) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
+
var applePayPaymentRequest, payNowPaymentAttributes, _a;
|
|
123
|
+
var _this = this;
|
|
124
|
+
return __generator(this, function (_b) {
|
|
125
|
+
switch (_b.label) {
|
|
126
|
+
case 0:
|
|
127
|
+
applePayPaymentRequest = this.extractApplePaymentRequestParams(request);
|
|
128
|
+
payNowPaymentAttributes = this.extractPayNowPaymentAttributes(request);
|
|
129
|
+
_a = this;
|
|
130
|
+
return [4 /*yield*/, (0, apple_pay_client_1.createSession)(applePayPaymentRequest)];
|
|
131
|
+
case 1:
|
|
132
|
+
_a.applePaySession = _b.sent();
|
|
133
|
+
this.applePaySession.onvalidatemerchant = function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
134
|
+
var merchantSession, e_1;
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
switch (_a.label) {
|
|
137
|
+
case 0:
|
|
138
|
+
_a.trys.push([0, 2, , 3]);
|
|
139
|
+
return [4 /*yield*/, payNow.getMerchantSession(event.validationURL, payNowPaymentAttributes)];
|
|
140
|
+
case 1:
|
|
141
|
+
merchantSession = _a.sent();
|
|
142
|
+
return [3 /*break*/, 3];
|
|
143
|
+
case 2:
|
|
144
|
+
e_1 = _a.sent();
|
|
145
|
+
console.log('Unable to establish new merchant session');
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
case 3:
|
|
148
|
+
this.applePaySession.completeMerchantValidation(merchantSession);
|
|
149
|
+
return [2 /*return*/];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}); };
|
|
153
|
+
this.applePaySession.onpaymentauthorized = function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
154
|
+
var e_2;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
_a.trys.push([0, 2, , 3]);
|
|
159
|
+
return [4 /*yield*/, payNow.authorizePayment(__assign(__assign({}, payNowPaymentAttributes), event.payment.token))];
|
|
160
|
+
case 1:
|
|
161
|
+
_a.sent();
|
|
162
|
+
this.applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
|
|
163
|
+
return [3 /*break*/, 3];
|
|
164
|
+
case 2:
|
|
165
|
+
e_2 = _a.sent();
|
|
166
|
+
this.applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
|
|
167
|
+
return [3 /*break*/, 3];
|
|
168
|
+
case 3: return [2 /*return*/];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}); };
|
|
172
|
+
this.applePaySession.begin();
|
|
173
|
+
return [2 /*return*/];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
ApplePay.prototype.extractApplePaymentRequestParams = function (payload) {
|
|
179
|
+
var countryCode = payload.countryCode, currencyCode = payload.currencyCode, merchantCapabilities = payload.merchantCapabilities, supportedNetworks = payload.supportedNetworks, total = payload.total;
|
|
180
|
+
return {
|
|
181
|
+
countryCode: countryCode,
|
|
182
|
+
currencyCode: currencyCode,
|
|
183
|
+
merchantCapabilities: merchantCapabilities,
|
|
184
|
+
supportedNetworks: supportedNetworks,
|
|
185
|
+
total: total,
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
ApplePay.prototype.extractPayNowPaymentAttributes = function (payload) {
|
|
189
|
+
var paymentAttributes = payload.paymentAttributes;
|
|
190
|
+
return paymentAttributes;
|
|
191
|
+
};
|
|
192
|
+
ApplePay.prototype.sendMessage = function (payload) {
|
|
193
|
+
this.iframe.contentWindow.postMessage(payload, fzPayNowDomain);
|
|
194
|
+
};
|
|
195
|
+
return ApplePay;
|
|
196
|
+
}());
|
|
197
|
+
exports.ApplePay = ApplePay;
|
|
198
|
+
//# sourceMappingURL=applepay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applepay.js","sourceRoot":"","sources":["../../../src/applepay/applepay.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.SupportedNetwork = exports.MerchantCapability = exports.getEligibilty = exports.createSession = void 0;
|
|
40
|
+
var SupportedNetwork;
|
|
41
|
+
(function (SupportedNetwork) {
|
|
42
|
+
SupportedNetwork["Amex"] = "amex";
|
|
43
|
+
SupportedNetwork["Visa"] = "visa";
|
|
44
|
+
SupportedNetwork["MasterCard"] = "masterCard";
|
|
45
|
+
})(SupportedNetwork || (exports.SupportedNetwork = SupportedNetwork = {}));
|
|
46
|
+
var MerchantCapability;
|
|
47
|
+
(function (MerchantCapability) {
|
|
48
|
+
MerchantCapability["Supports3DS"] = "supports3DS";
|
|
49
|
+
MerchantCapability["SupportsCredit"] = "supportsCredit";
|
|
50
|
+
MerchantCapability["SupportsDebit"] = "supportsDebit";
|
|
51
|
+
MerchantCapability["SupportsEMV"] = "supportsEMV";
|
|
52
|
+
})(MerchantCapability || (exports.MerchantCapability = MerchantCapability = {}));
|
|
53
|
+
var getEligibilty = function () {
|
|
54
|
+
return window.ApplePaySession && window.ApplePaySession.canMakePayments();
|
|
55
|
+
};
|
|
56
|
+
exports.getEligibilty = getEligibilty;
|
|
57
|
+
var createSession = function (payload) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
+
return __generator(this, function (_a) {
|
|
59
|
+
switch (_a.label) {
|
|
60
|
+
case 0: return [4 /*yield*/, new window.ApplePaySession(2, payload)];
|
|
61
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}); };
|
|
65
|
+
exports.createSession = createSession;
|
|
66
|
+
//# sourceMappingURL=apple-pay-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apple-pay-client.js","sourceRoot":"","sources":["../../../../src/applepay/clients/apple-pay-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAK,gBAIJ;AAJD,WAAK,gBAAgB;IACnB,iCAAa,CAAA;IACb,iCAAa,CAAA;IACb,6CAAyB,CAAA;AAC3B,CAAC,EAJI,gBAAgB,gCAAhB,gBAAgB,QAIpB;AAED,IAAK,kBAKJ;AALD,WAAK,kBAAkB;IACrB,iDAA2B,CAAA;IAC3B,uDAAiC,CAAA;IACjC,qDAA+B,CAAA;IAC/B,iDAA2B,CAAA;AAC7B,CAAC,EALI,kBAAkB,kCAAlB,kBAAkB,QAKtB;AAaD,IAAM,aAAa,GAAG;IACpB,OAAO,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC,eAAe,EAAE,CAAA;AAC3E,CAAC,CAAA;AASC,sCAAa;AAPf,IAAM,aAAa,GAAG,UAAO,OAAuB;;;oBAC3C,qBAAM,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,EAAA;oBAAnD,sBAAO,SAA4C,EAAA;;;KACpD,CAAA;AAGC,sCAAa"}
|