@tap-payments/apple-pay-button 0.0.10-test → 0.0.12-test

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.
@@ -1,240 +1,217 @@
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
- import BaseService from './base';
53
- import httpClient from './httpClient';
54
- var APPService = (function (_super) {
55
- __extends(APPService, _super);
56
- function APPService() {
57
- return _super.call(this, httpClient) || this;
58
- }
59
- Object.defineProperty(APPService.prototype, "init", {
60
- enumerable: false,
61
- configurable: true,
62
- writable: true,
63
- value: function (publicKey, merchantId) {
64
- return __awaiter(this, void 0, void 0, function () {
65
- var body, data;
66
- return __generator(this, function (_a) {
67
- switch (_a.label) {
68
- case 0:
69
- body = {
70
- headers: { authorization: "Bearer ".concat(publicKey) },
71
- reqBody: { public_key: publicKey, merchant_id: merchantId }
72
- };
73
- return [4, this.post('/init', body)];
74
- case 1:
75
- data = (_a.sent()).data;
76
- if (data.errors)
77
- throw data;
78
- return [2, {
79
- merchant: data.merchant,
80
- payment_options: data.payment_options
81
- }];
82
- }
83
- });
84
- });
85
- }
86
- });
87
- Object.defineProperty(APPService.prototype, "appleSession", {
88
- enumerable: false,
89
- configurable: true,
90
- writable: true,
91
- value: function (merchant, validationURL, merchantRegisteredDomain, options) {
92
- return __awaiter(this, void 0, void 0, function () {
93
- var body, data;
94
- return __generator(this, function (_a) {
95
- switch (_a.label) {
96
- case 0:
97
- body = {
98
- validationUrl: validationURL,
99
- origin: merchantRegisteredDomain,
100
- merchantIdentifier: (options === null || options === void 0 ? void 0 : options.merchantIdentifier) || 'merchant.tap.gosell',
101
- merchantId: (options === null || options === void 0 ? void 0 : options.mid) || merchant.id,
102
- merchantName: (options === null || options === void 0 ? void 0 : options.mn) || merchant.name,
103
- session_token: merchant.session_token
104
- };
105
- return [4, this.post('/session', body)];
106
- case 1:
107
- data = (_a.sent()).data;
108
- if (data.errors)
109
- throw data;
110
- return [2, data.body];
111
- }
112
- });
113
- });
114
- }
115
- });
116
- Object.defineProperty(APPService.prototype, "nativeAppleSession", {
117
- enumerable: false,
118
- configurable: true,
119
- writable: true,
120
- value: function (merchant, validationURL, merchantRegisteredDomain, options) {
121
- return __awaiter(this, void 0, void 0, function () {
122
- var data;
123
- return __generator(this, function (_a) {
124
- switch (_a.label) {
125
- case 0: return [4, this.httpClient.post(validationURL, {
126
- merchantIdentifier: (options === null || options === void 0 ? void 0 : options.merchantIdentifier) || 'merchant.tap.gosell',
127
- displayName: (options === null || options === void 0 ? void 0 : options.mn) || merchant.name,
128
- initiative: 'web',
129
- initiativeContext: merchantRegisteredDomain
130
- })];
131
- case 1:
132
- data = (_a.sent()).data;
133
- return [2, data];
134
- }
135
- });
136
- });
137
- }
138
- });
139
- Object.defineProperty(APPService.prototype, "tapTokenization", {
140
- enumerable: false,
141
- configurable: true,
142
- writable: true,
143
- value: function (applePaymentData, merchant) {
144
- return __awaiter(this, void 0, void 0, function () {
145
- var body, data;
146
- return __generator(this, function (_a) {
147
- switch (_a.label) {
148
- case 0:
149
- body = {
150
- method: 'POST',
151
- path: '/v2/token',
152
- headers: {
153
- session_token: merchant.session_token
154
- },
155
- reqBody: {
156
- type: 'applepay',
157
- token_data: applePaymentData
158
- }
159
- };
160
- return [4, this.post('/api', body)];
161
- case 1:
162
- data = (_a.sent()).data;
163
- if (data.errors)
164
- throw data;
165
- return [2, data];
166
- }
167
- });
168
- });
169
- }
170
- });
171
- Object.defineProperty(APPService.prototype, "createCharge", {
172
- enumerable: false,
173
- configurable: true,
174
- writable: true,
175
- value: function (publicKey, merchant, request, cardToken) {
176
- var body = {
177
- method: 'POST',
178
- path: '/v2/charge',
179
- headers: {
180
- session_token: merchant.session_token
181
- },
182
- reqBody: {
183
- id: null,
184
- amount: request.total.amount,
185
- currency: request.currencyCode,
186
- public_key: publicKey,
187
- product: 'GOSELL',
188
- threeDSecure: true,
189
- save_card: false,
190
- fee: 0,
191
- statement_descriptor: 'Sample',
192
- description: 'Test Description',
193
- metadata: {},
194
- reference: {
195
- transaction: 'txn_0001',
196
- order: 'ord_0001'
197
- },
198
- receipt: {
199
- email: false,
200
- sms: true
201
- },
202
- customer: {
203
- id: null,
204
- first_name: 'Hala',
205
- middle_name: null,
206
- last_name: 'Q.',
207
- email: 'email@email.com',
208
- phone: {
209
- country_code: '965',
210
- number: '00000000'
211
- }
212
- },
213
- source: {
214
- id: cardToken
215
- },
216
- hashstring: null,
217
- post: {
218
- url: null
219
- },
220
- redirect: {
221
- url: 'https://jslib.gosell.io/demo?token=63cce645332aa501e6cf768f&mode=popup'
222
- },
223
- ipaddress: null,
224
- selected_currency: request.currencyCode,
225
- selected_amount: request.total.amount,
226
- merchant: {
227
- id: merchant.id
228
- },
229
- order: {
230
- id: 'ord_06CO2023731xt7V22SC0X487'
231
- }
232
- }
233
- };
234
- return this.post('/api', body);
235
- }
236
- });
237
- return APPService;
238
- }(BaseService));
239
- var appService = new APPService();
240
- export default appService;
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
+ import BaseService from './base';
53
+ import httpClient from './httpClient';
54
+ var APPService = (function (_super) {
55
+ __extends(APPService, _super);
56
+ function APPService() {
57
+ return _super.call(this, httpClient) || this;
58
+ }
59
+ Object.defineProperty(APPService.prototype, "init", {
60
+ enumerable: false,
61
+ configurable: true,
62
+ writable: true,
63
+ value: function (publicKey, merchantId) {
64
+ return __awaiter(this, void 0, void 0, function () {
65
+ var body, data;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0:
69
+ body = {
70
+ headers: { authorization: "Bearer ".concat(publicKey) },
71
+ reqBody: { public_key: publicKey, merchant_id: merchantId }
72
+ };
73
+ return [4, this.post('/init', body)];
74
+ case 1:
75
+ data = (_a.sent()).data;
76
+ if (data.errors)
77
+ throw data;
78
+ return [2, {
79
+ merchant: data.merchant,
80
+ payment_options: data.payment_options
81
+ }];
82
+ }
83
+ });
84
+ });
85
+ }
86
+ });
87
+ Object.defineProperty(APPService.prototype, "appleSession", {
88
+ enumerable: false,
89
+ configurable: true,
90
+ writable: true,
91
+ value: function (merchant, validationURL, merchantRegisteredDomain) {
92
+ return __awaiter(this, void 0, void 0, function () {
93
+ var body, data;
94
+ return __generator(this, function (_a) {
95
+ switch (_a.label) {
96
+ case 0:
97
+ body = {
98
+ validationUrl: validationURL,
99
+ origin: merchantRegisteredDomain,
100
+ merchantIdentifier: 'merchant.tap.gosell',
101
+ merchantId: merchant.id,
102
+ merchantName: merchant.name,
103
+ session_token: merchant.session_token
104
+ };
105
+ return [4, this.post('/session', body)];
106
+ case 1:
107
+ data = (_a.sent()).data;
108
+ if (data.errors)
109
+ throw data;
110
+ return [2, data];
111
+ }
112
+ });
113
+ });
114
+ }
115
+ });
116
+ Object.defineProperty(APPService.prototype, "tapTokenization", {
117
+ enumerable: false,
118
+ configurable: true,
119
+ writable: true,
120
+ value: function (applePaymentData, merchant) {
121
+ return __awaiter(this, void 0, void 0, function () {
122
+ var body, data;
123
+ return __generator(this, function (_a) {
124
+ switch (_a.label) {
125
+ case 0:
126
+ body = {
127
+ method: 'POST',
128
+ path: '/v2/token',
129
+ headers: {
130
+ session_token: merchant.session_token
131
+ },
132
+ reqBody: {
133
+ type: 'applepay',
134
+ token_data: applePaymentData
135
+ }
136
+ };
137
+ return [4, this.post('/api', body)];
138
+ case 1:
139
+ data = (_a.sent()).data;
140
+ if (data.errors)
141
+ throw data;
142
+ return [2, data];
143
+ }
144
+ });
145
+ });
146
+ }
147
+ });
148
+ Object.defineProperty(APPService.prototype, "createCharge", {
149
+ enumerable: false,
150
+ configurable: true,
151
+ writable: true,
152
+ value: function (publicKey, merchant, request, cardToken) {
153
+ var body = {
154
+ method: 'POST',
155
+ path: '/v2/charge',
156
+ headers: {
157
+ session_token: merchant.session_token
158
+ },
159
+ reqBody: {
160
+ id: null,
161
+ amount: request.total.amount,
162
+ currency: request.currencyCode,
163
+ public_key: publicKey,
164
+ product: 'GOSELL',
165
+ threeDSecure: true,
166
+ save_card: false,
167
+ fee: 0,
168
+ statement_descriptor: 'Sample',
169
+ description: 'Test Description',
170
+ metadata: {},
171
+ reference: {
172
+ transaction: 'txn_0001',
173
+ order: 'ord_0001'
174
+ },
175
+ receipt: {
176
+ email: false,
177
+ sms: true
178
+ },
179
+ customer: {
180
+ id: null,
181
+ first_name: 'Hala',
182
+ middle_name: null,
183
+ last_name: 'Q.',
184
+ email: 'email@email.com',
185
+ phone: {
186
+ country_code: '965',
187
+ number: '00000000'
188
+ }
189
+ },
190
+ source: {
191
+ id: cardToken
192
+ },
193
+ hashstring: null,
194
+ post: {
195
+ url: null
196
+ },
197
+ redirect: {
198
+ url: 'https://jslib.gosell.io/demo?token=63cce645332aa501e6cf768f&mode=popup'
199
+ },
200
+ ipaddress: null,
201
+ selected_currency: request.currencyCode,
202
+ selected_amount: request.total.amount,
203
+ merchant: {
204
+ id: merchant.id
205
+ },
206
+ order: {
207
+ id: 'ord_06CO2023731xt7V22SC0X487'
208
+ }
209
+ }
210
+ };
211
+ return this.post('/api', body);
212
+ }
213
+ });
214
+ return APPService;
215
+ }(BaseService));
216
+ var appService = new APPService();
217
+ export default appService;
@@ -1,9 +1,9 @@
1
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
- export default class BaseService {
3
- httpClient: AxiosInstance;
4
- constructor(httpClient: AxiosInstance);
5
- get(url: string, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
6
- post(url: string, data?: any, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
7
- put(url: string, data?: any, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
8
- delete(url: string, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
9
- }
1
+ import { AxiosInstance, AxiosRequestConfig } from 'axios';
2
+ export default class BaseService {
3
+ httpClient: AxiosInstance;
4
+ constructor(httpClient: AxiosInstance);
5
+ get(url: string, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
6
+ post(url: string, data?: any, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
7
+ put(url: string, data?: any, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
8
+ delete(url: string, config?: AxiosRequestConfig<any>): Promise<import("axios").AxiosResponse<any, any>>;
9
+ }
package/build/api/base.js CHANGED
@@ -1,45 +1,45 @@
1
- var BaseService = (function () {
2
- function BaseService(httpClient) {
3
- Object.defineProperty(this, "httpClient", {
4
- enumerable: true,
5
- configurable: true,
6
- writable: true,
7
- value: void 0
8
- });
9
- this.httpClient = httpClient;
10
- }
11
- Object.defineProperty(BaseService.prototype, "get", {
12
- enumerable: false,
13
- configurable: true,
14
- writable: true,
15
- value: function (url, config) {
16
- return this.httpClient.get(url, config);
17
- }
18
- });
19
- Object.defineProperty(BaseService.prototype, "post", {
20
- enumerable: false,
21
- configurable: true,
22
- writable: true,
23
- value: function (url, data, config) {
24
- return this.httpClient.post(url, data, config);
25
- }
26
- });
27
- Object.defineProperty(BaseService.prototype, "put", {
28
- enumerable: false,
29
- configurable: true,
30
- writable: true,
31
- value: function (url, data, config) {
32
- return this.httpClient.put(url, data, config);
33
- }
34
- });
35
- Object.defineProperty(BaseService.prototype, "delete", {
36
- enumerable: false,
37
- configurable: true,
38
- writable: true,
39
- value: function (url, config) {
40
- return this.httpClient.delete(url, config);
41
- }
42
- });
43
- return BaseService;
44
- }());
45
- export default BaseService;
1
+ var BaseService = (function () {
2
+ function BaseService(httpClient) {
3
+ Object.defineProperty(this, "httpClient", {
4
+ enumerable: true,
5
+ configurable: true,
6
+ writable: true,
7
+ value: void 0
8
+ });
9
+ this.httpClient = httpClient;
10
+ }
11
+ Object.defineProperty(BaseService.prototype, "get", {
12
+ enumerable: false,
13
+ configurable: true,
14
+ writable: true,
15
+ value: function (url, config) {
16
+ return this.httpClient.get(url, config);
17
+ }
18
+ });
19
+ Object.defineProperty(BaseService.prototype, "post", {
20
+ enumerable: false,
21
+ configurable: true,
22
+ writable: true,
23
+ value: function (url, data, config) {
24
+ return this.httpClient.post(url, data, config);
25
+ }
26
+ });
27
+ Object.defineProperty(BaseService.prototype, "put", {
28
+ enumerable: false,
29
+ configurable: true,
30
+ writable: true,
31
+ value: function (url, data, config) {
32
+ return this.httpClient.put(url, data, config);
33
+ }
34
+ });
35
+ Object.defineProperty(BaseService.prototype, "delete", {
36
+ enumerable: false,
37
+ configurable: true,
38
+ writable: true,
39
+ value: function (url, config) {
40
+ return this.httpClient.delete(url, config);
41
+ }
42
+ });
43
+ return BaseService;
44
+ }());
45
+ export default BaseService;
@@ -1,2 +1,2 @@
1
- declare const httpClient: import("axios").AxiosInstance;
2
- export default httpClient;
1
+ declare const httpClient: import("axios").AxiosInstance;
2
+ export default httpClient;
@@ -1,16 +1,16 @@
1
- import axios from 'axios';
2
- var MW_BASE_URL = 'https://checkout.payments.tap.company/api';
3
- var httpClient = axios.create({
4
- baseURL: MW_BASE_URL,
5
- headers: {
6
- 'Content-Type': 'application/json',
7
- Accept: 'application/json'
8
- }
9
- });
10
- httpClient.interceptors.request.use(function (config) {
11
- return config;
12
- });
13
- httpClient.interceptors.response.use(function (response) {
14
- return response;
15
- });
16
- export default httpClient;
1
+ import axios from 'axios';
2
+ var MW_BASE_URL = 'https://checkout.payments.tap.company/api';
3
+ var httpClient = axios.create({
4
+ baseURL: MW_BASE_URL,
5
+ headers: {
6
+ 'Content-Type': 'application/json',
7
+ Accept: 'application/json'
8
+ }
9
+ });
10
+ httpClient.interceptors.request.use(function (config) {
11
+ return config;
12
+ });
13
+ httpClient.interceptors.response.use(function (response) {
14
+ return response;
15
+ });
16
+ export default httpClient;