Skip to content

Commit

Permalink
Merge pull request #767 from ebanx/upkeep/remove-get-country-usage
Browse files Browse the repository at this point in the history
Remove deprecated GetCountry usage
  • Loading branch information
afstarosta authored Apr 22, 2019
2 parents 4301666 + b16c127 commit 2cae7da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gateways/class-wc-ebanx-new-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,12 @@ public function get_transaction_address( $attr = '' ) {
! isset( WC()->customer )
|| is_admin()
|| empty( WC_EBANX_Request::read( 'billing_country', null ) )
&& empty( WC()->customer->get_country() )
&& empty( WC()->customer->get_billing_country() )
) {
return false;
}

$address['country'] = trim( strtolower( WC()->customer->get_country() ) );
$address['country'] = trim( strtolower( WC()->customer->get_billing_country() ) );
if ( ! empty( WC_EBANX_Request::read( 'billing_country', null ) ) ) {
$address['country'] = trim( strtolower( WC_EBANX_Request::read( 'billing_country' ) ) );
}
Expand Down Expand Up @@ -561,7 +561,7 @@ public function checkout_rate_conversion( $currency, $template = true, $country
}

if ( null === $country ) {
$country = trim( strtolower( WC()->customer->get_country() ) );
$country = trim( strtolower( WC()->customer->get_billing_country() ) );
}

$exchange = $this->ebanx->exchange();
Expand Down
4 changes: 2 additions & 2 deletions services/class-wc-ebanx-payment-adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function transform( $order, $configs, $names, $gateway_id ) {
*/
public static function transform_card( $order, $configs, $names, $gateway_id ) {
$payment = self::transform( $order, $configs, $names, $gateway_id );
$country = trim( strtolower( WC()->customer->get_country() ) );
$country = trim( strtolower( WC()->customer->get_billing_country() ) );

if ( in_array( $country, WC_EBANX_Constants::$credit_card_countries ) ) {
$payment->instalments = '1';
Expand Down Expand Up @@ -179,7 +179,7 @@ private static function transform_person( $order, $configs, $names, $gateway_id
* @throws Exception Throws parameter missing exception.
*/
private static function get_document( $configs, $names, $gateway_id ) {
$country = trim( strtolower( WC()->customer->get_country() ) );
$country = trim( strtolower( WC()->customer->get_billing_country() ) );

switch ( $country ) {
case WC_EBANX_Constants::COUNTRY_ARGENTINA:
Expand Down

0 comments on commit 2cae7da

Please sign in to comment.