Skip to content

Commit 78a3f3e

Browse files
author
Ievgen Sentiabov
committed
Merge branch 'MAGETWO-43957' into MAGETWO-44446
2 parents f960313 + a4129d9 commit 78a3f3e

File tree

8 files changed

+209
-187
lines changed

8 files changed

+209
-187
lines changed

app/code/Magento/Braintree/Model/PaymentMethod.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ public function capture(InfoInterface $payment, $amount)
604604
if ($result->success) {
605605
$payment->setIsTransactionClosed(false)
606606
->setShouldCloseParentTransaction(false);
607-
if ($this->isFinalCapture($payment->getParentId(), $amount)) {
607+
if ($payment->isCaptureFinal($amount)) {
608608
$payment->setShouldCloseParentTransaction(true);
609609
}
610610
} else {
@@ -905,7 +905,7 @@ protected function processSuccessResult(
905905
->setAdditionalInformation($this->getExtraTransactionInformation($result->transaction))
906906
->setAmount($amount)
907907
->setShouldCloseParentTransaction(false);
908-
if ($this->isFinalCapture($payment->getParentId(), $amount)) {
908+
if ($payment->isCaptureFinal($amount)) {
909909
$payment->setShouldCloseParentTransaction(true);
910910
}
911911
if (isset($result->transaction->creditCard['token']) && $result->transaction->creditCard['token']) {
@@ -964,21 +964,4 @@ protected function _convertObjToArray($data)
964964
{
965965
return json_decode(json_encode($data), true);
966966
}
967-
968-
/**
969-
* Checks whether the capture is final
970-
*
971-
* @param string $orderId
972-
* @param string $amount
973-
* @return bool
974-
*/
975-
protected function isFinalCapture($orderId, $amount)
976-
{
977-
if (!empty($orderId)) {
978-
$order = $this->orderRepository->get($orderId);
979-
return (float)$order->getTotalDue() === (float) $amount;
980-
}
981-
982-
return false;
983-
}
984967
}

0 commit comments

Comments
 (0)