Skip to content

fix(api): return fixed discounts in major units - #2458

Merged
charlietlamb merged 1 commit into
devfrom
charlie/fix-customer-reward-amount
Jul 28, 2026
Merged

fix(api): return fixed discounts in major units#2458
charlietlamb merged 1 commit into
devfrom
charlie/fix-customer-reward-amount

Conversation

@charlietlamb

@charlietlamb charlietlamb commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • convert Stripe amount_off values to Autumn major currency units in expanded customer rewards
  • keep percentage discount values unchanged
  • add an integration regression test covering a $250 customer-level coupon

Testing

  • bunx tsgo --build --noEmit
  • red: customer API returned 25000 instead of 250
  • green: ./run.sh .../customer-fixed-discount-major-units.test.ts — 1 pass, 0 fail

Summary by cubic

Fix the customer rewards API to return fixed-discount coupon amounts in Autumn major currency units (e.g., $250 => 250, not 25000). Percentage discounts are unchanged.

Written for commit b25ee93. Summary will update on new commits.

Review in cubic

Greptile Summary

Converts fixed Stripe coupon amounts from minor units into Autumn’s major currency units while leaving percentage discounts unchanged.

  • [Bug fixes, API changes] Normalizes expanded customer fixed-discount values using the coupon currency.
  • [Improvements] Adds an integration regression test for a $250 customer-level coupon.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The response conversion mirrors the existing major-to-minor Stripe coupon creation path, preserves percentage discounts, and is covered by a focused customer API regression test.

Important Files Changed

Filename Overview
server/src/internal/customers/cusUtils/cusResponseUtils/getCusRewards.ts Correctly applies the shared currency-aware minor-to-major unit conversion to fixed discounts without changing percentage values.
server/tests/integration/customers/rewards/customer-fixed-discount-major-units.test.ts Adds focused regression coverage confirming that a $250 fixed coupon is returned as 250 rather than 25000.

Reviews (1): Last reviewed commit: "fix(api): 🐛 return fixed discounts in m..." | Re-trigger Greptile

@capy-ai

capy-ai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Capy auto-review is paused for this organization because the usage-cycle auto-review limit has been reached. Increase the limit or turn it off in billing settings to resume automatic reviews.

@charlietlamb
charlietlamb merged commit fc49a26 into dev Jul 28, 2026
15 checks passed
@charlietlamb
charlietlamb deleted the charlie/fix-customer-reward-amount branch July 28, 2026 19:51
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