@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.
Files changed (51) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +240 -194
  3. package/build/@types/ApplePayButtonProps.d.ts +129 -0
  4. package/build/@types/ApplePayButtonProps.js +1 -0
  5. package/build/@types/charge.d.ts +57 -0
  6. package/build/@types/charge.js +1 -0
  7. package/build/@types/checkoutProfile.d.ts +216 -0
  8. package/build/@types/checkoutProfile.js +1 -0
  9. package/build/@types/enums.d.ts +65 -0
  10. package/build/@types/enums.js +76 -0
  11. package/build/@types/index.d.ts +6 -82
  12. package/build/@types/index.js +6 -1
  13. package/build/@types/tapLocalisation.d.ts +193 -0
  14. package/build/@types/tapLocalisation.js +1 -0
  15. package/build/@types/tapTheme.d.ts +842 -0
  16. package/build/@types/tapTheme.js +1 -0
  17. package/build/api.d.ts +29 -0
  18. package/build/{api/app.service.js → api.js} +244 -253
  19. package/build/constants/index.d.ts +3 -51
  20. package/build/constants/index.js +3 -51
  21. package/build/features/ApplePayButton/ApplePayButton.d.ts +4 -6
  22. package/build/features/ApplePayButton/ApplePayButton.js +49 -80
  23. package/build/features/ApplePayButton/index.d.ts +3 -3
  24. package/build/features/ApplePayButton/index.js +2 -2
  25. package/build/hooks/index.d.ts +1 -1
  26. package/build/hooks/index.js +1 -1
  27. package/build/hooks/useApplePay.d.ts +93 -9
  28. package/build/hooks/useApplePay.js +447 -243
  29. package/build/hooks/useMerchantApplePay.d.ts +20 -0
  30. package/build/hooks/useMerchantApplePay.js +188 -0
  31. package/build/index.d.ts +4 -4
  32. package/build/index.js +13 -10
  33. package/build/utils/config.d.ts +14 -11
  34. package/build/utils/config.js +65 -72
  35. package/build/utils/defaultValues.d.ts +2 -0
  36. package/build/utils/defaultValues.js +27 -0
  37. package/build/utils/html.d.ts +1 -1
  38. package/build/utils/html.js +9 -9
  39. package/build/utils/index.d.ts +4 -1
  40. package/build/utils/index.js +4 -1
  41. package/build/utils/theme.d.ts +12 -0
  42. package/build/utils/theme.js +61 -0
  43. package/package.json +109 -104
  44. package/build/api/app.service.d.ts +0 -23
  45. package/build/api/base.d.ts +0 -9
  46. package/build/api/base.js +0 -45
  47. package/build/api/httpClient.d.ts +0 -8
  48. package/build/api/httpClient.js +0 -33
  49. package/build/features/ApplePayButton/ApplePayButton.css +0 -21
  50. package/build/hooks/useScript.d.ts +0 -1
  51. 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 __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
