mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +08:00
Merge branch 'trunk' into PCP-2521-apple-pay-recurring-payments
This commit is contained in:
commit
6c0e0a96dc
18 changed files with 230 additions and 60 deletions
|
@ -71,7 +71,7 @@ return array(
|
|||
// Connection tab fields.
|
||||
$fields = $insert_after(
|
||||
$fields,
|
||||
'ppcp_dcc_status',
|
||||
'ppcp_reference_transactions_status',
|
||||
array(
|
||||
'applepay_status' => array(
|
||||
'title' => __( 'Apple Pay Payments', 'woocommerce-paypal-payments' ),
|
||||
|
|
|
@ -42,7 +42,7 @@ return array(
|
|||
// Connection tab fields.
|
||||
$fields = $insert_after(
|
||||
$fields,
|
||||
'ppcp_dcc_status',
|
||||
'ppcp_reference_transactions_status',
|
||||
array(
|
||||
'googlepay_status' => array(
|
||||
'title' => __( 'Google Pay Payments', 'woocommerce-paypal-payments' ),
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace WooCommerce\PayPalCommerce\SavePaymentMethods;
|
|||
use Psr\Log\LoggerInterface;
|
||||
use WC_Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\UserIdToken;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingAgreementsEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PaymentTokensEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\Order;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\PaymentSource;
|
||||
|
@ -55,6 +56,30 @@ class SavePaymentMethodsModule implements ModuleInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
$settings = $c->get( 'wcgateway.settings' );
|
||||
assert( $settings instanceof Settings );
|
||||
|
||||
$billing_agreements_endpoint = $c->get( 'api.endpoint.billing-agreements' );
|
||||
assert( $billing_agreements_endpoint instanceof BillingAgreementsEndpoint );
|
||||
|
||||
add_action(
|
||||
'woocommerce_paypal_payments_gateway_migrate_on_update',
|
||||
function() use ( $settings, $billing_agreements_endpoint ) {
|
||||
$reference_transaction_enabled = $billing_agreements_endpoint->reference_transaction_enabled();
|
||||
if ( $reference_transaction_enabled !== true ) {
|
||||
$settings->set( 'vault_enabled', false );
|
||||
$settings->persist();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (
|
||||
( ! $settings->has( 'vault_enabled' ) || ! $settings->get( 'vault_enabled' ) )
|
||||
&& ( ! $settings->has( 'vault_enabled_dcc' ) || ! $settings->get( 'vault_enabled_dcc' ) )
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter(
|
||||
'woocommerce_paypal_payments_localized_script_data',
|
||||
function( array $localized_script_data ) use ( $c ) {
|
||||
|
@ -78,8 +103,12 @@ class SavePaymentMethodsModule implements ModuleInterface {
|
|||
// Adds attributes needed to save payment method.
|
||||
add_filter(
|
||||
'ppcp_create_order_request_body_data',
|
||||
function( array $data, string $payment_method, array $request_data ): array {
|
||||
function( array $data, string $payment_method, array $request_data ) use ( $settings ): array {
|
||||
if ( $payment_method === CreditCardGateway::ID ) {
|
||||
if ( ! $settings->has( 'vault_enabled_dcc' ) || ! $settings->get( 'vault_enabled_dcc' ) ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$save_payment_method = $request_data['save_payment_method'] ?? false;
|
||||
if ( $save_payment_method ) {
|
||||
$data['payment_source'] = array(
|
||||
|
@ -106,6 +135,10 @@ class SavePaymentMethodsModule implements ModuleInterface {
|
|||
}
|
||||
|
||||
if ( $payment_method === PayPalGateway::ID ) {
|
||||
if ( ! $settings->has( 'vault_enabled' ) || ! $settings->get( 'vault_enabled' ) ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$funding_source = $request_data['funding_source'] ?? null;
|
||||
|
||||
if ( $funding_source && $funding_source === 'venmo' ) {
|
||||
|
|
|
@ -237,8 +237,18 @@ class VaultingModule implements ModuleInterface {
|
|||
|
||||
add_filter(
|
||||
'woocommerce_available_payment_gateways',
|
||||
function( array $methods ): array {
|
||||
/**
|
||||
* Param types removed to avoid third-party issues.
|
||||
*
|
||||
* @psalm-suppress MissingClosureParamType
|
||||
*/
|
||||
function( $methods ) {
|
||||
global $wp;
|
||||
|
||||
if ( ! is_array( $methods ) ) {
|
||||
return $methods;
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $wp->query_vars['add-payment-method'] )
|
||||
&& apply_filters( 'woocommerce_paypal_payments_disable_add_payment_method', true )
|
||||
|
|
|
@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace WooCommerce\PayPalCommerce\WcGateway;
|
||||
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingAgreementsEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PayUponInvoiceOrderEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Entity\ApplicationContext;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
|
@ -332,6 +333,7 @@ return array(
|
|||
$container->get( 'http.redirector' ),
|
||||
$container->get( 'api.partner_merchant_id-production' ),
|
||||
$container->get( 'api.partner_merchant_id-sandbox' ),
|
||||
$container->get( 'api.endpoint.billing-agreements' ),
|
||||
$logger
|
||||
);
|
||||
},
|
||||
|
@ -367,8 +369,9 @@ return array(
|
|||
$order_endpoint = $container->get( 'api.endpoint.order' );
|
||||
$payments_endpoint = $container->get( 'api.endpoint.payments' );
|
||||
$refund_fees_updater = $container->get( 'wcgateway.helper.refund-fees-updater' );
|
||||
$prefix = $container->get( 'api.prefix' );
|
||||
$logger = $container->get( 'woocommerce.logger.woocommerce' );
|
||||
return new RefundProcessor( $order_endpoint, $payments_endpoint, $refund_fees_updater, $logger );
|
||||
return new RefundProcessor( $order_endpoint, $payments_endpoint, $refund_fees_updater, $prefix, $logger );
|
||||
},
|
||||
'wcgateway.processor.authorized-payments' => static function ( ContainerInterface $container ): AuthorizedPaymentsProcessor {
|
||||
$order_endpoint = $container->get( 'api.endpoint.order' );
|
||||
|
@ -418,6 +421,18 @@ return array(
|
|||
},
|
||||
|
||||
'wcgateway.settings.fields.subscriptions_mode' => static function ( ContainerInterface $container ): array {
|
||||
$subscription_mode_options = array(
|
||||
'vaulting_api' => __( 'PayPal Vaulting', 'woocommerce-paypal-payments' ),
|
||||
'subscriptions_api' => __( 'PayPal Subscriptions', 'woocommerce-paypal-payments' ),
|
||||
'disable_paypal_subscriptions' => __( 'Disable PayPal for subscriptions', 'woocommerce-paypal-payments' ),
|
||||
);
|
||||
|
||||
$billing_agreements_endpoint = $container->get( 'api.endpoint.billing-agreements' );
|
||||
$reference_transaction_enabled = $billing_agreements_endpoint->reference_transaction_enabled();
|
||||
if ( $reference_transaction_enabled !== true ) {
|
||||
unset( $subscription_mode_options['vaulting_api'] );
|
||||
}
|
||||
|
||||
return array(
|
||||
'title' => __( 'Subscriptions Mode', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'select',
|
||||
|
@ -426,11 +441,7 @@ return array(
|
|||
'desc_tip' => true,
|
||||
'description' => __( 'Utilize PayPal Vaulting for flexible subscription processing with saved payment methods, create “PayPal Subscriptions” to bill customers at regular intervals, or disable PayPal for subscription-type products.', 'woocommerce-paypal-payments' ),
|
||||
'default' => 'vaulting_api',
|
||||
'options' => array(
|
||||
'vaulting_api' => __( 'PayPal Vaulting', 'woocommerce-paypal-payments' ),
|
||||
'subscriptions_api' => __( 'PayPal Subscriptions', 'woocommerce-paypal-payments' ),
|
||||
'disable_paypal_subscriptions' => __( 'Disable PayPal for subscriptions', 'woocommerce-paypal-payments' ),
|
||||
),
|
||||
'options' => $subscription_mode_options,
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
|
@ -1315,6 +1326,12 @@ return array(
|
|||
'wcgateway.enable-pui-url-live' => static function ( ContainerInterface $container ): string {
|
||||
return 'https://www.paypal.com/bizsignup/entry?country.x=DE&product=payment_methods&capabilities=PAY_UPON_INVOICE';
|
||||
},
|
||||
'wcgateway.enable-reference-transactions-url-sandbox' => static function ( ContainerInterface $container ): string {
|
||||
return 'https://www.sandbox.paypal.com/bizsignup/entry?product=ADVANCED_VAULTING';
|
||||
},
|
||||
'wcgateway.enable-reference-transactions-url-live' => static function ( ContainerInterface $container ): string {
|
||||
return 'https://www.paypal.com/bizsignup/entry?product=ADVANCED_VAULTING';
|
||||
},
|
||||
'wcgateway.settings.connection.dcc-status-text' => static function ( ContainerInterface $container ): string {
|
||||
$state = $container->get( 'onboarding.state' );
|
||||
if ( $state->current_state() < State::STATE_ONBOARDED ) {
|
||||
|
@ -1353,6 +1370,39 @@ return array(
|
|||
esc_html( $dcc_button_text )
|
||||
);
|
||||
},
|
||||
'wcgateway.settings.connection.reference-transactions-status-text' => static function ( ContainerInterface $container ): string {
|
||||
$environment = $container->get( 'onboarding.environment' );
|
||||
assert( $environment instanceof Environment );
|
||||
|
||||
$billing_agreements_endpoint = $container->get( 'api.endpoint.billing-agreements' );
|
||||
assert( $billing_agreements_endpoint instanceof BillingAgreementsEndpoint );
|
||||
|
||||
$enabled = $billing_agreements_endpoint->reference_transaction_enabled();
|
||||
|
||||
$enabled_status_text = esc_html__( 'Status: Available', 'woocommerce-paypal-payments' );
|
||||
$disabled_status_text = esc_html__( 'Status: Not yet enabled', 'woocommerce-paypal-payments' );
|
||||
|
||||
$button_text = $enabled
|
||||
? esc_html__( 'Settings', 'woocommerce-paypal-payments' )
|
||||
: esc_html__( 'Enable Advanced PayPal Wallet', 'woocommerce-paypal-payments' );
|
||||
|
||||
$enable_url = $environment->current_environment_is( Environment::PRODUCTION )
|
||||
? $container->get( 'wcgateway.enable-reference-transactions-url-live' )
|
||||
: $container->get( 'wcgateway.enable-reference-transactions-url-sandbox' );
|
||||
|
||||
$button_url = $enabled
|
||||
? admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-gateway#field-paypal_saved_payments' )
|
||||
: $enable_url;
|
||||
|
||||
return sprintf(
|
||||
'<p>%1$s %2$s</p><p><a target="%3$s" href="%4$s" class="button">%5$s</a></p>',
|
||||
$enabled ? $enabled_status_text : $disabled_status_text,
|
||||
$enabled ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no"></span>',
|
||||
$enabled ? '_self' : '_blank',
|
||||
esc_url( $button_url ),
|
||||
esc_html( $button_text )
|
||||
);
|
||||
},
|
||||
'wcgateway.settings.connection.pui-status-text' => static function ( ContainerInterface $container ): string {
|
||||
$state = $container->get( 'onboarding.state' );
|
||||
if ( $state->current_state() < State::STATE_ONBOARDED ) {
|
||||
|
|
|
@ -369,6 +369,9 @@ class CreditCardGateway extends \WC_Payment_Gateway_CC {
|
|||
$saved_payment_card = WC()->session->get( 'ppcp_saved_payment_card' );
|
||||
if ( $saved_payment_card ) {
|
||||
if ( $saved_payment_card['payment_source'] === 'card' && $saved_payment_card['status'] === 'COMPLETED' ) {
|
||||
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $saved_payment_card['order_id'] );
|
||||
$wc_order->save_meta_data();
|
||||
|
||||
$this->update_transaction_id( $saved_payment_card['order_id'], $wc_order );
|
||||
$wc_order->payment_complete();
|
||||
WC()->session->set( 'ppcp_saved_payment_card', null );
|
||||
|
|
|
@ -91,24 +91,14 @@ class CheckoutHelper {
|
|||
/**
|
||||
* Ensures product is neither downloadable nor virtual.
|
||||
*
|
||||
* @param WC_Product $product WC product.
|
||||
* @param WC_Product $product WC product (can be a variation).
|
||||
* @return bool
|
||||
*/
|
||||
public function is_physical_product( WC_Product $product ):bool {
|
||||
public function is_physical_product( WC_Product $product ): bool {
|
||||
if ( $product->is_downloadable() || $product->is_virtual() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( is_a( $product, WC_Product_Variable::class ) ) {
|
||||
foreach ( $product->get_available_variations( 'object' ) as $variation ) {
|
||||
if ( is_a( $variation, WC_Product_Variation::class ) ) {
|
||||
if ( true === $variation->is_downloadable() || true === $variation->is_virtual() ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,11 @@ class PayUponInvoiceHelper {
|
|||
if ( $cart && ! is_checkout_pay_page() ) {
|
||||
$items = $cart->get_cart_contents();
|
||||
foreach ( $items as $item ) {
|
||||
$product = wc_get_product( $item['product_id'] );
|
||||
$product_id = $item['product_id'];
|
||||
if ( isset( $item['variation_id'] ) && $item['variation_id'] ) {
|
||||
$product_id = $item['variation_id'];
|
||||
}
|
||||
$product = wc_get_product( $product_id );
|
||||
if ( $product && ! $this->checkout_helper->is_physical_product( $product ) ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,13 @@ class RefundProcessor {
|
|||
*/
|
||||
private $logger;
|
||||
|
||||
/**
|
||||
* The prefix.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $prefix;
|
||||
|
||||
/**
|
||||
* The refund fees updater.
|
||||
*
|
||||
|
@ -69,13 +76,21 @@ class RefundProcessor {
|
|||
* @param OrderEndpoint $order_endpoint The order endpoint.
|
||||
* @param PaymentsEndpoint $payments_endpoint The payments endpoint.
|
||||
* @param RefundFeesUpdater $refund_fees_updater The refund fees updater.
|
||||
* @param string $prefix The prefix.
|
||||
* @param LoggerInterface $logger The logger.
|
||||
*/
|
||||
public function __construct( OrderEndpoint $order_endpoint, PaymentsEndpoint $payments_endpoint, RefundFeesUpdater $refund_fees_updater, LoggerInterface $logger ) {
|
||||
public function __construct(
|
||||
OrderEndpoint $order_endpoint,
|
||||
PaymentsEndpoint $payments_endpoint,
|
||||
RefundFeesUpdater $refund_fees_updater,
|
||||
string $prefix,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
|
||||
$this->order_endpoint = $order_endpoint;
|
||||
$this->payments_endpoint = $payments_endpoint;
|
||||
$this->refund_fees_updater = $refund_fees_updater;
|
||||
$this->prefix = $prefix;
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
@ -164,7 +179,7 @@ class RefundProcessor {
|
|||
$capture = $captures[0];
|
||||
$refund = new RefundCapture(
|
||||
$capture,
|
||||
$capture->invoice_id(),
|
||||
$capture->invoice_id() ?: $this->prefix . $wc_order->get_order_number(),
|
||||
$reason,
|
||||
new Amount(
|
||||
new Money( $amount, $wc_order->get_currency() )
|
||||
|
|
|
@ -410,6 +410,16 @@ return function ( ContainerInterface $container, array $fields ): array {
|
|||
'requirements' => array( 'dcc' ),
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'ppcp_reference_transactions_status' => array(
|
||||
'title' => __( 'Advanced PayPal Wallet', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-text',
|
||||
'text' => $container->get( 'wcgateway.settings.connection.reference-transactions-status-text' ),
|
||||
'screens' => array(
|
||||
State::STATE_ONBOARDED,
|
||||
),
|
||||
'requirements' => array( 'dcc' ),
|
||||
'gateway' => Settings::CONNECTION_TAB_ID,
|
||||
),
|
||||
'ppcp_pui_status' => array(
|
||||
'title' => __( 'Pay upon Invoice', 'woocommerce-paypal-payments' ),
|
||||
'type' => 'ppcp-text',
|
||||
|
|
|
@ -14,6 +14,7 @@ use WooCommerce\PayPalCommerce\AdminNotices\Entity\Message;
|
|||
use WooCommerce\PayPalCommerce\AdminNotices\Repository\Repository;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Authentication\PayPalBearer;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\BillingAgreementsEndpoint;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
|
||||
use WooCommerce\PayPalCommerce\Http\RedirectorInterface;
|
||||
|
@ -152,6 +153,13 @@ class SettingsListener {
|
|||
*/
|
||||
private $partner_merchant_id_sandbox;
|
||||
|
||||
/**
|
||||
* Billing Agreements endpoint.
|
||||
*
|
||||
* @var BillingAgreementsEndpoint
|
||||
*/
|
||||
private $billing_agreements_endpoint;
|
||||
|
||||
/**
|
||||
* The logger.
|
||||
*
|
||||
|
@ -162,21 +170,22 @@ class SettingsListener {
|
|||
/**
|
||||
* SettingsListener constructor.
|
||||
*
|
||||
* @param Settings $settings The settings.
|
||||
* @param array $setting_fields The setting fields.
|
||||
* @param WebhookRegistrar $webhook_registrar The Webhook Registrar.
|
||||
* @param Cache $cache The Cache.
|
||||
* @param State $state The state.
|
||||
* @param Bearer $bearer The bearer.
|
||||
* @param string $page_id ID of the current PPCP gateway settings page, or empty if it is not such page.
|
||||
* @param Cache $signup_link_cache The signup link cache.
|
||||
* @param array $signup_link_ids Signup link ids.
|
||||
* @param Cache $pui_status_cache The PUI status cache.
|
||||
* @param Cache $dcc_status_cache The DCC status cache.
|
||||
* @param RedirectorInterface $redirector The HTTP redirector.
|
||||
* @param string $partner_merchant_id_production Partner merchant ID production.
|
||||
* @param string $partner_merchant_id_sandbox Partner merchant ID sandbox.
|
||||
* @param ?LoggerInterface $logger The logger.
|
||||
* @param Settings $settings The settings.
|
||||
* @param array $setting_fields The setting fields.
|
||||
* @param WebhookRegistrar $webhook_registrar The Webhook Registrar.
|
||||
* @param Cache $cache The Cache.
|
||||
* @param State $state The state.
|
||||
* @param Bearer $bearer The bearer.
|
||||
* @param string $page_id ID of the current PPCP gateway settings page, or empty if it is not such page.
|
||||
* @param Cache $signup_link_cache The signup link cache.
|
||||
* @param array $signup_link_ids Signup link ids.
|
||||
* @param Cache $pui_status_cache The PUI status cache.
|
||||
* @param Cache $dcc_status_cache The DCC status cache.
|
||||
* @param RedirectorInterface $redirector The HTTP redirector.
|
||||
* @param string $partner_merchant_id_production Partner merchant ID production.
|
||||
* @param string $partner_merchant_id_sandbox Partner merchant ID sandbox.
|
||||
* @param BillingAgreementsEndpoint $billing_agreements_endpoint Billing Agreements endpoint.
|
||||
* @param ?LoggerInterface $logger The logger.
|
||||
*/
|
||||
public function __construct(
|
||||
Settings $settings,
|
||||
|
@ -193,6 +202,7 @@ class SettingsListener {
|
|||
RedirectorInterface $redirector,
|
||||
string $partner_merchant_id_production,
|
||||
string $partner_merchant_id_sandbox,
|
||||
BillingAgreementsEndpoint $billing_agreements_endpoint,
|
||||
LoggerInterface $logger = null
|
||||
) {
|
||||
|
||||
|
@ -210,6 +220,7 @@ class SettingsListener {
|
|||
$this->redirector = $redirector;
|
||||
$this->partner_merchant_id_production = $partner_merchant_id_production;
|
||||
$this->partner_merchant_id_sandbox = $partner_merchant_id_sandbox;
|
||||
$this->billing_agreements_endpoint = $billing_agreements_endpoint;
|
||||
$this->logger = $logger ?: new NullLogger();
|
||||
}
|
||||
|
||||
|
@ -367,7 +378,9 @@ class SettingsListener {
|
|||
$vault_enabled = wc_clean( wp_unslash( $_POST['ppcp']['vault_enabled'] ?? '' ) );
|
||||
$subscription_mode = wc_clean( wp_unslash( $_POST['ppcp']['subscriptions_mode'] ?? '' ) );
|
||||
|
||||
if ( $subscription_mode === 'vaulting_api' && $vault_enabled !== '1' ) {
|
||||
$reference_transaction_enabled = $this->billing_agreements_endpoint->reference_transaction_enabled();
|
||||
|
||||
if ( $subscription_mode === 'vaulting_api' && $vault_enabled !== '1' && $reference_transaction_enabled === true ) {
|
||||
$this->settings->set( 'vault_enabled', true );
|
||||
$this->settings->persist();
|
||||
}
|
||||
|
|
|
@ -435,15 +435,21 @@ class WCGatewayModule implements ModuleInterface {
|
|||
add_action(
|
||||
'woocommerce_paypal_payments_clear_apm_product_status',
|
||||
function( Settings $settings = null ) use ( $c ): void {
|
||||
|
||||
// Clear DCC Product status.
|
||||
$dcc_product_status = $c->get( 'wcgateway.helper.dcc-product-status' );
|
||||
if ( $dcc_product_status instanceof DCCProductStatus ) {
|
||||
$dcc_product_status->clear( $settings );
|
||||
}
|
||||
|
||||
// Clear Pay Upon Invoice status.
|
||||
$pui_product_status = $c->get( 'wcgateway.pay-upon-invoice-product-status' );
|
||||
if ( $pui_product_status instanceof PayUponInvoiceProductStatus ) {
|
||||
$pui_product_status->clear( $settings );
|
||||
}
|
||||
|
||||
// Clear Reference Transaction status.
|
||||
delete_transient( 'ppcp_reference_transaction_enabled' );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -158,7 +158,16 @@ class WcSubscriptionsModule implements ModuleInterface {
|
|||
|
||||
add_filter(
|
||||
'woocommerce_available_payment_gateways',
|
||||
function( array $methods ) use ( $c ) : array {
|
||||
/**
|
||||
* Param types removed to avoid third-party issues.
|
||||
*
|
||||
* @psalm-suppress MissingClosureParamType
|
||||
*/
|
||||
function( $methods ) use ( $c ) {
|
||||
if ( ! is_array( $methods ) ) {
|
||||
return $methods;
|
||||
}
|
||||
|
||||
if ( ! is_wc_endpoint_url( 'order-pay' ) ) {
|
||||
return $methods;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue