Skip to content

Commit 61ac47d

Browse files
committed
MAGETWO-58282: [PR] Bugfixes delivery for 2.2
2 parents 8bf902a + 4476ce1 commit 61ac47d

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

app/code/Magento/Paypal/Model/Express.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -672,19 +672,13 @@ public function assignData(\Magento\Framework\DataObject $data)
672672

673673
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA);
674674

675-
if (
676-
!is_array($additionalData)
677-
|| !isset($additionalData[ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT])
678-
) {
675+
if (!is_array($additionalData)) {
679676
return $this;
680677
}
681678

682-
$this->getInfoInstance()
683-
->setAdditionalInformation(
684-
ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT,
685-
$additionalData[ExpressCheckout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT]
686-
);
687-
679+
foreach ($additionalData as $key => $value) {
680+
$this->getInfoInstance()->setAdditionalInformation($key, $value);
681+
}
688682
return $this;
689683
}
690684

app/code/Magento/Paypal/Test/Unit/Model/ExpressTest.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ public function testAssignData()
182182
$data = new DataObject(
183183
[
184184
PaymentInterface::KEY_ADDITIONAL_DATA => [
185-
Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue
185+
Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => $transportValue,
186+
Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID => $transportValue,
187+
Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN => $transportValue
186188
]
187189
]
188190
);
@@ -202,11 +204,12 @@ public function testAssignData()
202204

203205
$this->parentAssignDataExpectation($data);
204206

205-
$paymentInfo->expects(static::once())
207+
$paymentInfo->expects(static::exactly(3))
206208
->method('setAdditionalInformation')
207-
->with(
208-
Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT,
209-
$transportValue
209+
->withConsecutive(
210+
[Express\Checkout::PAYMENT_INFO_TRANSPORT_TOKEN, $transportValue],
211+
[Express\Checkout::PAYMENT_INFO_TRANSPORT_PAYER_ID, $transportValue],
212+
[Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT, $transportValue]
210213
);
211214

212215
$this->_model->assignData($data);

0 commit comments

Comments
 (0)