Skip to content

Conversation

@olliemath
Copy link
Member

@olliemath olliemath commented Nov 22, 2025

Draft: this allows explicitly setting a quantity (e.g. a rate) as a dimenensionless number by not providing a currency_code

Previously we have insisted every contribution_amount be accompanied by a currency to avoid it being accidentally omitted.

However, this lead to a situation where people started placing non-monetary floats into the text field in order to avoid currency conversion. This in turn caused issues with ids that look like numbers: 1234E5432, 0001000 etc.

examples

// 1.23 USD
{contribution_amount: 123, currency_code: "GBP"}
// 1.23 literal (no unit)
{contribution_amount: 1.23}
// "1.23" (literal string / id)
{contribution_text: "1.23"}

anything else?

this change requires updating the amount field from integer to float - we may want a way to further validate the int status of monetary values

we may want to explicitly version this change as it means we will explicitly prohibit the use of contribution_text for numbers

@olliemath olliemath requested a review from muratabur as a code owner November 22, 2025 10:44
@olliemath olliemath changed the title feat: update currency_code to be nullable feat: update currency_code to be optional Nov 22, 2025
this allows explicitly setting a quantity (e.g. a rate) as
a dimenensionless number
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.

2 participants