Skip to content

Conversation

@EuzebioBatista2
Copy link
Contributor

@EuzebioBatista2 EuzebioBatista2 commented Jun 27, 2025

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

  1. Baixe o plugin.
  2. No painel administrativo do WordPress, vá para Plugins > Adicionar Novo.
  3. Clique em "Enviar Plugin" e selecione o arquivo ZIP do plugin que você baixou.
  4. Clique em "Instalar Agora" e, em seguida, em "Ativar Plugin".

Resumo(3.1.3):

  • URL de fallback para conversão de moeda

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:

  • Adicionadas rotas de fallback para taxas de câmbio no caso de falha na API principal. Isso inclui a inicialização do 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)
  • Definida a constante GIVE_MULTI_CURRENCY_CURRENCIES para especificar as moedas suportadas pelos mecanismos de fallback. (give-currency.php give-currency.phpR54-R60)

Atualizações de Versionamento e Documentação:

  • Atualizada a versão do plugin para 3.1.3 em give-currency.php, .github/workflows/main.yml e adicionada uma entrada correspondente no CHANGELOG.md e README.md. (give-currency.php [1] [2] .github/workflows/main.yml [3] CHANGELOG.md [4] README.md [5])

@EuzebioBatista2 EuzebioBatista2 self-assigned this Jun 27, 2025
@EuzebioBatista2 EuzebioBatista2 added the bug Something isn't working label Jun 27, 2025
@EuzebioBatista2 EuzebioBatista2 requested a review from Copilot June 27, 2025 15:33
@EuzebioBatista2 EuzebioBatista2 changed the title 3.1.3 - give-multimoeda (URL secundária para conversão de moeda) 3.1.3 - give-multimoeda (URL de fallback para conversão de moeda) Jun 27, 2025

This comment was marked as outdated.

@EuzebioBatista2 EuzebioBatista2 requested a review from Copilot July 2, 2025 17:26

This comment was marked as outdated.

@EuzebioBatista2 EuzebioBatista2 requested a review from Copilot July 2, 2025 17:32
Copy link

Copilot AI left a 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_CURRENCIES constant and add Includes/json/fallback_rates.json with 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.md are inconsistent with README.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) {

define(
'GIVE_MULTI_CURRENCY_CURRENCIES',
['USD', 'EUR', 'BRL', 'JPY', 'GBP', 'SAR', 'MXN', 'CHF']
) ;
Copy link

Copilot AI Jul 2, 2025

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 );.

Suggested change
) ;
);

Copilot uses AI. Check for mistakes.
$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));
Copy link

Copilot AI Jul 2, 2025

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.

Suggested change
$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));

Copilot uses AI. Check for mistakes.
}
} else {
$response = json_decode($data['body'], true);
if (WP_Filesystem()) {
Copy link

Copilot AI Jul 2, 2025

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.

Suggested change
if (WP_Filesystem()) {
if ($wp_filesystem) {

Copilot uses AI. Check for mistakes.
@EuzebioBatista2 EuzebioBatista2 merged commit 10a3b7c into main Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants