Skip to content

Commit

Permalink
Merge pull request #14 from LinkNacional/dev
Browse files Browse the repository at this point in the history
1.2.2 WordPress guidelines fixes
  • Loading branch information
emanuellopess authored Sep 25, 2024
2 parents 233c7b8 + e0087be commit 1940c6a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: '1.2.1' # // TODO caso necessário definir a tag da release manualmente
custom_tag: '1.2.2' # // TODO caso necessário definir a tag da release manualmente

# Generate new release
- name: Generate new Release
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.2.2 - 25/09/2024
* Atualização de documentação;
* Correção de slug de tradução no formato incorreto;
* Mudança na nomenclatura das configurações para evitar colisões.

# 1.2.1 - 10/09/2024
* Refatoração de plugin com slug e nome do plugin sugeridos pela equipe do WordPress.

Expand Down
6 changes: 3 additions & 3 deletions Includes/LknmpGatewayGiveWP.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public function get_handle_custom_payment_route($request) {

switch ($statusFront) {
case '1':
$donation_id = get_option("lkn_mercadopago_" . $id);
$donation_id = get_option("lknmp_gateway_" . $id);
if ( ! $donation_id) {
return new WP_Error('no_donation_id', 'No donation ID found', array('status' => 404));
}
Expand All @@ -268,7 +268,7 @@ public function get_handle_custom_payment_route($request) {
exit;
break;
case '2':
$donation_id = get_option("lkn_mercadopago_" . $id);
$donation_id = get_option("lknmp_gateway_" . $id);
if ( ! $donation_id) {
return new WP_Error('no_donation_id', 'No donation ID found', array('status' => 404));
}
Expand All @@ -288,7 +288,7 @@ public function get_handle_custom_payment_route($request) {
exit;
break;
case '3':
$donation_id = get_option("lkn_mercadopago_" . $id);
$donation_id = get_option("lknmp_gateway_" . $id);
if ( ! $donation_id) {
return new WP_Error('no_donation_id', 'No donation ID found', array('status' => 404));
}
Expand Down
18 changes: 9 additions & 9 deletions Public/LknmpGatewayGiveWPGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function getLegacyFormFieldMarkup(int $formId, array $args): string {
<div class="donation-errors">
<div class="give-notice give-notice-error" id="give_error_warning">
<p class="give_notice give_warning">
<strong>' . esc_html__('Notice:', 'give') . '</strong>
' . esc_html__('Mercado Pago is not enabled for the classic and multistep form!', 'give') . '</p>
<strong>' . esc_html__('Notice:', 'lknmp-gateway-givewp') . '</strong>
' . esc_html__('Mercado Pago is not enabled for the classic and multistep form!', 'lknmp-gateway-givewp') . '</p>
</div>
</div>';
return $html;
Expand All @@ -74,16 +74,16 @@ public function getLegacyFormFieldMarkup(int $formId, array $args): string {
Give()->notices->print_frontend_notice(
sprintf(
'%1$s %2$s',
esc_html__('Erro:', 'give'),
esc_html__('Mercado Pago Token was not provided or is invalid!', 'give')
esc_html__('Erro:', 'lknmp-gateway-givewp'),
esc_html__('Mercado Pago Token was not provided or is invalid!', 'lknmp-gateway-givewp')
)
);
} elseif (empty($configs['key']) && strlen($configs['token']) <= 5) {
Give()->notices->print_frontend_notice(
sprintf(
'%1$s %2$s',
esc_html__('Erro:', 'give'),
esc_html__('Mercado Pago Public Key was not provided or is invalid!', 'give')
esc_html__('Erro:', 'lknmp-gateway-givewp'),
esc_html__('Mercado Pago Public Key was not provided or is invalid!', 'lknmp-gateway-givewp')
)
);
}
Expand All @@ -103,7 +103,7 @@ public function getLegacyFormFieldMarkup(int $formId, array $args): string {
public function createPayment(Donation $donation, $gatewayData): GatewayCommand {
try {
$idTeste = $gatewayData['gatewayId'];
add_option("lkn_mercadopago_" . $idTeste, $donation->id);
add_option("lknmp_gateway_" . $idTeste, $donation->id);

return new PaymentPending();
} catch (Exception $e) {
Expand Down Expand Up @@ -143,8 +143,8 @@ public function enqueueScript(int $formId): void {
$MenssageErrorEmailEmpty = __('The Email field is empty. Please fill in this field before proceeding.', 'lknmp-gateway-givewp');
$MenssageErrorEmailInvalid = __('The Email field is invalid. Please enter a valid email address.', 'lknmp-gateway-givewp');
$MenssageDonation = __('Donation of ', 'lknmp-gateway-givewp');
$MenssageErrorToken = __('Mercado Pago Token was not provided or is invalid!');
$MenssageErrorPublicKey = __('Mercado Pago Public Key was not provided or is invalid!');
$MenssageErrorToken = __('Mercado Pago Token was not provided or is invalid!', 'lknmp-gateway-givewp');
$MenssageErrorPublicKey = __('Mercado Pago Public Key was not provided or is invalid!', 'lknmp-gateway-givewp');

$hastoken = ! empty($configs['token']) && strlen($configs['token']) > 10 ? 'true' : 'false';
$haspublicKey = ! empty($configs['key']) && strlen($configs['key']) > 10 ? 'true' : 'false';
Expand Down
13 changes: 11 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://www.linknacional.com.br/wordpress/givewp/
Tags: givewp, payment, mercadopago, card
Requires at least: 5.7
Tested up to: 6.6
Stable tag: 1.2.1
Stable tag: 1.2.2
Requires PHP: 7.4
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Expand All @@ -22,7 +22,11 @@ The [MercadoPago Payment Gateway for GiveWP](https://www.linknacional.com.br/wor
[GiveWP](https://wordpress.org/plugins/give/) is needed for the plugin to work.

JS Libraries used:
[MercadoPago sdk-js](https://github.com/mercadopago/sdk-js)
The [MercadoPago sdk-js](https://github.com/mercadopago/sdk-js) is needed for the plugin to work. [Learn more](https://www.mercadopago.com.br/developers/pt/docs/checkout-pro/integrate-checkout-pro/web).

As a Payment Gateway this plugin contacts these external resources to complete the payment:
[Mercado Pago Checkout API](https://api.mercadopago.com/checkout/preferences)
[Mercado Pago Checkout JS SDK](https://sdk.mercadopago.com/js/v2)

**User instructions**

Expand Down Expand Up @@ -76,6 +80,11 @@ The Link Nacional MercadoPago for GiveWP plugin is now live and working.

== Changelog ==

= 1.2.2 = *2024/09/25*
* Update documentation;
* Fix translation mismatch issues;
* Change option names to avoid collisions.

= 1.2.1 = *2024/09/10*
* Refactor with requested name and slug changes.

Expand Down
4 changes: 2 additions & 2 deletions lknmp-gateway-givewp.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Requires Plugins: give
* Plugin URI: https://www.linknacional.com.br/wordpress/givewp/
* Description: MercadoPago Payment Gateway for GiveWP donation plugin for WordPress.
* Version: 1.2.1
* Version: 1.2.2
* Author: Link Nacional
* Author URI: https://www.linknacional.com.br/wordpress/givewp//
* License: GPL-3.0+
Expand All @@ -42,7 +42,7 @@
* Rename this for your plugin and update it as you release new versions.
*/
if ( ! defined('LKNMP_GATEWAY_GIVEWP_VERSION')) {
define( 'LKNMP_GATEWAY_GIVEWP_VERSION', '1.2.1' );
define( 'LKNMP_GATEWAY_GIVEWP_VERSION', '1.2.2' );
}

if ( ! defined('LKNMP_GATEWAY_MIN_GIVE_VERSION')) {
Expand Down
4 changes: 2 additions & 2 deletions uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@

$lkn_array_remove_options = give_get_settings();

// Remove todos as options que possuem lkn_mercadopago_
// Remove todos as options que possuem lknmp_gateway_
$lkn_array_remove_options = array_filter($lkn_array_remove_options, function ($key) {
return strpos($key, 'lkn_mercadopago_') === 0;
return strpos($key, 'lknmp_gateway_') === 0;
}, \ARRAY_FILTER_USE_KEY);

$lkn_array_remove_options = array_keys($lkn_array_remove_options);
Expand Down

0 comments on commit 1940c6a

Please sign in to comment.