Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix StripeDecimalCurrencyAmountField Defaults #1786

Closed

Conversation

arnav13081994
Copy link
Contributor

Description

This PR contains the following changes:

  1. Updated max_digits from 19 to 24 for unit_amount_decimal and amount_decimal model fields. This was done because the largest allowed value by Stripe is for the IDR (Indonesian Rupiah) which is 999,999,999,998.999,999,999,999 (24 digits, 12 decimals). In fact the Stripe console allows one to enter up to 14 decimals but automatically rounds off to 12 decimal places in its API.
  2. Updated StripeDecimalCurrencyAmountField defaults to 14 max_digits. This was done because one can enter the max number in IDR (Indonesian Rupiah) currency of 999,999,999,998.99.

Checklist:

  • I've updated the tests or confirm that my change doesn't require any updates.
  • I've updated the documentation or confirm that my change doesn't require any updates.
  • I confirm that my change doesn't drop code coverage below the current level.
  • I've updated migrations or confirm that my change doesn't make changes to any model.

Rationale

Fix: #1762

@jleclanche
Copy link
Member

Only one migration and commit please

Updated max_digits from 19 to 24 for unit_amount_decimal and amount_decimal model fields.
This was done because the largest allowed value by Stripe is for the IDR (Indonesian Rupiah)
which is 999,999,999,998.999,999,999,999 (24 digits, 12 decimals).
In fact the Stripe console allows one to enter up to 14 decimals but
automatically rounds off to 12 decimal places in its API.

Updated StripeDecimalCurrencyAmountField defaults to 14 max_digits

This was done because one can enter the max number in
IDR (Indonesian Rupiah) currency of 999,999,999,998.99.
@arnav13081994
Copy link
Contributor Author

@jleclanche Updated. Please review and merge.

@jleclanche jleclanche modified the milestones: 2.8.0, 3.0.0 Aug 29, 2023
jleclanche added a commit that referenced this pull request Aug 29, 2023
@jleclanche jleclanche closed this Aug 29, 2023
@arnav13081994 arnav13081994 deleted the fix_decimal_field branch September 1, 2023 12:22
jleclanche added a commit that referenced this pull request Apr 25, 2024
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.

Invalid decimal error for subscriptions larger than 99,999.99
2 participants