Code Duplication    Length = 38-38 lines in 2 locations

includes/payment-methods/class-wc-gateway-stripe-bitcoin.php 1 location

@@ 65-102 (lines=38) @@
62
	/**
63
	 * Constructor
64
	 */
65
	public function __construct() {
66
		$this->id                   = 'stripe_bitcoin';
67
		$this->method_title         = __( 'Stripe Bitcoin', 'woocommerce-gateway-stripe' );
68
		/* translators: link */
69
		$this->method_description   = sprintf( __( 'All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' ) );
70
		$this->supports             = array(
71
			'products',
72
			'refunds',
73
		);
74
75
		// Load the form fields.
76
		$this->init_form_fields();
77
78
		// Load the settings.
79
		$this->init_settings();
80
81
		$main_settings              = get_option( 'woocommerce_stripe_settings' );
82
		$this->title                = $this->get_option( 'title' );
83
		$this->description          = $this->get_option( 'description' );
84
		$this->enabled              = $this->get_option( 'enabled' );
85
		$this->testmode             = ( ! empty( $main_settings['testmode'] ) && 'yes' === $main_settings['testmode'] ) ? true : false;
86
		$this->saved_cards          = ( ! empty( $main_settings['saved_cards'] ) && 'yes' === $main_settings['saved_cards'] ) ? true : false;
87
		$this->publishable_key      = ! empty( $main_settings['publishable_key'] ) ? $main_settings['publishable_key'] : '';
88
		$this->secret_key           = ! empty( $main_settings['secret_key'] ) ? $main_settings['secret_key'] : '';
89
		$this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : '';
90
91
		if ( $this->testmode ) {
92
			$this->publishable_key = ! empty( $main_settings['test_publishable_key'] ) ? $main_settings['test_publishable_key'] : '';
93
			$this->secret_key      = ! empty( $main_settings['test_secret_key'] ) ? $main_settings['test_secret_key'] : '';
94
		}
95
96
		add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
97
		add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
98
		add_action( 'woocommerce_thankyou_stripe_bitcoin', array( $this, 'thankyou_page' ) );
99
100
		// Customer Emails.
101
		add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
102
	}
103
104
	/**
105
	 * Returns all supported currencies for this payment method.

includes/payment-methods/class-wc-gateway-stripe-multibanco.php 1 location

@@ 58-95 (lines=38) @@
55
	/**
56
	 * Constructor
57
	 */
58
	public function __construct() {
59
		$this->id                   = 'stripe_multibanco';
60
		$this->method_title         = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' );
61
		/* translators: link */
62
		$this->method_description   = sprintf( __( 'All other general Stripe settings can be adjusted <a href="%s">here</a>.', 'woocommerce-gateway-stripe' ), admin_url( 'admin.php?page=wc-settings&tab=checkout&section=stripe' ) );
63
		$this->supports             = array(
64
			'products',
65
			'refunds',
66
		);
67
68
		// Load the form fields.
69
		$this->init_form_fields();
70
71
		// Load the settings.
72
		$this->init_settings();
73
74
		$main_settings              = get_option( 'woocommerce_stripe_settings' );
75
		$this->title                = $this->get_option( 'title' );
76
		$this->description          = $this->get_option( 'description' );
77
		$this->enabled              = $this->get_option( 'enabled' );
78
		$this->testmode             = ( ! empty( $main_settings['testmode'] ) && 'yes' === $main_settings['testmode'] ) ? true : false;
79
		$this->saved_cards          = ( ! empty( $main_settings['saved_cards'] ) && 'yes' === $main_settings['saved_cards'] ) ? true : false;
80
		$this->publishable_key      = ! empty( $main_settings['publishable_key'] ) ? $main_settings['publishable_key'] : '';
81
		$this->secret_key           = ! empty( $main_settings['secret_key'] ) ? $main_settings['secret_key'] : '';
82
		$this->statement_descriptor = ! empty( $main_settings['statement_descriptor'] ) ? $main_settings['statement_descriptor'] : '';
83
84
		if ( $this->testmode ) {
85
			$this->publishable_key = ! empty( $main_settings['test_publishable_key'] ) ? $main_settings['test_publishable_key'] : '';
86
			$this->secret_key      = ! empty( $main_settings['test_secret_key'] ) ? $main_settings['test_secret_key'] : '';
87
		}
88
89
		add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
90
		add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) );
91
		add_action( 'woocommerce_thankyou_stripe_multibanco', array( $this, 'thankyou_page' ) );
92
93
		// Customer Emails
94
		add_action( 'woocommerce_email_before_order_table', array( $this, 'email_instructions' ), 10, 3 );
95
	}
96
97
	/**
98
	 * Returns all supported currencies for this payment method.