Skip to content

Commit

Permalink
Merge branch 'develop' into bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Logvin committed Aug 14, 2015
2 parents 2987481 + ddd2dd4 commit f04367c
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/
namespace Magento\Checkout\Api;

/**
* Interface for managing guest payment information
* @api
*/
interface GuestPaymentInformationManagementInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/
namespace Magento\Checkout\Api;

/**
* Interface for managing guest shipping address information
* @api
*/
interface GuestShippingInformationManagementInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/
namespace Magento\Checkout\Api;

/**
* Interface for managing quote payment information
* @api
*/
interface PaymentInformationManagementInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/
namespace Magento\Checkout\Api;

/**
* Interface for managing customer shipping address information
* @api
*/
interface ShippingInformationManagementInterface
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
define(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'mage/storage',
Expand All @@ -12,13 +13,13 @@ define(
'Magento_Checkout/js/model/payment/method-converter',
'Magento_Checkout/js/model/payment-service'
],
function (quote, urlBuilder, storage, errorProcessor, customer, methodConverter, paymentService) {
function ($, quote, urlBuilder, storage, errorProcessor, customer, methodConverter, paymentService) {
'use strict';

return function () {
var serviceUrl,
payload;
return function (deferred) {
var serviceUrl;

deferred = deferred || $.Deferred();
/**
* Checkout for guest and registered customer.
*/
Expand All @@ -29,19 +30,19 @@ define(
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/payment-information', {});
}
payload = {
cartId: quote.getQuoteId()
};

return storage.get(
serviceUrl, JSON.stringify(payload)
serviceUrl, false
).done(
function (response) {
quote.setTotals(response.totals);
paymentService.setPaymentMethods(methodConverter(response.payment_methods));
deferred.resolve();
}
).fail(
function (response) {
errorProcessor.process(response);
deferred.reject();
}
);
};
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Checkout/view/frontend/web/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ define([
};
events['click ' + this.options.item.button] = function(event) {
event.stopPropagation();
self._updateItemQty($(event.target));
self._updateItemQty($(event.currentTarget));
};

this._on(this.element, events);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See COPYING.txt for license details.
*/
-->
<li id="opc-payment" role="presentation" class="checkout-payment-method" data-bind="fadeVisible: isVisible">
<li id="payment" role="presentation" class="checkout-payment-method" data-bind="fadeVisible: isVisible">
<div class="step-title" data-bind="i18n: title" data-role="title"></div>
<div id="checkout-step-payment"
class="step-content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* See COPYING.txt for license details.
*/
-->
<li id="opc-shipping" class="checkout-shipping-address" data-bind="fadeVisible: visible()">
<li id="shipping" class="checkout-shipping-address" data-bind="fadeVisible: visible()">
<div class="step-title" data-bind="i18n: 'Shipping Address'" data-role="title"></div>
<div id="checkout-step-shipping"
class="step-content"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,50 @@
/*global define,alert*/
define(
[
'ko',
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/resource-url-manager',
'Magento_Checkout/js/model/payment-service',
'Magento_Checkout/js/model/error-processor',
'Magento_Ui/js/model/messageList',
'mage/storage',
'Magento_Checkout/js/action/get-totals',
'Magento_Checkout/js/action/get-payment-information',
'Magento_Checkout/js/model/totals',
'mage/translate'
],
function (ko, $, quote, urlManager, paymentService, errorProcessor, messageList, storage, getTotalsAction, $t) {
function ($, quote, urlManager, errorProcessor, messageList, storage, getPaymentInformationAction, totals, $t) {
'use strict';

return function (isApplied, isLoading) {
var quoteId = quote.getQuoteId();
var url = urlManager.getCancelCouponUrl(quoteId);
var message = $t('Your coupon was successfully removed');
var quoteId = quote.getQuoteId(),
url = urlManager.getCancelCouponUrl(quoteId),
message = $t('Your coupon was successfully removed');
messageList.clear();

return storage.delete(
url,
false
).done(
function (response) {
function () {
var deferred = $.Deferred();
isLoading(false);
getTotalsAction([], deferred);
$.when(deferred).done(function() {
totals.isLoading(true);
getPaymentInformationAction(deferred);
$.when(deferred).done(function () {
isApplied(false);
paymentService.setPaymentMethods(
paymentService.getAvailablePaymentMethods()
);
totals.isLoading(false);
});
messageList.addSuccessMessage({
'message': message
});
messageList.addSuccessMessage({'message': message});
}
).fail(
function (response) {
isLoading(false);
totals.isLoading(false);
errorProcessor.process(response);
}
).always(
function () {
isLoading(false);
}
);
};
}
Expand Down

0 comments on commit f04367c

Please sign in to comment.