@lancom/shared 0.0.212 → 0.0.214
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/assets/js/api/admin.js +36 -0
- package/assets/js/api/index.js +3 -3
- package/components/checkout/order/order-payment-information/order-payment-information.vue +1 -1
- package/components/checkout/order/order-review/order-review.vue +2 -2
- package/components/common/payment/payment_card/payment-card.scss +0 -0
- package/components/common/payment/payment_card/payment-card.vue +45 -0
- package/components/{checkout/payment/payment-cart/payment-cart.vue → common/payment/payment_card/pinpayment/pinpayment.vue} +2 -1
- package/components/common/payment/payment_card/stripe/stripe.scss +0 -0
- package/components/common/payment/payment_card/stripe/stripe.vue +74 -0
- package/components/modals/payment_modal/payment-modal.vue +26 -116
- package/components/order/order_payment/order-payment.vue +6 -5
- package/components/product/product.vue +5 -3
- package/mixins/payment.js +2 -2
- package/nuxt.config.js +16 -3
- package/package.json +1 -1
- package/store/index.js +20 -0
- package/store/order.js +3 -2
- /package/components/{checkout/payment/payment-cart/payment-cart.scss → common/payment/payment_card/pinpayment/pinpayment.scss} +0 -0
- /package/components/{checkout → common}/payment/payment_failed/payment-failed.scss +0 -0
- /package/components/{checkout → common}/payment/payment_failed/payment-failed.vue +0 -0
- /package/components/{checkout → common}/payment/payment_success/payment-success.scss +0 -0
- /package/components/{checkout → common}/payment/payment_success/payment-success.vue +0 -0
package/assets/js/api/admin.js
CHANGED
|
@@ -377,6 +377,21 @@ export default {
|
|
|
377
377
|
removeWebhook(id) {
|
|
378
378
|
return _delete(`admin/webhooks/${id}`);
|
|
379
379
|
},
|
|
380
|
+
async fetchGrabbers(params) {
|
|
381
|
+
return sortByName(await _get('admin/grabbers', params));
|
|
382
|
+
},
|
|
383
|
+
fetchGrabberById(id) {
|
|
384
|
+
return _get(`admin/grabbers/${id}`);
|
|
385
|
+
},
|
|
386
|
+
saveGrabber(grabber) {
|
|
387
|
+
return grabber._id ? _put(`admin/grabbers/${grabber._id}`, grabber) : _post('admin/grabbers', grabber);
|
|
388
|
+
},
|
|
389
|
+
runGrabber(grabber) {
|
|
390
|
+
return _post(`admin/grabbers/${grabber._id}/run`, grabber);
|
|
391
|
+
},
|
|
392
|
+
removeGrabber(id) {
|
|
393
|
+
return _delete(`admin/grabbers/${id}`);
|
|
394
|
+
},
|
|
380
395
|
async fetchCurrencies(params) {
|
|
381
396
|
return sortByName(await _get('admin/currencies', params));
|
|
382
397
|
},
|
|
@@ -419,6 +434,9 @@ export default {
|
|
|
419
434
|
removeWarehouse(id) {
|
|
420
435
|
return _delete(`admin/warehouse/${id}`);
|
|
421
436
|
},
|
|
437
|
+
addProductToWarehouse(id, data) {
|
|
438
|
+
return _post(`admin/warehouse/${id}/product`, data);
|
|
439
|
+
},
|
|
422
440
|
fetchWarehouseTaskById(id) {
|
|
423
441
|
return _get(`admin/warehouse-task/${id}`);
|
|
424
442
|
},
|
|
@@ -458,6 +476,12 @@ export default {
|
|
|
458
476
|
moveToWarehouseLocations(move) {
|
|
459
477
|
return _post(`admin/warehouse-locations/move/bulk`, move);
|
|
460
478
|
},
|
|
479
|
+
fetchWarehouseCanonicalProductsLocations(warehouse) {
|
|
480
|
+
return _get(`admin/warehouses/${warehouse}/canonical-products-locations`);
|
|
481
|
+
},
|
|
482
|
+
removeCanonicalProductLocation(warehouse, canonicalProduct, location) {
|
|
483
|
+
return _delete(`admin/warehouses/${warehouse}/canonical-product/${canonicalProduct}/locations/${location}`);
|
|
484
|
+
},
|
|
461
485
|
async fetchBanners(params) {
|
|
462
486
|
return sortByName(await _get('admin/banners', params));
|
|
463
487
|
},
|
|
@@ -482,6 +506,18 @@ export default {
|
|
|
482
506
|
removeMenu(id) {
|
|
483
507
|
return _delete(`admin/menus/${id}`);
|
|
484
508
|
},
|
|
509
|
+
fetchPrintFactories(params) {
|
|
510
|
+
return _get('admin/print-factories', params);
|
|
511
|
+
},
|
|
512
|
+
fetchPrintFactoryById(id) {
|
|
513
|
+
return _get(`admin/print-factories/${id}`);
|
|
514
|
+
},
|
|
515
|
+
savePrintFactory(factory) {
|
|
516
|
+
return factory._id ? _put(`admin/print-factories/${factory._id}`, factory) : _post('admin/print-factories', factory);
|
|
517
|
+
},
|
|
518
|
+
removePrintFactory(id) {
|
|
519
|
+
return _delete(`admin/print-factories/${id}`);
|
|
520
|
+
},
|
|
485
521
|
fetchPrintTypes(params) {
|
|
486
522
|
return _get('admin/print-types', params);
|
|
487
523
|
},
|
package/assets/js/api/index.js
CHANGED
|
@@ -93,9 +93,9 @@ const api = {
|
|
|
93
93
|
fetchOrderByToken(token, params) {
|
|
94
94
|
return _get(`order/token/${token}`, params);
|
|
95
95
|
},
|
|
96
|
-
createOrderPayment(id, card, shop,
|
|
97
|
-
const url =
|
|
98
|
-
return _post(url, card);
|
|
96
|
+
createOrderPayment(id, { card, shop, country, invoice, payment }) {
|
|
97
|
+
const url = invoice ? `shop/${shop}/order/${id}/invoice/${invoice}/payment` : `shop/${shop}/order/${id}/payment`;
|
|
98
|
+
return _post(url, { card, country, payment });
|
|
99
99
|
},
|
|
100
100
|
addOrderTimeline(id, item) {
|
|
101
101
|
return _post(`order/${id}/timeline`, item);
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
import { mapGetters, mapMutations, mapActions } from 'vuex';
|
|
76
76
|
import { generateOrderData } from '@lancom/shared/assets/js/utils/order';
|
|
77
77
|
import gtm from '@lancom/shared/assets/js/utils/gtm';
|
|
78
|
-
import PaymentCart from '@lancom/shared/components/
|
|
78
|
+
import PaymentCart from '@lancom/shared/components/common/payment/payment_card/pinpayment/pinpayment';
|
|
79
79
|
import ProgressStepsControls from '@lancom/shared/components/common/progress_steps/progress_steps_controls/progress-steps-controls';
|
|
80
80
|
import { ORDER_PAYMENT_METHOD } from '@lancom/shared/assets/js/constants/order';
|
|
81
81
|
import payment from '@lancom/shared/mixins/payment';
|
|
@@ -45,8 +45,8 @@ import { groupSimpleProducts } from '@lancom/shared/assets/js/utils/cart';
|
|
|
45
45
|
import ProgressStepsControls from '@lancom/shared/components/common/progress_steps/progress_steps_controls/progress-steps-controls';
|
|
46
46
|
import { ORDER_PAYMENT_METHOD, ORDER_STEPS } from '@lancom/shared/assets/js/constants/order';
|
|
47
47
|
import payment from '@lancom/shared/mixins/payment';
|
|
48
|
-
import PaymentSuccess from '@lancom/shared/components/
|
|
49
|
-
import PaymentFailed from '@lancom/shared/components/
|
|
48
|
+
import PaymentSuccess from '@lancom/shared/components/common/payment/payment_success/payment-success';
|
|
49
|
+
import PaymentFailed from '@lancom/shared/components/common/payment/payment_failed/payment-failed';
|
|
50
50
|
|
|
51
51
|
export default {
|
|
52
52
|
name: 'OrderReview',
|
|
File without changes
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="Card__wrapper">
|
|
3
|
+
<client-only>
|
|
4
|
+
<component
|
|
5
|
+
:is="cardComponent"
|
|
6
|
+
ref="card"
|
|
7
|
+
:paymentData="paymentData"
|
|
8
|
+
@inited="$emit('inited')" />
|
|
9
|
+
</client-only>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { mapGetters } from 'vuex';
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: 'PaymentCard',
|
|
18
|
+
components: {
|
|
19
|
+
Pinpayment: () => import('./pinpayment/pinpayment'),
|
|
20
|
+
Stripe: () => import('./stripe/stripe')
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
paymentData: {
|
|
24
|
+
type: Object,
|
|
25
|
+
required: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
...mapGetters(['payment']),
|
|
30
|
+
cardComponent() {
|
|
31
|
+
console.log('payment: ', this.payment);
|
|
32
|
+
return 'stripe';
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
async tokenize() {
|
|
37
|
+
return await this.$refs.card.tokenize();
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<style lang="scss" scoped>
|
|
44
|
+
@import 'payment-card.scss';
|
|
45
|
+
</style>
|
|
@@ -163,6 +163,7 @@ export default {
|
|
|
163
163
|
|
|
164
164
|
this.fields.on('ready', () => {
|
|
165
165
|
this.loading = false;
|
|
166
|
+
this.$emit('inited');
|
|
166
167
|
});
|
|
167
168
|
},
|
|
168
169
|
tokenize() {
|
|
@@ -199,5 +200,5 @@ export default {
|
|
|
199
200
|
</script>
|
|
200
201
|
|
|
201
202
|
<style lang="scss" scoped>
|
|
202
|
-
@import '
|
|
203
|
+
@import 'pinpayment.scss';
|
|
203
204
|
</style>
|
|
File without changes
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div v-if="loadedStripe">
|
|
4
|
+
<stripe-element-card
|
|
5
|
+
ref="card"
|
|
6
|
+
:pk="stripe" />
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import { StripeElementCard } from '@vue-stripe/vue-stripe';
|
|
13
|
+
import { mapGetters } from 'vuex';
|
|
14
|
+
|
|
15
|
+
let stripeStartLoaded = false;
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'PaymentCardStripe',
|
|
19
|
+
components: {
|
|
20
|
+
StripeElementCard
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
loadedStripe: false
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
computed: {
|
|
28
|
+
...mapGetters(['payment']),
|
|
29
|
+
stripe() {
|
|
30
|
+
return this.payment.clientKey;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
created() {
|
|
34
|
+
this.loadStripe();
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
async tokenize() {
|
|
38
|
+
const data = {
|
|
39
|
+
...this.$refs.card.element,
|
|
40
|
+
};
|
|
41
|
+
const { token, error } = await this.$refs.card.stripe.createToken(data);
|
|
42
|
+
if (error) {
|
|
43
|
+
throw new Error(error.message);
|
|
44
|
+
}
|
|
45
|
+
return token;
|
|
46
|
+
},
|
|
47
|
+
loadStripe() {
|
|
48
|
+
if (process.browser) {
|
|
49
|
+
if (!stripeStartLoaded) {
|
|
50
|
+
stripeStartLoaded = true;
|
|
51
|
+
let domElement = document.createElement('script');
|
|
52
|
+
domElement.setAttribute('src', 'https://js.stripe.com/v3/');
|
|
53
|
+
domElement.onload = () => {
|
|
54
|
+
this.loadedStripe = true;
|
|
55
|
+
};
|
|
56
|
+
domElement.onerror = () => {
|
|
57
|
+
setTimeout(() => this.loadStripe(), 1000);
|
|
58
|
+
};
|
|
59
|
+
document.body.appendChild(domElement);
|
|
60
|
+
} else {
|
|
61
|
+
let repeated = 0;
|
|
62
|
+
let timer = setInterval(() => {
|
|
63
|
+
if (typeof window.Stripe !== 'undefined' || repeated++ > 20) {
|
|
64
|
+
this.loadedStripe = true;
|
|
65
|
+
this.$emit('inited');
|
|
66
|
+
clearInterval(timer);
|
|
67
|
+
}
|
|
68
|
+
}, 500);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
</script>
|
|
@@ -28,52 +28,14 @@
|
|
|
28
28
|
v-show="!isVisibleChargeMessage"
|
|
29
29
|
class="lc_modal__content">
|
|
30
30
|
<div
|
|
31
|
-
v-if="
|
|
31
|
+
v-if="loadingCard"
|
|
32
32
|
class="lc_modal__spinner">
|
|
33
33
|
<spinner />
|
|
34
34
|
</div>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</div>
|
|
40
|
-
<div
|
|
41
|
-
id="errors_for_name"
|
|
42
|
-
class="error_message">
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
<div class="form-row">
|
|
46
|
-
<div
|
|
47
|
-
id="number"
|
|
48
|
-
class="PaymentModal__field-container">
|
|
49
|
-
</div>
|
|
50
|
-
<div
|
|
51
|
-
id="errors_for_number"
|
|
52
|
-
class="error_message">
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
<div class="form-row--cols">
|
|
56
|
-
<div class="form-col col-half">
|
|
57
|
-
<div
|
|
58
|
-
id="cvc"
|
|
59
|
-
class="PaymentModal__field-container">
|
|
60
|
-
</div>
|
|
61
|
-
<div
|
|
62
|
-
id="errors_for_cvc"
|
|
63
|
-
class="error_message">
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
<div class="form-col col-half">
|
|
67
|
-
<div
|
|
68
|
-
id="expiry"
|
|
69
|
-
class="PaymentModal__field-container">
|
|
70
|
-
</div>
|
|
71
|
-
<div
|
|
72
|
-
id="errors_for_expiry"
|
|
73
|
-
class="error_message">
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
35
|
+
<payment-card
|
|
36
|
+
ref="card"
|
|
37
|
+
:paymentData="orderData"
|
|
38
|
+
@inited="initedCard"/>
|
|
77
39
|
<div class="form-row PaymentModal__terms">
|
|
78
40
|
<label class="form-label PaymentModal__label-with-checkbox">
|
|
79
41
|
<checkbox v-model="agreeTermsAndCondition" />
|
|
@@ -118,15 +80,17 @@ import { mapGetters, mapActions, mapMutations } from 'vuex';
|
|
|
118
80
|
import { price } from '@lancom/shared/assets/js/utils/filters';
|
|
119
81
|
import gtm from '@lancom/shared/assets/js/utils/gtm';
|
|
120
82
|
import gapis from '@lancom/shared/assets/js/utils/gapis';
|
|
121
|
-
import PaymentSuccess from '@lancom/shared/components/
|
|
122
|
-
import PaymentFailed from '@lancom/shared/components/
|
|
83
|
+
import PaymentSuccess from '@lancom/shared/components/common/payment/payment_success/payment-success';
|
|
84
|
+
import PaymentFailed from '@lancom/shared/components/common/payment/payment_failed/payment-failed';
|
|
85
|
+
import PaymentCard from '@lancom/shared/components/common/payment/payment_card/payment-card';
|
|
123
86
|
|
|
124
87
|
export default {
|
|
125
88
|
name: 'PaymentModal',
|
|
126
89
|
filters: { price },
|
|
127
90
|
components: {
|
|
128
91
|
PaymentSuccess,
|
|
129
|
-
PaymentFailed
|
|
92
|
+
PaymentFailed,
|
|
93
|
+
PaymentCard
|
|
130
94
|
},
|
|
131
95
|
props: {
|
|
132
96
|
switchModal: {
|
|
@@ -140,7 +104,7 @@ export default {
|
|
|
140
104
|
data() {
|
|
141
105
|
return {
|
|
142
106
|
processing: false,
|
|
143
|
-
|
|
107
|
+
loadingCard: false,
|
|
144
108
|
form: {},
|
|
145
109
|
fields: null,
|
|
146
110
|
agreeTermsAndCondition: false,
|
|
@@ -149,7 +113,7 @@ export default {
|
|
|
149
113
|
};
|
|
150
114
|
},
|
|
151
115
|
computed: {
|
|
152
|
-
...mapGetters(['shop']),
|
|
116
|
+
...mapGetters(['shop', 'country', 'payment']),
|
|
153
117
|
...mapGetters('order', ['orderData']),
|
|
154
118
|
isVisibleChargeMessage() {
|
|
155
119
|
return this.isSuccessOrderCharge || this.isFailedOrderCharge;
|
|
@@ -163,14 +127,13 @@ export default {
|
|
|
163
127
|
return (charge && !charge.success) || this.errorMessage;
|
|
164
128
|
},
|
|
165
129
|
disaledBack() {
|
|
166
|
-
return this.
|
|
130
|
+
return this.loadingCard || this.processing;
|
|
167
131
|
},
|
|
168
132
|
disaledSubmit() {
|
|
169
|
-
return this.
|
|
133
|
+
return this.loadingCard || this.processing || !this.agreeTermsAndCondition || !this.confirmCopyright;
|
|
170
134
|
}
|
|
171
135
|
},
|
|
172
136
|
mounted() {
|
|
173
|
-
this.initHostedPayment();
|
|
174
137
|
if (this.orderData.test) {
|
|
175
138
|
this.clearCart();
|
|
176
139
|
this.clearTemplate();
|
|
@@ -188,46 +151,8 @@ export default {
|
|
|
188
151
|
...mapActions('cart', ['clearCart']),
|
|
189
152
|
...mapMutations('product', ['clearTemplate']),
|
|
190
153
|
...mapMutations('layers', ['resetLayers']),
|
|
191
|
-
|
|
192
|
-
this.
|
|
193
|
-
this.fields = window.HostedFields.create({
|
|
194
|
-
sandbox: process.env.IS_PROD !== 'true',
|
|
195
|
-
styles: {
|
|
196
|
-
input: {
|
|
197
|
-
'font-size': '16px',
|
|
198
|
-
'font-family': 'helvetica, tahoma, calibri, sans-serif',
|
|
199
|
-
color: '#3a3a3a'
|
|
200
|
-
},
|
|
201
|
-
'.hosted-fields-invalid:not(:focus)': {
|
|
202
|
-
color: 'red'
|
|
203
|
-
},
|
|
204
|
-
'input::placeholder': {
|
|
205
|
-
color: '#B0B0BA'
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
fields: {
|
|
209
|
-
name: {
|
|
210
|
-
selector: '#name',
|
|
211
|
-
placeholder: 'Full Name'
|
|
212
|
-
},
|
|
213
|
-
number: {
|
|
214
|
-
selector: '#number',
|
|
215
|
-
placeholder: 'Card Number'
|
|
216
|
-
},
|
|
217
|
-
cvc: {
|
|
218
|
-
selector: '#cvc',
|
|
219
|
-
placeholder: 'CVC'
|
|
220
|
-
},
|
|
221
|
-
expiry: {
|
|
222
|
-
selector: '#expiry',
|
|
223
|
-
placeholder: 'MM/YY'
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
this.fields.on('ready', () => {
|
|
229
|
-
this.loadingFields = false;
|
|
230
|
-
});
|
|
154
|
+
initedCard() {
|
|
155
|
+
this.loadingCard = true;
|
|
231
156
|
},
|
|
232
157
|
handleErrors(err) {
|
|
233
158
|
// err.messages.forEach(({ message }) => this.$toastr.e(message));
|
|
@@ -236,7 +161,7 @@ export default {
|
|
|
236
161
|
},
|
|
237
162
|
async proceedPayment(card) {
|
|
238
163
|
try {
|
|
239
|
-
const data = { card, shop: this.shop._id };
|
|
164
|
+
const data = { card, shop: this.shop._id, country: this.country?._id, payment: this.payment };
|
|
240
165
|
await this.submitPayment(data);
|
|
241
166
|
this.clearCart();
|
|
242
167
|
this.clearTemplate();
|
|
@@ -264,31 +189,16 @@ export default {
|
|
|
264
189
|
this.deleteOrder();
|
|
265
190
|
this.switchModal('showOrderModal');
|
|
266
191
|
},
|
|
267
|
-
submit() {
|
|
192
|
+
async submit() {
|
|
268
193
|
this.processing = true;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
address_country: this.orderData.country
|
|
278
|
-
},
|
|
279
|
-
(err, response) => {
|
|
280
|
-
if (!this.processing) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if (err) {
|
|
285
|
-
this.handleErrors(err);
|
|
286
|
-
this.processing = false;
|
|
287
|
-
} else {
|
|
288
|
-
this.proceedPayment(response);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
);
|
|
194
|
+
try {
|
|
195
|
+
const response = await this.$refs.card.tokenize();
|
|
196
|
+
this.proceedPayment(response);
|
|
197
|
+
} catch (e) {
|
|
198
|
+
this.handleErrors(e);
|
|
199
|
+
} finally {
|
|
200
|
+
this.processing = false;
|
|
201
|
+
}
|
|
292
202
|
},
|
|
293
203
|
clearFailedCharge() {
|
|
294
204
|
this.errorMessage = null;
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
<script>
|
|
52
52
|
import { mapGetters } from 'vuex';
|
|
53
53
|
import api from '@lancom/shared/assets/js/api';
|
|
54
|
-
import PaymentCart from '@lancom/shared/components/
|
|
55
|
-
import PaymentSuccess from '@lancom/shared/components/
|
|
54
|
+
import PaymentCart from '@lancom/shared/components/common/payment/payment_card/pinpayment/pinpayment';
|
|
55
|
+
import PaymentSuccess from '@lancom/shared/components/common/payment/payment_success/payment-success';
|
|
56
56
|
|
|
57
57
|
export default {
|
|
58
58
|
name: 'OrderPayment',
|
|
@@ -77,7 +77,7 @@ export default {
|
|
|
77
77
|
};
|
|
78
78
|
},
|
|
79
79
|
computed: {
|
|
80
|
-
...mapGetters(['shop']),
|
|
80
|
+
...mapGetters(['shop', 'country', 'payment']),
|
|
81
81
|
model() {
|
|
82
82
|
return this.invoice || this.order;
|
|
83
83
|
}
|
|
@@ -94,8 +94,9 @@ export default {
|
|
|
94
94
|
this.processing = true;
|
|
95
95
|
const card = await this.$refs.paymentCart.tokenize();
|
|
96
96
|
if (card) {
|
|
97
|
-
const { _id:
|
|
98
|
-
const {
|
|
97
|
+
const { _id: invoice } = this.invoice || {};
|
|
98
|
+
const payload = { invoice, card, shop: this.shop._id, country: this.country?._id, payment: this.payment };
|
|
99
|
+
const { paid } = await api.createOrderPayment(this.order._id, payload);
|
|
99
100
|
this.model.paid = paid;
|
|
100
101
|
}
|
|
101
102
|
} catch (e) {
|
|
@@ -48,7 +48,9 @@ import ProductFabricAndSizeInfo from './layouts/product_fabric_and_size_info/pro
|
|
|
48
48
|
import ProductPackaging from './layouts/product_packaging/product-packaging';
|
|
49
49
|
import ProductModelMeasurements from './layouts/product_model_measurements/product-model-measurements';
|
|
50
50
|
import ProductSizeTable from './layouts/product_size_table/product-size-table';
|
|
51
|
-
|
|
51
|
+
import RelatedProducts from '@lancom/shared/components/product/related_products/related-products';
|
|
52
|
+
import Gallery from '@lancom/shared/components/product/gallery/gallery';
|
|
53
|
+
|
|
52
54
|
// import ProductLabelsCustomization from './layouts/product_labels_customization/product-labels-customization';
|
|
53
55
|
|
|
54
56
|
export default {
|
|
@@ -61,8 +63,8 @@ export default {
|
|
|
61
63
|
ProductPackaging,
|
|
62
64
|
ProductModelMeasurements,
|
|
63
65
|
ProductSizeTable,
|
|
64
|
-
RelatedProducts
|
|
65
|
-
Gallery
|
|
66
|
+
RelatedProducts,
|
|
67
|
+
Gallery
|
|
66
68
|
// ProductLabelsCustomization
|
|
67
69
|
},
|
|
68
70
|
computed: {
|
package/mixins/payment.js
CHANGED
|
@@ -16,7 +16,7 @@ export default {
|
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
18
|
computed: {
|
|
19
|
-
...mapGetters(['shop']),
|
|
19
|
+
...mapGetters(['shop', 'country', 'payment']),
|
|
20
20
|
...mapGetters('order', ['orderData', 'card']),
|
|
21
21
|
isVisibleChargeMessage() {
|
|
22
22
|
return this.isSuccessOrderCharge || this.isFailedOrderCharge;
|
|
@@ -44,7 +44,7 @@ export default {
|
|
|
44
44
|
async proceedPayment(card) {
|
|
45
45
|
try {
|
|
46
46
|
this.clearFailedCharge();
|
|
47
|
-
const data = { card, shop: this.shop._id };
|
|
47
|
+
const data = { card, shop: this.shop._id, country: this.country, payment: this.payment };
|
|
48
48
|
await this.submitPayment(data);
|
|
49
49
|
this.onOrderSucces();
|
|
50
50
|
} catch (e) {
|
package/nuxt.config.js
CHANGED
|
@@ -89,6 +89,11 @@ module.exports = (config, axios, { raygunClient, publicPath } = {}) => ({
|
|
|
89
89
|
STATIC_URL: process.env.STATIC_URL
|
|
90
90
|
},
|
|
91
91
|
build: {
|
|
92
|
+
splitChunks: {
|
|
93
|
+
layouts: false,
|
|
94
|
+
pages: false,
|
|
95
|
+
commons: false
|
|
96
|
+
},
|
|
92
97
|
publicPath: publicPath || '/client/',
|
|
93
98
|
postcss: null,
|
|
94
99
|
transpile: [
|
|
@@ -152,10 +157,10 @@ module.exports = (config, axios, { raygunClient, publicPath } = {}) => ({
|
|
|
152
157
|
title: { _text: product.name },
|
|
153
158
|
content: { _text: review.text },
|
|
154
159
|
pros: {
|
|
155
|
-
pro:
|
|
160
|
+
pro: (review.pro || '').split(/\n/).map(pro => ({ _text: pro }))
|
|
156
161
|
},
|
|
157
162
|
cons: {
|
|
158
|
-
con:
|
|
163
|
+
con: (review.cons || '').split(/\n/).map(cons => ({ _text: cons }))
|
|
159
164
|
},
|
|
160
165
|
review_url: {
|
|
161
166
|
_attributes: {
|
|
@@ -275,11 +280,19 @@ module.exports = (config, axios, { raygunClient, publicPath } = {}) => ({
|
|
|
275
280
|
'g:is_bundle': { _text: product.prePrint ? 'yes' : 'no' },
|
|
276
281
|
'g:identifier_exists': sp.gtin ? 'yes' : 'no',
|
|
277
282
|
'g:product_weight': { _text: `${product.weight} kg` },
|
|
278
|
-
'g:shipping_weight': { _text: `${((product.weight || 0) + (product.weight || 0) * 0.05).toFixed(3)} kg` }
|
|
283
|
+
'g:shipping_weight': { _text: `${((product.weight || 0) + (product.weight || 0) * 0.05).toFixed(3)} kg` },
|
|
284
|
+
'g:quantity': { _text: sp.quantityStock },
|
|
285
|
+
'g:pickup_method': { _text: 'buy' },
|
|
286
|
+
'g:pickup_sla': { _text: 'next day' }
|
|
279
287
|
};
|
|
288
|
+
|
|
280
289
|
if (sp.gtin) {
|
|
281
290
|
info['g:gtin'] = { _text: sp.gtin || '' };
|
|
282
291
|
}
|
|
292
|
+
|
|
293
|
+
if (sp.storeCode) {
|
|
294
|
+
info['g:store_code'] = { _text: sp.storeCode };
|
|
295
|
+
}
|
|
283
296
|
if (product.volume) {
|
|
284
297
|
if (product.volume.length) {
|
|
285
298
|
info['g:shipping_length'] = { _text: `${product.volume.length} cm` };
|
package/package.json
CHANGED
package/store/index.js
CHANGED
|
@@ -6,6 +6,7 @@ const CLOSED_NOTIFICATION = 'lancom-closed-notification-1.0';
|
|
|
6
6
|
export const state = () => ({
|
|
7
7
|
country: null,
|
|
8
8
|
currency: null,
|
|
9
|
+
payment: null,
|
|
9
10
|
shop: {},
|
|
10
11
|
menus: [],
|
|
11
12
|
contacts: {},
|
|
@@ -23,6 +24,7 @@ export const getters = {
|
|
|
23
24
|
currency: ({ currency }) => currency,
|
|
24
25
|
currencies: ({ shop }) => (shop.countries || []).reduce((currencies, { country }) => [...currencies, country?.currency], []).filter(c => !!c),
|
|
25
26
|
shop: ({ shop }) => shop || {},
|
|
27
|
+
payment: ({ payment }) => payment || {},
|
|
26
28
|
menus: ({ menus }) => menus || [],
|
|
27
29
|
topMenu: ({ menus }) => (menus || []).find(({ type }) => type === 'top'),
|
|
28
30
|
footerMenus: ({ menus }) => (menus || []).filter(({ type }) => type === 'footer'),
|
|
@@ -52,6 +54,21 @@ export const actions = {
|
|
|
52
54
|
const settings = await api.fetchClientSettings(shop._id, params);
|
|
53
55
|
commit('setCountry', settings.country);
|
|
54
56
|
commit('setCurrency', settings.currency);
|
|
57
|
+
|
|
58
|
+
if (process.env.PINPAYMENT_PUBLISHABLE_API_KEY) {
|
|
59
|
+
commit('setPayment', {
|
|
60
|
+
type: 'pinpayment',
|
|
61
|
+
clientKey: process.env.PINPAYMENT_PUBLISHABLE_API_KEY
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
const countrySettings = (shop.countries || []).find(c => c.country?._id === settings.country?._id) || { settings: [] };
|
|
65
|
+
const countrySetting = countrySettings.settings.find(s => !!s.settings.app.STRIPE_PUBLIC_KEY);
|
|
66
|
+
commit('setPayment', {
|
|
67
|
+
type: 'stripe',
|
|
68
|
+
clientKey: countrySetting.settings.app.STRIPE_PUBLIC_KEY
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
55
72
|
// }
|
|
56
73
|
try {
|
|
57
74
|
if (req.headers.cookie) {
|
|
@@ -99,6 +116,9 @@ export const actions = {
|
|
|
99
116
|
};
|
|
100
117
|
|
|
101
118
|
export const mutations = {
|
|
119
|
+
setPayment(state, payment) {
|
|
120
|
+
state.payment = payment;
|
|
121
|
+
},
|
|
102
122
|
setCountry(state, country) {
|
|
103
123
|
state.country = country;
|
|
104
124
|
},
|
package/store/order.js
CHANGED
|
@@ -19,9 +19,10 @@ export const actions = {
|
|
|
19
19
|
const response = await api.createOrder(order, shop);
|
|
20
20
|
commit('setOrderData', response);
|
|
21
21
|
},
|
|
22
|
-
async submitPayment({ commit, state: { orderData } }, { card, shop }) {
|
|
22
|
+
async submitPayment({ commit, state: { orderData } }, { card, payment, country, shop }) {
|
|
23
23
|
const { _id } = orderData || {};
|
|
24
|
-
|
|
24
|
+
debugger;
|
|
25
|
+
const response = await api.createOrderPayment(_id, { card, shop, country, payment });
|
|
25
26
|
commit('setOrderData', response);
|
|
26
27
|
return {};
|
|
27
28
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|