@salla.sa/applepay 2.14.180 → 2.14.181

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +12 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/applepay",
3
- "version": "2.14.180",
3
+ "version": "2.14.181",
4
4
  "description": "Salla Apple Pay light",
5
5
  "main": "dist/app.js",
6
6
  "scripts": {
@@ -26,5 +26,5 @@
26
26
  "dependencies": {
27
27
  "axios": "^1.10.0"
28
28
  },
29
- "gitHead": "13ad54d4292824da31513d120d2f70f0c22d0621"
29
+ "gitHead": "6fa6b5ed28e1d42c8131bd379f55df72493249c4"
30
30
  }
package/src/index.js CHANGED
@@ -80,7 +80,7 @@ window.SallaApplePay = {
80
80
  },
81
81
 
82
82
  prepareLineItems: function () {
83
- if(!SallaApplePay.detail?.items?.length){
83
+ if (!SallaApplePay.detail?.items?.length) {
84
84
  SallaApplePay.detail.items = [
85
85
  {
86
86
  label: salla.lang.get('pages.cart.items_total'),
@@ -93,12 +93,12 @@ window.SallaApplePay = {
93
93
  },
94
94
 
95
95
  prepareTotal: function () {
96
- return {
97
- // apple ask to use business name
98
- label: window.location.hostname || 'Salla',
99
- //label: salla.lang.get('pages.cart.final_total'),
100
- amount: SallaApplePay.detail.amount
101
- }
96
+ return {
97
+ // apple ask to use business name
98
+ label: window.location.hostname || 'Salla',
99
+ //label: salla.lang.get('pages.cart.final_total'),
100
+ amount: SallaApplePay.detail.amount
101
+ }
102
102
  },
103
103
 
104
104
  startSession: async function (event) {
@@ -162,7 +162,7 @@ window.SallaApplePay = {
162
162
  return Http.post(SallaApplePay.detail.oncouponcodechanged.url.replace('{id}', SallaApplePay.id), {
163
163
  'coupon': event.couponCode,
164
164
  'payment_method': 'apple_pay',
165
- }, async ({data}) => {
165
+ }, async ({ data }) => {
166
166
  if (typeof SallaApplePay.detail.oncouponcodechanged.onSuccess === 'function') {
167
167
  SallaApplePay.detail.oncouponcodechanged.onSuccess(data);
168
168
  }
@@ -215,7 +215,7 @@ window.SallaApplePay = {
215
215
  Http.post(SallaApplePay.detail.authorized.url.replace('{id}', SallaApplePay.id), {
216
216
  payment_method: 'apple_pay',
217
217
  applepay_token: JSON.stringify(event.payment)
218
- }, ({data}) => {
218
+ }, ({ data }) => {
219
219
  Salla.event.dispatch('payments::apple-pay.authorized.success', data);
220
220
 
221
221
  SallaApplePay.session.completePayment(ApplePaySession.STATUS_SUCCESS);
@@ -365,14 +365,14 @@ window.SallaApplePay = {
365
365
  recalculateTotal: () => {
366
366
  salla.logger.log('Recalculate Total');
367
367
 
368
- return Http.requestWithSupportAjax(SallaApplePay.detail.recalculateTotal.url.replace('{id}', SallaApplePay.id),{}, 'get').then((data) => {
368
+ return Http.requestWithSupportAjax(SallaApplePay.detail.recalculateTotal.url.replace('{id}', SallaApplePay.id), {}, 'get').then((data) => {
369
369
  let cart = data.data.initial_data?.cart || data.data.cart;
370
370
  // todo :: enhance response from backend
371
371
  SallaApplePay.detail.amount = cart.total;
372
372
  SallaApplePay.detail.items = (cart.totals || cart.items).map((item) => {
373
373
  return {
374
374
  label: item.title,
375
- amount: item.amount === 'مجاني' ? 0 : item.amount.toString().replace('+', ''),
375
+ amount: (item.amount === 'مجاني' || item.amount === 'Free') ? 0 : item.amount.toString().replace('+', ''),
376
376
  };
377
377
  })
378
378
 
@@ -398,7 +398,7 @@ window.SallaApplePay = {
398
398
  private_company_id: private_company_id,
399
399
  payment_method: 'apple_pay'
400
400
  }, 'post').then(() => {
401
- if (typeof SallaApplePay.detail. shippingMethodSelected.onSuccess === 'function') {
401
+ if (typeof SallaApplePay.detail.shippingMethodSelected.onSuccess === 'function') {
402
402
  SallaApplePay.detail.shippingMethodSelected.onSuccess(data);
403
403
  }
404
404