diff --git a/modules/ppcp-api-client/services.php b/modules/ppcp-api-client/services.php index b2b07834d..5f920d5f5 100644 --- a/modules/ppcp-api-client/services.php +++ b/modules/ppcp-api-client/services.php @@ -83,6 +83,7 @@ return array( 'api.paypal-host' => function( ContainerInterface $container ) : string { return PAYPAL_API_URL; }, + // It seems this 'api.paypal-website-url' key is always overridden in ppcp-onboarding/services.php 'api.paypal-website-url' => function( ContainerInterface $container ) : string { return PAYPAL_URL; }, diff --git a/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php b/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php index 800660fbf..b8afe08bc 100644 --- a/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php +++ b/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php @@ -594,12 +594,12 @@ class PayPalSubscriptionsModule implements ModuleInterface { $screen_id = wc_get_page_screen_id( 'shop_subscription' ); remove_meta_box( 'woocommerce-subscription-schedule', $screen_id, 'side' ); - $environment = $c->get( 'onboarding.environment' ); + $host = $c->get( 'api.paypal-website-url' ); + add_meta_box( 'ppcp_paypal_subscription', __( 'PayPal Subscription', 'woocommerce-paypal-payments' ), - function() use ( $subscription_id, $environment ) { - $host = $environment->current_environment_is( Environment::SANDBOX ) ? 'https://www.sandbox.paypal.com' : 'https://www.paypal.com'; + function() use ( $subscription_id, $host ) { $url = trailingslashit( $host ) . 'billing/subscriptions/' . $subscription_id; echo '
' . esc_html__( 'This subscription is linked to a PayPal Subscription, Cancel it to unlink.', 'woocommerce-paypal-payments' ) . '
'; echo '' . esc_html__( 'Subscription:', 'woocommerce-paypal-payments' ) . ' ' . esc_attr( $subscription_id ) . '
'; diff --git a/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js b/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js index 66913a859..b3435ff0c 100644 --- a/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js +++ b/modules/ppcp-save-payment-methods/resources/js/add-payment-method.js @@ -4,7 +4,10 @@ import { PaymentMethods } from "../../../ppcp-button/resources/js/modules/Helper/CheckoutMethodState"; -import {setVisible} from "../../../ppcp-button/resources/js/modules/Helper/Hiding"; +import { + setVisible, + setVisibleByClass +} from "../../../ppcp-button/resources/js/modules/Helper/Hiding"; import {loadPaypalJsScript} from "../../../ppcp-button/resources/js/modules/Helper/ScriptLoading"; loadPaypalJsScript( @@ -60,7 +63,7 @@ loadPaypalJsScript( const init = () => { - setVisible(ORDER_BUTTON_SELECTOR, getCurrentPaymentMethod() !== PaymentMethods.PAYPAL); + setVisibleByClass(ORDER_BUTTON_SELECTOR, getCurrentPaymentMethod() !== PaymentMethods.PAYPAL, 'ppcp-hidden'); setVisible(`#ppc-button-${PaymentMethods.PAYPAL}-save-payment-method`, getCurrentPaymentMethod() === PaymentMethods.PAYPAL); }