Skip to content

Commit

Permalink
Merge pull request #553 from ebanx/staging/v1.17.0
Browse files Browse the repository at this point in the history
Staging/v1.17.0
  • Loading branch information
Anderson Campanha authored Aug 7, 2017
2 parents 6581aa7 + 3f4af0b commit cedb08a
Show file tree
Hide file tree
Showing 40 changed files with 778 additions and 576 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

#1.17.0
* Feature - New Thank You pages for Credit Card and Boleto [#544](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/544)
* Feature - Added translation for Minimum Amount for Purchase error on Colombia [#547](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/547)
* Feature - Added Portuguese translation for Settings Page [#549](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/549)
* Feature - Changed project license to Apache v2.0 [548](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/548)
* Fix - Changed IOF messages on Admin Dashboard [#545](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/545)
* Fix - Fixed Debit Card tokenize error [#550](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/550)
* Fix - Fixed One Click Payment not processing [#551](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/551)
* Fix - Updated pay for order layout [#552](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/552)

# 1.16.0
* Feature - Pay for order(woocommerce native payment by link) [#531](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/531)
* Feature - Added Credit Card Gateway for Colombia [#534](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/534)
Expand Down
5 changes: 5 additions & 0 deletions woocommerce-gateway-ebanx/assets/css/paying-via-ebanx.css
Original file line number Diff line number Diff line change
Expand Up @@ -495,3 +495,8 @@ li[class*="ebanx"] .payment_box .ebanx-credit-card-label > .ebanx-credit-card-bi
-webkit-box-shadow: none;
box-shadow: none;
}

.ebanx-compliance-fields .ebanx-form-row {
padding-left: 0;
padding-right: 0;
}
2 changes: 2 additions & 0 deletions woocommerce-gateway-ebanx/assets/js/debit-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ jQuery( function($) {
wc_ebanx_form.removeHiddenInputs();
} else {
wc_ebanx_form.form.append('<input type="hidden" name="ebanx_debit_token" id="ebanx_debit_token" value="' + response.data.token + '"/>');
wc_ebanx_form.form.append('<input type="hidden" name="ebanx_masked_card_number" id="ebanx_masked_card_number" value="' + response.data.masked_card_number + '"/>');
wc_ebanx_form.form.submit();
}
},
Expand All @@ -111,6 +112,7 @@ jQuery( function($) {
removeHiddenInputs: function () {
$('#ebanx_debit_token').remove();
$('#ebanx_billing_cvv').remove();
$('#ebanx_masked_card_number').remove();
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

if (!defined('ABSPATH')) {
exit;
}

class WC_EBANX_Payment_Exception extends Exception {
protected $code;
protected $message;

public function __construct($message, $code, Throwable $previous = null)
{
parent::__construct($code, 0, $previous);
$this->code = $code;
$this->message = $message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - ACCOUNT', 'woocommerce-gateway-ebanx');

$this->api_name = 'ebanxaccount';
$this->title = __('Saldo EBANX', 'woocommerce-gateway-ebanx');
$this->description = __('Pague usando o saldo da sua conta do EBANX.', 'woocommerce-gateway-ebanx');
$this->title = 'Saldo EBANX';
$this->description = 'Pague usando o saldo da sua conta do EBANX.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - Baloto', 'woocommerce-gateway-ebanx');

$this->api_name = 'baloto';
$this->title = __('Baloto', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con Baloto.', 'woocommerce-gateway-ebanx');
$this->title = 'Baloto';
$this->description = 'Paga con Baloto.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - Banking Ticket', 'woocommerce-gateway-ebanx');

$this->api_name = 'boleto';
$this->title = __('Boleto EBANX', 'woocommerce-gateway-ebanx');
$this->description = __('Pague com boleto bancário.', 'woocommerce-gateway-ebanx');
$this->title = 'Boleto EBANX';
$this->description = 'Pague com boleto bancário.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public function __construct()
$this->id = 'ebanx-credit-card-br';
$this->method_title = __('EBANX - Credit Card Brazil', 'woocommerce-gateway-ebanx');

$this->title = __('Cartão de Crédito', 'woocommerce-gateway-ebanx');
$this->description = __('Pague com cartão de crédito.', 'woocommerce-gateway-ebanx');
$this->title = 'Cartão de Crédito';
$this->description = 'Pague com cartão de crédito.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function __construct()
$this->id = 'ebanx-credit-card-co';
$this->method_title = __('EBANX - Credit Card Colombia', 'woocommerce-gateway-ebanx');

$this->title = __('Tarjeta de Crédito', 'woocommerce-gateway-ebanx');
$this->description = __('Pay with credit card.', 'woocommerce-gateway-ebanx');
$this->title = 'Tarjeta de Crédito';
$this->description = 'Pay with credit card.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function __construct()
$this->id = 'ebanx-credit-card-mx';
$this->method_title = __('EBANX - Credit Card Mexico', 'woocommerce-gateway-ebanx');

$this->title = __('Tarjeta de Crédito', 'woocommerce-gateway-ebanx');
$this->description = __('Pay with credit card.', 'woocommerce-gateway-ebanx');
$this->title = 'Tarjeta de Crédito';
$this->description = 'Pay with credit card.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - Debit Card', 'woocommerce-gateway-ebanx');

$this->api_name = 'debitcard';
$this->title = __('Tarjeta de Débito', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con tarjeta de débito.', 'woocommerce-gateway-ebanx');
$this->title = 'Tarjeta de Débito';
$this->description = 'Paga con tarjeta de débito.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - PSE', 'woocommerce-gateway-ebanx');

$this->api_name = 'eft';
$this->title = __('PSE - Pago Seguros en Línea', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con PSE - Pago Seguros en Línea.', 'woocommerce-gateway-ebanx');
$this->title = 'PSE - Pago Seguros en Línea';
$this->description = 'Paga con PSE - Pago Seguros en Línea.';

parent::__construct();

Expand Down
54 changes: 39 additions & 15 deletions woocommerce-gateway-ebanx/gateways/class-wc-ebanx-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,20 +758,7 @@ public function process_payment($order_id)

$country = $this->getTransactionAddress('country');

$code = $e->getMessage();

$languages = array(
'mx' => 'es',
'cl' => 'es',
'pe' => 'es',
'co' => 'es',
'br' => 'pt-br',
);
$language = $languages[$country];

$errors = WC_EBANX_Errors::get_errors();

$message = !empty($errors[$language][$code]) ? $errors[$language][$code] : $errors[$language]['GENERAL'] . " ({$code})";
$message = self::get_error_message($e, $country);

WC()->session->set('refresh_totals', true);
WC_EBANX::log("EBANX Error: $message");
Expand All @@ -783,6 +770,42 @@ public function process_payment($order_id)
}
}

/**
* Get the error message
*
* @param Exception $exception
* @param string $country
* @return string
*/
private static function get_error_message($exception, $country)
{
$code = $exception->getCode() ?: $exception->getMessage();

$languages = array(
'mx' => 'es',
'cl' => 'es',
'pe' => 'es',
'co' => 'es',
'br' => 'pt-br',
);
$language = $languages[$country];

$errors = WC_EBANX_Errors::get_errors();

if ($code === 'BP-DR-6' && $language === 'es') {
$error_info = array();
preg_match('/Amount must be greater than (\w{3}) (.+)/',
$exception->getMessage(),
$error_info
);
$amount = $error_info[2];
$currency = $error_info[1];
return sprintf($errors[$language][$code], wc_price($amount, array('currency' => $currency)));
}

return !empty($errors[$language][$code]) ? $errors[$language][$code] : $errors[$language]['GENERAL'] . " ({$code})";
}

/**
* The page of order received, we call them as "Thank you pages"
*
Expand Down Expand Up @@ -921,14 +944,15 @@ protected function save_user_meta_fields($order)
protected function process_response_error($request, $order)
{
$code = isset($request->status_code) ? $request->status_code : 'GENERAL';
$status_message = isset($request->status_message) ? $request->status_message : '';
$error_message = __(sprintf('EBANX: An error occurred: %s - %s', $code, $request->status_message), 'woocommerce-gateway-ebanx');

$order->update_status('failed', $error_message);
$order->add_order_note($error_message);

do_action('ebanx_process_response_error', $order, $code);

throw new Exception($code);
throw new WC_EBANX_Payment_Exception($status_message, $code);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public function __construct()
$this->id = 'ebanx-multicaja';
$this->method_title = __('EBANX - Multicaja', 'woocommerce-gateway-ebanx');

$this->title = __('Multicaja', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con multicaja.', 'woocommerce-gateway-ebanx');
$this->title = 'Multicaja';
$this->description = 'Paga con multicaja.';

$this->template_file = 'flow/multicaja/payment-form.php';
$this->flow_payment_method = 'multicaja';

parent::__construct();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - OXXO', 'woocommerce-gateway-ebanx');

$this->api_name = 'oxxo';
$this->title = __('OXXO', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con boleta OXXO.', 'woocommerce-gateway-ebanx');
$this->title = 'OXXO';
$this->description = 'Paga con boleta OXXO.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - Pagoefectivo', 'woocommerce-gateway-ebanx');

$this->api_name = 'pagoefectivo';
$this->title = __('PagoEfectivo', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con PagoEfectivo.', 'woocommerce-gateway-ebanx');
$this->title = 'PagoEfectivo';
$this->description = 'Paga con PagoEfectivo.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function __construct()
$this->id = 'ebanx-safetypay';
$this->method_title = __('EBANX - Safetypay', 'woocommerce-gateway-ebanx');

$this->title = __('SafetyPay', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con SafetyPay.', 'woocommerce-gateway-ebanx');
$this->title = 'SafetyPay';
$this->description = 'Paga con SafetyPay.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - Sencillito', 'woocommerce-gateway-ebanx');

$this->api_name = 'sencillito';
$this->title = __('Sencillito', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con Sencillito.', 'woocommerce-gateway-ebanx');
$this->title = 'Sencillito';
$this->description = 'Paga con Sencillito.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - Servipag', 'woocommerce-gateway-ebanx');

$this->api_name = 'servipag';
$this->title = __('ServiPag', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con Servipag.', 'woocommerce-gateway-ebanx');
$this->title = 'ServiPag';
$this->description = 'Paga con Servipag.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function __construct()
$this->method_title = __('EBANX - TEF', 'woocommerce-gateway-ebanx');

$this->api_name = 'tef';
$this->title = __('Débito Online', 'woocommerce-gateway-ebanx');
$this->description = __('Selecione o seu banco. A seguir, você será redirecionado para concluir o pagamento pelo seu internet banking.', 'woocommerce-gateway-ebanx');
$this->title = 'Débito Online';
$this->description = 'Selecione o seu banco. A seguir, você será redirecionado para concluir o pagamento pelo seu internet banking.';

parent::__construct();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public function __construct()
$this->id = 'ebanx-webpay';
$this->method_title = __('EBANX - Webpay', 'woocommerce-gateway-ebanx');

$this->title = __('Webpay', 'woocommerce-gateway-ebanx');
$this->description = __('Paga con Webpay.', 'woocommerce-gateway-ebanx');
$this->title = 'Webpay';
$this->description = 'Paga con Webpay.';

$this->template_file = 'flow/webpay/payment-form.php';
$this->flow_payment_method = 'webpay';
Expand Down
Binary file not shown.
Loading

0 comments on commit cedb08a

Please sign in to comment.