From 9be6e8e5440b95f3ba46a5b7b2635ac71321611a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 13 Oct 2020 00:13:41 +0200 Subject: add refund_delay option --- .../GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php index 8454636..74cde71 100644 --- a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php +++ b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php @@ -171,6 +171,12 @@ function gnutaler_init_gateway_class() 'description' => __( 'Set the text the customer will see when confirming payment. %s will be substituted with the order number. (Example: MyShop #%s)', 'gnutaler' ), 'default' => 'WooTalerShop #%s', ), + 'GNU_Taler_refund_delay' => array( + 'title' => __( 'How long should refunds be possible', 'gnutaler' ), + 'type' => 'number', + 'description' => __( 'Set the number of days a customer has to request a refund', 'gnutaler' ), + 'default' => '14', + ), 'debug' => array( 'title' => __( 'Debug Log', 'woocommerce' ), 'label' => __( 'Enable logging', 'woocommerce' ), @@ -601,6 +607,7 @@ function gnutaler_init_gateway_class() $wc_cart = WC()->cart->get_cart(); $wc_order_id = $wc_order->get_order_key() . '-' . $wc_order->get_order_number(); $wc_order_products_array = $this->mutate_products_to_json_format( $wc_cart, $wc_order_currency, $wc_order ); + $refund_delay = $this->get_option( 'GNU_Taler_refund_delay' ); $order_json = array( 'order' => array( 'amount' => $wc_order_currency . ':' . $wc_order_total_amount, @@ -619,6 +626,12 @@ function gnutaler_init_gateway_class() 'delivery_location' => $this->mutate_shipping_information_to_json_format( $wc_order ), ), ); + if (isset ($refund_delay)) + { + $order_json['refund_delay'] = array ( + 'd_ms' => $refund_delay) + ); + } return $order_json; } -- cgit v1.2.3