Skip to content

Commit

Permalink
[FIX] Call default method so that mixings can take effect
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k3lm committed Jul 9, 2018
1 parent 75da707 commit ee95081
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 41 deletions.
46 changes: 6 additions & 40 deletions view/frontend/web/js/action/set-payment-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@ define(
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'mage/url',
'mage/storage',
'Magento_Checkout/js/model/error-processor',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/full-screen-loader'
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/action/set-payment-information'
],
function ($, quote, urlBuilder, url, storage, errorProcessor, customer, fullScreenLoader) {
function ($, quote, urlBuilder, storage, errorProcessor, fullScreenLoader, setPaymentInformation) {
'use strict';

return function (messageContainer) {
var serviceUrl,
payload,
method = 'put',
paymentData = quote.paymentMethod(),
ShowSequraForm = function () {
if (typeof window.SequraFormInstance === 'undefined') {
setTimeout(ShowSequraForm, 100);
Expand All @@ -33,33 +29,9 @@ define(
window.SequraFormInstance.show();
};

/**
* Checkout for guest and registered customer.
*/
if (!customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
cartId: quote.getQuoteId()
});
payload = {
cartId: quote.getQuoteId(),
email: quote.guestEmail,
paymentMethod: paymentData
};
method = 'post';
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/selected-payment-method', {});
payload = {
cartId: quote.getQuoteId(),
method: paymentData
};
}
fullScreenLoader.startLoader();

return storage[method](
serviceUrl, JSON.stringify(payload)
).done(
return setPaymentInformation(messageContainer, quote.paymentMethod()).done(
function () {
serviceUrl = urlBuilder.createUrl('/sequra_core/Submission',{});
serviceUrl = urlBuilder.createUrl('/sequra_core/Submission', {});
storage.get(serviceUrl).done(
function (response) {
$('[id^="sq-identification"]').remove();
Expand All @@ -72,13 +44,7 @@ define(
fullScreenLoader.stopLoader();
}
);
}
).fail(
function (response) {
errorProcessor.process(response, messageContainer);
fullScreenLoader.stopLoader();
}
);
});
};
}
);
2 changes: 1 addition & 1 deletion view/frontend/web/template/payment/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</div>
<div class="checkout-agreements-block">
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div class="actions-toolbar">
Expand Down

0 comments on commit ee95081

Please sign in to comment.