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

New Form Builder currency selector should update custom amounts properly #7553

Open
2 tasks
emanuellopess opened this issue Sep 26, 2024 · 0 comments
Open
2 tasks
Labels
type: bug Existing functionality is broken

Comments

@emanuellopess
Copy link

User Story

As a admin, I want to manipulate the decimal values in the custom amount so that donors don't get confused and prevent errors on some payment gateways.

Details

We can't update or change the decimal limit of the CurrencyInput element path: src/DonationForms/resources/registrars/templates/fields/Amount/CustomAmount.tsx

<CurrencyInput
                intlConfig={{
                    locale: navigator.language,
                    currency,
                }}
                className="givewp-fields-amount__input givewp-fields-amount__input-custom"
                aria-invalid={fieldError ? 'true' : 'false'}
                id="amount-custom"
                name="amount-custom"
                placeholder={__('Enter custom amount', 'give')}
                defaultValue={defaultValue}
                value={value}
                decimalsLimit={2} // This should be customized in the global attributs
                onValueChange={(value) => onValueChange(value !== undefined ? value : '')}
            />

As it only accepts two decimals when we insert the custom amount with the decimal value with currencies that use comma as a decimal limit the calculations break.

Expected Behavior

Donation with currencies that the decimal limit is a comma should work properly and taken into account in the calculations.
The donation form shoul detect the decimal limit defined in give global configurations

Steps to Reproduce

  1. Define BRL as default currency
  2. Go to your donation form built with the new form builder
  3. Donate with custom amount as an value with decimal ex.: 4.000,50
  4. Scroll down to donation summary
  5. View error

Visuals

image

Additional Context

System Information

Details

WordPress Environment

Home URL: https://wordpress.local
Site URL: https://wordpress.local
WP Version: 6.6.2
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: –
WP Cron: ✔
Language: pt_BR
Permalink Structure: /%postname%/
Show on Front: posts
Table Prefix Length: wp_
Table Prefix Length: 3
Table Prefix Status: Aceitável
Admin AJAX: Acessível
Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, upgraded

Server Environment

Hosting Provider: DBH: mariadb:3306, SRV: wordpress.local
TLS Connection: Conexão usa TLS 1.3
TLS Connection: Probably Okay
Server Info: Apache/2.4.61 (Debian)
PHP Version: 8.1.29
PHP Post Max Size: 256 MB
PHP Time Limit: 30
PHP Max Input Vars: 1000
PHP Max Upload Size: 256 MB
cURL Version: 7.88.1, OpenSSL/3.0.13
SUHOSIN Installed: –
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ❌O seu servidor não tem a classe SoapClient ativada - alguns plugins de gateway que utilizem SOAP podem não funcionar como esperado.
DOMDocument: ✔
gzip: ✔
GD Graphics Library: ✔
Multibyte String: ✔
Post remoto: ✔
Requisição remota do tipo GET: ✔

GiveWP Configuration

GiveWP Version: 3.16.2
GiveWP Cache: Ativado
Database Updates: Todas as atualizações de banco de dados foram concluídas.
Database Updates: All Database Migrations Completed.
Database Tables: ✔ wp_give_donors✔ wp_give_donormeta✔ wp_give_comments✔ wp_give_commentmeta✔ wp_give_sessions✔ wp_give_formmeta✔ wp_give_sequential_ordering✔ wp_give_donationmeta✔ wp_give_revenue✔ wp_give_migrations✔ wp_give_log
GiveWP Cache: Ativado
GiveWP Cache: ✔Nova doação✔Recibo de doação✔Recibo de processamento de doação✔Nova doação off-line✔Instruções de Doação Offline✔Novo cadastro usuário✔Informações de cadastro do usuário✔Observação de doação✔Acesso por e-mail
Upgraded From: 3.16.2
Test Mode: Ativado
Currency Code: BRL
Currency Position: Antes
Decimal Separator: ,
Thousands Separator: .
Success Page: https://wordpress.local/confirmacao-da-doacao/
Failure Page: https://wordpress.local/a-doacao-falhou/
Donation History Page: https://wordpress.local/donor-dashboard/
GiveWP Forms Slug: /donations/
Enabled Payment Gateways: Doação de teste, Doação Offline
Default Payment Gateway: Doação de teste
PayPal IPN Notifications: N/A
Donor Email Access: Ativado
Stripe Webhook Notifications: N/A

Active GiveWP Add-ons

Other Active Plugins

Plugin Check (PCP): por WordPress Performance Team and Plugin Review Team – 1.1.0

Inactive Plugins

Akismet Anti-spam: Spam Protection: por Automattic - Anti-spam Team – 5.3.3
SureCart: por SureCart – 2.31.2
test plugin: por test – 1.0.0
WooCommerce: por Automattic – 9.3.3

Theme

Name: Twenty Twenty-Four
Version: 1.2
Author URL: https://br.wordpress.org

Acceptance Criteria

  • Donation with other currencies that accept comma should not break the form;
  • Decimal limit should be comming from GiveWP global settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Existing functionality is broken
Projects
None yet
Development

No branches or pull requests

1 participant