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

Undocumented maximum value for amounts #358

Open
jeantil opened this issue Feb 24, 2025 · 0 comments
Open

Undocumented maximum value for amounts #358

jeantil opened this issue Feb 24, 2025 · 0 comments

Comments

@jeantil
Copy link

jeantil commented Feb 24, 2025

The mangopay sdk for java uses a native int to represent the value of an amount in cents.

Integers on the java platform are signed and stored on 32 bits resulting in a value range that can go from -2147483648 to 2147483647. This means that the maximum amount that can safely be represented for a mangopay transaction is 2 147 483 647 cents or 21 474 836.47€

While that number is large, it is within the scope of possible financial transactions that can happen in the real world.

Trying to call the mgp sdk with a value that exceeds that value leads to a silent integer overflow (the number is trucated and can resultin a negative number). This is quite hard to spot, there are no controls at all in the SDK that help the user know he triggered an overflow and it can result in either a payin with the wrong amount being created or a completely misleading error

{"Message":"One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.","Type":"param_error","errors":{"DebitedFunds":"The value cannot be less than Fees"}}

The documentation on data formats does not mention a limit or a max amount, nor does the payin documentation. I haven´t checked the other transaction types documentation.

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

No branches or pull requests

1 participant