- return new (P || (P = Promise))(function (resolve, reject) {
19
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23
- });
24
- };
25
- var __generator = (this && this.__generator) || function (thisArg, body) {
26
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
27
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
28
- function verb(n) { return function (v) { return step([n, v]); }; }
29
- function step(op) {
30
- if (f) throw new TypeError("Generator is already executing.");
31
- while (_) try {
32
- 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;
33
- if (y = 0, t) op = [op[0] & 2, t.value];
34
- switch (op[0]) {
35
- case 0: case 1: t = op; break;
36
- case 4: _.label++; return { value: op[1], done: false };
37
- case 5: _.label++; y = op[1]; op = [0]; continue;
38
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
39
- default:
40
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
41
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
42
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
43
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
44
- if (t[2]) _.ops.pop();
45
- _.trys.pop(); continue;
46
- }
47
- op = body.call(thisArg, _);
48
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
50
- }
51
- };
52
- var __rest = (this && this.__rest) || function (s, e) {
53
- var t = {};
54
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
55
- t[p] = s[p];
56
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
57
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
58
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
59
- t[p[i]] = s[p[i]];
60
- }
61
- return t;
62
- };
63
- import BaseService from './base';
64
- import httpClient, { setAxiosGlobalHeaders, MW_BASE_BETA_URL, MW_BASE_DEV_URL, MW_BASE_LIVE_URL, MW_BASE_STAGING_URL, MW_BASE_SANDBOX_URL } from './httpClient';
65
- import BrowserInfo from '@tap-payments/browser-info';
66
- import { generateApplicationHeader, rsaSetup } from '../utils/config';
67
- import { RSA_BETA_MW_PUBLIC_KEY, RSA_DEV_MW_PUBLIC_KEY, RSA_PRODUCTION_MW_PUBLIC_KEY, RSA_SANDBOX_MW_PUBLIC_KEY, RSA_STAGING_MW_PUBLIC_KEY } from '../constants';
68
- var APPService = (function (_super) {
69
- __extends(APPService, _super);
70
- function APPService() {
71
- var _this = _super.call(this, httpClient) || this;
72
- Object.defineProperty(_this, "baseUrl", {
73
- enumerable: true,
74
- configurable: true,
75
- writable: true,
76
- value: void 0
77
- });
78
- Object.defineProperty(_this, "env", {
79
- enumerable: true,
80
- configurable: true,
81
- writable: true,
82
- value: void 0
83
- });
84
- _this.baseUrl = MW_BASE_LIVE_URL;
85
- _this.env = 'production';
86
- return _this;
87
- }
88
- Object.defineProperty(APPService.prototype, "setEnv", {
89
- enumerable: false,
90
- configurable: true,
91
- writable: true,
92
- value: function (env) {
93
- this.env = env;
94
- }
95
- });
96
- Object.defineProperty(APPService.prototype, "setBaseUrl", {
97
- enumerable: false,
98
- configurable: true,
99
- writable: true,
100
- value: function () {
101
- if (!this.env)
102
- throw new Error('Environment is not set');
103
- switch (this.env) {
104
- case 'staging':
105
- this.baseUrl = MW_BASE_STAGING_URL;
106
- break;
107
- case 'beta':
108
- this.baseUrl = MW_BASE_BETA_URL;
109
- break;
110
- case 'development':
111
- this.baseUrl = MW_BASE_DEV_URL;
112
- break;
113
- case 'sandbox':
114
- this.baseUrl = MW_BASE_SANDBOX_URL;
115
- break;
116
- default:
117
- this.baseUrl = MW_BASE_LIVE_URL;
118
- break;
119
- }
120
- }
121
- });
122
- Object.defineProperty(APPService.prototype, "getHeaderPublicKey", {
123
- enumerable: false,
124
- configurable: true,
125
- writable: true,
126
- value: function () {
127
- if (!this.env)
128
- throw new Error('Environment is not set');
129
- switch (this.env) {
130
- case 'staging':
131
- return RSA_STAGING_MW_PUBLIC_KEY;
132
- case 'beta':
133
- return RSA_BETA_MW_PUBLIC_KEY;
134
- case 'development':
135
- return RSA_DEV_MW_PUBLIC_KEY;
136
- case 'sandbox':
137
- return RSA_SANDBOX_MW_PUBLIC_KEY;
138
- default:
139
- return RSA_PRODUCTION_MW_PUBLIC_KEY;
140
- }
141
- }
142
- });
143
- Object.defineProperty(APPService.prototype, "setBrowserHeaders", {
144
- enumerable: false,
145
- configurable: true,
146
- writable: true,
147
- value: function (_a) {
148
- var locale = _a.locale, pk = _a.pk, domain = _a.domain;
149
- return __awaiter(this, void 0, void 0, function () {
150
- var encryptString, encryptedHeaders, mdn, authorization, rest, application;
151
- return __generator(this, function (_b) {
152
- switch (_b.label) {
153
- case 0:
154
- encryptString = rsaSetup(this.getHeaderPublicKey());
155
- return [4, new BrowserInfo.BrowserInfo({
156
- app: { name: '@tap-payments/apple-pay-button', language: locale },
157
- credentials: { mdn: domain, pk: pk },
158
- encrypt: function (_key, value) { return encryptString(value); }
159
- }).get()];
160
- case 1:
161
- encryptedHeaders = _b.sent();
162
- mdn = encryptedHeaders.mdn, authorization = encryptedHeaders.authorization, rest = __rest(encryptedHeaders, ["mdn", "authorization"]);
163
- application = generateApplicationHeader(rest);
164
- setAxiosGlobalHeaders({
165
- authorization: pk,
166
- mdn: mdn,
167
- application: application
168
- });
169
- return [2];
170
- }
171
- });
172
- });
173
- }
174
- });
175
- Object.defineProperty(APPService.prototype, "checkoutProfile", {
176
- enumerable: false,
177
- configurable: true,
178
- writable: true,
179
- value: function (merchantId) {
180
- return __awaiter(this, void 0, void 0, function () {
181
- var data, merchant, payment_options, session;
182
- return __generator(this, function (_a) {
183
- switch (_a.label) {
184
- case 0: return [4, this.post(this.baseUrl + '/checkoutprofile', { merchant_id: merchantId !== null && merchantId !== void 0 ? merchantId : '' })];
185
- case 1:
186
- data = (_a.sent()).data;
187
- if (data.errors)
188
- throw data;
189
- merchant = data.merchant, payment_options = data.payment_options, session = data.session;
190
- setAxiosGlobalHeaders({ session: session });
191
- return [2, { merchant: merchant, payment_options: payment_options }];
192
- }
193
- });
194
- });
195
- }
196
- });
197
- Object.defineProperty(APPService.prototype, "appleSession", {
198
- enumerable: false,
199
- configurable: true,
200
- writable: true,
201
- value: function (merchant, validationURL, merchantRegisteredDomain, merchantIdentifier) {
202
- return __awaiter(this, void 0, void 0, function () {
203
- var body, data;
204
- return __generator(this, function (_a) {
205
- switch (_a.label) {
206
- case 0:
207
- body = {
208
- validationUrl: validationURL,
209
- origin: merchantRegisteredDomain,
210
- merchantIdentifier: merchantIdentifier,
211
- merchantId: merchant.id,
212
- merchantName: merchant.name
213
- };
214
- return [4, this.post(this.baseUrl + '/validatemerchant', body)];
215
- case 1:
216
- data = (_a.sent()).data;
217
- if (data.errors)
218
- throw data;
219
- return [2, data];
220
- }
221
- });
222
- });
223
- }
224
- });
225
- Object.defineProperty(APPService.prototype, "tapTokenization", {
226
- enumerable: false,
227
- configurable: true,
228
- writable: true,
229
- value: function (applePaymentData) {
230
- return __awaiter(this, void 0, void 0, function () {
231
- var body, data;
232
- return __generator(this, function (_a) {
233
- switch (_a.label) {
234
- case 0:
235
- body = {
236
- type: 'applepay',
237
- token_data: applePaymentData
238
- };
239
- return [4, this.post(this.baseUrl + '/token', body)];
240
- case 1:
241
- data = (_a.sent()).data;
242
- if (data.errors)
243
- throw data;
244
- return [2, data];
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 Scope: {
2
- readonly AppleToken: "AppleToken";
3
- readonly TapToken: "TapToken";
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";