Skip to content

Commit

Permalink
FireCheckout compatibility fix to save shipping address on single page (
Browse files Browse the repository at this point in the history
#152)

checkout for PayPal
  • Loading branch information
aashwin-rvvup authored Jul 30, 2024
1 parent 8c5ea6d commit aa4a595
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
27 changes: 17 additions & 10 deletions view/frontend/web/js/view/payment/method-renderer/rvvup-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ define([
'Magento_Ui/js/model/messageList',
'Magento_Customer/js/model/customer',
'Rvvup_Payments/js/view/payment/methods/rvvup-paypal',
'Magento_Checkout/js/action/set-shipping-information',
'domReady!'
], function (
Component,
Expand All @@ -49,6 +50,7 @@ define([
messageList,
customer,
rvvupPaypal,
setShippingInformation,
) {
'use strict';

Expand Down Expand Up @@ -368,17 +370,22 @@ define([
if(!rvvupPaypal.validate(self, additionalValidators)) {
return reject(createError);
}
setPaymentInformation(self.messageContainer, self.getData(), false).done(function () {
let saveShippingPromise = rvvupPaypal.shouldSaveShippingInformation() ? setShippingInformation() : $.Deferred().resolve();

saveShippingPromise
.then(function () {
return setPaymentInformation(self.messageContainer, self.getData(), false);
})
.then(function () {
return $.when(getOrderPaymentActions(self.messageContainer))
.done(function () {
return resolve();
}).fail(function () {
return reject(createError);
});
}).fail(function () {
loader.stopLoader();
return reject(createError);
})
})
.then(function () {
resolve();
})
.fail(function () {
loader.stopLoader();
return reject(createError);
});
}).then(() => {
loader.stopLoader();
return orderPaymentAction.getPaymentToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ define(['mage/utils/wrapper'], function (wrapper) {
return true;
}
);
target.shouldSaveShippingInformation = wrapper.wrapSuper(
target.shouldSaveShippingInformation,
function () {
if (fcModule === null) {
return false;
}
return !fcModule.layout.isMultistep();
}
)
} catch (e) {
}
return target;
Expand Down
4 changes: 4 additions & 0 deletions view/frontend/web/js/view/payment/methods/rvvup-paypal.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ define([], function () {
}

return main.isPlaceOrderActionAllowed() !== false;
},

shouldSaveShippingInformation: function () {
return false;
}
}
}();
Expand Down

0 comments on commit aa4a595

Please sign in to comment.