-
Notifications
You must be signed in to change notification settings - Fork 0
3.1.3 - give-multimoeda (URL de fallback para conversão de moeda) #45
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR bumps the plugin to version 3.1.3, adds a fallback mechanism for currency conversion when the primary API fails, and introduces a local JSON file of rates as a last-resort fallback.
- Define a
GIVE_MULTI_CURRENCY_CURRENCIESconstant and addIncludes/json/fallback_rates.jsonwith hard-coded rates - Implement primary API call, secondary “frankfurter.app” fallback, and local-file fallback in
GiveMultiCurrencyActions.php - Update version strings in
give-currency.php, changelogs, and GitHub workflow tag
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| give-currency.php | Bumped version to 3.1.3 and defined new GIVE_MULTI_CURRENCY_CURRENCIES constant |
| README.md | Added 3.1.3 changelog entry |
| Includes/json/fallback_rates.json | Introduced local fallback rates file |
| Includes/GiveMultiCurrencyActions.php | Added multi-tiered API fallback logic and JSON caching |
| CHANGELOG.md | Recorded 3.1.3 release notes |
| .github/workflows/main.yml | Updated custom_tag from 3.1.2 to 3.1.3 |
Comments suppressed due to low confidence (2)
CHANGELOG.md:1
- [nitpick] Heading levels in
CHANGELOG.mdare inconsistent withREADME.md(using#vs###). Consider standardizing heading levels across changelog files for consistency.
# 3.1.3 - 27/06/2025
Includes/GiveMultiCurrencyActions.php:44
- Add unit or integration tests to cover the new fallback logic paths when the primary currency API fails, ensuring both the secondary API and local JSON file handling are validated.
if (is_wp_error($data) || wp_remote_retrieve_response_code($data) !== 200) {
give-currency.php
Outdated
| define( | ||
| 'GIVE_MULTI_CURRENCY_CURRENCIES', | ||
| ['USD', 'EUR', 'BRL', 'JPY', 'GBP', 'SAR', 'MXN', 'CHF'] | ||
| ) ; |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Remove extra spaces before the semicolon for consistent formatting: change ) ; to );.
| ) ; | |
| ); |
| $jsonFilePath = GIVE_MULTI_CURRENCY_DIR . 'Includes/json/fallback_rates.json'; | ||
|
|
||
| if (is_wp_error($data) || wp_remote_retrieve_response_code($data) !== 200) { | ||
| $fallbackData = wp_remote_get('https://api.frankfurter.app/latest?from=' . $defaultCurrency . '&to=' . implode(',', $currencyCodes)); |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting the API endpoint URL to a named constant to avoid repetition and simplify future updates.
| $fallbackData = wp_remote_get('https://api.frankfurter.app/latest?from=' . $defaultCurrency . '&to=' . implode(',', $currencyCodes)); | |
| $fallbackData = wp_remote_get(FRANKFURTER_API_URL . '?from=' . $defaultCurrency . '&to=' . implode(',', $currencyCodes)); |
| } | ||
| } else { | ||
| $response = json_decode($data['body'], true); | ||
| if (WP_Filesystem()) { |
Copilot
AI
Jul 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking WP_Filesystem() in a conditional may not correctly verify that $wp_filesystem is initialized. Consider checking if $wp_filesystem is truthy instead of calling WP_Filesystem() again.
| if (WP_Filesystem()) { | |
| if ($wp_filesystem) { |
Give Multimoeda
Contribuidores: linknacional
Link: https://www.linknacional.com.br/wordpress/
Tags: givewp, cielo, give, payment, linknacional
Testado até: 6.7.2
Versão estável: 3.1.3
Licença: GPLv2 ou posterior
URI da Licença: http://www.gnu.org/licenses/gpl-2.0.html
Traduções: Português(Brasil)
Descrição
O GiveWP Multi-Moeda é um plugin para a plataforma de doação GiveWP que tem o objetivo de fazer a conversão da moeda estrangeira para a moeda nacional (BRL) a fim de realizar um determinado pagamento internacional e o mesmo ser reconhecido pelos processadores de pagamento do Brasil.
Instalação
Resumo(3.1.3):
Resumo copilot:
Este pull request introduz a versão 3.1.3 do plugin "Give - Multi-Moedas" com melhorias significativas, incluindo mecanismos de fallback para taxas de câmbio e atualizações de versionamento e documentação. As mudanças mais importantes estão agrupadas abaixo:
Novos Recursos e Melhorias:
WP_Filesystem, recuperação de dados de fallback e uso de um arquivo JSON local (fallback_rates.json) como último recurso. (Includes/GiveMultiCurrencyActions.php,Includes/json/fallback_rates.json, give-currency.phpR54-R60)GIVE_MULTI_CURRENCY_CURRENCIESpara especificar as moedas suportadas pelos mecanismos de fallback. (give-currency.phpgive-currency.phpR54-R60)Atualizações de Versionamento e Documentação:
give-currency.php,.github/workflows/main.ymle adicionada uma entrada correspondente noCHANGELOG.mdeREADME.md. (give-currency.php[1] [2].github/workflows/main.yml[3]CHANGELOG.md[4]README.md[5])