Code Duplication    Length = 28-28 lines in 7 locations

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

@@ 217-244 (lines=28) @@
214
	/**
215
	 * Payment form on checkout page
216
	 */
217
	public function payment_fields() {
218
		$user                 = wp_get_current_user();
219
		$total                = WC()->cart->total;
220
221
		// If paying from order, we need to get total from order not cart.
222
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
223
			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
224
			$total = $order->get_total();
225
		}
226
227
		if ( is_add_payment_method_page() ) {
228
			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
229
			$total        = '';
230
		} else {
231
			$pay_button_text = '';
232
		}
233
234
		echo '<div
235
			id="stripe-alipay-payment-data"
236
			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
237
			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
238
239
		if ( $this->description ) {
240
			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
241
		}
242
243
		echo '</div>';
244
	}
245
246
	/**
247
	 * Creates the source for charge.

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

@@ 207-234 (lines=28) @@
204
	/**
205
	 * Payment form on checkout page
206
	 */
207
	public function payment_fields() {
208
		$user  = wp_get_current_user();
209
		$total = WC()->cart->total;
210
211
		// If paying from order, we need to get total from order not cart.
212
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
213
			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
214
			$total = $order->get_total();
215
		}
216
217
		if ( is_add_payment_method_page() ) {
218
			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
219
			$total        = '';
220
		} else {
221
			$pay_button_text = '';
222
		}
223
224
		echo '<div
225
			id="stripe-bancontact-payment-data"
226
			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
227
			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
228
229
		if ( $this->description ) {
230
			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
231
		}
232
233
		echo '</div>';
234
	}
235
236
	/**
237
	 * Creates the source for charge.

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

@@ 218-245 (lines=28) @@
215
	/**
216
	 * Payment form on checkout page
217
	 */
218
	public function payment_fields() {
219
		$user                 = wp_get_current_user();
220
		$total                = WC()->cart->total;
221
222
		// If paying from order, we need to get total from order not cart.
223
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
224
			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
225
			$total = $order->get_total();
226
		}
227
228
		if ( is_add_payment_method_page() ) {
229
			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
230
			$total        = '';
231
		} else {
232
			$pay_button_text = '';
233
		}
234
235
		echo '<div
236
			id="stripe-bitcoin-payment-data"
237
			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
238
			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
239
240
		if ( $this->description ) {
241
			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
242
		}
243
244
		echo '</div>';
245
	}
246
247
	/**
248
	 * Output for the order received page.

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

@@ 207-234 (lines=28) @@
204
	/**
205
	 * Payment form on checkout page
206
	 */
207
	public function payment_fields() {
208
		$user                 = wp_get_current_user();
209
		$total                = WC()->cart->total;
210
211
		// If paying from order, we need to get total from order not cart.
212
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
213
			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
214
			$total = $order->get_total();
215
		}
216
217
		if ( is_add_payment_method_page() ) {
218
			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
219
			$total        = '';
220
		} else {
221
			$pay_button_text = '';
222
		}
223
224
		echo '<div
225
			id="stripe-giropay-payment-data"
226
			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
227
			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
228
229
		if ( $this->description ) {
230
			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
231
		}
232
233
		echo '</div>';
234
	}
235
236
	/**
237
	 * Creates the source for charge.

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

@@ 207-234 (lines=28) @@
204
	/**
205
	 * Payment form on checkout page
206
	 */
207
	public function payment_fields() {
208
		$user                 = wp_get_current_user();
209
		$total                = WC()->cart->total;
210
211
		// If paying from order, we need to get total from order not cart.
212
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
213
			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
214
			$total = $order->get_total();
215
		}
216
217
		if ( is_add_payment_method_page() ) {
218
			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
219
			$total        = '';
220
		} else {
221
			$pay_button_text = '';
222
		}
223
224
		echo '<div
225
			id="stripe-ideal-payment-data"
226
			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
227
			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
228
229
		if ( $this->description ) {
230
			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
231
		}
232
233
		echo '</div>';
234
	}
235
236
	/**
237
	 * Creates the source for charge.

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

@@ 208-235 (lines=28) @@
205
	/**
206
	 * Payment form on checkout page
207
	 */
208
	public function payment_fields() {
209
		$user                 = wp_get_current_user();
210
		$total                = WC()->cart->total;
211
212
		// If paying from order, we need to get total from order not cart.
213
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
214
			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
215
			$total = $order->get_total();
216
		}
217
218
		if ( is_add_payment_method_page() ) {
219
			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
220
			$total        = '';
221
		} else {
222
			$pay_button_text = '';
223
		}
224
225
		echo '<div
226
			id="stripe-p24-payment-data"
227
			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
228
			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
229
230
		if ( $this->description ) {
231
			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
232
		}
233
234
		echo '</div>';
235
	}
236
237
	/**
238
	 * Creates the source for charge.

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

@@ 207-234 (lines=28) @@
204
	/**
205
	 * Payment form on checkout page
206
	 */
207
	public function payment_fields() {
208
		$user  = wp_get_current_user();
209
		$total = WC()->cart->total;
210
211
		// If paying from order, we need to get total from order not cart.
212
		if ( isset( $_GET['pay_for_order'] ) && ! empty( $_GET['key'] ) ) {
213
			$order = wc_get_order( wc_get_order_id_by_order_key( wc_clean( $_GET['key'] ) ) );
214
			$total = $order->get_total();
215
		}
216
217
		if ( is_add_payment_method_page() ) {
218
			$pay_button_text = __( 'Add Payment', 'woocommerce-gateway-stripe' );
219
			$total        = '';
220
		} else {
221
			$pay_button_text = '';
222
		}
223
224
		echo '<div
225
			id="stripe-sofort-payment-data"
226
			data-amount="' . esc_attr( WC_Stripe_Helper::get_stripe_amount( $total ) ) . '"
227
			data-currency="' . esc_attr( strtolower( get_woocommerce_currency() ) ) . '">';
228
229
		if ( $this->description ) {
230
			echo apply_filters( 'wc_stripe_description', wpautop( wp_kses_post( $this->description ) ) );
231
		}
232
233
		echo '</div>';
234
	}
235
236
	/**
237
	 * Creates the source for charge.