Skip to content

Commit

Permalink
Add a payload extender to the default shipping-save-processor
Browse files Browse the repository at this point in the history
This will allow third party extensions to modify the payload for the
shipping address selection process, with the goal being the easy
addition of extension_attributes with as few extension conflicts as
possible.

By separating this out into it's own model (as opposed to including it
in the result of the processor return), non-default processors will also
be able to utilize it.
  • Loading branch information
Navarr Barnier authored and Navarr Barnier committed Sep 22, 2017
1 parent ecefd85 commit 9fc22ff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ define([
'Magento_Checkout/js/model/payment/method-converter',
'Magento_Checkout/js/model/error-processor',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/action/select-billing-address'
'Magento_Checkout/js/action/select-billing-address',
'Magento_Checkout/js/model/shipping-save-processor/payload-extender'
], function (
ko,
quote,
Expand All @@ -22,7 +23,8 @@ define([
methodConverter,
errorProcessor,
fullScreenLoader,
selectBillingAddressAction
selectBillingAddressAction,
payloadExtender
) {
'use strict';

Expand All @@ -46,6 +48,8 @@ define([
}
};

payloadExtender(payload);

fullScreenLoader.startLoader();

return storage.post(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
define([], function () {
'use strict';

return function (payload) {
payload.addressInformation['extension_attributes'] = {};

return payload;
};
});

0 comments on commit 9fc22ff

Please sign in to comment.