Skip to content

Commit

Permalink
Merge pull request #13 from LinkNacional/dev
Browse files Browse the repository at this point in the history
2.0.1 Correções de problemas do formulário legado e ajustes
  • Loading branch information
emanuellopess authored Oct 17, 2024
2 parents 71b9ed4 + 641e5c0 commit 9c5089a
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 56 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/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: '2.0.0' # // TODO caso necessário definir a tag da release manualmente
custom_tag: '2.0.1' # // TODO caso necessário definir a tag da release manualmente

# Generate new release
- name: Generate new Release
Expand Down
10 changes: 8 additions & 2 deletions Admin/LknPaymentEredeForGivewpAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ public function add_settings_into_section($settings) :array {
$settings[] = array(
'name' => __('Debug mode', PAYMENT_EREDE_FOR_GIVEWP_TEXT_DOMAIN),
'id' => 'lkn_erede_credit_debug_setting_field',
'desc' => __('Saves transaction logs for testing purposes.', PAYMENT_EREDE_FOR_GIVEWP_TEXT_DOMAIN),
'desc' => sprintf(
__( 'Saves transaction logs for testing purposes. %sSee logs.%s', PAYMENT_EREDE_FOR_GIVEWP_TEXT_DOMAIN),
'<a target="_blank" href="' . home_url('wp-admin/edit.php?post_type=give_forms&page=give-tools&tab=logs') . '">', '</a>'
),
'type' => 'radio',
'default' => 'disabled',
'options' => array(
Expand Down Expand Up @@ -310,7 +313,10 @@ public function add_settings_into_section($settings) :array {
$settings[] = array(
'name' => __('Debug mode', PAYMENT_EREDE_FOR_GIVEWP_TEXT_DOMAIN),
'id' => 'lkn_erede_debit_3ds_debug_setting_field',
'desc' => __('Saves transaction logs for testing purposes.', PAYMENT_EREDE_FOR_GIVEWP_TEXT_DOMAIN),
'desc' => sprintf(
__( 'Saves transaction logs for testing purposes. %sSee logs.%s', PAYMENT_EREDE_FOR_GIVEWP_TEXT_DOMAIN),
'<a target="_blank" href="' . home_url('wp-admin/edit.php?post_type=give_forms&page=give-tools&tab=logs') . '">', '</a>'
),
'type' => 'radio',
'default' => 'disabled',
'options' => array(
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.0.1 - 10/10/2024
* Add link to view logs;
* Fix donation status;

# 2.0.0 - 14/05/2024
* Added compatibility with GiveWP 3.0.0 template.
* General plugin optimizations.
Expand Down
52 changes: 28 additions & 24 deletions Public/LknPaymentEredeForGivewpCreditGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function createPayment(Donation $donation, $gatewayData): GatewayCommand
LknPaymentEredeForGivewpHelper::log('[Raw body 1]: ' . var_export(($body), true), $logname);
}

$body = apply_filters('lkn_erede_credit_body', $body, $currencyCode, $donation);
$body = apply_filters('lkn_erede_credit_body', $body, $currencyCode);

$response = wp_remote_post($configs['api_url'], array(
'headers' => $headers,
Expand Down Expand Up @@ -320,29 +320,33 @@ final public static function credit_card_form($form_id, $args) {
<input type="hidden" name="gatewayData[paymentTimezoneOffset]" value="" />

<script type="text/javascript">
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
function setCreditInfo() {
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
}

setCreditInfo()
</script>

<!-- CARD NUMBER INPUT -->
Expand Down
50 changes: 27 additions & 23 deletions Public/LknPaymentEredeForGivewpDebitGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,29 +296,33 @@ final public static function debit_card_form($form_id, $args) {
<input type="hidden" name="gatewayData[paymentTimezoneOffset]" value="" />

<script type="text/javascript">
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
function setDebitInfo() {
const language = window.navigator.language.slice(0, 2)
const height = screen.height
const width = screen.width
const colorDepth = window.screen.colorDepth
const userAgent = navigator.userAgent
const date = new Date()
const timezoneOffset = date.getTimezoneOffset()

const userAgentInput = document.getElementsByName('gatewayData[paymentUserAgent]')[0]
const deviceColorInput = document.getElementsByName('gatewayData[paymentColorDepth]')[0]
const langInput = document.getElementsByName('gatewayData[paymentLanguage]')[0]
const heightInput = document.getElementsByName('gatewayData[paymentHeight]')[0]
const widthInput = document.getElementsByName('gatewayData[paymentWidth]')[0]
const timezoneInput = document.getElementsByName('gatewayData[paymentTimezoneOffset]')[0]

if (userAgentInput && deviceColorInput && langInput && heightInput && widthInput && timezoneInput) {
userAgentInput.value = userAgent
deviceColorInput.value = colorDepth
langInput.value = language
heightInput.value = height
widthInput.value = width
timezoneInput.value = timezoneOffset
}
}

setDebitInfo()
</script>

<!-- CARD NUMBER INPUT -->
Expand Down
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: payment, donation, credit, debit, card
Requires at least: 5.7
Requires PHP: 7.4
Tested up to: 6.6
Stable tag: 2.0.0
Stable tag: 2.0.1
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -65,6 +65,10 @@ To get your E-Rede production credentials you will need to follow [this guide](h
1. None

== Changelog ==
= 2.0.1 =
**10/10/2024**
* Add link to view logs;
* Fix donation status;

= 2.0.0 =
**14/05/2024**
Expand Down
Binary file modified languages/payment-erede-for-givewp-pt_BR.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions languages/payment-erede-for-givewp-pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ msgstr "Desabilitado"
msgid "Debug mode"
msgstr "Modo de depuração"

msgid "Saves transaction logs for testing purposes."
msgstr "Salva logs da transação para fins de teste."
msgid "Saves transaction logs for testing purposes. %sSee logs.%s"
msgstr "Salva logs da transação para fins de teste. %sVer logs.%s"

msgid "Donation"
msgstr "Doação"
Expand Down
2 changes: 1 addition & 1 deletion languages/payment-erede-for-givewp.pot
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ msgstr ""
msgid "Debug mode"
msgstr ""

msgid "Saves transaction logs for testing purposes."
msgid "Saves transaction logs for testing purposes. %sSee logs.%s"
msgstr ""

msgid "Donation"
Expand Down
4 changes: 2 additions & 2 deletions payment-erede-for-givewp.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Plugin Name: Payment Gateway E-Rede for GiveWP
* Plugin URI: https://www.linknacional.com.br/wordpress/plugins/
* Description: Credit and debit card payment using E-Rede
* Version: 2.0.0
* Version: 2.0.1
* Author: Link Nacional
* Author URI: https://www.linknacional.com.br/wordpress/plugins/
* License: GPL-3.0+
Expand All @@ -41,7 +41,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'PAYMENT_EREDE_FOR_GIVEWP_VERSION', '2.0.0' );
define( 'PAYMENT_EREDE_FOR_GIVEWP_VERSION', '2.0.1' );

define( 'PAYMENT_EREDE_FOR_GIVEWP_MIN_GIVE_VERSION', '2.31.0' );

Expand Down

0 comments on commit 9c5089a

Please sign in to comment.