[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-gnu-taler-payment-for-woocommerce] branch master updated: use bil
From: |
gnunet |
Subject: |
[taler-gnu-taler-payment-for-woocommerce] branch master updated: use billing address if shipping address is not given |
Date: |
Mon, 27 Feb 2023 17:40:44 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnu-taler-payment-for-woocommerce.
The following commit(s) were added to refs/heads/master by this push:
new 193869a use billing address if shipping address is not given
193869a is described below
commit 193869a02545b296b81a6bf9af013301e671db33
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Feb 27 17:40:42 2023 +0100
use billing address if shipping address is not given
---
class-wc-gnutaler-gateway.php | 56 ++++++++++++++++++++++++++++++++++++-------
readme.txt | 4 ++++
2 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/class-wc-gnutaler-gateway.php b/class-wc-gnutaler-gateway.php
index 94b2e06..fe86503 100644
--- a/class-wc-gnutaler-gateway.php
+++ b/class-wc-gnutaler-gateway.php
@@ -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 );
-
- // Split the address into street and street number.
+ $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.
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,
);
diff --git a/readme.txt b/readme.txt
index 5f6f223..d43d1aa 100644
--- a/readme.txt
+++ b/readme.txt
@@ -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
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-gnu-taler-payment-for-woocommerce] branch master updated: use billing address if shipping address is not given,
gnunet <=