Skip to content

Commit

Permalink
MAGETWO-54362: [Github] Stop screen loader on payment error #3749
Browse files Browse the repository at this point in the history
  • Loading branch information
irenelagno committed Aug 9, 2016
2 parents 2bf419c + 39ec4d4 commit 2f9ecce
Showing 1 changed file with 72 additions and 71 deletions.
143 changes: 72 additions & 71 deletions app/code/Magento/Checkout/view/frontend/web/js/model/quote.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,77 +2,78 @@
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
['ko'],
function (ko) {
'use strict';
var billingAddress = ko.observable(null);
var shippingAddress = ko.observable(null);
var shippingMethod = ko.observable(null);
var paymentMethod = ko.observable(null);
var quoteData = window.checkoutConfig.quoteData;
var basePriceFormat = window.checkoutConfig.basePriceFormat;
var priceFormat = window.checkoutConfig.priceFormat;
var storeCode = window.checkoutConfig.storeCode;
var totalsData = window.checkoutConfig.totalsData;
var totals = ko.observable(totalsData);
var collectedTotals = ko.observable({});
return {
totals: totals,
shippingAddress: shippingAddress,
shippingMethod: shippingMethod,
billingAddress: billingAddress,
paymentMethod: paymentMethod,
guestEmail: null,
define([
'ko',
'underscore'
], function (ko, _) {
'use strict';

getQuoteId: function() {
return quoteData.entity_id;
},
isVirtual: function() {
return !!Number(quoteData.is_virtual);
},
getPriceFormat: function() {
return priceFormat;
},
getBasePriceFormat: function() {
return basePriceFormat;
},
getItems: function() {
return window.checkoutConfig.quoteItemData;
},
getTotals: function() {
return totals;
},
setTotals: function(totalsData) {
if (_.isObject(totalsData) && _.isObject(totalsData.extension_attributes)) {
_.each(totalsData.extension_attributes, function(element, index) {
totalsData[index] = element;
});
}
totals(totalsData);
this.setCollectedTotals('subtotal_with_discount', parseFloat(totalsData.subtotal_with_discount));
},
setPaymentMethod: function(paymentMethodCode) {
paymentMethod(paymentMethodCode);
},
getPaymentMethod: function() {
return paymentMethod;
},
getStoreCode: function() {
return storeCode;
},
setCollectedTotals: function(code, value) {
var totals = collectedTotals();
totals[code] = value;
collectedTotals(totals);
},
getCalculatedTotal: function() {
var total = 0.;
_.each(collectedTotals(), function(value) {
total += value;
var billingAddress = ko.observable(null);
var shippingAddress = ko.observable(null);
var shippingMethod = ko.observable(null);
var paymentMethod = ko.observable(null);
var quoteData = window.checkoutConfig.quoteData;
var basePriceFormat = window.checkoutConfig.basePriceFormat;
var priceFormat = window.checkoutConfig.priceFormat;
var storeCode = window.checkoutConfig.storeCode;
var totalsData = window.checkoutConfig.totalsData;
var totals = ko.observable(totalsData);
var collectedTotals = ko.observable({});
return {
totals: totals,
shippingAddress: shippingAddress,
shippingMethod: shippingMethod,
billingAddress: billingAddress,
paymentMethod: paymentMethod,
guestEmail: null,

getQuoteId: function() {
return quoteData.entity_id;
},
isVirtual: function() {
return !!Number(quoteData.is_virtual);
},
getPriceFormat: function() {
return priceFormat;
},
getBasePriceFormat: function() {
return basePriceFormat;
},
getItems: function() {
return window.checkoutConfig.quoteItemData;
},
getTotals: function() {
return totals;
},
setTotals: function(totalsData) {
if (_.isObject(totalsData) && _.isObject(totalsData.extension_attributes)) {
_.each(totalsData.extension_attributes, function(element, index) {
totalsData[index] = element;
});
return total;
}
};
}
);
totals(totalsData);
this.setCollectedTotals('subtotal_with_discount', parseFloat(totalsData.subtotal_with_discount));
},
setPaymentMethod: function(paymentMethodCode) {
paymentMethod(paymentMethodCode);
},
getPaymentMethod: function() {
return paymentMethod;
},
getStoreCode: function() {
return storeCode;
},
setCollectedTotals: function(code, value) {
var totals = collectedTotals();
totals[code] = value;
collectedTotals(totals);
},
getCalculatedTotal: function() {
var total = 0.;
_.each(collectedTotals(), function(value) {
total += value;
});
return total;
}
};
});

0 comments on commit 2f9ecce

Please sign in to comment.