mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-31 04:58:28 +08:00
Use correct query arg when hpos is enabled
This commit is contained in:
parent
5cd5a49016
commit
2cf7f23178
3 changed files with 12 additions and 13 deletions
|
@ -184,10 +184,12 @@ class SubscriptionsHandler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Are we editing an order or subscription tied to PPEC?
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification
|
// phpcs:ignore WordPress.Security.NonceVerification
|
||||||
$order_id = wc_clean( wp_unslash( $_GET['post'] ?? $_POST['post_ID'] ?? '' ) );
|
$order_id = wc_clean( wp_unslash( $_GET['id'] ?? $_GET['post'] ?? $_POST['post_ID'] ?? '' ) );
|
||||||
if ( ! $order_id ) {
|
if ( $order_id ) {
|
||||||
return false;
|
$order = wc_get_order( $order_id );
|
||||||
|
return ( $order && PPECHelper::PPEC_GATEWAY_ID === $order->get_payment_method() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we on the WC > Subscriptions screen?
|
// Are we on the WC > Subscriptions screen?
|
||||||
|
@ -196,18 +198,15 @@ class SubscriptionsHandler {
|
||||||
*
|
*
|
||||||
* @psalm-suppress UndefinedClass
|
* @psalm-suppress UndefinedClass
|
||||||
*/
|
*/
|
||||||
$post_type = class_exists( OrderUtil::class ) && OrderUtil::custom_orders_table_usage_is_enabled()
|
$post_type_or_page = class_exists( OrderUtil::class ) && OrderUtil::custom_orders_table_usage_is_enabled()
|
||||||
? OrderUtil::get_order_type( $order_id ) ?? ''
|
// phpcs:ignore WordPress.Security.NonceVerification
|
||||||
|
? wc_clean( wp_unslash( $_GET['page'] ?? '' ) )
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification
|
// phpcs:ignore WordPress.Security.NonceVerification
|
||||||
: wc_clean( wp_unslash( $_GET['post_type'] ?? $_POST['post_type'] ?? '' ) );
|
: wc_clean( wp_unslash( $_GET['post_type'] ?? $_POST['post_type'] ?? '' ) );
|
||||||
if ( $post_type === 'shop_subscription' ) {
|
if ( $post_type_or_page === 'shop_subscription' || $post_type_or_page === 'wc-orders--shop_subscription' ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we editing an order or subscription tied to PPEC?
|
return false;
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification
|
|
||||||
$order = wc_get_order( $order_id );
|
|
||||||
return ( $order && PPECHelper::PPEC_GATEWAY_ID === $order->get_payment_method() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ class OXXO {
|
||||||
|
|
||||||
if ( $post_type === $screen ) {
|
if ( $post_type === $screen ) {
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||||
$post_id = wc_clean( wp_unslash( $_GET['post'] ?? '' ) );
|
$post_id = wc_clean( wp_unslash( $_GET['id'] ?? $_GET['post'] ?? '' ) );
|
||||||
$order = wc_get_order( $post_id );
|
$order = wc_get_order( $post_id );
|
||||||
if ( is_a( $order, WC_Order::class ) && $order->get_payment_method() === OXXOGateway::ID ) {
|
if ( is_a( $order, WC_Order::class ) && $order->get_payment_method() === OXXOGateway::ID ) {
|
||||||
$payer_action = $order->get_meta( 'ppcp_oxxo_payer_action' );
|
$payer_action = $order->get_meta( 'ppcp_oxxo_payer_action' );
|
||||||
|
|
|
@ -519,7 +519,7 @@ class PayUponInvoice {
|
||||||
|
|
||||||
if ( $post_type === $screen ) {
|
if ( $post_type === $screen ) {
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||||
$post_id = wc_clean( wp_unslash( $_GET['post'] ?? '' ) );
|
$post_id = wc_clean( wp_unslash( $_GET['id'] ?? $_GET['post'] ?? '' ) );
|
||||||
$order = wc_get_order( $post_id );
|
$order = wc_get_order( $post_id );
|
||||||
if ( is_a( $order, WC_Order::class ) && $order->get_payment_method() === PayUponInvoiceGateway::ID ) {
|
if ( is_a( $order, WC_Order::class ) && $order->get_payment_method() === PayUponInvoiceGateway::ID ) {
|
||||||
$instructions = $order->get_meta( 'ppcp_ratepay_payment_instructions_payment_reference' );
|
$instructions = $order->get_meta( 'ppcp_ratepay_payment_instructions_payment_reference' );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue