@salla.sa/applepay 1.0.23

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.
@@ -0,0 +1,28 @@
1
+ name: Publish NPM Package
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Access package.json
12
+ run: cat ./package.json
13
+ - name: Automated Version Bump
14
+ uses: phips28/gh-action-bump-version@master
15
+ with:
16
+ tag-prefix: ''
17
+ env:
18
+ GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
19
+ - name: Publish New Version
20
+ uses: actions/setup-node@master
21
+ with:
22
+ node-version: 12
23
+ registry-url: https://registry.npmjs.org/
24
+ scope: 'salla.sa'
25
+ - name: Publish to NPM Package Registry
26
+ run: npm publish --access private
27
+ env:
28
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org>
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # applePay-js
2
+
3
+ # Installing
4
+
5
+ ```
6
+ npm install --save @salla.sa/applepay
7
+ ```
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@salla.sa/applepay",
3
+ "version": "1.0.23",
4
+ "description": "Salla Apple Pay",
5
+ "main": "dist/app.js",
6
+ "scripts": {
7
+ "dev": "npm run development",
8
+ "development": "",
9
+ "watch": "",
10
+ "watch-poll": "npm run watch -- --watch-poll",
11
+ "hot": "",
12
+ "prod": "npm run production",
13
+ "production": "",
14
+ "lint": "eslint ./src --fix",
15
+ "test": "echo \"Error: no test specified\" && exit 1"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/SallaApp/applePay-js.git"
20
+ },
21
+ "keywords": [
22
+ "salla",
23
+ "ui"
24
+ ],
25
+ "publishConfig": {
26
+ "registry": "https://npm.pkg.github.com/"
27
+ },
28
+ "author": "rasha@salla.sa",
29
+ "bugs": {
30
+ "url": "https://github.com/SallaApp/applePay-js/issues"
31
+ },
32
+ "license": "UNLICENSED",
33
+ "homepage": "https://github.com/SallaApp/applePay-js#readme",
34
+ "dependencies": {
35
+ "axios": "^0.23.0"
36
+ }
37
+ }
@@ -0,0 +1,440 @@
1
+ import Http from './http';
2
+ import DetectOS from './DetectOS';
3
+
4
+ window.Salla = window.Salla || {};
5
+ window.Salla.Payments = window.Salla.Payments || {};
6
+
7
+ /**
8
+ * Full Example
9
+ *
10
+ * Salla.event.createAndDispatch('payments::apple-pay.start-transaction', {
11
+ * amount: 1000,
12
+ * validateMerchant: {
13
+ * url: '{{ route('cp.marketplace.cart.pay', ['cart' => $cart]) }}',
14
+ * // onFailed: (response) => {
15
+ * // laravel.ajax.errorHandler(response);
16
+ * // this.onCancel({}, response.data.error.message);
17
+ * // },
18
+ * // onSuccess: (response) => {
19
+ * // laravel.ajax.successHandler(response);
20
+ * // }
21
+ * },
22
+ * authorized: {
23
+ * url: '{{ route('cp.marketplace.cart.confirm', ['cart' => $cart]) }}',
24
+ * // onFailed: (response) => {
25
+ * // laravel.ajax.errorHandler(response);
26
+ * // this.onCancel({}, response.data.error.message);
27
+ * // },
28
+ * // onSuccess: (response) => {
29
+ * // // nothing
30
+ * // }
31
+ * },
32
+ * // onError: function (message) {
33
+ * // laravel.alert(message);
34
+ * // }
35
+ * });
36
+ *
37
+ * You can hide the apple pay button easy with add data-show-if-apple-pay-supported to element like <div data-show-if-apple-pay-supported>
38
+ *
39
+ * @type {{init: Window.Salla.Payments.ApplePay.init, initDefault: Window.Salla.Payments.ApplePay.initDefault, onCancel: Window.Salla.Payments.ApplePay.onCancel, onPaymentAuthorized: Window.Salla.Payments.ApplePay.onPaymentAuthorized, getApplePaySessionVersion: (function(): number), startSession: (function(*): undefined), abortSession: Window.Salla.Payments.ApplePay.abortSession, onValidateMerchant: Window.Salla.Payments.ApplePay.onValidateMerchant}}
40
+ */
41
+ window.Salla.Payments.ApplePay = function() {
42
+
43
+ const session = null;
44
+ const detail = null;
45
+ let address_id = null;
46
+ let shipping_methods = [];
47
+ let total;
48
+ let request;
49
+ let id;
50
+
51
+ return {
52
+ init: function() {
53
+ // init the helpers
54
+ document.removeEventListener('payments::apple-pay.start-transaction', window.Salla.Payments.ApplePay.startSession);
55
+ Salla.event.addEventListener('payments::apple-pay.start-transaction', window.Salla.Payments.ApplePay.startSession);
56
+
57
+ if (!(window.ApplePaySession && ApplePaySession.canMakePayments())) {
58
+ $('[data-show-if-apple-pay-supported]').hide();
59
+ }
60
+ },
61
+
62
+ initDefault: function() {
63
+ let _this = window.Salla.Payments.ApplePay;
64
+
65
+ if (!_this.detail.onError) {
66
+ _this.detail.onError = function(message) {
67
+ laravel.alert(message);
68
+ };
69
+ }
70
+
71
+ if (!_this.detail.authorized.onFailed) {
72
+ _this.detail.authorized.onFailed = (response) => {
73
+ laravel.ajax.errorHandler(response);
74
+ _this.onCancel({}, response.data.error.message);
75
+ };
76
+ }
77
+
78
+ if (!_this.detail.validateMerchant.onFailed) {
79
+ _this.detail.validateMerchant.onFailed = (response) => {
80
+ laravel.ajax.errorHandler(response);
81
+ _this.onCancel({}, response.data.error.message);
82
+ };
83
+ }
84
+
85
+ if (!_this.detail.authorized.onSuccess) {
86
+ _this.detail.authorized.onSuccess = (response) => {
87
+ laravel.ajax.successHandler(response);
88
+ };
89
+ }
90
+ },
91
+
92
+ startSession: function(event) {
93
+ console.log('start session : payments::apple-pay.start-transaction');
94
+
95
+ let _this = window.Salla.Payments.ApplePay;
96
+ _this.detail = event.detail || event;
97
+ console.log(_this.detail);
98
+
99
+ _this.initDefault();
100
+
101
+ if (!(window.ApplePaySession && ApplePaySession.canMakePayments())) {
102
+ console.log('error');
103
+ return;
104
+ }
105
+
106
+ let label = window.location.hostname || 'Salla';
107
+
108
+ let version = _this.getApplePaySessionVersion();
109
+ let supportedNetworks = _this.detail.supportedNetworks || ['masterCard', 'visa'];
110
+
111
+ if (version === 5) {
112
+ supportedNetworks.push('mada');
113
+ }
114
+
115
+
116
+ _this.total = {
117
+ type: 'final',
118
+ label: label,
119
+ amount: _this.detail.amount
120
+ };
121
+
122
+ _this.request = {
123
+ countryCode: 'SA',
124
+ currencyCode: _this.detail.currency || 'SAR',
125
+ requiredShippingContactFields: _this.detail.requiredShippingContactFields ? _this.detail.requiredShippingContactFields : [],
126
+ merchantCapabilities: ['supports3DS'],
127
+ supportedNetworks: _this.detail.supportedNetworks || supportedNetworks,
128
+ total: _this.total,
129
+ shippingContact: _this.detail.shippingContact ? _this.detail.shippingContact : {},
130
+ shippingMethods: _this.detail.shippingMethods && _this.detail.shippingMethods.length ? _this.mappingShippingMethods(event.detail.shippingMethods) : []
131
+ };
132
+
133
+ console.log('apple pay payment request:', _this.request);
134
+
135
+ // https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest
136
+ _this.session = new ApplePaySession(version, _this.request);
137
+
138
+ _this.session.onshippingcontactselected = _this.onShippingContactSelected;
139
+ _this.session.onshippingmethodselected = _this.onShippingMethodSelected;
140
+ _this.session.onvalidatemerchant = _this.onValidateMerchant;
141
+ _this.session.onpaymentauthorized = _this.onPaymentAuthorized;
142
+ _this.session.oncancel = _this.onCancel;
143
+ _this.session.begin();
144
+ },
145
+
146
+ onCancel: (event = {}, message = null) => {
147
+ window.Salla.Payments.ApplePay.detail.onError(message || 'فشل الدفع!');
148
+ Salla.event.createAndDispatch('payments::apple-pay.canceled', event);
149
+ },
150
+
151
+ /**
152
+ * Confirm payment after authorization.
153
+ *
154
+ * @param event
155
+ */
156
+ onPaymentAuthorized: (event) => {
157
+ let _this = window.Salla.Payments.ApplePay;
158
+ console.log(event.payment);
159
+
160
+ Salla.event.createAndDispatch('payments::apple-pay.authorized.init', event);
161
+ Http.post(_this.detail.authorized.url.replace('{id}', _this.id), {
162
+ payment_method: 'apple_pay',
163
+ applepay_token: JSON.stringify(event.payment)
164
+ }, ({data}) => {
165
+ Salla.event.createAndDispatch('payments::apple-pay.authorized.success', data);
166
+
167
+ _this.session.completePayment(ApplePaySession.STATUS_SUCCESS);
168
+
169
+ if (typeof _this.detail.authorized.onSuccess === 'function') {
170
+ _this.detail.authorized.onSuccess(data);
171
+ }
172
+ }, ({response}) => {
173
+
174
+ Salla.event.createAndDispatch('payments::apple-pay.authorized.failed', response);
175
+
176
+ _this.session.completePayment(ApplePaySession.STATUS_FAILURE);
177
+
178
+ if (typeof _this.detail.authorized.onFailed === 'function') {
179
+ _this.detail.authorized.onFailed(response);
180
+ }
181
+ });
182
+ },
183
+
184
+ /**
185
+ * Validate Submit.
186
+ *
187
+ * @param event
188
+ */
189
+ onValidateMerchant: (event) => {
190
+ let _this = window.Salla.Payments.ApplePay;
191
+ Salla.event.createAndDispatch('payments::apple-pay.validate-merchant.init', event);
192
+
193
+ Http.post(_this.detail.validateMerchant.url.replace('{id}', _this.id), {
194
+ amount: _this.detail.amount,
195
+ validation_url: event.validationURL,
196
+ payment_method: 'apple_pay'
197
+ }, ({data}) => {
198
+
199
+ Salla.event.createAndDispatch('payments::apple-pay.validate-merchant.success', data);
200
+
201
+ if (typeof _this.detail.validateMerchant.onSuccess === 'function') {
202
+ _this.detail.validateMerchant.onSuccess(data).then((response) => {
203
+
204
+ //set cart id
205
+ if (response.data) {
206
+ _this.id = response.data.id || response.data.data.id;
207
+ }
208
+
209
+ _this.session.completeMerchantValidation(data.data);
210
+
211
+ }).catch((response) => {
212
+ _this.abortValidateMerchant(response);
213
+ });
214
+ } else {
215
+ _this.session.completeMerchantValidation(data.data);
216
+ }
217
+
218
+ }, ({response}) => {
219
+ _this.abortValidateMerchant(response);
220
+ });
221
+ },
222
+
223
+ abortValidateMerchant: (response = null) => {
224
+ let _this = window.Salla.Payments.ApplePay;
225
+
226
+ // todo :: check if we still need it.
227
+ // _this.session.completeMerchantValidation(ApplePaySession.STATUS_FAILURE);
228
+ _this.abortSession();
229
+ Salla.event.createAndDispatch('payments::apple-pay.validate-merchant.failed', response);
230
+
231
+ if (typeof _this.detail.validateMerchant.onFailed === 'function') {
232
+ _this.detail.validateMerchant.onFailed(response);
233
+ }
234
+ },
235
+
236
+ /**
237
+ * Select Shipping Contact
238
+ *
239
+ * @param event
240
+ */
241
+ onShippingContactSelected: (event) => {
242
+ console.log(event.shippingContact);
243
+
244
+ let _this = window.Salla.Payments.ApplePay;
245
+ if (!_this.detail.requiredShippingContactFields) {
246
+ return;
247
+ }
248
+ return new Promise((resolve, reject) => {
249
+ // Create New Address
250
+ Http.post(_this.detail.shippingContactSelected.url.replace('{id}', _this.id),
251
+ {
252
+ 'country': event.shippingContact.country,
253
+ 'city': event.shippingContact.locality,
254
+ 'local': event.shippingContact.subLocality,
255
+ 'description': event.shippingContact.subAdministrativeArea,
256
+ 'street': event.shippingContact.administrativeArea,
257
+ 'country_code': event.shippingContact.countryCode,
258
+ 'postal_code': event.shippingContact.postalCode
259
+ },
260
+ ({data}) => {
261
+ if (typeof _this.detail.shippingContactSelected.onSuccess === 'function') {
262
+ _this.detail.shippingContactSelected.onSuccess(data);
263
+ }
264
+
265
+ _this.address_id = data.data.address_id;
266
+ _this.shipping_methods = data.data.shipping_methods;
267
+
268
+ if (!_this.shipping_methods || (_this.shipping_methods && !_this.shipping_methods.length)) {
269
+ reject('لايوجد شركات شحن لهذا العنوان');
270
+ }
271
+
272
+ resolve(data);
273
+
274
+ }, ({response}) => {
275
+ console.log(response);
276
+ // _this.abortSession();
277
+ if (typeof _this.detail.shippingContactSelected.onFailed === 'function') {
278
+ _this.detail.shippingContactSelected.onFailed(response);
279
+ }
280
+ _this.session.completeShippingContactSelection({
281
+ 'newTotal': _this.total,
282
+ 'errors': [new window.ApplePayError('shippingContactInvalid', 'locality', response.data.error.message)]
283
+ });
284
+ });
285
+
286
+ }).then(() => {
287
+ _this.selectApplePayShippingMethod(_this.shipping_methods[0]['ship_id'], _this.shipping_methods[0]['private_ship_id']);
288
+ }).then(() => {
289
+ console.log('shipping contact selected success');
290
+ _this.session.completeShippingContactSelection(
291
+ {
292
+ 'newTotal': _this.total,
293
+ 'newShippingMethods': _this.mappingShippingMethods(_this.shipping_methods)
294
+ }
295
+ );
296
+ }).catch(function(error) {
297
+ console.log(error);
298
+ _this.session.completeShippingContactSelection(
299
+ {
300
+ 'newTotal': _this.total,
301
+ 'errors': [new window.ApplePayError('shippingContactInvalid', 'locality', error)]
302
+ });
303
+ //_this.abortSession();
304
+ });
305
+ },
306
+
307
+ /**
308
+ * Select Shipping Method
309
+ *
310
+ * @param event
311
+ *
312
+ */
313
+ onShippingMethodSelected: (event) => {
314
+ let _this = window.Salla.Payments.ApplePay;
315
+ console.log(event.shippingMethod);
316
+
317
+ return new Promise((resolve, reject) => {
318
+ let shipping_ids = event.shippingMethod.identifier.split(',');
319
+ _this.selectApplePayShippingMethod(
320
+ shipping_ids[0],
321
+ typeof shipping_ids[1] === 'undefined' ? null : shipping_ids[1]
322
+ );
323
+ resolve();
324
+
325
+ }).then(() => {
326
+ _this.session.completeShippingMethodSelection({'newTotal': _this.total});
327
+
328
+ }).catch(function(error) {
329
+ console.log(error);
330
+ _this.abortSession();
331
+ });
332
+ },
333
+
334
+
335
+ abortSession: () => {
336
+ let _this = window.Salla.Payments.ApplePay;
337
+
338
+ if (_this.session) {
339
+ _this.session.abort();
340
+ }
341
+ },
342
+
343
+ getApplePaySessionVersion: () => {
344
+ const userAgent = navigator.userAgent || navigator.vendor || window.opera;
345
+
346
+ if (userAgent === 'sallapp') {
347
+ return 5;
348
+ }
349
+
350
+ // can't handle custom user agent like sallapp
351
+ let detection = DetectOS.init();
352
+ let v = parseFloat(detection.os.version);
353
+
354
+ if (detection.os.name === 'Macintosh') {
355
+ if (v < 10.142) {
356
+ return 1;
357
+ }
358
+ } else {
359
+ if (v < 12.11) {
360
+ return 1;
361
+ }
362
+ }
363
+
364
+ return 5;
365
+ },
366
+
367
+ recalculateTotal: () => {
368
+ console.log('Recalculate Total');
369
+ let _this = window.Salla.Payments.ApplePay;
370
+
371
+ $.ajax({
372
+ url: _this.detail.recalculateTotal.url.replace('{id}', _this.id),
373
+ method: 'GET',
374
+ async: false,
375
+ success: function(data) {
376
+ _this.total = Object.assign({}, _this.total, {
377
+ amount: data.data.initial_data.cart.total
378
+ });
379
+
380
+ let total = _this.total;
381
+ _this.request = Object.assign({}, _this.request, {total});
382
+ console.log('Recalculate Total Success', total);
383
+ },
384
+ error: function(e) {
385
+ console.log('Recalculate Total Failed');
386
+ console.log(response);
387
+ }
388
+ });
389
+ },
390
+
391
+ selectApplePayShippingMethod: (company_id, private_company_id) => {
392
+ let _this = window.Salla.Payments.ApplePay;
393
+ console.log('select shipping method ', 'company_id : ' + company_id, 'private_company_id: ' + private_company_id);
394
+
395
+ $.ajax({
396
+ url: _this.detail.shippingMethodSelected.url.replace('{id}', _this.id),
397
+ method: 'POST',
398
+ data: {
399
+ address_id: _this.address_id,
400
+ company_id: company_id,
401
+ private_company_id: private_company_id,
402
+ payment_method: 'apple_pay'
403
+ },
404
+ async: false,
405
+ success: function(data) {
406
+ if (typeof _this.detail.shippingMethodSelected.onSuccess === 'function') {
407
+ _this.detail.shippingMethodSelected.onSuccess(data);
408
+ }
409
+ _this.recalculateTotal();
410
+ },
411
+ error: function(response) {
412
+ // _this.abortSession();
413
+ if (typeof _this.detail.shippingMethodSelected.onFailed === 'function') {
414
+ _this.detail.shippingMethodSelected.onFailed(response);
415
+ }
416
+ }
417
+ });
418
+ },
419
+
420
+ mappingShippingMethods: (methods) => {
421
+
422
+ return methods.map(function(method) {
423
+ let identifier = method.ship_id.toString();
424
+
425
+ if (method.private_ship_id) {
426
+ identifier += ',' + method.private_ship_id.toString();
427
+ }
428
+ return {
429
+ 'label': method.shipping_title,
430
+ 'amount': method.enable_free_shipping ? 0 : method.ship_cost,
431
+ 'detail': '',
432
+ 'identifier': identifier
433
+ };
434
+ });
435
+ }
436
+ };
437
+
438
+ }();
439
+
440
+ window.Salla.Payments.ApplePay.init();
@@ -0,0 +1,75 @@
1
+ export default {
2
+ options: [],
3
+ header: [navigator.platform, navigator.userAgent, navigator.appVersion, navigator.vendor, window.opera],
4
+ dataos: [
5
+ {name: 'Windows Phone', value: 'Windows Phone', version: 'OS'},
6
+ {name: 'Windows', value: 'Win', version: 'NT'},
7
+ {name: 'iPhone', value: 'iPhone', version: 'OS'},
8
+ {name: 'iPad', value: 'iPad', version: 'OS'},
9
+ {name: 'Kindle', value: 'Silk', version: 'Silk'},
10
+ {name: 'Android', value: 'Android', version: 'Android'},
11
+ {name: 'PlayBook', value: 'PlayBook', version: 'OS'},
12
+ {name: 'BlackBerry', value: 'BlackBerry', version: '/'},
13
+ {name: 'Macintosh', value: 'Mac', version: 'OS X'},
14
+ {name: 'Linux', value: 'Linux', version: 'rv'},
15
+ {name: 'Palm', value: 'Palm', version: 'PalmOS'}
16
+ ],
17
+ databrowser: [
18
+ {name: 'Chrome', value: 'Chrome', version: 'Chrome'},
19
+ {name: 'Firefox', value: 'Firefox', version: 'Firefox'},
20
+ {name: 'Safari', value: 'Safari', version: 'Version'},
21
+ {name: 'Internet Explorer', value: 'MSIE', version: 'MSIE'},
22
+ {name: 'Opera', value: 'Opera', version: 'Opera'},
23
+ {name: 'BlackBerry', value: 'CLDC', version: 'CLDC'},
24
+ {name: 'Mozilla', value: 'Mozilla', version: 'Mozilla'}
25
+ ],
26
+ init: function () {
27
+ var agent = this.header.join(' '),
28
+ os = this.matchItem(agent, this.dataos),
29
+ browser = this.matchItem(agent, this.databrowser);
30
+
31
+ return {os: os, browser: browser};
32
+ },
33
+ matchItem: function (string, data) {
34
+ var i = 0,
35
+ j = 0,
36
+ html = '',
37
+ regex,
38
+ regexv,
39
+ match,
40
+ matches,
41
+ version;
42
+
43
+ for (i = 0; i < data.length; i += 1) {
44
+ regex = new RegExp(data[i].value, 'i');
45
+ match = regex.test(string);
46
+ if (match) {
47
+ regexv = new RegExp(data[i].version + '[- /:;]([\\d._]+)', 'i');
48
+ matches = string.match(regexv);
49
+ version = '';
50
+ if (matches) {
51
+ if (matches[1]) {
52
+ matches = matches[1];
53
+ }
54
+ }
55
+ if (matches) {
56
+ matches = matches.split(/[._]+/);
57
+ for (j = 0; j < matches.length; j += 1) {
58
+ if (j === 0) {
59
+ version += matches[j] + '.';
60
+ } else {
61
+ version += matches[j];
62
+ }
63
+ }
64
+ } else {
65
+ version = '0';
66
+ }
67
+ return {
68
+ name: data[i].name,
69
+ version: parseFloat(version)
70
+ };
71
+ }
72
+ }
73
+ return {name: 'unknown', version: 0};
74
+ }
75
+ };
package/src/http.js ADDED
@@ -0,0 +1,30 @@
1
+ import axios from 'axios'
2
+
3
+ export default {
4
+ request(method, url, data, successCb = null, errorCb = null) {
5
+ return axios
6
+ .request({ url, data, method: method.toLowerCase(), responseType: 'json'})
7
+ .then(successCb)
8
+ .catch(errorCb);
9
+ },
10
+
11
+ get(url, successCb = null, errorCb = null, data) {
12
+ // return this.request('get', url, data, successCb, errorCb);
13
+ return axios
14
+ .get(url, { params: data })
15
+ .then(successCb)
16
+ .catch(errorCb);
17
+ },
18
+
19
+ post(url, data, successCb = null, errorCb = null ) {
20
+ return this.request('post', url, data, successCb, errorCb);
21
+ },
22
+
23
+ put(url, data, successCb = null, errorCb = null) {
24
+ return this.request('put', url, data, successCb, errorCb);
25
+ },
26
+
27
+ delete(url, data, successCb = null, errorCb = null) {
28
+ return this.request('delete', url, data, successCb, errorCb);
29
+ }
30
+ };
package/src/index.js ADDED
@@ -0,0 +1 @@
1
+ require('./ApplePay');