Skip to content

Change money/amount properties from int to decimal - #11

Merged
SlimAhmad merged 1 commit into
mainfrom
feature/decimal-money-properties
Sep 17, 2026
Merged

SlimAhmad merged 1 commit into
mainfrom
feature/decimal-money-properties

Conversation

@SlimAhmad

Copy link
Copy Markdown
Owner

Summary

  • Every monetary property across the request/response models (Amount, Fee, AppFee, MerchantFee, AvailableBalance, AmountRefunded, ChargedAmount, settlement/statement amounts, transfer limits, bill-payment min/max, etc.) was typed int, silently truncating any fractional currency value. Changed to decimal in both the external DTOs and the public domain models. Also fixed the one field (InitiateTransferResponse.Fee) that was float for the same reason.
  • Left non-monetary lookalikes as int (pagination counts, IDs, retry-strategy config values, charge counters, card expiry, etc.) — only actual money fields moved.
  • Bug found while doing this: several *Validations.cs files only had an IsInvalid(double) overload for numeric checks. Once a validated field's static type became decimal, IsInvalid(field) silently rebound to IsInvalid(object) at compile time (a boxed decimal is never null), so non-positive amounts stopped being flagged as invalid. Added matching IsInvalid(decimal) overloads (and IsInvalid(int) where needed to resolve now-ambiguous calls from plain int parameters) everywhere the double overload existed, restoring the original validation behavior. This was caught by the existing unit test suite (106 failures) before it could ship.

Test plan

  • dotnet build FlutterWave.Core.sln — 0 warnings, 0 errors
  • dotnet test FlutterWave.Core.Tests.Unit — 1296/1296 passing
  • dotnet test FlutterWave.Core.Tests.Acceptance — 102/102 passing

🤖 Generated with Claude Code

Every monetary field across the request/response models (Amount,
Fee, AppFee, MerchantFee, AvailableBalance, AmountRefunded, etc.) was
typed as int, silently truncating fractional currency values returned
by or sent to the API. Change them to decimal throughout, in both the
external DTOs and the public domain models, and fix the one Fee field
that was float for the same reason.

Fields that only look money-shaped but aren't (pagination counts,
retry-strategy config values, charge counters, IDs) were left as int.

This surfaced a real bug: several *Validations.cs files only had an
IsInvalid(double) overload for numeric checks, so once a validated
field's static type became decimal, `IsInvalid(field)` silently
rebound to IsInvalid(object) (decimal boxes to a non-null object) and
stopped flagging non-positive amounts as invalid. Added matching
IsInvalid(decimal) overloads (and IsInvalid(int) where needed to
resolve now-ambiguous calls from plain int parameters) everywhere the
double overload existed, restoring the original validation behavior.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@SlimAhmad
SlimAhmad merged commit 29d2269 into main Sep 17, 2026
1 check failed
@SlimAhmad
SlimAhmad deleted the feature/decimal-money-properties branch September 17, 2026 20:32
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