@lancom/shared 0.0.319 → 0.0.321
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.
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<progress-steps-controls
|
|
68
68
|
class="OrderPaymentInformation__controls"
|
|
69
69
|
:disabled-prev="creating"
|
|
70
|
-
:disabled-next="creating"
|
|
70
|
+
:disabled-next="loadingCard || creating || submitting"
|
|
71
71
|
label-next="MAKE PAYMENT"
|
|
72
72
|
@prev="$emit('prev')"
|
|
73
73
|
@next="submit" />
|
|
@@ -106,6 +106,7 @@ export default {
|
|
|
106
106
|
return {
|
|
107
107
|
initing: false,
|
|
108
108
|
creating: false,
|
|
109
|
+
submitting: false,
|
|
109
110
|
loadingCard: true,
|
|
110
111
|
isDepositPayment: this.order.paymentMethod === ORDER_PAYMENT_METHOD.DEPOSIT
|
|
111
112
|
};
|
|
@@ -163,7 +164,7 @@ export default {
|
|
|
163
164
|
}).join('</p><p>')}</p>`;
|
|
164
165
|
},
|
|
165
166
|
async submit() {
|
|
166
|
-
this.
|
|
167
|
+
this.submitting = true;
|
|
167
168
|
this.errorMessage = null;
|
|
168
169
|
|
|
169
170
|
const orderInfo = this.orderData || generateOrderData(this.order, this.entities, this.cartPricing);
|
|
@@ -186,6 +187,7 @@ export default {
|
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
this.creating = false;
|
|
190
|
+
this.submitting = false;
|
|
189
191
|
// this.$emit('next');
|
|
190
192
|
},
|
|
191
193
|
async submitOrder() {
|
|
@@ -86,7 +86,8 @@
|
|
|
86
86
|
</template>
|
|
87
87
|
|
|
88
88
|
<script>
|
|
89
|
-
let
|
|
89
|
+
let timer = null;
|
|
90
|
+
let pinpaymentStartLoaded = false;
|
|
90
91
|
|
|
91
92
|
export default {
|
|
92
93
|
name: 'Payment',
|
|
@@ -113,7 +114,7 @@ export default {
|
|
|
113
114
|
async mounted() {
|
|
114
115
|
this.loading = true;
|
|
115
116
|
|
|
116
|
-
await this.
|
|
117
|
+
await this.loadPinpayments();
|
|
117
118
|
|
|
118
119
|
if (window.HostedFields) {
|
|
119
120
|
await this.initHostedPayment();
|
|
@@ -125,6 +126,9 @@ export default {
|
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
},
|
|
129
|
+
destroyed() {
|
|
130
|
+
clearInterval(timer);
|
|
131
|
+
},
|
|
128
132
|
methods: {
|
|
129
133
|
initHostedPayment() {
|
|
130
134
|
this.fields = window.HostedFields.create({
|
|
@@ -201,30 +205,33 @@ export default {
|
|
|
201
205
|
);
|
|
202
206
|
});
|
|
203
207
|
},
|
|
204
|
-
async
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
208
|
+
async loadPinpayments() {
|
|
209
|
+
if (process.browser) {
|
|
210
|
+
await (new Promise((resolve, reject) => {
|
|
211
|
+
if (!pinpaymentStartLoaded) {
|
|
212
|
+
pinpaymentStartLoaded = true;
|
|
213
|
+
let domElement = document.createElement('script');
|
|
214
|
+
domElement.type = "text/javascript";
|
|
215
|
+
domElement.setAttribute('src', 'https://cdn.pinpayments.com/pin.hosted_fields.v1.js');
|
|
216
|
+
domElement.onload = () => {
|
|
217
|
+
resolve();
|
|
218
|
+
};
|
|
219
|
+
domElement.onerror = () => {
|
|
220
|
+
setTimeout(() => this.loadPinpayments(), 1000);
|
|
221
|
+
};
|
|
222
|
+
document.body.appendChild(domElement);
|
|
223
|
+
} else {
|
|
224
|
+
let repeated = 0;
|
|
225
|
+
timer = setInterval(() => {
|
|
226
|
+
if (!!window.HostedFields || repeated++ > 40) {
|
|
227
|
+
clearInterval(timer);
|
|
228
|
+
resolve();
|
|
213
229
|
}
|
|
214
|
-
},
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
loadPinpayments() {
|
|
219
|
-
return new Promise((resolve) => {
|
|
220
|
-
const script = document.createElement('script');
|
|
221
|
-
script.type = "text/javascript";
|
|
222
|
-
script.src = 'https://cdn.pinpayments.com/pin.hosted_fields.v1.js';
|
|
223
|
-
script.onload = () => resolve();
|
|
224
|
-
const body = document.getElementsByTagName('body')[0];
|
|
225
|
-
body.appendChild(script);
|
|
226
|
-
});
|
|
230
|
+
}, 500);
|
|
231
|
+
}
|
|
232
|
+
}));
|
|
227
233
|
}
|
|
234
|
+
}
|
|
228
235
|
}
|
|
229
236
|
};
|
|
230
237
|
</script>
|
|
@@ -9,6 +9,7 @@ import api from '@lancom/shared/assets/js/api';
|
|
|
9
9
|
import { mapGetters } from 'vuex';
|
|
10
10
|
|
|
11
11
|
let stripeStartLoaded = false;
|
|
12
|
+
let timer = null;
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
name: 'PaymentStripePayment',
|
|
@@ -35,9 +36,12 @@ export default {
|
|
|
35
36
|
return this.payment.clientKey;
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
|
-
|
|
39
|
+
mounted() {
|
|
39
40
|
this.loadStripe();
|
|
40
41
|
},
|
|
42
|
+
destroyed() {
|
|
43
|
+
clearInterval(timer);
|
|
44
|
+
},
|
|
41
45
|
methods: {
|
|
42
46
|
async tokenize() {
|
|
43
47
|
if (this.paymentIntent) {
|
|
@@ -73,9 +77,8 @@ export default {
|
|
|
73
77
|
};
|
|
74
78
|
document.body.appendChild(domElement);
|
|
75
79
|
} else {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (typeof window.Stripe !== 'undefined' || repeated++ > 20) {
|
|
80
|
+
timer = setInterval(() => {
|
|
81
|
+
if (typeof window.Stripe !== 'undefined') {
|
|
79
82
|
this.onLoaded();
|
|
80
83
|
clearInterval(timer);
|
|
81
84
|
}
|