@salla.sa/applepay 2.13.91 → 2.13.92
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 +2 -2
- package/src/index.js +11 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/applepay",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.92",
|
|
4
4
|
"description": "Salla Apple Pay light",
|
|
5
5
|
"main": "dist/app.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"axios": "^0.23.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "aac7e64cd183dea2fc6ad51732a40eb5248fef9d"
|
|
30
30
|
}
|
package/src/index.js
CHANGED
|
@@ -141,9 +141,19 @@ window.SallaApplePay = {
|
|
|
141
141
|
SallaApplePay.session.onpaymentauthorized = SallaApplePay.onPaymentAuthorized;
|
|
142
142
|
SallaApplePay.session.oncancel = SallaApplePay.onCancel;
|
|
143
143
|
SallaApplePay.session.oncouponcodechanged = SallaApplePay.oncouponcodechanged;
|
|
144
|
+
SallaApplePay.session.onpaymentmethodselected = SallaApplePay.onpaymentmethodselected;
|
|
144
145
|
|
|
145
146
|
SallaApplePay.session.begin();
|
|
146
147
|
},
|
|
148
|
+
async onpaymentmethodselected(event) {
|
|
149
|
+
await SallaApplePay.recalculateTotal();
|
|
150
|
+
const updatedPaymentDetails = {
|
|
151
|
+
newTotal: SallaApplePay.prepareTotal(),
|
|
152
|
+
newLineItems: SallaApplePay.prepareLineItems(),
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
SallaApplePay.session.completePaymentMethodSelection(updatedPaymentDetails);
|
|
156
|
+
},
|
|
147
157
|
|
|
148
158
|
oncouponcodechanged(event) {
|
|
149
159
|
Salla.event.dispatch('payments::apple-pay.coupon.change', event);
|
|
@@ -245,12 +255,7 @@ window.SallaApplePay = {
|
|
|
245
255
|
Salla.event.dispatch('payments::apple-pay.validate-merchant.success', data);
|
|
246
256
|
|
|
247
257
|
// Define a function to handle the completion of merchant validation
|
|
248
|
-
const completeMerchantValidation =
|
|
249
|
-
try {
|
|
250
|
-
await SallaApplePay.recalculateTotal();
|
|
251
|
-
} catch (error) {
|
|
252
|
-
salla.logger.warn('🍏 Pay: Failed recalculate total', error);
|
|
253
|
-
}
|
|
258
|
+
const completeMerchantValidation = (responseData) => {
|
|
254
259
|
SallaApplePay.session.completeMerchantValidation(responseData);
|
|
255
260
|
};
|
|
256
261
|
|