Skip to content

Commit e0a10ea

Browse files
committed
Fix negative refund amount
1 parent e1cb536 commit e0a10ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/controllers/OrdersController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,11 +1238,11 @@ public function actionTransactionRefund(): Response
12381238
}
12391239
}
12401240

1241-
if (!$amount) {
1241+
if (!$amount || $amount <= 0) {
12421242
$amount = $transaction->getRefundableAmount();
12431243
}
12441244

1245-
if ($amount > $transaction->getRefundableAmount()) {
1245+
if ($amount <= 0 || $amount > $transaction->getRefundableAmount()) {
12461246
$error = Craft::t('commerce', 'Can not refund amount greater than the remaining amount');
12471247
if ($this->request->getAcceptsJson()) {
12481248
return $this->asFailure($error);

0 commit comments

Comments
 (0)