PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.10.6
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.10.6
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / includes / core / gateways / class-wpfnl-gateway-cod.php

class-wpfnl-gateway-cod.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.10.6, at includes/core/gateways/class-wpfnl-gateway-cod.php

68 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Wpfnl_Pro_Gateway_Cod
5 */
6
7 namespace WPFunnels\Gateway;
8
9 use WPFunnels\Traits\SingletonTrait;
10 use WPFunnels\Wpfnl_functions;
11 use WPFunnels\Gateway\API\Wpfnl_Gateway;
12
13
14 /**
15 * Class Wpfnl_Pro_Gateway_Cod
16 * @package WPFunnelsPro\Frontend\Gateways
17 */
18 class Wpfnl_Gateway_Cod extends Wpfnl_Gateway {
19
20 use SingletonTrait;
21
22 public $key = 'cod';
23
24
25 /**
26 * @var bool $refund_support
27 */
28 public $refund_support;
29
30
31 public function __construct() {
32 $this->refund_support = false;
33 add_filter( 'woocommerce_cod_process_payment_order_status', array( $this, 'maybe_setup_offer_for_cod' ), 9999, 2 );
34 }
35
36
37 /**
38 * set new status for orders based on offer
39 *
40 * @param $order_status
41 * @param $order
42 * @return string
43 */
44 public function maybe_setup_offer_for_cod( $order_status, $order ) {
45
46 $payment_method = $order->get_payment_method();
47 $funnel_id = Wpfnl_functions::get_funnel_id_from_order( $order->get_id() );
48 $offer_settings = Wpfnl_functions::get_offer_settings();
49 if ( $offer_settings['offer_orders'] == 'main-order' && $funnel_id ) {
50 return 'wc-wpfnl-main-order';
51 }
52
53 return $order_status;
54 }
55
56
57 /**
58 * process payment for offer
59 *
60 * @param $order
61 * @param $offer_product
62 * @return bool
63 */
64 public function process_payment( $order, $offer_product ) {
65 $result['is_success'] = true;
66 return $result;
67 }
68 }