@infosoftas/s4-orders-js-sdk 0.1.0 → 0.1.2
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/.release-it.json
CHANGED
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -102,23 +102,8 @@ const App: FC<ConfigType> = ({
|
|
|
102
102
|
setFailedMsg('');
|
|
103
103
|
setErrorsMsg([]);
|
|
104
104
|
try {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (data.orderId) {
|
|
108
|
-
await handleOrderDelete(data.orderId);
|
|
109
|
-
}
|
|
110
|
-
} catch (error) {
|
|
111
|
-
console.log(error);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
setLoading(false);
|
|
115
|
-
setOrderId(null);
|
|
116
|
-
setOrderInfo(null);
|
|
117
|
-
setIframeSrc(null);
|
|
118
|
-
setIsConfirmed(false);
|
|
119
|
-
setShowOrderForm(true);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
105
|
+
// There is no way to detect the difference between "cancelled" and "accepted" payment for Vipps via UI
|
|
106
|
+
// Completing an order for cancelled payment is fine. The backend handles it correctly.
|
|
122
107
|
|
|
123
108
|
await orderComplete(orderId || data.orderId || '');
|
|
124
109
|
setIsConfirmed(true);
|
|
@@ -100,7 +100,10 @@ const OrderForm: FC<Props> = ({
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
if (!subscriberId) {
|
|
103
|
-
|
|
103
|
+
const sessionSubscriberId = sessionStorage.getItem('subscriberId');
|
|
104
|
+
if (sessionSubscriberId) {
|
|
105
|
+
subscriberId = sessionSubscriberId;
|
|
106
|
+
}
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
if (!userId) {
|
|
@@ -109,6 +109,8 @@ const useOrderForm = ({
|
|
|
109
109
|
});
|
|
110
110
|
id = response.id;
|
|
111
111
|
|
|
112
|
+
sessionStorage.setItem('subscriberId', id); // For avoiding attempt of creating subscriber again
|
|
113
|
+
|
|
112
114
|
if (userId && identityProviderId) {
|
|
113
115
|
await mapSubscriberToUser(id, {
|
|
114
116
|
userId: userId,
|