Billing.unit_amount_decimal returns a database error if the value is more than 7 digits
mistalaba opened this issue · comments
Describe the bug
models.Billing.unit_amount_decimal
is set to
unit_amount_decimal = StripeDecimalCurrencyAmountField(
null=True,
blank=True,
max_digits=19,
decimal_places=12,
help_text=(
"Same as `unit_amount`, but contains a decimal value with "
"at most 12 decimal places."
),
)
This breaks if the input value is for example 10000000 (100,000.00) because of the max_digits
, which should be higher that 19. This seems to be fixed in the master branch where you are using max_digits=djstripe_settings.decimal_max_digits
(set to 24 instead of 19) and decimal_places=djstripe_settings.decimal_places
instead. I'm sorry for not giving more details, I don't have access to our project using dj-stripe right now 🙏
To Reproduce
Add a billing instance and set unit_amount_decimal
to a value with more than 7 digits.
Software versions
- Dj-Stripe version: 2.8.2
- Python version: 3.11
- Django version: 4.2.5
@mistalaba Please refer to the discussion here
Closing this issue as there is already a discussion on this.