diff --git a/CHANGELOG.md b/CHANGELOG.md index 890c8f5d..33a51e53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +# 1.13.1 +* Fix - Avoid duplication payment notifications [#509](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/509) +* Fix - Changed PSE thank you page HTML [#512](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/512) +* Fix - Changed Boleto thank you page HTML [#513](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/513) + # 1.13.0 * Fix - Fix for debug log when is enabled before record a log [#507](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/507) * Fix - Fix issue to avoid some issues on refund transactions [#506](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/506) diff --git a/docker-compose.yml b/docker-compose.yml index 1557e55a..493c8e91 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: ports: - 3306:3306 volumes: - - ./.data:/var/lib/mysql + - ./.data/db:/var/lib/mysql woo_plugin: image: ebanx/ebanx-woocommerce @@ -29,6 +29,7 @@ services: ports: - 80:80 volumes: + - /var/www/html - ./woocommerce-gateway-ebanx/:/var/www/html/wp-content/plugins/woocommerce-gateway-ebanx/ links: - woo_mysql:mysql \ No newline at end of file diff --git a/woocommerce-gateway-ebanx/assets/css/paying-via-ebanx.css b/woocommerce-gateway-ebanx/assets/css/paying-via-ebanx.css index ae209467..2944a0e6 100644 --- a/woocommerce-gateway-ebanx/assets/css/paying-via-ebanx.css +++ b/woocommerce-gateway-ebanx/assets/css/paying-via-ebanx.css @@ -363,31 +363,21 @@ li[class*="ebanx"] .payment_box .ebanx-credit-card-label > .ebanx-credit-card-bi margin: 20px 0; } -.woocommerce .ebanx-button--group-two > a, -.woocommerce .ebanx-button--group-two > button, -.woocommerce .ebanx-button--group-two > .button { - width: 49%; - float: left; -} - -.woocommerce .ebanx-button--group-two > a:not(:first-child), -.woocommerce .ebanx-button--group-two > button:not(:first-child), -.woocommerce .ebanx-button--group-two > .button:not(:first-child) { - float: right; +.button.banking-ticket__action { + width: calc(50% - 10px); + display: inline-block; + margin: 0; } -.woocommerce .ebanx-button--group::before, -.woocommerce .ebanx-button--group::after { - content: " "; - display: table; +.button.banking-ticket__action:last-child { + margin-left: 20px; } .woocommerce .ebanx-button--group::after {clear: both;} .woocommerce .ebanx-button--copy { position: relative; - margin-bottom: 0 !important; - + margin: 0 !important; transition: all .3s; } @@ -465,14 +455,15 @@ li[class*="ebanx"] .payment_box .ebanx-credit-card-label > .ebanx-credit-card-bi .banking-ticket__barcode::after {clear: both;} .banking-ticket__barcode-code { - display: inline-block; + display: block; letter-spacing: .32px; - vertical-align: middle; + text-align: center; } .banking-ticket__barcode-copy { - display: inline-block; - margin-left: 32px; + display: block; + text-align: center; + margin-top: 20px; } .ebanx-form-row .select2.select2-container { diff --git a/woocommerce-gateway-ebanx/gateways/class-wc-ebanx-gateway.php b/woocommerce-gateway-ebanx/gateways/class-wc-ebanx-gateway.php index 5bee5941..dbd90431 100644 --- a/woocommerce-gateway-ebanx/gateways/class-wc-ebanx-gateway.php +++ b/woocommerce-gateway-ebanx/gateways/class-wc-ebanx-gateway.php @@ -941,49 +941,14 @@ final public function process_hook(array $codes, $notificationType) $order = new WC_Order($order_id); - // TODO: if (empty($order)) {} - // TODO: if ($data->status != "SUCCESS") - switch (strtoupper($notificationType)) { case 'REFUND': - $refunds = current(get_post_meta($order->id, "_ebanx_payment_refunds")); - - foreach ($refunds as $k => $ref) { - foreach ($data->payment->refunds as $refund) { - if ($ref->id == $refund->id) { - if ($refund->status == 'CO' && $refunds[$k]->status != 'CO') { - $order->add_order_note(sprintf(__('EBANX: Your Refund was confirmed to EBANX - Refund ID: %s', 'woocommerce-gateway-ebanx'), $refund->id)); - } - if ($refund->status == 'CA' && $refunds[$k]->status != 'CA') { - $order->add_order_note(sprintf(__('EBANX: Your Refund was canceled to EBANX - Refund ID: %s', 'woocommerce-gateway-ebanx'), $refund->id)); - } - - $refunds[$k]->status = $refund->status; // status == co save note - $refunds[$k]->cancel_date = $refund->cancel_date; - $refunds[$k]->request_date = $refund->request_date; - $refunds[$k]->pending_date = $refund->pending_date; - $refunds[$k]->confirm_date = $refund->confirm_date; - } - } - } + $this->process_refund_hook($order, $data); - update_post_meta($order->id, "_ebanx_payment_refunds", $refunds); break; case 'UPDATE': - switch (strtoupper($data->payment->status)) { - case 'CO': - $order->update_status('processing'); - break; - case 'CA': - $order->update_status('failed'); - break; - case 'PE': - $order->update_status('on-hold'); - break; - case 'OP': - $order->update_status('pending'); - break; - } + $this->update_payment($order, $data); + break; }; @@ -993,7 +958,77 @@ final public function process_hook(array $codes, $notificationType) } /** - * Create the conveter amount on checkout page + * Updates the payment when receive a notification from EBANX + * + * @param WC_Order $order + * @param EBANX_Request $data + * @return void + */ + final public function update_payment($order, $data) { + $requestStatus = strtoupper($data->payment->status); + + $status = array( + 'CO' => 'Confirmed', + 'CA' => 'Canceled', + 'PE' => 'Pending', + 'OP' => 'Opened' + ); + $new_status = null; + switch ($requestStatus) { + case 'CO': + $new_status = 'processing'; + break; + case 'CA': + $new_status = 'failed'; + break; + case 'PE': + $new_status = 'on-hold'; + break; + case 'OP': + $new_status = 'pending'; + break; + } + + if ($new_status !== $order->status) { + $paymentStatus = $status[$data->payment->status]; + $order->add_order_note(sprintf(__('EBANX: The payment has been updated to: %s.', 'woocommerce-gateway-ebanx'), $paymentStatus)); + } + } + + /** + * Updates the refunds when receivers a EBANX refund notification + * + * @param WC_Order $order + * @param EBANX_Request $data + * @return void + */ + final public function process_refund_hook($order, $data) { + $refunds = current(get_post_meta($order->id, "_ebanx_payment_refunds")); + + foreach ($refunds as $k => $ref) { + foreach ($data->payment->refunds as $refund) { + if ($ref->id == $refund->id) { + if ($refund->status == 'CO' && $refunds[$k]->status != 'CO') { + $order->add_order_note(sprintf(__('EBANX: Your Refund was confirmed to EBANX - Refund ID: %s', 'woocommerce-gateway-ebanx'), $refund->id)); + } + if ($refund->status == 'CA' && $refunds[$k]->status != 'CA') { + $order->add_order_note(sprintf(__('EBANX: Your Refund was canceled to EBANX - Refund ID: %s', 'woocommerce-gateway-ebanx'), $refund->id)); + } + + $refunds[$k]->status = $refund->status; // status == co save note + $refunds[$k]->cancel_date = $refund->cancel_date; + $refunds[$k]->request_date = $refund->request_date; + $refunds[$k]->pending_date = $refund->pending_date; + $refunds[$k]->confirm_date = $refund->confirm_date; + } + } + } + + update_post_meta($order->id, "_ebanx_payment_refunds", $refunds); + } + + /** + * Create the converter amount on checkout page * * @param string $currency Possible currencies: BRL, USD, EUR, PEN, CLP, COP, MXN * @return void diff --git a/woocommerce-gateway-ebanx/readme.txt b/woocommerce-gateway-ebanx/readme.txt index 51753cbe..fcca91af 100644 --- a/woocommerce-gateway-ebanx/readme.txt +++ b/woocommerce-gateway-ebanx/readme.txt @@ -3,7 +3,7 @@ Contributors: ebanxwp Tags: credit card, boleto, ebanx, woocommerce, approval rate, conversion rate, brazil, mexico, peru, colombia, chile, oxxo, baloto, cash payment, local payment one-click payment, installments, alternative payments, accept more payments Requires at least: 4.0 Tested up to: 4.7 -Stable tag: 1.13.0 +Stable tag: 1.13.1 License: MIT License URI: https://opensource.org/licenses/MIT @@ -136,6 +136,11 @@ Yes, you can. == Changelog == += 1.13.1 = +* Fix - Avoid duplication payment notifications [#509](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/509) +* Fix - Changed PSE thank you page HTML [#512](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/512) +* Fix - Changed Boleto thank you page HTML [#513](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/513) + = 1.13.0 = * Fix - Fix for debug log when is enabled before record a log [#507](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/507) * Fix - Fix issue to avoid some issues on refund transactions [#506](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/506) diff --git a/woocommerce-gateway-ebanx/services/class-wc-ebanx-hooks.php b/woocommerce-gateway-ebanx/services/class-wc-ebanx-hooks.php index 3979aa68..e6602c4f 100644 --- a/woocommerce-gateway-ebanx/services/class-wc-ebanx-hooks.php +++ b/woocommerce-gateway-ebanx/services/class-wc-ebanx-hooks.php @@ -35,9 +35,6 @@ private static function is_url_response() { public static function payment_status_hook_action() { ob_start(); - // $myfile = fopen("/var/www/checkout-woocommerce/test.txt", "a") or die("Unable to open file!"); - // fwrite($myfile, json_encode(array('get' => $_GET, 'post' => $_REQUEST, 'request' => $_REQUEST))); - if ( ( WC_EBANX_Request::has('operation') && WC_EBANX_Request::read('operation') == 'payment_status_change' && WC_EBANX_Request::has('notification_type') @@ -68,8 +65,9 @@ public static function payment_status_hook_action() { if ( self::is_url_response() ) { wp_redirect( $order->get_checkout_order_received_url() ); - exit; } + + exit; } ob_end_clean(); diff --git a/woocommerce-gateway-ebanx/templates/baloto/payment-on-hold.php b/woocommerce-gateway-ebanx/templates/baloto/payment-on-hold.php index 4430bd44..0c79a837 100644 --- a/woocommerce-gateway-ebanx/templates/baloto/payment-on-hold.php +++ b/woocommerce-gateway-ebanx/templates/baloto/payment-on-hold.php @@ -22,8 +22,7 @@
- Guardar como PDF - Imprimir Baloto + Guardar como PDFImprimir Baloto

