-
Notifications
You must be signed in to change notification settings - Fork 192
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
Fee recovery problems with (custom) zero based currency #7425
Comments
Another solution would be for GiveWP to add these currencies into its hard coded list of zero based currencies:
|
This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 14 additional days. Note, if this Issue is reporting a bug, please reach out to our support at https://givewp.com/support. If this is a feature request, please see our feedback board at feedback.givewp.com — that’s the best place to make feature requests, unless you’re providing a PR. |
I found my problem. There are TWO separate GiveWP filters for designating a currency as zero based.
I was only using the latter one. Both need to be used together. For example: // Gateway does not accept amounts with decimal places for these currencies
add_filter('give_get_zero_based_currencies', static function($currency_list) {
foreach (self::ZERO_BASED_CURRENCIES as $currency => $symbol) {
if (!in_array($currency, $currency_list)) {
$currency_list[] = $currency;
}
}
return $currency_list;
});
add_filter('give_fee_zero_based_currency', static function ($currency_list) {
foreach (self::ZERO_BASED_CURRENCIES as $currency => $symbol) {
if (!isset($currency_list[$currency])) {
$currency_list[$currency] = give_currency_symbol($currency) ?? $symbol;
}
}
return $currency_list;
}); |
This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 14 additional days. Note, if this Issue is reporting a bug, please reach out to our support at https://givewp.com/support. If this is a feature request, please see our feedback board at feedback.givewp.com — that’s the best place to make feature requests, unless you’re providing a PR. |
User Story
As a zero decimal currency donor, I want fee recovery calculations to be less confusing.
Details
In this example, the donor is giving 10555 in the IDR currency. This currency is not classified as a zero based currency by default, but it was specified as such using the
give_fee_zero_based_currency
filter in the custom gateway plugin. The payment gateway only accepts integer amounts for this currency.The donor checks the box to cover the transaction fees. Here is the preview shown:
So far so good.
But the actual calculations for the fee recovery do use decimal places. Here is the final breakdown of the fee recovery as shown in the receipt:
Three problems.
Notably, this problem does not occur when using a currency that is zero based by default, such as the Japanese Yen.
Expected Behavior
The donation amount should remain the same as what the donor agreed to. It should be 10871.
The amounts should not include any decimal places. The original amount should be 10555. The fee should be 316.
Steps to Reproduce
give_fee_zero_based_currency
filter that inserts the IDR currency into the list.System Information
Details
GiveWP 3.4.2 PHP 8.0.30Acceptance Criteria
give_fee_zero_based_currency
filter.The text was updated successfully, but these errors were encountered: