Skip to content

Commit 9a88392

Browse files
committed
Fixed a bug where a negative payment amount could be set on an order (GHSA-78vr-q6cf-c7p6)
1 parent a7d365c commit 9a88392

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Cart requests that include a `couponCode` param are now rate-limited. (GHSA-h5gm-x9wr-vhcm)
6+
- Fixed a bug where a negative payment amount could be set on an order. (GHSA-78vr-q6cf-c7p6)
67

78
## 4.11.1 - 2026-04-30
89

src/elements/Order.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2449,14 +2449,19 @@ public function getPaymentAmount(): float
24492449
/**
24502450
* Sets the order's payment amount in the order's currency. This amount is not persisted.
24512451
*
2452+
* This will remain null if set to zero or a negative number.
2453+
*
24522454
* @throws CurrencyException
24532455
* @throws InvalidConfigException
24542456
*/
24552457
public function setPaymentAmount(float $amount): void
24562458
{
24572459
$paymentCurrency = Plugin::getInstance()->getPaymentCurrencies()->getPaymentCurrencyByIso($this->getPaymentCurrency());
24582460
$amount = Currency::round($amount, $paymentCurrency);
2459-
$this->_paymentAmount = $amount;
2461+
2462+
if($amount >= 0) {
2463+
$this->_paymentAmount = $amount;
2464+
}
24602465
}
24612466

24622467
/**

0 commit comments

Comments
 (0)