diff --git a/woocommerce-gateway-ebanx/templates/banking-ticket/payment-on-hold.php b/woocommerce-gateway-ebanx/templates/banking-ticket/payment-on-hold.php index d6a34a12..7087f335 100644 --- a/woocommerce-gateway-ebanx/templates/banking-ticket/payment-on-hold.php +++ b/woocommerce-gateway-ebanx/templates/banking-ticket/payment-on-hold.php @@ -37,8 +37,7 @@
- Salvar em PDF - Imprimir boleto + Salvar em PDFImprimir boleto
diff --git a/woocommerce-gateway-ebanx/templates/oxxo/payment-on-hold.php b/woocommerce-gateway-ebanx/templates/oxxo/payment-on-hold.php index 3cbbef01..4ed06fd8 100644 --- a/woocommerce-gateway-ebanx/templates/oxxo/payment-on-hold.php +++ b/woocommerce-gateway-ebanx/templates/oxxo/payment-on-hold.php @@ -24,8 +24,7 @@
- Guardar como PDF - Imprimir OXXO + Guardar como PDFImprimir OXXO

diff --git a/woocommerce-gateway-ebanx/woocommerce-gateway-ebanx.php b/woocommerce-gateway-ebanx/woocommerce-gateway-ebanx.php index 6ba30bbc..3e0af6b2 100644 --- a/woocommerce-gateway-ebanx/woocommerce-gateway-ebanx.php +++ b/woocommerce-gateway-ebanx/woocommerce-gateway-ebanx.php @@ -5,7 +5,7 @@ * Description: Offer Latin American local payment methods & increase your conversion rates with the solution used by AliExpress, AirBnB and Spotify in Brazil. * Author: EBANX * Author URI: https://www.ebanx.com/business/en - * Version: 1.13.0 + * Version: 1.13.1 * License: MIT * Text Domain: woocommerce-gateway-ebanx * Domain Path: /languages