@wikala/spmkt 2.13.1 → 2.14.0
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.
package/api/address.js
CHANGED
|
@@ -37,6 +37,17 @@ const Address = {
|
|
|
37
37
|
return taddress.filter((i) => i).join(separator)
|
|
38
38
|
},
|
|
39
39
|
|
|
40
|
+
getAddressType(address, allowedTypes=['personal', 'business']) {
|
|
41
|
+
let addressType = address.type
|
|
42
|
+
if(!allowedTypes.includes(address.type)) {
|
|
43
|
+
addressType = allowedTypes[0]
|
|
44
|
+
}
|
|
45
|
+
if(address.company_name && address.company_name !== '') {
|
|
46
|
+
addressType = 'business'
|
|
47
|
+
}
|
|
48
|
+
return addressType
|
|
49
|
+
},
|
|
50
|
+
|
|
40
51
|
getList() {
|
|
41
52
|
return request({
|
|
42
53
|
url: '/addresses/',
|
|
@@ -46,7 +57,7 @@ const Address = {
|
|
|
46
57
|
|
|
47
58
|
edit(addressData) {
|
|
48
59
|
if (!addressData.type) {
|
|
49
|
-
addressData.type = '
|
|
60
|
+
addressData.type = 'personal'
|
|
50
61
|
}
|
|
51
62
|
if(addressData.type !== 'business') {
|
|
52
63
|
['company_name', 'company_tax_id', 'company_business_id'].forEach(
|
|
@@ -76,7 +87,7 @@ const Address = {
|
|
|
76
87
|
|
|
77
88
|
validate(addressData) {
|
|
78
89
|
if (!addressData.type) {
|
|
79
|
-
addressData.type = '
|
|
90
|
+
addressData.type = 'personal'
|
|
80
91
|
}
|
|
81
92
|
return request({
|
|
82
93
|
url: '/addresses/validate',
|
|
@@ -88,6 +88,7 @@ import _ from 'underscore'
|
|
|
88
88
|
import { mapGetters, mapState, mapActions, mapMutations } from 'vuex'
|
|
89
89
|
|
|
90
90
|
import { Cart } from '../../../api'
|
|
91
|
+
import { Address } from '../../../api'
|
|
91
92
|
|
|
92
93
|
import { createAddress } from '../../Address/address.schema'
|
|
93
94
|
|
|
@@ -283,13 +284,16 @@ export default {
|
|
|
283
284
|
this.scrollToElement('.reservation-slot')
|
|
284
285
|
return
|
|
285
286
|
}
|
|
287
|
+
|
|
286
288
|
let pmreq = {
|
|
287
|
-
method: this.deliveryType
|
|
289
|
+
method: this.deliveryType,
|
|
290
|
+
rate_id: '',
|
|
291
|
+
address_type: Address.getAddressType(this.checkoutRequestData.shipping_address),
|
|
288
292
|
}
|
|
289
293
|
if (this.deliveryType === 'delivery') {
|
|
290
294
|
pmreq.rate_id = this.checkoutRequestData.delivery_cost_id
|
|
291
295
|
}
|
|
292
|
-
|
|
296
|
+
|
|
293
297
|
this.continueButtonLoading = true
|
|
294
298
|
await this.getPaymentMethods(pmreq)
|
|
295
299
|
this.continueButtonLoading = false
|
|
@@ -5,6 +5,7 @@ import _ from 'underscore'
|
|
|
5
5
|
import shortid from 'shortid'
|
|
6
6
|
import GoogleAnalyticsEEC from '../../../utils/google-analytics-eec'
|
|
7
7
|
import { addressSchema } from '../../Address/address.schema'
|
|
8
|
+
import { Address } from '../../../api'
|
|
8
9
|
|
|
9
10
|
export default {
|
|
10
11
|
setGuestMode(state, guestMode) {
|
|
@@ -65,6 +66,7 @@ export default {
|
|
|
65
66
|
state.checkoutRequestData.shipping_address = { ...addressSchema }
|
|
66
67
|
state.checkoutRequestData.shipping_address_id = ''
|
|
67
68
|
}
|
|
69
|
+
state.checkoutRequestData.shipping_address.type = Address.getAddressType(state.checkoutRequestData.shipping_address)
|
|
68
70
|
},
|
|
69
71
|
|
|
70
72
|
setBillingAddress(state, address) {
|
|
@@ -77,6 +79,7 @@ export default {
|
|
|
77
79
|
state.checkoutRequestData.billing_address = { ...addressSchema }
|
|
78
80
|
state.checkoutRequestData.billing_address_id = ''
|
|
79
81
|
}
|
|
82
|
+
state.checkoutRequestData.billing_address.type = Address.getAddressType(state.checkoutRequestData.billing_address)
|
|
80
83
|
},
|
|
81
84
|
|
|
82
85
|
setDeliveryAddressCoordinates(state, coordinates) {
|