Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/amzngh-1126' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jaybeckr committed Jun 1, 2022
2 parents ca85318 + 872e2f5 commit 11cd371
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions Model/AsyncManagement/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,19 @@ public function decline($order, $chargeId, $detail)
}
if ($order->canHold() || $order->isPaymentReview()) {
$this->closeLastTransaction($order);
$this->amazonAdapter->closeChargePermission(
$order->getStoreId(),
$order->getPayment()->getAdditionalInformation()['charge_permission_id'],
'Canceled due to capture declined.',
true
);
$chargePermissionId = $order->getPayment()->getAdditionalInformation()['charge_permission_id'] ?? '';
if (!empty($chargePermissionId)) {
$this->amazonAdapter->closeChargePermission(
$order->getStoreId(),
$chargePermissionId,
'Canceled due to capture declined.',
true
);
} else {
$this->asyncLogger->info('Unable to close charge permission for order #' . $order->getIncrementId()
. '; no charge permission ID associated with order');
}

$this->setOrderState($order, 'canceled');
$payment = $order->getPayment();
$transaction = $this->transactionBuilder->setPayment($payment)
Expand Down

0 comments on commit 11cd371

Please sign in to comment.