use billing address if shipping address is not given
rodzic
9fcaf65b93
commit
193869a025
|
@ -9,7 +9,7 @@
|
|||
* Plugin Name: GNU Taler Payment for WooCommerce
|
||||
* Plugin URI: https://git.taler.net/woocommerce-taler
|
||||
* Description: This plugin enables payments via the GNU Taler payment system
|
||||
* Version: 0.9.3
|
||||
* Version: 0.9.4
|
||||
* Author: Dominique Hofmann, Jan Strübin, Christian Grothoff
|
||||
* Author URI: https://taler.net/
|
||||
*
|
||||
|
@ -790,11 +790,51 @@ function gnutaler_init_gateway_class() {
|
|||
$shipping_address_street = '';
|
||||
$shipping_address_street_nr = '';
|
||||
|
||||
$store_address = $wc_order->get_shipping_address_1();
|
||||
$store_address = $wc_order->get_shipping_address_1( $context = 'view' );
|
||||
if ( is_null( $store_address ) || empty( $store_address ) )
|
||||
$store_address = $wc_order->get_billing_address_1( $context = 'view' );
|
||||
$store_address_inverted = strrev( $store_address );
|
||||
$store_address_array = str_split( $store_address_inverted );
|
||||
$country = $wc_order->get_shipping_country ($context = 'view');
|
||||
if ( is_null( $country ) || empty( $country ) )
|
||||
$country = $wc_order->get_billing_country ($context = 'view');
|
||||
$state = $wc_order->get_shipping_state ($context = 'view');
|
||||
if ( is_null( $state ) || empty( $state ) )
|
||||
$state = $wc_order->get_billing_state ($context = 'view');
|
||||
$city = $wc_order->get_shipping_city ($context = 'view');
|
||||
if ( is_null( $city ) || empty( $city ) )
|
||||
$city = $wc_order->get_billing_city ($context = 'view');
|
||||
$postcode = $wc_order->get_shipping_postcode ($context = 'view');
|
||||
if ( is_null( $postcode ) || empty( $postcode ) )
|
||||
$postcode = $wc_order->get_billing_postcode ($context = 'view');
|
||||
|
||||
$this->info (
|
||||
sprintf(
|
||||
'Shipping address is %s - %s - %s - %s - %s',
|
||||
$store_address,
|
||||
$wc_order->get_shipping_country ($context = 'view'),
|
||||
$wc_order->get_shipping_state ($context = 'view'),
|
||||
$wc_order->get_shipping_city ($context = 'view'),
|
||||
$wc_order->get_shipping_postcode ($context = 'view')) );
|
||||
|
||||
$this->info (
|
||||
sprintf(
|
||||
'Billing address is %s - %s - %s - %s - %s',
|
||||
$store_address,
|
||||
$wc_order->get_billing_country ($context = 'view'),
|
||||
$wc_order->get_billing_state ($context = 'view'),
|
||||
$wc_order->get_billing_city ($context = 'view'),
|
||||
$wc_order->get_billing_postcode ($context = 'view')) );
|
||||
$this->info (
|
||||
sprintf(
|
||||
'Using address is %s - %s - %s - %s - %s',
|
||||
$store_address,
|
||||
$country,
|
||||
$state,
|
||||
$city,
|
||||
$postcode));
|
||||
|
||||
// Split the address into street and street number.
|
||||
// Split the address into street and street number.
|
||||
foreach ( $store_address_array as $char ) {
|
||||
if ( ! $whitechar_encounter ) {
|
||||
$shipping_address_street .= $char;
|
||||
|
@ -805,10 +845,10 @@ function gnutaler_init_gateway_class() {
|
|||
}
|
||||
}
|
||||
$ret = array(
|
||||
'country' => $wc_order->get_shipping_country(),
|
||||
'country_subdivision' => $wc_order->get_shipping_state(),
|
||||
'town' => $wc_order->get_shipping_city(),
|
||||
'post_code' => $wc_order->get_shipping_postcode(),
|
||||
'country' => $country,
|
||||
'country_subdivision' => $state,
|
||||
'town' => $city,
|
||||
'post_code' => $postcode,
|
||||
'street' => $shipping_address_street,
|
||||
'building_number' => $shipping_address_street_nr,
|
||||
);
|
||||
|
|
|
@ -45,6 +45,10 @@ A: For the plugin to work correctly you need to have the WooCommerce plugin inst
|
|||
|
||||
== Changelog ==
|
||||
|
||||
= 0.9.4 =
|
||||
|
||||
* Use billing address in contract if shipping address is not given
|
||||
|
||||
= 0.9.3 =
|
||||
|
||||
* Fix log logic
|
||||
|
|
Ładowanie…
Reference in New Issue