@tap-payments/apple-pay-button 0.0.2 → 0.0.3-staging
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/LICENSE +21 -21
- package/README.md +240 -194
- package/build/@types/ApplePayButtonProps.d.ts +129 -0
- package/build/@types/ApplePayButtonProps.js +1 -0
- package/build/@types/charge.d.ts +57 -0
- package/build/@types/charge.js +1 -0
- package/build/@types/checkoutProfile.d.ts +216 -0
- package/build/@types/checkoutProfile.js +1 -0
- package/build/@types/enums.d.ts +65 -0
- package/build/@types/enums.js +76 -0
- package/build/@types/index.d.ts +6 -82
- package/build/@types/index.js +6 -1
- package/build/@types/tapLocalisation.d.ts +193 -0
- package/build/@types/tapLocalisation.js +1 -0
- package/build/@types/tapTheme.d.ts +842 -0
- package/build/@types/tapTheme.js +1 -0
- package/build/api.d.ts +29 -0
- package/build/{api/app.service.js → api.js} +244 -253
- package/build/constants/index.d.ts +3 -51
- package/build/constants/index.js +3 -51
- package/build/features/ApplePayButton/ApplePayButton.d.ts +4 -6
- package/build/features/ApplePayButton/ApplePayButton.js +49 -80
- package/build/features/ApplePayButton/index.d.ts +3 -3
- package/build/features/ApplePayButton/index.js +2 -2
- package/build/hooks/index.d.ts +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/useApplePay.d.ts +93 -9
- package/build/hooks/useApplePay.js +447 -243
- package/build/hooks/useMerchantApplePay.d.ts +20 -0
- package/build/hooks/useMerchantApplePay.js +188 -0
- package/build/index.d.ts +4 -4
- package/build/index.js +13 -10
- package/build/utils/config.d.ts +14 -11
- package/build/utils/config.js +65 -72
- package/build/utils/defaultValues.d.ts +2 -0
- package/build/utils/defaultValues.js +27 -0
- package/build/utils/html.d.ts +1 -1
- package/build/utils/html.js +9 -9
- package/build/utils/index.d.ts +4 -1
- package/build/utils/index.js +4 -1
- package/build/utils/theme.d.ts +12 -0
- package/build/utils/theme.js +61 -0
- package/package.json +109 -104
- package/build/api/app.service.d.ts +0 -23
- package/build/api/base.d.ts +0 -9
- package/build/api/base.js +0 -45
- package/build/api/httpClient.d.ts +0 -8
- package/build/api/httpClient.js +0 -33
- package/build/features/ApplePayButton/ApplePayButton.css +0 -21
- package/build/hooks/useScript.d.ts +0 -1
- package/build/hooks/useScript.js +0 -39
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/api.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MerchantResponse, CheckoutProfileRequest, ChargeRequestBody, AuthorizeRequestBody } from './@types';
|
|
2
|
+
export declare const setAxiosGlobalHeaders: (headers: Record<string, string>) => void;
|
|
3
|
+
export declare const getAxiosGlobalHeaders: () => {
|
|
4
|
+
[x: string]: import("axios").AxiosHeaderValue | undefined;
|
|
5
|
+
Accept?: import("axios").AxiosHeaderValue | undefined;
|
|
6
|
+
"Content-Length"?: import("axios").AxiosHeaderValue | undefined;
|
|
7
|
+
"User-Agent"?: import("axios").AxiosHeaderValue | undefined;
|
|
8
|
+
"Content-Encoding"?: import("axios").AxiosHeaderValue | undefined;
|
|
9
|
+
Authorization?: import("axios").AxiosHeaderValue | undefined;
|
|
10
|
+
'Content-Type'?: import("axios").AxiosHeaderValue | undefined;
|
|
11
|
+
};
|
|
12
|
+
declare class APPService {
|
|
13
|
+
setHttpHeaders(headers: Record<string, string>): Promise<void>;
|
|
14
|
+
setBrowserHeaders({ locale, pk, domain }: {
|
|
15
|
+
locale: string;
|
|
16
|
+
pk: string;
|
|
17
|
+
domain: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
checkoutProfile(request: CheckoutProfileRequest): Promise<{
|
|
20
|
+
merchant: any;
|
|
21
|
+
payment_options: any;
|
|
22
|
+
}>;
|
|
23
|
+
appleSession(merchant: Pick<MerchantResponse, 'name' | 'id'>, validationURL: string, merchantRegisteredDomain: string, merchantIdentifier: string): Promise<any>;
|
|
24
|
+
tapTokenization(applePaymentData: Record<string, string>): Promise<any>;
|
|
25
|
+
createCharge(request: ChargeRequestBody): Promise<any>;
|
|
26
|
+
createAuthorize(request: AuthorizeRequestBody): Promise<any>;
|
|
27
|
+
}
|
|
28
|
+
declare const appService: APPService;
|
|
29
|
+
export default appService;
|
|
@@ -1,253 +1,244 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
})();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
function
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
case
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
return APPService;
|
|
251
|
-
}(BaseService));
|
|
252
|
-
var appService = new APPService();
|
|
253
|
-
export default appService;
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
import BrowserInfo from '@tap-payments/browser-info';
|
|
60
|
+
import { MW_BASE_URL, RSA_MW_PUBLIC_KEY } from './constants';
|
|
61
|
+
import axios from 'axios';
|
|
62
|
+
import { generateApplicationHeader, rsaSetup } from '@tap-payments/acceptance-sdk';
|
|
63
|
+
var axiosInstance = axios.create({
|
|
64
|
+
baseURL: MW_BASE_URL,
|
|
65
|
+
headers: {
|
|
66
|
+
'Content-Type': 'application/json'
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
export var setAxiosGlobalHeaders = function (headers) {
|
|
70
|
+
Object.entries(headers).forEach(function (_a) {
|
|
71
|
+
var key = _a[0], value = _a[1];
|
|
72
|
+
axiosInstance.defaults.headers.common[key] = value;
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
export var getAxiosGlobalHeaders = function () {
|
|
76
|
+
return __assign({}, axiosInstance.defaults.headers.common);
|
|
77
|
+
};
|
|
78
|
+
var APPService = (function () {
|
|
79
|
+
function APPService() {
|
|
80
|
+
}
|
|
81
|
+
Object.defineProperty(APPService.prototype, "setHttpHeaders", {
|
|
82
|
+
enumerable: false,
|
|
83
|
+
configurable: true,
|
|
84
|
+
writable: true,
|
|
85
|
+
value: function (headers) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
setAxiosGlobalHeaders(headers);
|
|
89
|
+
return [2];
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(APPService.prototype, "setBrowserHeaders", {
|
|
95
|
+
enumerable: false,
|
|
96
|
+
configurable: true,
|
|
97
|
+
writable: true,
|
|
98
|
+
value: function (_a) {
|
|
99
|
+
var locale = _a.locale, pk = _a.pk, domain = _a.domain;
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var encryptString, encryptedHeaders, mdn, authorization, rest, application;
|
|
102
|
+
return __generator(this, function (_b) {
|
|
103
|
+
switch (_b.label) {
|
|
104
|
+
case 0:
|
|
105
|
+
encryptString = rsaSetup(RSA_MW_PUBLIC_KEY);
|
|
106
|
+
return [4, new BrowserInfo.BrowserInfo({
|
|
107
|
+
app: { name: '@tap-payments/apple-pay-button', language: locale },
|
|
108
|
+
credentials: { mdn: domain, pk: pk },
|
|
109
|
+
encrypt: function (_key, value) { return encryptString(value.substring(0, 115)); }
|
|
110
|
+
}).get()];
|
|
111
|
+
case 1:
|
|
112
|
+
encryptedHeaders = _b.sent();
|
|
113
|
+
mdn = encryptedHeaders.mdn, authorization = encryptedHeaders.authorization, rest = __rest(encryptedHeaders, ["mdn", "authorization"]);
|
|
114
|
+
application = generateApplicationHeader(rest);
|
|
115
|
+
setAxiosGlobalHeaders({
|
|
116
|
+
authorization: pk,
|
|
117
|
+
mdn: mdn,
|
|
118
|
+
application: application
|
|
119
|
+
});
|
|
120
|
+
return [2];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(APPService.prototype, "checkoutProfile", {
|
|
127
|
+
enumerable: false,
|
|
128
|
+
configurable: true,
|
|
129
|
+
writable: true,
|
|
130
|
+
value: function (request) {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
132
|
+
var data, merchant, payment_options, session;
|
|
133
|
+
return __generator(this, function (_a) {
|
|
134
|
+
switch (_a.label) {
|
|
135
|
+
case 0: return [4, axiosInstance.post('/checkoutprofile', request)];
|
|
136
|
+
case 1:
|
|
137
|
+
data = (_a.sent()).data;
|
|
138
|
+
if (data.errors)
|
|
139
|
+
throw data;
|
|
140
|
+
merchant = data.merchant, payment_options = data.payment_options, session = data.session;
|
|
141
|
+
setAxiosGlobalHeaders({ session: session });
|
|
142
|
+
return [2, { merchant: merchant, payment_options: payment_options }];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
Object.defineProperty(APPService.prototype, "appleSession", {
|
|
149
|
+
enumerable: false,
|
|
150
|
+
configurable: true,
|
|
151
|
+
writable: true,
|
|
152
|
+
value: function (merchant, validationURL, merchantRegisteredDomain, merchantIdentifier) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
+
var body, data;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
body = {
|
|
159
|
+
validationUrl: validationURL,
|
|
160
|
+
origin: merchantRegisteredDomain,
|
|
161
|
+
merchantIdentifier: merchantIdentifier,
|
|
162
|
+
merchantId: merchant.id,
|
|
163
|
+
merchantName: merchant.name
|
|
164
|
+
};
|
|
165
|
+
return [4, axiosInstance.post('/validatemerchant', body)];
|
|
166
|
+
case 1:
|
|
167
|
+
data = (_a.sent()).data;
|
|
168
|
+
if (data.errors)
|
|
169
|
+
throw data;
|
|
170
|
+
return [2, data];
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
Object.defineProperty(APPService.prototype, "tapTokenization", {
|
|
177
|
+
enumerable: false,
|
|
178
|
+
configurable: true,
|
|
179
|
+
writable: true,
|
|
180
|
+
value: function (applePaymentData) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
182
|
+
var body, data;
|
|
183
|
+
return __generator(this, function (_a) {
|
|
184
|
+
switch (_a.label) {
|
|
185
|
+
case 0:
|
|
186
|
+
body = {
|
|
187
|
+
type: 'applepay',
|
|
188
|
+
token_data: applePaymentData
|
|
189
|
+
};
|
|
190
|
+
return [4, axiosInstance.post('/token', body)];
|
|
191
|
+
case 1:
|
|
192
|
+
data = (_a.sent()).data;
|
|
193
|
+
if (data.errors)
|
|
194
|
+
throw data;
|
|
195
|
+
return [2, data];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
Object.defineProperty(APPService.prototype, "createCharge", {
|
|
202
|
+
enumerable: false,
|
|
203
|
+
configurable: true,
|
|
204
|
+
writable: true,
|
|
205
|
+
value: function (request) {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
207
|
+
var data;
|
|
208
|
+
return __generator(this, function (_a) {
|
|
209
|
+
switch (_a.label) {
|
|
210
|
+
case 0: return [4, axiosInstance.post('/charge', request)];
|
|
211
|
+
case 1:
|
|
212
|
+
data = (_a.sent()).data;
|
|
213
|
+
if (data.errors)
|
|
214
|
+
throw data;
|
|
215
|
+
return [2, data];
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
Object.defineProperty(APPService.prototype, "createAuthorize", {
|
|
222
|
+
enumerable: false,
|
|
223
|
+
configurable: true,
|
|
224
|
+
writable: true,
|
|
225
|
+
value: function (request) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
+
var data;
|
|
228
|
+
return __generator(this, function (_a) {
|
|
229
|
+
switch (_a.label) {
|
|
230
|
+
case 0: return [4, axiosInstance.post('/authorize', request)];
|
|
231
|
+
case 1:
|
|
232
|
+
data = (_a.sent()).data;
|
|
233
|
+
if (data.errors)
|
|
234
|
+
throw data;
|
|
235
|
+
return [2, data];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
return APPService;
|
|
242
|
+
}());
|
|
243
|
+
var appService = new APPService();
|
|
244
|
+
export default appService;
|
|
@@ -1,51 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export declare const ButtonStyle: {
|
|
6
|
-
readonly Black: "black";
|
|
7
|
-
readonly White: "white";
|
|
8
|
-
readonly WhiteOutline: "white-outline";
|
|
9
|
-
};
|
|
10
|
-
export declare const Locale: {
|
|
11
|
-
readonly EN: "en";
|
|
12
|
-
readonly AR: "ar";
|
|
13
|
-
readonly FR: "fr";
|
|
14
|
-
};
|
|
15
|
-
export declare const ButtonType: {
|
|
16
|
-
readonly BOOK: "book";
|
|
17
|
-
readonly BUY: "buy";
|
|
18
|
-
readonly CHECK_OUT: "check-out";
|
|
19
|
-
readonly PAY: "pay";
|
|
20
|
-
readonly PLAIN: "plain";
|
|
21
|
-
readonly SUBSCRIBE: "subscribe";
|
|
22
|
-
};
|
|
23
|
-
export declare const MerchantCapabilities: {
|
|
24
|
-
readonly Supports3DS: "supports3DS";
|
|
25
|
-
readonly SupportsCredit: "supportsCredit";
|
|
26
|
-
readonly SupportsDebit: "supportsDebit";
|
|
27
|
-
};
|
|
28
|
-
export declare const SupportedNetworks: {
|
|
29
|
-
readonly Amex: "amex";
|
|
30
|
-
readonly Mada: "mada";
|
|
31
|
-
readonly MasterCard: "masterCard";
|
|
32
|
-
readonly Visa: "visa";
|
|
33
|
-
readonly ChinaUnionPay: "chinaUnionPay";
|
|
34
|
-
readonly Discover: "discover";
|
|
35
|
-
readonly Electron: "electron";
|
|
36
|
-
readonly Jcb: "jcb";
|
|
37
|
-
readonly Maestro: "maestro";
|
|
38
|
-
};
|
|
39
|
-
export declare const ApplePayVersion = 5;
|
|
40
|
-
export declare const Environment: {
|
|
41
|
-
readonly Production: "production";
|
|
42
|
-
readonly Sandbox: "sandbox";
|
|
43
|
-
readonly Beta: "beta";
|
|
44
|
-
readonly Development: "development";
|
|
45
|
-
readonly Staging: "staging";
|
|
46
|
-
};
|
|
47
|
-
export declare const RSA_DEV_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
|
|
48
|
-
export declare const RSA_SANDBOX_MW_PUBLIC_KEY = "";
|
|
49
|
-
export declare const RSA_PRODUCTION_MW_PUBLIC_KEY = "";
|
|
50
|
-
export declare const RSA_BETA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
|
|
51
|
-
export declare const RSA_STAGING_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
|
|
1
|
+
export declare const ApplePayVersion = 5;
|
|
2
|
+
export declare const RSA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
|
|
3
|
+
export declare const MW_BASE_URL = "https://mw-sdk.staging.tap.company/v2/checkout";
|