PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.20
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.20
1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 All 164 releases
← All changes | includes/Templates/Payment.php +4 -45 1.9.15 → 1.10.20 View file →
@@ -24,16 +24,8 @@
24 24 */
25 25 private $order_id;
26 26
27 27 /**
28 - * The gateway ID.
29 - *
30 - * @phpstan-ignore-next-line
31 - * @var string
32 - */
33 - private $gateway_id;
34 -
35 - /**
36 28 * The order.
37 29 *
38 30 * @var \WC_Order
39 31 */
@@ -74,10 +66,8 @@
74 66 */
75 67 public function __construct( int $order_id ) {
76 68 $this->order_id = $order_id;
77 69 $this->check_troubleshooting_form_submission();
78 - // $this->gateway_id = isset( $_GET['gateway'] ) ? sanitize_key( wp_unslash( $_GET['gateway'] ) ) : '';
79 -
80 70 $settings_service = Settings::instance();
81 71 $this->disable_wp_head = (bool) $settings_service->get_settings( 'checkout', 'disable_wp_head' );
82 72 $this->disable_wp_footer = (bool) $settings_service->get_settings( 'checkout', 'disable_wp_footer' );
83 73
@@ -128,9 +118,9 @@
128 118 * @since 1.3.0
129 119 */
130 120 $script_exclude_list = apply_filters(
131 121 'woocommerce_pos_payment_template_dequeue_script_handles',
132 - woocommerce_pos_get_settings( 'checkout', 'dequeue_script_handles' )
122 + Settings::instance()->dequeue_script_handles()
133 123 );
134 124
135 125 /**
136 126 * List of style handles to exclude from the payment template.
@@ -138,9 +128,9 @@
138 128 * @since 1.3.0
139 129 */
140 130 $style_exclude_list = apply_filters(
141 131 'woocommerce_pos_payment_template_dequeue_style_handles',
142 - woocommerce_pos_get_settings( 'checkout', 'dequeue_style_handles' )
132 + Settings::instance()->dequeue_style_handles()
143 133 );
144 134
145 135 // Loop through all enqueued styles and dequeue those that are in the exclusion list.
146 136 if ( \is_array( $style_exclude_list ) ) {
@@ -171,12 +161,8 @@
171 161 if ( ! \defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
172 162 \define( 'WOOCOMMERCE_CHECKOUT', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound -- WooCommerce constant.
173 163 }
174 164
175 - // if ( ! $this->gateway_id ) {
176 - // wp_die( /* translators: Short WCPOS UI label; keep concise. */ esc_html__( 'No gateway selected', 'woocommerce-pos' ) );
177 - // }.
178 -
179 165 do_action( 'woocommerce_pos_before_pay' );
180 166
181 167 try {
182 168 // initialize order and nonces before the user is switched to customer.
@@ -203,11 +189,8 @@
203 189 */
204 190 wp_set_current_user( $this->order->get_customer_id() );
205 191 add_filter( 'nonce_user_logged_out', array( $this, 'nonce_user_logged_out' ), 10, 2 );
206 192
207 - // create nonce for customer
208 - // $nonce_field = '<input type="hidden" id="woocommerce-pay-nonce" name="woocommerce-pay-nonce" value="' . $this->create_customer_nonce() . '" />';.
209 -
210 193 // Logged in customer trying to pay for someone else's order.
211 194 if ( ! current_user_can( 'pay_for_order', $this->order_id ) ) {
212 195 wp_die( esc_html__( 'This order cannot be paid for. Please contact us if you need assistance.', 'woocommerce-pos' ) );
213 196 }
@@ -215,13 +198,8 @@
215 198 // We need to reload the gateways here to use the current customer details.
216 199 WC()->payment_gateways()->init();
217 200 $available_gateways = WC()->payment_gateways->get_available_payment_gateways();
218 201
219 - // if ( isset( $available_gateways[ $this->gateway_id ] ) ) {
220 - // $gateway = $available_gateways[ $this->gateway_id ];
221 - // $gateway->chosen = true;
222 - // }.
223 -
224 202 $order_button_text = apply_filters( 'woocommerce_pay_order_button_text', /* translators: Short WCPOS UI label; keep concise. */ __( 'Pay for order', 'woocommerce-pos' ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WooCommerce core hook.
225 203
226 204 include woocommerce_pos_locate_template( 'payment.php' );
227 205 } catch ( Exception $e ) {
@@ -240,14 +218,14 @@
240 218 $script_handles = $wp_scripts->queue;
241 219
242 220 $style_exclude_list = apply_filters(
243 221 'woocommerce_pos_payment_template_dequeue_style_handles',
244 - woocommerce_pos_get_settings( 'checkout', 'dequeue_style_handles' )
222 + Settings::instance()->dequeue_style_handles()
245 223 );
246 224
247 225 $script_exclude_list = apply_filters(
248 226 'woocommerce_pos_payment_template_dequeue_script_handles',
249 - woocommerce_pos_get_settings( 'checkout', 'dequeue_script_handles' )
227 + Settings::instance()->dequeue_script_handles()
250 228 );
251 229
252 230 $merged_style_handles = array_unique( array_merge( $style_handles, $style_exclude_list ) );
253 231 $merged_script_handles = array_unique( array_merge( $script_handles, $script_exclude_list ) );
@@ -537,25 +515,6 @@
537 515
538 516 $settings_service = Settings::instance();
539 517 $settings_service->save_settings( 'checkout', $new_settings );
540 518 }
541 - }
542 -
543 - /**
544 - * Custom version of wp_create_nonce that uses the customer ID.
545 - *
546 - * @phpstan-ignore-next-line
547 - */
548 - private function create_customer_nonce() {
549 - $user = wp_get_current_user();
550 - $uid = (int) $user->ID;
551 - // if ( ! $uid ) {
552 - // ** This filter is documented in wp-includes/pluggable.php */
553 - // $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
554 - // }.
555 -
556 - $token = '';
557 - $i = wp_nonce_tick();
558 -
559 - return substr( wp_hash( $i . '|woocommerce-pay|' . $uid . '|' . $token, 'nonce' ), - 12, 10 );
560 519 }
561 520 }