Skip to content

pr: [Nightly Fix] - Bug - Guard Zero Amount Coupons#49

Open
jewel-claw wants to merge 1 commit into
masterfrom
nightly-fix/guard-zero-amount-coupons
Open

pr: [Nightly Fix] - Bug - Guard Zero Amount Coupons#49
jewel-claw wants to merge 1 commit into
masterfrom
nightly-fix/guard-zero-amount-coupons

Conversation

@jewel-claw

Copy link
Copy Markdown

What

Guard the coupon discount-percent calculation against zero payable amounts in the submission handler.

Why

When coupons are applied, the handler calculates a discount percentage by dividing by $amountToPay. That value can be zero in fully discounted or malformed requests, which can trigger a division-by-zero warning and break the submission flow.

Fix

  • Only compute the derived discount percentage when the payable amount is greater than zero
  • Leave the coupon line-item generation and discount totals unchanged

Confidence

High. The change is a small defensive guard in one location, and the modified file passes php -l.

@greptile-apps

greptile-apps Bot commented Mar 20, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

@kilo-code-bot

kilo-code-bot Bot commented Mar 20, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • includes/Classes/SubmissionHandler.php - Fix is correct

The guard condition if ($amountToPay > 0) correctly prevents division-by-zero when the payable amount is zero. The $discountPercent variable remains at its initialized value of 0 when the guard is not satisfied, which is the expected behavior.


Reviewed by minimax-m2.5-20260211 · 109,113 tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant