1
+ diff --git a/Model/Express.php b/Model/Express.php
2
+ index 8ba8adcede51..accb22b26533 100644
3
+ --- a/Model/Express.php
4
+ +++ b/Model/Express.php
5
+ @@ -669,7 +669,7 @@ public function getApi()
6
+ public function assignData(\Magento\Framework\DataObject $data)
7
+ {
8
+ parent::assignData($data);
9
+ -
10
+ +
11
+ $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
12
+
13
+ if (!is_array($additionalData)) {
14
+ @@ -677,6 +677,11 @@ public function assignData(\Magento\Framework\DataObject $data)
15
+ }
16
+
17
+ foreach ($additionalData as $key => $value) {
18
+ + // Skip extension attributes
19
+ + if ($key === \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY) {
20
+ + continue;
21
+ + }
22
+ +
23
+ $this->getInfoInstance()->setAdditionalInformation($key, $value);
24
+ }
25
+ return $this;
26
+ diff --git a/Test/Unit/Model/ExpressTest.php b/Test/Unit/Model/ExpressTest.php
27
+ index 6a2d33d01019..3d224262c99f 100644
28
+ --- a/Test/Unit/Model/ExpressTest.php
29
+ +++ b/Test/Unit/Model/ExpressTest.php
30
+ @@ -161,12 +161,21 @@ public function testAssignData()
31
+ {
32
+ $transportValue = 'something';
33
+
34
+ + $extensionAttributeMock = $this->getMockForAbstractClass(
35
+ + \Magento\Quote\Api\Data\PaymentExtensionInterface::class,
36
+ + [],
37
+ + '',
38
+ + false,
39
+ + false
40
+ + );
41
+ +
42
+ $data = new DataObject(
43
+ [
44
+ PaymentInterface::KEY_ADDITIONAL_DATA => [
45
+ Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue,
46
+ Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID => $transportValue,
47
+ - Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue
48
+ + Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue,
49
+ + \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY => $extensionAttributeMock
50
+ ]
51
+ ]
52
+ );
53
+ diff --git a/view/frontend/web/js/action/set-payment-method.js b/view/frontend/web/js/action/set-payment-method.js
54
+ index a994f9defd58..650d5794a244 100644
55
+ --- a/view/frontend/web/js/action/set-payment-method.js
56
+ +++ b/view/frontend/web/js/action/set-payment-method.js
57
+ @@ -10,42 +10,12 @@ define([
58
+ 'mage/storage',
59
+ 'Magento_Checkout/js/model/error-processor',
60
+ 'Magento_Customer/js/model/customer',
61
+ - 'Magento_Checkout/js/model/full-screen-loader'
62
+ - ], function ($, quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader) {
63
+ + 'Magento_Checkout/js/model/full-screen-loader',
64
+ + 'Magento_Checkout/js/action/set-payment-information'
65
+ + ], function ($, quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader, setPaymentInformation) {
66
+ 'use strict';
67
+
68
+ return function (messageContainer) {
69
+ - var serviceUrl,
70
+ - payload,
71
+ - paymentData = quote.paymentMethod();
72
+ -
73
+ - /**
74
+ - * Checkout for guest and registered customer.
75
+ - */
76
+ - if (!customer.isLoggedIn()) {
77
+ - serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
78
+ - cartId: quote.getQuoteId()
79
+ - });
80
+ - payload = {
81
+ - cartId: quote.getQuoteId(),
82
+ - email: quote.guestEmail,
83
+ - paymentMethod: paymentData
84
+ - };
85
+ - } else {
86
+ - serviceUrl = urlBuilder.createUrl('/carts/mine/set-payment-information', {});
87
+ - payload = {
88
+ - cartId: quote.getQuoteId(),
89
+ - paymentMethod: paymentData
90
+ - };
91
+ - }
92
+ - fullScreenLoader.startLoader();
93
+ -
94
+ - return storage.post(
95
+ - serviceUrl, JSON.stringify(payload)
96
+ - ).fail(function (response) {
97
+ - errorProcessor.process(response, messageContainer);
98
+ - }).always(function () {
99
+ - fullScreenLoader.stopLoader();
100
+ - });
101
+ + return setPaymentInformation(messageContainer, quote.paymentMethod());
102
+ };
103
+ diff --git a/Test/Unit/Model/ExpressTest.php b/Test/Unit/Model/ExpressTest.php
104
+ index 3d224262c99f..1b8c33622e78 100644
105
+ --- a/Test/Unit/Model/ExpressTest.php
106
+ +++ b/Test/Unit/Model/ExpressTest.php
107
+ @@ -161,7 +161,7 @@ public function testAssignData()
108
+ {
109
+ $transportValue = 'something';
110
+
111
+ - $extensionAttributeMock = $this->getMockForAbstractClass(
112
+ + $extensionAttribute = $this->getMockForAbstractClass(
113
+ \Magento\Quote\Api\Data\PaymentExtensionInterface::class,
114
+ [],
115
+ '',
116
+ @@ -175,7 +175,7 @@ public function testAssignData()
117
+ Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue,
118
+ Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID => $transportValue,
119
+ Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue,
120
+ - \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY => $extensionAttributeMock
121
+ + \Magento\Framework\Api\ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY => $extensionAttribute
122
+ ]
123
+ ]
124
+ );
125
+ diff --git a/view/frontend/web/js/action/set-payment-method.js b/view/frontend/web/js/action/set-payment-method.js
126
+ index feb2538b0517..63e34437c6f9 100644
127
+ --- a/view/frontend/web/js/action/set-payment-method.js
128
+ +++ b/view/frontend/web/js/action/set-payment-method.js
129
+ @@ -4,15 +4,9 @@
130
+ */
131
+
132
+ define([
133
+ - 'jquery',
134
+ 'Magento_Checkout/js/model/quote',
135
+ - 'Magento_Checkout/js/model/url-builder',
136
+ - 'mage/storage',
137
+ - 'Magento_Checkout/js/model/error-processor',
138
+ - 'Magento_Customer/js/model/customer',
139
+ - 'Magento_Checkout/js/model/full-screen-loader',
140
+ 'Magento_Checkout/js/action/set-payment-information'
141
+ - ], function ($, quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader, setPaymentInformation) {
142
+ + ], function (quote, setPaymentInformation) {
143
+ 'use strict';
144
+
145
+ return function (messageContainer) {
0 commit comments