@fat-zebra/sdk 1.0.6 → 1.2.2
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/CHANGELOG.md +13 -0
- package/README.md +162 -0
- package/dist/applepay/applepay.d.ts +20 -0
- package/dist/applepay/applepay.js +93 -0
- package/dist/applepay/clients/apple-pay-client.d.ts +24 -0
- package/dist/applepay/clients/apple-pay-client.js +29 -0
- package/dist/applepay/clients/paynow-client.d.ts +17 -0
- package/dist/applepay/clients/paynow-client.js +55 -0
- package/dist/applepay/index.d.ts +1 -0
- package/dist/applepay/index.js +1 -0
- package/dist/hpp/hpp.d.ts +61 -0
- package/dist/hpp/hpp.js +186 -0
- package/dist/hpp/index.d.ts +2 -0
- package/dist/hpp/index.js +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +7 -1
- package/dist/main.d.ts +38 -0
- package/dist/main.js +148 -0
- package/dist/paypal/paypal-button.d.ts +31 -0
- package/dist/paypal/paypal-button.js +199 -0
- package/dist/paypal/paypal-checkout.d.ts +21 -0
- package/dist/paypal/paypal-checkout.js +100 -0
- package/dist/paypal/types.d.ts +188 -0
- package/dist/paypal/types.js +5 -0
- package/dist/paypal/validation.d.ts +4 -0
- package/dist/paypal/validation.js +65 -0
- package/dist/react/VerifyCard.d.ts +2 -4
- package/dist/react/VerifyCard.js +1 -2
- package/dist/react/url.d.ts +2 -11
- package/dist/react/useFatZebra.d.ts +2 -3
- package/dist/react/useFatZebra.js +7 -7
- package/dist/sca/cardinal.d.ts +1 -1
- package/dist/sca/cardinal.js +1 -1
- package/dist/sca/index.d.ts +8 -5
- package/dist/sca/index.js +26 -87
- package/dist/sca/scenarios/index.d.ts +3 -2
- package/dist/sca/types.d.ts +1 -1
- package/dist/sca/types.js +1 -1
- package/dist/shared/api-gateway-client.d.ts +7 -0
- package/dist/shared/api-gateway-client.js +37 -3
- package/dist/shared/env.d.ts +1 -1
- package/dist/shared/env.development.d.ts +5 -0
- package/dist/shared/env.development.js +5 -0
- package/dist/shared/env.js +1 -1
- package/dist/shared/event-manager.d.ts +1 -1
- package/dist/shared/event-manager.js +0 -1
- package/dist/shared/post-message-client.d.ts +1 -1
- package/dist/shared/post-message-client.js +2 -3
- package/dist/shared/types.d.ts +40 -33
- package/dist/shared/types.js +7 -1
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +3 -0
- package/dist/validation/schemas/customer.json +38 -0
- package/dist/validation/schemas/hpp-load-params.json +40 -0
- package/dist/validation/schemas/hpp-options.json +48 -0
- package/dist/validation/schemas/payment-intent.json +48 -0
- package/dist/validation/schemas/payment-method.json +83 -0
- package/dist/validation/schemas/verify-card-options.json +15 -0
- package/dist/validation/schemas/verify-card-params.json +24 -0
- package/dist/validation/validation-helper.d.ts +3 -0
- package/dist/validation/validation-helper.js +6 -0
- package/dist/validation/validators/hpp-load-params-validator.d.ts +3 -0
- package/dist/validation/validators/hpp-load-params-validator.js +14 -0
- package/dist/validation/validators/verify-card-params-validator.d.ts +3 -0
- package/dist/validation/validators/verify-card-params-validator.js +16 -0
- package/docker-compose.yml +16 -0
- package/package.json +44 -15
- package/tsconfig.json +8 -18
- package/tsconfig.package.json +25 -0
- package/index.js +0 -0
- package/jest.config.js +0 -16
- package/yarn-error.log +0 -2374
|
@@ -7,10 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { RequestHeaderSdkVersion, RequestHeaderMerchantUsername, RequestTimeout, } from "./constants";
|
|
10
|
+
import { RequestHeaderSdkVersion, RequestHeaderMerchantUsername, RequestTimeout, LongRequestTimeout, } from "./constants";
|
|
11
11
|
import axios from "axios";
|
|
12
12
|
import { getSdkVersionNumber } from "./util";
|
|
13
|
-
|
|
13
|
+
const baseUrl = process.env.API_GATEWAY_URL;
|
|
14
14
|
class GatewayClient {
|
|
15
15
|
constructor({ accessToken, username }) {
|
|
16
16
|
const headers = {};
|
|
@@ -18,7 +18,7 @@ class GatewayClient {
|
|
|
18
18
|
headers[RequestHeaderSdkVersion] = getSdkVersionNumber();
|
|
19
19
|
headers[RequestHeaderMerchantUsername] = username;
|
|
20
20
|
this.client = axios.create({
|
|
21
|
-
baseURL:
|
|
21
|
+
baseURL: baseUrl,
|
|
22
22
|
timeout: RequestTimeout,
|
|
23
23
|
headers,
|
|
24
24
|
responseType: "json",
|
|
@@ -57,5 +57,39 @@ class GatewayClient {
|
|
|
57
57
|
return this.client.get(`/credit_cards/${data.card_token}`);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
+
/**************** PayPal /****************/
|
|
61
|
+
createPayPalOrder(data) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return this.client.post("/paypal/orders", data, {
|
|
64
|
+
timeout: LongRequestTimeout,
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
capturePayPalOrder(data) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
return this.client.post(`/paypal/orders/${data.id}/capture`, null, {
|
|
71
|
+
timeout: LongRequestTimeout,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
authorizePayPalOrder(data) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
return this.client.post(`/paypal/orders/${data.id}/authorize`, null, {
|
|
78
|
+
timeout: LongRequestTimeout,
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
createPayPalBillingAgreement(data) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
return this.client.post("/paypal/billing_agreements", data, {
|
|
85
|
+
timeout: LongRequestTimeout,
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
approvePayPalBillingAgreement(data) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
return this.client.post(`/paypal/billing_agreements/${data.id}/approve`, null, { timeout: LongRequestTimeout });
|
|
92
|
+
});
|
|
93
|
+
}
|
|
60
94
|
}
|
|
61
95
|
export default GatewayClient;
|
package/dist/shared/env.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const bridgeUrl = "http://paynow.test";
|
|
2
2
|
declare const apiUrl = "http://api.test:3002/sdk";
|
|
3
|
-
declare const payNowUrl = "http://paynow.test";
|
|
3
|
+
declare const payNowUrl = "http://paynow.test:3004";
|
|
4
4
|
declare const songbirdUrl = "https://songbirdstag.cardinalcommerce.com/edge/v1/songbird.js";
|
|
5
5
|
export { bridgeUrl, apiUrl, payNowUrl, songbirdUrl };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const bridgeUrl = "http://paynow.test";
|
|
2
|
+
declare const apiUrl = "http://api.test:3002/sdk";
|
|
3
|
+
declare const payNowUrl = "http://paynow.test:3004";
|
|
4
|
+
declare const songbirdUrl = "https://songbirdstag.cardinalcommerce.com/edge/v1/songbird.js";
|
|
5
|
+
export { bridgeUrl, apiUrl, payNowUrl, songbirdUrl };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const bridgeUrl = "http://paynow.test";
|
|
2
|
+
const apiUrl = "http://api.test:3002/sdk";
|
|
3
|
+
const payNowUrl = "http://paynow.test:3004";
|
|
4
|
+
const songbirdUrl = "https://songbirdstag.cardinalcommerce.com/edge/v1/songbird.js";
|
|
5
|
+
export { bridgeUrl, apiUrl, payNowUrl, songbirdUrl };
|
package/dist/shared/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const bridgeUrl = "http://paynow.test";
|
|
2
2
|
const apiUrl = "http://api.test:3002/sdk";
|
|
3
|
-
const payNowUrl = "http://paynow.test";
|
|
3
|
+
const payNowUrl = "http://paynow.test:3004";
|
|
4
4
|
const songbirdUrl = "https://songbirdstag.cardinalcommerce.com/edge/v1/songbird.js";
|
|
5
5
|
export { bridgeUrl, apiUrl, payNowUrl, songbirdUrl };
|
|
@@ -26,4 +26,4 @@ interface ErrorEventDetail {
|
|
|
26
26
|
declare const emit: (event: PublicEvent, data: SuccessEventDetail | ErrorEventDetail, target?: HTMLElement | Window) => void;
|
|
27
27
|
declare const on: (event: PublicEvent, callback: (e: any) => void, target?: HTMLElement | Window) => void;
|
|
28
28
|
export { emit, on };
|
|
29
|
-
export type { EventData };
|
|
29
|
+
export type { EventData, SuccessEventDetail, ErrorEventDetail };
|
|
@@ -44,5 +44,5 @@ declare class PostMessageClient {
|
|
|
44
44
|
setEventListenersLegacy(handlers: EventHandlers): void;
|
|
45
45
|
send(message: PostMessage | PostMessageLegacy): void;
|
|
46
46
|
}
|
|
47
|
-
export { PostMessageClient };
|
|
47
|
+
export { PostMessageClient, };
|
|
48
48
|
export type { CreateCardTokenPostMessageData, CreatePurchasePostMessageData, PostMessage, PostMessageLegacy, PostMessageClientConfig };
|
|
@@ -8,8 +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
|
-
|
|
12
|
-
const domain = env.payNowUrl;
|
|
11
|
+
const domain = process.env.PAYNOW_BASE_URL;
|
|
13
12
|
// NODE_ENV is introduced to PostMessageClient purely for the purpose of bypassing security
|
|
14
13
|
// check on the postMessage event between parent and child frames. Unforunately there is
|
|
15
14
|
// no workaround to override event origin due to lack of support in existing test framework.
|
|
@@ -67,4 +66,4 @@ class PostMessageClient {
|
|
|
67
66
|
this.target.contentWindow.postMessage(message, domain);
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
|
-
export { PostMessageClient };
|
|
69
|
+
export { PostMessageClient, };
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PayPalPaymentMethod } from '../paypal/types';
|
|
1
2
|
declare enum NODE_ENV {
|
|
2
3
|
LOCALDEV = "localdev",
|
|
3
4
|
PRODUCTION = "production",
|
|
@@ -15,6 +16,10 @@ declare enum PublicEvent {
|
|
|
15
16
|
TOKENIZATION_ERROR = "fz.tokenization.error",
|
|
16
17
|
PAYMENT_SUCCESS = "fz.payment.success",
|
|
17
18
|
PAYMENT_ERROR = "fz.payment.error",
|
|
19
|
+
PAYPAL_CANCEL = "fz.paypal.cancel",
|
|
20
|
+
PAYPAL_SUCCESS = "fz.paypal.success",
|
|
21
|
+
PAYPAL_ERROR = "fz.paypal.error",
|
|
22
|
+
PAYPAL_PROCESSESING = "fz.paypal.processing",
|
|
18
23
|
BIN_LOOKUP = "fz.bin.lookup"
|
|
19
24
|
}
|
|
20
25
|
declare enum BridgeEvent {
|
|
@@ -29,7 +34,9 @@ declare enum BridgeEvent {
|
|
|
29
34
|
}
|
|
30
35
|
declare enum PaymentMethodType {
|
|
31
36
|
CARD = "card",
|
|
32
|
-
CARD_ON_FILE = "card_on_file"
|
|
37
|
+
CARD_ON_FILE = "card_on_file",
|
|
38
|
+
PAYPAL_ORDER = "paypal_order",
|
|
39
|
+
PAYPAL_BILLING = "paypal_billing"
|
|
33
40
|
}
|
|
34
41
|
interface Card {
|
|
35
42
|
number: string;
|
|
@@ -65,7 +72,7 @@ interface Payment {
|
|
|
65
72
|
amount: number;
|
|
66
73
|
currency: string;
|
|
67
74
|
reference: string;
|
|
68
|
-
hide_card_holder
|
|
75
|
+
hide_card_holder: boolean;
|
|
69
76
|
}
|
|
70
77
|
interface PaymentIntent {
|
|
71
78
|
payment: Payment;
|
|
@@ -73,36 +80,40 @@ interface PaymentIntent {
|
|
|
73
80
|
}
|
|
74
81
|
interface PaymentMethod {
|
|
75
82
|
type?: PaymentMethodType;
|
|
76
|
-
data: Card | CardOnFile;
|
|
83
|
+
data: Card | CardOnFile | PayPalPaymentMethod;
|
|
77
84
|
}
|
|
78
85
|
interface ValidationResult {
|
|
79
86
|
valid: boolean;
|
|
80
87
|
errors: string[];
|
|
81
88
|
}
|
|
82
|
-
type TokenizeCardResponse = {
|
|
83
|
-
bin: string;
|
|
84
|
-
token: string;
|
|
85
|
-
errors?: Array<string>;
|
|
86
|
-
};
|
|
87
89
|
type Callback = (event: any) => void;
|
|
88
|
-
type Handlers = Partial<Record<PublicEvent, Callback>>;
|
|
89
|
-
export type
|
|
90
|
+
type Handlers = Partial<Record<PublicEvent, Callback | null>>;
|
|
91
|
+
export type PaymentConfig = {
|
|
92
|
+
username: string;
|
|
90
93
|
accessToken: string;
|
|
91
94
|
paymentIntent: PaymentIntent;
|
|
92
|
-
|
|
93
|
-
options?: Options;
|
|
95
|
+
options: OptionalUrlValues;
|
|
94
96
|
};
|
|
95
|
-
export type
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
export type OptionalUrlValues = {
|
|
98
|
+
hide_card_holder?: string;
|
|
99
|
+
return_path?: string;
|
|
100
|
+
card_types?: Array<string>;
|
|
101
|
+
surcharge_enabled?: string;
|
|
102
|
+
sca_enabled?: boolean;
|
|
103
|
+
css?: string;
|
|
104
|
+
css_signature?: string;
|
|
105
|
+
tokenize_only?: boolean;
|
|
99
106
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
declare global {
|
|
108
|
+
interface Window {
|
|
109
|
+
ApplePaySession: any;
|
|
110
|
+
Cardinal: any;
|
|
111
|
+
FatZebra: any;
|
|
112
|
+
paypal: any;
|
|
113
|
+
HPP: any;
|
|
114
|
+
MerchantUsername: string;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
106
117
|
export type TransactionPayload = {
|
|
107
118
|
transactionId: string;
|
|
108
119
|
responseCode: string;
|
|
@@ -130,14 +141,10 @@ export type CreatePaymentResponse = {
|
|
|
130
141
|
v: TransactionPayload["verification"];
|
|
131
142
|
errors?: Array<string>;
|
|
132
143
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
export { BridgeEvent, PublicEvent, NODE_ENV, PaymentMethodType };
|
|
143
|
-
export type { Card, CardOnFile, Customer, CustomerSnakeCase, Handlers, Payment, PaymentIntent, PaymentMethod, TokenizeCardResponse, ValidationResult };
|
|
144
|
+
type TokenizeCardResponse = {
|
|
145
|
+
bin: string;
|
|
146
|
+
token: string;
|
|
147
|
+
errors?: Array<string>;
|
|
148
|
+
};
|
|
149
|
+
export { BridgeEvent, PublicEvent, NODE_ENV, PaymentMethodType, };
|
|
150
|
+
export type { PaymentMethod, PaymentIntent, Payment, Card, CardOnFile, CustomerSnakeCase, Customer, Handlers, ValidationResult, TokenizeCardResponse, };
|
package/dist/shared/types.js
CHANGED
|
@@ -17,6 +17,10 @@ var PublicEvent;
|
|
|
17
17
|
PublicEvent["TOKENIZATION_ERROR"] = "fz.tokenization.error";
|
|
18
18
|
PublicEvent["PAYMENT_SUCCESS"] = "fz.payment.success";
|
|
19
19
|
PublicEvent["PAYMENT_ERROR"] = "fz.payment.error";
|
|
20
|
+
PublicEvent["PAYPAL_CANCEL"] = "fz.paypal.cancel";
|
|
21
|
+
PublicEvent["PAYPAL_SUCCESS"] = "fz.paypal.success";
|
|
22
|
+
PublicEvent["PAYPAL_ERROR"] = "fz.paypal.error";
|
|
23
|
+
PublicEvent["PAYPAL_PROCESSESING"] = "fz.paypal.processing";
|
|
20
24
|
PublicEvent["BIN_LOOKUP"] = "fz.bin.lookup";
|
|
21
25
|
})(PublicEvent || (PublicEvent = {}));
|
|
22
26
|
var BridgeEvent;
|
|
@@ -34,5 +38,7 @@ var PaymentMethodType;
|
|
|
34
38
|
(function (PaymentMethodType) {
|
|
35
39
|
PaymentMethodType["CARD"] = "card";
|
|
36
40
|
PaymentMethodType["CARD_ON_FILE"] = "card_on_file";
|
|
41
|
+
PaymentMethodType["PAYPAL_ORDER"] = "paypal_order";
|
|
42
|
+
PaymentMethodType["PAYPAL_BILLING"] = "paypal_billing";
|
|
37
43
|
})(PaymentMethodType || (PaymentMethodType = {}));
|
|
38
|
-
export { BridgeEvent, PublicEvent, NODE_ENV, PaymentMethodType };
|
|
44
|
+
export { BridgeEvent, PublicEvent, NODE_ENV, PaymentMethodType, };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://www.fatzebra.com/schemas/customer.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"Customer": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"firstName": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"lastName": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"email": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"format": "email"
|
|
18
|
+
},
|
|
19
|
+
"address": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"city": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"postcode": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"state": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"country": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": []
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://www.fatzebra.com/schemas/hpp-load-params.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"required": [
|
|
6
|
+
"containerId",
|
|
7
|
+
"paymentIntent"
|
|
8
|
+
],
|
|
9
|
+
"properties": {
|
|
10
|
+
"version": {
|
|
11
|
+
"type": "number"
|
|
12
|
+
},
|
|
13
|
+
"containerId": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"customer": {
|
|
17
|
+
"$ref": "customer.json#/definitions/Customer"
|
|
18
|
+
},
|
|
19
|
+
"paymentIntent": {
|
|
20
|
+
"$ref": "payment-intent.json#/definitions/PaymentIntent"
|
|
21
|
+
},
|
|
22
|
+
"options": {
|
|
23
|
+
"$ref": "hpp-options.json#/definitions/HppOptions"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"if": {
|
|
27
|
+
"properties": {
|
|
28
|
+
"options": {
|
|
29
|
+
"propertes": {
|
|
30
|
+
"tokenizeOnly": {
|
|
31
|
+
"boolean": true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"else": {
|
|
38
|
+
"required": []
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://www.fatzebra.com/schemas/hpp-options.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"HppOptions": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"buttonText": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"cards": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
},
|
|
14
|
+
"challengeWindowSize": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"enum": ["01", "02", "03", "04", "05"]
|
|
17
|
+
},
|
|
18
|
+
"css": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"cssSignature": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"enableSca": {
|
|
25
|
+
"type": "boolean"
|
|
26
|
+
},
|
|
27
|
+
"hideButton": {
|
|
28
|
+
"type": "boolean"
|
|
29
|
+
},
|
|
30
|
+
"hideLogos": {
|
|
31
|
+
"type": "boolean"
|
|
32
|
+
},
|
|
33
|
+
"logoUrl": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"showEmail": {
|
|
37
|
+
"type": "boolean"
|
|
38
|
+
},
|
|
39
|
+
"showExtras": {
|
|
40
|
+
"type": "boolean"
|
|
41
|
+
},
|
|
42
|
+
"tokenizeOnly": {
|
|
43
|
+
"type": "boolean"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://www.fatzebra.com/schemas/payment-intent.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"definitions": {
|
|
6
|
+
"PaymentIntent": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"payment": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"additionalProperties": false,
|
|
13
|
+
"required": [
|
|
14
|
+
"amount",
|
|
15
|
+
"currency",
|
|
16
|
+
"reference"
|
|
17
|
+
],
|
|
18
|
+
"optional": [
|
|
19
|
+
"hide_card_holder"
|
|
20
|
+
],
|
|
21
|
+
"properties": {
|
|
22
|
+
"amount": {
|
|
23
|
+
"type": "integer",
|
|
24
|
+
"minimum": 1
|
|
25
|
+
},
|
|
26
|
+
"currency": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"reference": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
},
|
|
32
|
+
"hide_card_holder": {
|
|
33
|
+
"type": "boolean"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"verification": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 5
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"required": [
|
|
43
|
+
"payment",
|
|
44
|
+
"verification"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://www.fatzebra.com/schemas/payment-method.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"PaymentMethod": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"oneOff": [{
|
|
8
|
+
"properties": {
|
|
9
|
+
"type:": {
|
|
10
|
+
"const": "card"
|
|
11
|
+
},
|
|
12
|
+
"data": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"number": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"holder": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"expiryMonth": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"enum": [
|
|
24
|
+
"01",
|
|
25
|
+
"02",
|
|
26
|
+
"03",
|
|
27
|
+
"04",
|
|
28
|
+
"05",
|
|
29
|
+
"06",
|
|
30
|
+
"07",
|
|
31
|
+
"08",
|
|
32
|
+
"09",
|
|
33
|
+
"10",
|
|
34
|
+
"11",
|
|
35
|
+
"12"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"expiryYear": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"maxLength": 4
|
|
41
|
+
},
|
|
42
|
+
"cvv": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": [
|
|
47
|
+
"number",
|
|
48
|
+
"holder",
|
|
49
|
+
"expiryMonth",
|
|
50
|
+
"expiryYear",
|
|
51
|
+
"cvv"
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"required": [
|
|
56
|
+
"type",
|
|
57
|
+
"data"
|
|
58
|
+
]
|
|
59
|
+
}, {
|
|
60
|
+
"properties": {
|
|
61
|
+
"type:": {
|
|
62
|
+
"const": "card_on_file"
|
|
63
|
+
},
|
|
64
|
+
"data": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"properties": {
|
|
67
|
+
"token": {
|
|
68
|
+
"type": "string"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": [
|
|
72
|
+
"token"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"required": [
|
|
77
|
+
"type",
|
|
78
|
+
"data"
|
|
79
|
+
]
|
|
80
|
+
}]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://www.fatzebra.com/schemas/verify-card-options.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"VerifyCardOptions": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"challengeWindowSize": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["01", "02", "03", "04", "05"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "https://www.fatzebra.com/schemas/hpp-load-params.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"required": [
|
|
6
|
+
"customer",
|
|
7
|
+
"paymentIntent",
|
|
8
|
+
"paymentMethod"
|
|
9
|
+
],
|
|
10
|
+
"properties": {
|
|
11
|
+
"customer": {
|
|
12
|
+
"$ref": "customer.json#/definitions/Customer"
|
|
13
|
+
},
|
|
14
|
+
"paymentIntent": {
|
|
15
|
+
"$ref": "payment-intent.json#/definitions/PaymentIntent"
|
|
16
|
+
},
|
|
17
|
+
"paymentMethod": {
|
|
18
|
+
"$ref": "payment-method.json#/definitions/PaymentMethod"
|
|
19
|
+
},
|
|
20
|
+
"options": {
|
|
21
|
+
"$ref": "verify-card-options.json#/definitions/VerifyCardOptions"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
|
+
import customerSchema from '../schemas/customer.json';
|
|
3
|
+
import paymentIntentSchema from '../schemas/payment-intent.json';
|
|
4
|
+
import hppOptionsSchema from '../schemas/hpp-options.json';
|
|
5
|
+
import hppLoadParamsSchema from '../schemas/hpp-load-params.json';
|
|
6
|
+
const validator = new Ajv({
|
|
7
|
+
allErrors: true,
|
|
8
|
+
jsonPointers: true,
|
|
9
|
+
})
|
|
10
|
+
.addSchema(customerSchema)
|
|
11
|
+
.addSchema(paymentIntentSchema)
|
|
12
|
+
.addSchema(hppOptionsSchema)
|
|
13
|
+
.compile(hppLoadParamsSchema);
|
|
14
|
+
export { validator as validateHppLoadParams };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
|
+
import customerSchema from '../schemas/customer.json';
|
|
3
|
+
import paymentIntentSchema from '../schemas/payment-intent.json';
|
|
4
|
+
import paymentMethodSchema from "../schemas/payment-method.json";
|
|
5
|
+
import verifyCardOptionsSchema from "../schemas/verify-card-options.json";
|
|
6
|
+
import verifyCardParamsSchema from "../schemas/verify-card-params.json";
|
|
7
|
+
const validator = new Ajv({
|
|
8
|
+
allErrors: true,
|
|
9
|
+
jsonPointers: true,
|
|
10
|
+
})
|
|
11
|
+
.addSchema(customerSchema)
|
|
12
|
+
.addSchema(paymentIntentSchema)
|
|
13
|
+
.addSchema(paymentMethodSchema)
|
|
14
|
+
.addSchema(verifyCardOptionsSchema)
|
|
15
|
+
.compile(verifyCardParamsSchema);
|
|
16
|
+
export { validator as validateVerifyCardParams };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# docker-compose.yaml
|
|
2
|
+
version: "3"
|
|
3
|
+
services:
|
|
4
|
+
merchant:
|
|
5
|
+
image: webpack
|
|
6
|
+
build:
|
|
7
|
+
context: .
|
|
8
|
+
ports:
|
|
9
|
+
- 8080:8080
|
|
10
|
+
- 3000:3000
|
|
11
|
+
volumes:
|
|
12
|
+
- .:/bindmount:rw
|
|
13
|
+
# The volume is effectively hiding node_modules from the host and must be in this order
|
|
14
|
+
- node_modules:/src/node_modules
|
|
15
|
+
volumes:
|
|
16
|
+
node_modules:
|