Skip to content

Commit

Permalink
Merge pull request #647 from magento-mpi/MAGETWO-61561
Browse files Browse the repository at this point in the history
[MPI] Card is not saved after checkout with Braintree Credit Card using Vault
  • Loading branch information
Yaroslav Onischenko authored Dec 2, 2016
2 parents 6b486f7 + 2f58d24 commit 77dc68e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions app/code/Magento/Braintree/Model/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ public function assignData(\Magento\Framework\DataObject $data)

$infoInstance->setAdditionalInformation('cc_last4', $additionalData->getData('cc_last4'));
$infoInstance->setAdditionalInformation('cc_token', $additionalData->getData('cc_token'));
$infoInstance->setAdditionalInformation('store_in_vault', $additionalData->getData('store_in_vault'));
$infoInstance->setAdditionalInformation(
'payment_method_nonce',
$additionalData->getData('payment_method_nonce')
Expand Down
28 changes: 18 additions & 10 deletions app/code/Magento/Braintree/Test/Unit/Model/PaymentMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,25 @@ public function testAssignData()
->with($ccExpYear)
->willReturnSelf();

$this->infoInstanceMock->expects($this->atLeastOnce())
$this->infoInstanceMock->expects($this->at(0))
->method('setAdditionalInformation')
->willReturnMap(
[
['device_data', $deviceData],
['cc_last4', $ccLast4],
['cc_token', $ccToken],
['payment_method_nonce', $paymentMethodNonce],
['store_in_vault', $storeInVault]
]
);
->with('device_data', $deviceData);

$this->infoInstanceMock->expects($this->at(1))
->method('setAdditionalInformation')
->with('cc_last4', $ccLast4);

$this->infoInstanceMock->expects($this->at(2))
->method('setAdditionalInformation')
->with('cc_token', $ccToken);

$this->infoInstanceMock->expects($this->at(3))
->method('setAdditionalInformation')
->with('store_in_vault', $storeInVault);

$this->infoInstanceMock->expects($this->at(4))
->method('setAdditionalInformation')
->with('payment_method_nonce', $paymentMethodNonce);

$this->model->assignData($data);
}
Expand Down

0 comments on commit 77dc68e

Please sign in to comment.