Skip to content

Commit

Permalink
Merge branch 'master' into fix/value-without-taxes-on-tp
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderson Campanha authored Nov 19, 2018
2 parents 3e4bd8e + d112f68 commit d012fe7
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

# 1.34.4
* Improvement - Add instalments and interest translation [#714](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/714)

# 1.34.3
* Improvement - Mask document in Chile and Colombia [#708](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/708)
* Fix - Resolved wrong amount in checkout page [#709](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/709)
Expand Down
26 changes: 25 additions & 1 deletion gateways/class-wc-ebanx-credit-card-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,29 @@ public function get_payment_terms( $country, $amount, $currency_rate ) {
return $apply_filters;
}

/**
*
* @param string $country
*
* @return string
*/
public static function get_instalment_title_by_country( $country ) {
switch ( $country ) {
case WC_EBANX_Constants::COUNTRY_BRAZIL:
return 'Número de parcelas';
break;
case WC_EBANX_Constants::COUNTRY_COLOMBIA:
return 'Cuota';
break;
case WC_EBANX_Constants::COUNTRY_CHILE:
return 'Cuota';
break;
default:
return 'Mensualidades';
break;
}
}

/**
* The HTML structure on checkout page
*
Expand Down Expand Up @@ -459,9 +482,10 @@ public function payment_fields() {
'cards' => (array) $cards,
'cart_total' => $cart_total,
'place_order_enabled' => $save_card,
'instalments' => WC_EBANX_Constants::COUNTRY_BRAZIL === $country ? 'Número de parcelas' : 'Meses sin intereses',
'instalments' => self::get_instalment_title_by_country( $country ),
'id' => $this->id,
'add_tax' => WC_EBANX_Helper::should_apply_taxes(),
'with_interest' => WC_EBANX_Constants::COUNTRY_BRAZIL === $country ? ' com taxas' : '',
),
'woocommerce/ebanx/',
WC_EBANX::get_templates_path()
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: ebanxwp
Tags: credit card, boleto, ebanx, woocommerce, payment gateway, latin america, brazil, mexico, argentina, peru, colombia, chile, ecuador, cash payment, local payment, card payment, one-click payment, alternative payments, payment processing
Requires at least: 4.0
Tested up to: 4.9
Stable tag: 1.34.3
Stable tag: 1.34.4
License: Apache v2.0
License URI: http://www.apache.org/licenses/LICENSE-2.0

Expand Down Expand Up @@ -148,6 +148,9 @@ Yes, you can.

== Changelog ==

= 1.34.4 =
* Improvement - Add instalments and interest translation [#714](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/714)

= 1.34.3 =
* Improvement - Mask document in Chile and Colombia [#708](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/708)
* Fix - Resolved wrong amount in checkout page [#709](https://github.com/ebanx/woocommerce-gateway-ebanx/pull/709)
Expand Down
14 changes: 10 additions & 4 deletions templates/instalments.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
<?php if ( WC_EBANX_Helper::checkout_contains_subscription() ) : ?>
<input type="hidden" name="ebanx-credit-card-installments" value="1" />
<?php else : ?>
<label for="ebanx-card-installments"><?php echo esc_html( $instalments ); ?> <span class="required">*</span></label>
<label for="ebanx-card-installments">
<?php
// @codingStandardsIgnoreLine
echo esc_html( $instalments );
?>
<span class="required">*</span>
</label>
<select
data-country="<?php echo esc_attr( $country ); ?>"
data-amount="<?php echo esc_attr( $cart_total ); ?>"
Expand All @@ -21,9 +27,9 @@ class="ebanx-instalments ebanx-select-field"
<option value="<?php echo esc_attr( $instalment['number'] ); ?>">
<?php
// @codingStandardsIgnoreLine
printf( __( '%1$dx of %2$s', 'woocommerce-gateway-ebanx' ), absint( $instalment['number'] ), esc_html( strip_tags( wc_price( $instalment['price'] * $currency_rate , array( 'currency' => $currency ) ) ) ) );

echo esc_html( $instalment['has_interest'] ? __( ' with interest', 'woocommerce-gateway-ebanx' ) : '' );
printf( __( '%1$dx %2$s', 'woocommerce-gateway-ebanx' ), absint( $instalment['number'] ), esc_html( strip_tags( wc_price( $instalment['price'] * $currency_rate , array( 'currency' => $currency ) ) ) ) );
// @codingStandardsIgnoreLine
echo esc_html( $instalment['has_interest'] ? __( $with_interest, 'woocommerce-gateway-ebanx' ) : '' );
?>
</option>
<?php endforeach; ?>
Expand Down
2 changes: 1 addition & 1 deletion tests/woocommerce/cypress.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"DEMO_INTEREST_RATE": 37.50,
"DEMO_CURRENCY": "USD",
"DEMO_PLATFORM": "from_woocommerce",
"DEMO_PLATFORM_VERSION": "version=1.34.3",
"DEMO_PLATFORM_VERSION": "version=1.34.4",
"DEMO_INTEGRATION_KEY": "test_ik_XRsjfeba9c8ibhVv10NUiw"
}
2 changes: 1 addition & 1 deletion woocommerce-gateway-ebanx.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.34.3
* Version: 1.34.4
* License: MIT
* Text Domain: woocommerce-gateway-ebanx
* Domain Path: /languages
Expand Down

0 comments on commit d012fe7

Please sign in to comment.