@fat-zebra/sdk 1.4.14 → 1.5.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/.idea/fatzebra-js.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/CHANGELOG.md +13 -0
- package/README.dev.md +1 -14
- package/build-styles.js +12 -0
- package/dist/click_to_pay/index.d.ts +1 -1
- package/dist/click_to_pay/index.js +45 -1
- package/dist/fatzebra.css +91 -0
- package/dist/hpp/hpp.js +1 -3
- package/dist/local/fatzebra.js +18266 -0
- package/dist/local/fatzebra.js.map +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.js +7 -21
- package/dist/react/VerifyCard.d.ts +2 -2
- package/dist/react/VerifyCard.js +4 -4
- package/dist/react/VerifyExistingCard.d.ts +10 -0
- package/dist/react/VerifyExistingCard.js +12 -0
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/useFatZebra.d.ts +4 -2
- package/dist/react/useFatZebra.js +7 -7
- package/dist/react/verifyUrl.d.ts +8 -0
- package/dist/react/verifyUrl.js +22 -0
- package/dist/sca/cardinal.d.ts +11 -10
- package/dist/sca/cardinal.js +29 -8
- package/dist/sca/index.d.ts +3 -0
- package/dist/sca/index.js +53 -48
- package/dist/sca/types.d.ts +2 -2
- package/dist/shared/api-gateway-client.d.ts +4 -10
- package/dist/shared/api-gateway-client.js +12 -38
- package/dist/shared/env.d.ts +4 -0
- package/dist/shared/env.js +4 -0
- package/dist/shared/event-manager.d.ts +3 -1
- package/dist/shared/event-manager.js +7 -1
- package/dist/shared/post-message-client.d.ts +1 -0
- package/dist/shared/post-message-client.js +8 -13
- package/dist/shared/types.d.ts +8 -20
- package/dist/shared/types.js +4 -15
- package/dist/staging/fatzebra.css +91 -0
- package/dist/staging/fatzebra.js +18265 -0
- package/dist/staging/fatzebra.js.map +1 -0
- package/dist/staging/index.html +247 -0
- package/dist/validation/schemas/hpp-options.json +45 -93
- package/package.json +6 -7
- package/dist/production/fatzebra.js.LICENSE.txt +0 -1
- package/dist/src/applepay/applepay.js +0 -198
- package/dist/src/applepay/applepay.js.map +0 -1
- package/dist/src/applepay/clients/apple-pay-client.js +0 -66
- package/dist/src/applepay/clients/apple-pay-client.js.map +0 -1
- package/dist/src/applepay/clients/paynow-client.js +0 -96
- package/dist/src/applepay/clients/paynow-client.js.map +0 -1
- package/dist/src/applepay/index.js +0 -6
- package/dist/src/applepay/index.js.map +0 -1
- package/dist/src/click_to_pay/index.js +0 -88
- package/dist/src/click_to_pay/index.js.map +0 -1
- package/dist/src/click_to_pay/types.js +0 -3
- package/dist/src/click_to_pay/types.js.map +0 -1
- package/dist/src/hpp/hpp.js +0 -230
- package/dist/src/hpp/hpp.js.map +0 -1
- package/dist/src/hpp/hpp.test.js +0 -135
- package/dist/src/hpp/hpp.test.js.map +0 -1
- package/dist/src/hpp/index.js +0 -6
- package/dist/src/hpp/index.js.map +0 -1
- package/dist/src/index.js +0 -14
- package/dist/src/index.js.map +0 -1
- package/dist/src/main.js +0 -243
- package/dist/src/main.js.map +0 -1
- package/dist/src/main.test.js +0 -236
- package/dist/src/main.test.js.map +0 -1
- package/dist/src/paypal/paypal-button.js +0 -311
- package/dist/src/paypal/paypal-button.js.map +0 -1
- package/dist/src/paypal/paypal-button.test.js +0 -41
- package/dist/src/paypal/paypal-button.test.js.map +0 -1
- package/dist/src/paypal/paypal-checkout.js +0 -111
- package/dist/src/paypal/paypal-checkout.js.map +0 -1
- package/dist/src/paypal/paypal-checkout.test.js +0 -167
- package/dist/src/paypal/paypal-checkout.test.js.map +0 -1
- package/dist/src/paypal/types.js +0 -9
- package/dist/src/paypal/types.js.map +0 -1
- package/dist/src/paypal/validation.js +0 -73
- package/dist/src/paypal/validation.js.map +0 -1
- package/dist/src/react/VerifyCard.js +0 -29
- package/dist/src/react/VerifyCard.js.map +0 -1
- package/dist/src/react/index.js +0 -11
- package/dist/src/react/index.js.map +0 -1
- package/dist/src/react/submitForm.js +0 -13
- package/dist/src/react/submitForm.js.map +0 -1
- package/dist/src/react/url.js +0 -60
- package/dist/src/react/url.js.map +0 -1
- package/dist/src/react/url.test.js +0 -88
- package/dist/src/react/url.test.js.map +0 -1
- package/dist/src/react/useFatZebra.js +0 -119
- package/dist/src/react/useFatZebra.js.map +0 -1
- package/dist/src/sca/cardinal.js +0 -110
- package/dist/src/sca/cardinal.js.map +0 -1
- package/dist/src/sca/eci-mappings.js +0 -63
- package/dist/src/sca/eci-mappings.js.map +0 -1
- package/dist/src/sca/eci-mappings.test.js +0 -31
- package/dist/src/sca/eci-mappings.test.js.map +0 -1
- package/dist/src/sca/index.js +0 -363
- package/dist/src/sca/index.js.map +0 -1
- package/dist/src/sca/index.test.js +0 -620
- package/dist/src/sca/index.test.js.map +0 -1
- package/dist/src/sca/scenarios/enrollment.js +0 -161
- package/dist/src/sca/scenarios/enrollment.js.map +0 -1
- package/dist/src/sca/scenarios/index.js +0 -8
- package/dist/src/sca/scenarios/index.js.map +0 -1
- package/dist/src/sca/scenarios/validation.js +0 -139
- package/dist/src/sca/scenarios/validation.js.map +0 -1
- package/dist/src/sca/types.js +0 -57
- package/dist/src/sca/types.js.map +0 -1
- package/dist/src/shared/api-gateway-client.js +0 -184
- package/dist/src/shared/api-gateway-client.js.map +0 -1
- package/dist/src/shared/bridge-client.js +0 -24
- package/dist/src/shared/bridge-client.js.map +0 -1
- package/dist/src/shared/constants.js +0 -19
- package/dist/src/shared/constants.js.map +0 -1
- package/dist/src/shared/env.development.js +0 -12
- package/dist/src/shared/env.development.js.map +0 -1
- package/dist/src/shared/env.js +0 -46
- package/dist/src/shared/env.js.map +0 -1
- package/dist/src/shared/envs/local.js +0 -12
- package/dist/src/shared/envs/local.js.map +0 -1
- package/dist/src/shared/envs/production.js +0 -12
- package/dist/src/shared/envs/production.js.map +0 -1
- package/dist/src/shared/envs/sandbox.js +0 -12
- package/dist/src/shared/envs/sandbox.js.map +0 -1
- package/dist/src/shared/envs/staging.js +0 -12
- package/dist/src/shared/envs/staging.js.map +0 -1
- package/dist/src/shared/event-manager.js +0 -14
- package/dist/src/shared/event-manager.js.map +0 -1
- package/dist/src/shared/post-message-client.js +0 -107
- package/dist/src/shared/post-message-client.js.map +0 -1
- package/dist/src/shared/post-message-client.test.js +0 -58
- package/dist/src/shared/post-message-client.test.js.map +0 -1
- package/dist/src/shared/types.js +0 -47
- package/dist/src/shared/types.js.map +0 -1
- package/dist/src/shared/types.test.js +0 -55
- package/dist/src/shared/types.test.js.map +0 -1
- package/dist/src/shared/util.js +0 -96
- package/dist/src/shared/util.js.map +0 -1
- package/dist/src/shared/util.test.js +0 -148
- package/dist/src/shared/util.test.js.map +0 -1
- package/dist/src/validation/index.js +0 -12
- package/dist/src/validation/index.js.map +0 -1
- package/dist/src/validation/schemas/click-to-pay/load-params.json +0 -34
- package/dist/src/validation/schemas/click-to-pay/options.json +0 -23
- package/dist/src/validation/schemas/click-to-pay/payment-intent.json +0 -42
- package/dist/src/validation/schemas/customer.json +0 -38
- package/dist/src/validation/schemas/hpp-load-params.json +0 -40
- package/dist/src/validation/schemas/hpp-options.json +0 -48
- package/dist/src/validation/schemas/payment-intent.json +0 -48
- package/dist/src/validation/schemas/payment-method.json +0 -83
- package/dist/src/validation/schemas/verify-card-options.json +0 -15
- package/dist/src/validation/schemas/verify-card-params.json +0 -24
- package/dist/src/validation/validation-helper.js +0 -10
- package/dist/src/validation/validation-helper.js.map +0 -1
- package/dist/src/validation/validation-helper.test.js +0 -34
- package/dist/src/validation/validation-helper.test.js.map +0 -1
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js +0 -19
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js.map +0 -1
- package/dist/src/validation/validators/hpp-load-params-validator.js +0 -21
- package/dist/src/validation/validators/hpp-load-params-validator.js.map +0 -1
- package/dist/src/validation/validators/hpp-load-params-validator.test.js +0 -56
- package/dist/src/validation/validators/hpp-load-params-validator.test.js.map +0 -1
- package/dist/src/validation/validators/verify-card-params-validator.js +0 -23
- package/dist/src/validation/validators/verify-card-params-validator.js.map +0 -1
- package/dist/tests/helpers/api-gateway-mock.js +0 -37
- package/dist/tests/helpers/api-gateway-mock.js.map +0 -1
- /package/dist/react/{url.d.ts → paymentUrl.d.ts} +0 -0
- /package/dist/react/{url.js → paymentUrl.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/fatzebra-js.iml" filepath="$PROJECT_DIR$/.idea/fatzebra-js.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
v1.2.1
|
|
4
|
+
* PAY-1731: Provide merchant username in API request headers.
|
|
5
|
+
|
|
6
|
+
v1.2.0
|
|
7
|
+
* FEAT-43: Emit HPP form validation error messages via events
|
|
8
|
+
|
|
9
|
+
v1.1.5
|
|
10
|
+
* PAY-1710: Update README and include jwt generation script
|
|
11
|
+
|
|
12
|
+
v1.1.4 (Rolled back. Scheduled for later release.)
|
|
13
|
+
* PAY-1568: Conditionally require customer object depending on enableSca
|
package/README.dev.md
CHANGED
|
@@ -109,19 +109,6 @@ Visit https://fzapplepay.ngrok.io in Safari. That's all!
|
|
|
109
109
|
|
|
110
110
|
Webpack-dev-server supports hot reloading, meaning that code changes are reflected on the web page without restarting the server.
|
|
111
111
|
|
|
112
|
-
## PayPal
|
|
113
|
-
|
|
114
|
-
You can build & run for PayPal integration using:
|
|
115
|
-
```bash
|
|
116
|
-
npm run start:dev:paypal
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
You can also change the order request in:
|
|
120
|
-
```bash
|
|
121
|
-
# Change the `data` argument in the `paymentMethod` field
|
|
122
|
-
examples/paypal/merchant.ejs
|
|
123
|
-
```
|
|
124
|
-
|
|
125
112
|
## Build Javascript
|
|
126
113
|
|
|
127
114
|
There are two npm build scripts in `package.json` for building javascript files.
|
|
@@ -159,4 +146,4 @@ The release of the sdk follows a weekly schedule. In the beginning of a new rele
|
|
|
159
146
|
10. Prepare a new git tag for the new release version `git tag -a vX.X.X`.
|
|
160
147
|
11. Push git tag. `git push origin vX.X.X`.
|
|
161
148
|
|
|
162
|
-
Upon successful CI , a new entry with title 'Merged in release/vX.X,X' will be visible in the master branch page. This provides us with a clear view of what gets released in the past. Moreoever, we can quickly find out the list of features/bug fixes in a release by referring to the PR of the release candidate.
|
|
149
|
+
Upon successful CI , a new entry with title 'Merged in release/vX.X,X' will be visible in the master branch page. This provides us with a clear view of what gets released in the past. Moreoever, we can quickly find out the list of features/bug fixes in a release by referring to the PR of the release candidate.
|
package/build-styles.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
// Define the source file and the destination folder
|
|
5
|
+
const sourceFile = path.join(__dirname, './src/styles.css');
|
|
6
|
+
const destinationFolder = path.join(__dirname, 'dist/' + process.env.ENVIRONMENT);
|
|
7
|
+
const destinationFile = path.join(destinationFolder, 'fatzebra.css');
|
|
8
|
+
|
|
9
|
+
// Copy the file
|
|
10
|
+
fs.copyFileSync(sourceFile, destinationFile);
|
|
11
|
+
|
|
12
|
+
console.log('File copied successfully!');
|
|
@@ -14,7 +14,6 @@ declare class ClickToPay {
|
|
|
14
14
|
private iframe;
|
|
15
15
|
private paymentIntent;
|
|
16
16
|
private username;
|
|
17
|
-
private cardToken;
|
|
18
17
|
private postMessageClient;
|
|
19
18
|
private test;
|
|
20
19
|
private options;
|
|
@@ -23,6 +22,7 @@ declare class ClickToPay {
|
|
|
23
22
|
getPayNowUrl(options?: {
|
|
24
23
|
[key: string]: boolean | string;
|
|
25
24
|
}): string;
|
|
25
|
+
setCrossFramesEventListeners(): void;
|
|
26
26
|
purchase(): void;
|
|
27
27
|
}
|
|
28
28
|
export default ClickToPay;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PostMessageClient } from "../shared/post-message-client";
|
|
2
|
+
import { BridgeEvent, PublicEvent } from "../shared/types";
|
|
2
3
|
import * as util from '../shared/util';
|
|
4
|
+
import { emit } from "../shared/event-manager";
|
|
3
5
|
const CLICK_TO_PAY_DEFAULT_OPTIONS = {
|
|
4
6
|
iframe: true,
|
|
7
|
+
postmessage: true,
|
|
5
8
|
};
|
|
6
9
|
class ClickToPay {
|
|
7
10
|
constructor(config) {
|
|
8
11
|
this.paymentIntent = config.paymentIntent;
|
|
9
12
|
this.username = config.username;
|
|
10
13
|
this.test = config.test;
|
|
14
|
+
this.postMessageClient = new PostMessageClient({
|
|
15
|
+
channel: 'click_to_pay',
|
|
16
|
+
target: this.iframe
|
|
17
|
+
});
|
|
11
18
|
}
|
|
12
19
|
load(config) {
|
|
13
20
|
this.options = config.options;
|
|
@@ -15,6 +22,9 @@ class ClickToPay {
|
|
|
15
22
|
document.getElementById(config.containerId).appendChild(this.iframe);
|
|
16
23
|
const payNowUrl = this.getPayNowUrl(config.options);
|
|
17
24
|
this.iframe.setAttribute("src", payNowUrl);
|
|
25
|
+
this.iframe.onload = () => {
|
|
26
|
+
this.setCrossFramesEventListeners();
|
|
27
|
+
};
|
|
18
28
|
}
|
|
19
29
|
getPayNowUrl(options) {
|
|
20
30
|
const { payment } = this.paymentIntent;
|
|
@@ -38,6 +48,40 @@ class ClickToPay {
|
|
|
38
48
|
let searchParams = new URLSearchParams(queryString);
|
|
39
49
|
return queryString ? `${base}?${searchParams.toString()}` : `${base}`;
|
|
40
50
|
}
|
|
51
|
+
setCrossFramesEventListeners() {
|
|
52
|
+
const handlers = {};
|
|
53
|
+
handlers[BridgeEvent.TOKENIZE_CARD_RESPONSE] = (data) => {
|
|
54
|
+
console.log(data);
|
|
55
|
+
if (data.errors) {
|
|
56
|
+
emit(PublicEvent.TOKENIZATION_ERROR, {
|
|
57
|
+
message: 'Card tokenization failed.',
|
|
58
|
+
errors: data.errors,
|
|
59
|
+
data: null,
|
|
60
|
+
});
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
emit(PublicEvent.TOKENIZATION_SUCCESS, {
|
|
65
|
+
message: 'Card tokenization success.',
|
|
66
|
+
data
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
handlers[PublicEvent.CLICK_TO_PAY_TOKENIZATION_ERROR] = (data) => {
|
|
71
|
+
emit(PublicEvent.CLICK_TO_PAY_TOKENIZATION_ERROR, {
|
|
72
|
+
message: 'Card tokenization failed.',
|
|
73
|
+
errors: data.errors,
|
|
74
|
+
data: null,
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
handlers[PublicEvent.CLICK_TO_PAY_TOKENIZATION_SUCCESS] = (data) => {
|
|
78
|
+
emit(PublicEvent.CLICK_TO_PAY_TOKENIZATION_SUCCESS, {
|
|
79
|
+
message: 'Card tokenization success.',
|
|
80
|
+
data
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
this.postMessageClient.setEventListeners(handlers);
|
|
84
|
+
}
|
|
41
85
|
purchase() {
|
|
42
86
|
const message = {
|
|
43
87
|
channel: 'click_to_pay',
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.checkout-button-wrapper {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
height: 200px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.iframe-checkout {
|
|
9
|
+
flex: 1;
|
|
10
|
+
border: none;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
min-height: 0;
|
|
14
|
+
overflow: auto;
|
|
15
|
+
-webkit-overflow-scrolling: touch;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.iframe-foreground,
|
|
19
|
+
.iframe-background {
|
|
20
|
+
top: 0;
|
|
21
|
+
left: 0;
|
|
22
|
+
right: 0;
|
|
23
|
+
bottom: 0;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.iframe-foreground,
|
|
28
|
+
.iframe-background {
|
|
29
|
+
position: fixed;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.iframe-foreground {
|
|
33
|
+
z-index: -1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.iframe-background {
|
|
37
|
+
background: rgba(0, 0, 0, 0.5);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.iframe-foreground {
|
|
41
|
+
flex-grow: 1;
|
|
42
|
+
top: auto;
|
|
43
|
+
width: 100%;
|
|
44
|
+
max-width: 480px;
|
|
45
|
+
height: 80vh;
|
|
46
|
+
background-color: #ffffff;
|
|
47
|
+
border-radius: 25px 25px 0 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.slide-in .iframe-foreground {
|
|
51
|
+
transform: translateY(100vh);
|
|
52
|
+
transition: transform 0.4s ease, z-index 0.3s ease 0.4s;
|
|
53
|
+
z-index: -1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.slide-in .iframe-background {
|
|
57
|
+
opacity: 0;
|
|
58
|
+
z-index: -1;
|
|
59
|
+
transition: opacity 0.3s ease, z-index 0.3s ease 0.3s;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.slide-in.show .iframe-foreground {
|
|
63
|
+
transform: none;
|
|
64
|
+
transition: transform 0.4s ease;
|
|
65
|
+
z-index: 100;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.slide-in.show .iframe-background {
|
|
69
|
+
opacity: 1;
|
|
70
|
+
z-index: 0;
|
|
71
|
+
transition: opacity 0.3s ease;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media only screen and (min-width: 480px) {
|
|
75
|
+
.iframe-foreground {
|
|
76
|
+
margin: 0 auto;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@media only screen and (min-width: 768px) {
|
|
81
|
+
.iframe-foreground {
|
|
82
|
+
margin: 0;
|
|
83
|
+
width: 400px;
|
|
84
|
+
height: 100vh;
|
|
85
|
+
left: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.slide-in .iframe-foreground {
|
|
89
|
+
transform: translateX(-400px);
|
|
90
|
+
}
|
|
91
|
+
}
|