@salla.sa/applepay 2.14.289 → 2.14.291

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 +8 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/applepay",
3
- "version": "2.14.289",
3
+ "version": "2.14.291",
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": "f1703284ac4ea74abf62965e3b65a0e99b121a8d"
29
+ "gitHead": "ba1cc7bf2df6c6df2167459b31b4e852473f219b"
30
30
  }
package/src/index.js CHANGED
@@ -392,13 +392,18 @@ window.SallaApplePay = {
392
392
 
393
393
  selectApplePayShippingMethod: (company_id, private_company_id) => {
394
394
  salla.logger.log('🍏 Pay: select shipping method ', 'company_id : ' + company_id, 'private_company_id: ' + private_company_id);
395
-
396
- return Http.requestWithSupportAjax(SallaApplePay.detail.shippingMethodSelected.url.replace('{id}', SallaApplePay.id), {
395
+ const payload = {
397
396
  address_id: SallaApplePay.address_id,
398
397
  company_id: company_id,
399
398
  private_company_id: private_company_id,
400
399
  payment_method: 'apple_pay'
401
- }, 'post').then(() => {
400
+ }
401
+ const selectedShippingMethod = SallaApplePay.shipping_methods?.find((item)=> item.company === company_id || item.ship_id === company_id);
402
+ if (selectedShippingMethod?.route_id){
403
+ payload.shipping_route_id = selectedShippingMethod.route_id
404
+ payload.type = selectedShippingMethod.type
405
+ }
406
+ return Http.requestWithSupportAjax(SallaApplePay.detail.shippingMethodSelected.url.replace('{id}', SallaApplePay.id), payload, 'post').then(() => {
402
407
  if (typeof SallaApplePay.detail.shippingMethodSelected.onSuccess === 'function') {
403
408
  SallaApplePay.detail.shippingMethodSelected.onSuccess(data);
404
409
  }