mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Do not display onboarding payment methods screen when woopayments is active
This commit is contained in:
parent
7e3463394a
commit
cd57bf6add
5 changed files with 13 additions and 8 deletions
|
@ -59,6 +59,8 @@ export const getSteps = ( flags ) => {
|
|||
const steps = filterSteps( ALL_STEPS, [
|
||||
// Casual selling: Unlock the "Personal Account" choice.
|
||||
( step ) => flags.canUseCasualSelling || step.id !== 'business',
|
||||
// Hide methods screen when WooPayments is active.
|
||||
( step ) => ! flags.isWooPaymentsActive || step.id !== 'methods',
|
||||
] );
|
||||
|
||||
const totalStepsCount = steps.length;
|
||||
|
|
|
@ -23,6 +23,7 @@ const defaultTransient = Object.freeze( {
|
|||
canUseVaulting: false,
|
||||
canUseCardPayments: false,
|
||||
canUseSubscriptions: false,
|
||||
isWooPaymentsActive: false,
|
||||
} ),
|
||||
} );
|
||||
|
||||
|
|
|
@ -68,18 +68,14 @@ return array(
|
|||
$can_use_card_payments = $container->has( 'card-fields.eligible' ) && $container->get( 'card-fields.eligible' );
|
||||
$can_use_subscriptions = $container->has( 'wc-subscriptions.helper' ) && $container->get( 'wc-subscriptions.helper' )
|
||||
->plugin_is_active();
|
||||
|
||||
// Card payments are disabled for this plugin when WooPayments is active.
|
||||
// TODO: Move this condition to the card-fields.eligible service?
|
||||
if ( class_exists( '\WC_Payments' ) ) {
|
||||
$can_use_card_payments = false;
|
||||
}
|
||||
$is_woopayments_active = class_exists( '\WC_Payments' );
|
||||
|
||||
return new OnboardingProfile(
|
||||
$can_use_casual_selling,
|
||||
$can_use_vaulting,
|
||||
$can_use_card_payments,
|
||||
$can_use_subscriptions
|
||||
$can_use_subscriptions,
|
||||
$is_woopayments_active
|
||||
);
|
||||
},
|
||||
'settings.data.general' => static function ( ContainerInterface $container ) : GeneralSettings {
|
||||
|
|
|
@ -43,6 +43,7 @@ class OnboardingProfile extends AbstractDataModel {
|
|||
* @param bool $can_use_vaulting Whether vaulting is enabled in the store's country.
|
||||
* @param bool $can_use_card_payments Whether credit card payments are possible.
|
||||
* @param bool $can_use_subscriptions Whether WC Subscriptions plugin is active.
|
||||
* @param bool $is_woopayments_active Whether WooPayments plugin is active.
|
||||
*
|
||||
* @throws RuntimeException If the OPTION_KEY is not defined in the child class.
|
||||
*/
|
||||
|
@ -50,7 +51,8 @@ class OnboardingProfile extends AbstractDataModel {
|
|||
bool $can_use_casual_selling = false,
|
||||
bool $can_use_vaulting = false,
|
||||
bool $can_use_card_payments = false,
|
||||
bool $can_use_subscriptions = false
|
||||
bool $can_use_subscriptions = false,
|
||||
bool $is_woopayments_active = false
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -58,6 +60,7 @@ class OnboardingProfile extends AbstractDataModel {
|
|||
$this->flags['can_use_vaulting'] = $can_use_vaulting;
|
||||
$this->flags['can_use_card_payments'] = $can_use_card_payments;
|
||||
$this->flags['can_use_subscriptions'] = $can_use_subscriptions;
|
||||
$this->flags['is_woopayments_active'] = $is_woopayments_active;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,6 +80,9 @@ class OnboardingRestEndpoint extends RestEndpoint {
|
|||
'can_use_subscriptions' => array(
|
||||
'js_name' => 'canUseSubscriptions',
|
||||
),
|
||||
'is_woopayments_active' => array(
|
||||
'js_name' => 'isWooPaymentsActive',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue