From 4760011122cbac306d203cbec371fade529ae043 Mon Sep 17 00:00:00 2001 From: Peter Nguyen Date: Wed, 10 Nov 2021 14:27:36 +0700 Subject: [PATCH] New option to open widget in Paymentwall hosted page --- readme.txt | 3 +++ src/includes/admin/settings/paymentwall.php | 10 ++++++++++ src/includes/class-paymentwall-gateway.php | 5 +++++ src/paymentwall-for-woocommerce.php | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 8ac741a..0280284 100644 --- a/readme.txt +++ b/readme.txt @@ -37,6 +37,9 @@ View our full installation guide: 'No' ), 'default' => '1' + ), + 'use_paymentwall_hosted_page' => array( + 'title' => __('Open in Paymentwall hosted page', PW_TEXT_DOMAIN), + 'type' => 'select', + 'label' => __('Open in Paymentwall hosted page', PW_TEXT_DOMAIN), + 'options' => array( + '0' => 'No', + '1' => 'Yes' + ), + 'default' => '0' ) ); diff --git a/src/includes/class-paymentwall-gateway.php b/src/includes/class-paymentwall-gateway.php index 1f803eb..21bab19 100644 --- a/src/includes/class-paymentwall-gateway.php +++ b/src/includes/class-paymentwall-gateway.php @@ -113,6 +113,11 @@ function receipt_page($order_id) { // Clear shopping cart WC()->cart->empty_cart(); + if ($this->settings['use_paymentwall_hosted_page']) { + wp_redirect($widget->getUrl()); + return; + } + echo $this->get_template('widget.html', array( 'orderId' => $order_id, 'title' => sprintf(__('Please continue the purchase via %s using the widget below.', PW_TEXT_DOMAIN), $paymentSystemName), diff --git a/src/paymentwall-for-woocommerce.php b/src/paymentwall-for-woocommerce.php index 28f7757..9c0b4de 100644 --- a/src/paymentwall-for-woocommerce.php +++ b/src/paymentwall-for-woocommerce.php @@ -5,7 +5,7 @@ * Plugin Name: Paymentwall for WooCommerce * Plugin URI: https://docs.paymentwall.com/modules/woocommerce * Description: Official Paymentwall module for WordPress WooCommerce. - * Version: 1.7.3 + * Version: 1.7.4 * Author: The Paymentwall Team * Author URI: http://www.paymentwall.com/ * Text Domain: paymentwall-for-woocommerce