orderiom-api-package 0.4.88 → 0.4.90
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/package.json +1 -1
- package/src/common.js +3 -3
- package/src/modules/order.js +34 -22
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -113,10 +113,10 @@ export function formatTime(date){
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export function isTokenExpired(token) {
|
|
116
|
-
const base64Url = token.split(".")[1];
|
|
117
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
118
|
-
|
|
119
116
|
try{
|
|
117
|
+
const base64Url = token.split(".")[1];
|
|
118
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
119
|
+
|
|
120
120
|
const jsonPayload = decodeURIComponent(
|
|
121
121
|
atob(base64)
|
|
122
122
|
.split("")
|
package/src/modules/order.js
CHANGED
|
@@ -603,31 +603,43 @@ const actions = {
|
|
|
603
603
|
commit("product/setDeliveryTime", "", {root: true});
|
|
604
604
|
commit("product/SetTotalPrice", "0.00", {root: true});
|
|
605
605
|
|
|
606
|
-
|
|
607
|
-
(
|
|
608
|
-
res.data.data.paymentLink.includes("/paymentstatus/?") ||
|
|
609
|
-
res.data.data.paymentLink.includes("/paymentstatus?")
|
|
610
|
-
) &&
|
|
611
|
-
data.$router &&
|
|
612
|
-
data.routeName
|
|
613
|
-
) {
|
|
614
|
-
data.$router.push({
|
|
615
|
-
name: data.routeName,
|
|
616
|
-
query: res.data.data.paymentLink
|
|
617
|
-
.split("?")[1]
|
|
618
|
-
.split("&")
|
|
619
|
-
.map((query) => query.split("="))
|
|
620
|
-
.reduce((result, element) => {
|
|
621
|
-
if (!element) return result;
|
|
622
|
-
result[element[0]] = element[1];
|
|
623
|
-
return result;
|
|
624
|
-
}, {}),
|
|
625
|
-
});
|
|
626
|
-
} else {
|
|
606
|
+
const classicRedirect = (res) => {
|
|
627
607
|
window.location = res.data.data.paymentLink;
|
|
608
|
+
return res;
|
|
628
609
|
}
|
|
629
610
|
|
|
630
|
-
return res;
|
|
611
|
+
if(!data.$router || !data.routeName) return classicRedirect(res);
|
|
612
|
+
|
|
613
|
+
// find route name for vue-router
|
|
614
|
+
let name = null;
|
|
615
|
+
if(
|
|
616
|
+
res.data.data.paymentLink.includes("/paymentstatus/?") ||
|
|
617
|
+
res.data.data.paymentLink.includes("/paymentstatus?")
|
|
618
|
+
){
|
|
619
|
+
// Check string data.routeName to ensure backward compatibility
|
|
620
|
+
name = typeof data.routeName === 'string' ? data.routeName : data.routeName['paymentstatus']
|
|
621
|
+
}else if(
|
|
622
|
+
res.data.data.paymentLink.includes("/payment/?") ||
|
|
623
|
+
res.data.data.paymentLink.includes("/payment?")
|
|
624
|
+
){
|
|
625
|
+
// Check string data.routeName to ensure backward compatibility
|
|
626
|
+
name = typeof data.routeName === 'string' ? null : data.routeName['payment']
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
if(!name) return classicRedirect(res);
|
|
630
|
+
|
|
631
|
+
data.$router.push({
|
|
632
|
+
name,
|
|
633
|
+
query: res.data.data.paymentLink
|
|
634
|
+
.split("?")[1]
|
|
635
|
+
.split("&")
|
|
636
|
+
.map((query) => query.split("="))
|
|
637
|
+
.reduce((result, element) => {
|
|
638
|
+
if (!element) return result;
|
|
639
|
+
result[element[0]] = element[1];
|
|
640
|
+
return result;
|
|
641
|
+
}, {}),
|
|
642
|
+
});
|
|
631
643
|
}).catch(error => {
|
|
632
644
|
const status = error.response ? error.response.status : null;
|
|
633
645
|
if (status === 422) {
|