mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add Pay Later flag and pass it to welcome docs component
This commit is contained in:
parent
109e6517f0
commit
7bf3e83d85
5 changed files with 17 additions and 6 deletions
|
@ -12,7 +12,8 @@ import AdvancedOptionsForm from '../Components/AdvancedOptionsForm';
|
|||
|
||||
const StepWelcome = ( { setStep, currentStep } ) => {
|
||||
const { storeCountry } = CommonHooks.useWooSettings();
|
||||
const { canUseCardPayments, canUseFastlane } = OnboardingHooks.useFlags();
|
||||
const { canUseCardPayments, canUseFastlane, canUsePayLater } =
|
||||
OnboardingHooks.useFlags();
|
||||
const nonAcdcIcons = [ 'paypal', 'visa', 'mastercard', 'amex', 'discover' ];
|
||||
|
||||
return (
|
||||
|
@ -55,7 +56,7 @@ const StepWelcome = ( { setStep, currentStep } ) => {
|
|||
<WelcomeDocs
|
||||
useAcdc={ canUseCardPayments }
|
||||
isFastlane={ canUseFastlane }
|
||||
isPayLater={ true }
|
||||
isPayLater={ canUsePayLater }
|
||||
storeCountry={ storeCountry }
|
||||
/>
|
||||
<Separator text={ __( 'or', 'woocommerce-paypal-payments' ) } />
|
||||
|
|
|
@ -25,6 +25,7 @@ const defaultTransient = Object.freeze( {
|
|||
canUseSubscriptions: false,
|
||||
shouldSkipPaymentMethods: false,
|
||||
canUseFastlane: false,
|
||||
canUsePayLater: false,
|
||||
} ),
|
||||
} );
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ return array(
|
|||
->plugin_is_active();
|
||||
$should_skip_payment_methods = class_exists( '\WC_Payments' );
|
||||
$can_use_fastlane = $container->get( 'axo.eligible' );
|
||||
$can_use_pay_later = $container->get( 'button.helper.messages-apply' );
|
||||
|
||||
return new OnboardingProfile(
|
||||
$can_use_casual_selling,
|
||||
|
@ -77,7 +78,8 @@ return array(
|
|||
$can_use_card_payments,
|
||||
$can_use_subscriptions,
|
||||
$should_skip_payment_methods,
|
||||
$can_use_fastlane
|
||||
$can_use_fastlane,
|
||||
$can_use_pay_later->for_country()
|
||||
);
|
||||
},
|
||||
'settings.data.general' => static function ( ContainerInterface $container ) : GeneralSettings {
|
||||
|
|
|
@ -44,6 +44,8 @@ class OnboardingProfile extends AbstractDataModel {
|
|||
* @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 $should_skip_payment_methods Whether it should skip payment methods screen.
|
||||
* @param bool $can_use_fastlane Whether it can use Fastlane or not.
|
||||
* @param bool $can_use_pay_later Whether it can use PAy Later or not.
|
||||
*
|
||||
* @throws RuntimeException If the OPTION_KEY is not defined in the child class.
|
||||
*/
|
||||
|
@ -53,7 +55,8 @@ class OnboardingProfile extends AbstractDataModel {
|
|||
bool $can_use_card_payments = false,
|
||||
bool $can_use_subscriptions = false,
|
||||
bool $should_skip_payment_methods = false,
|
||||
bool $can_use_fastlane = false
|
||||
bool $can_use_fastlane = false,
|
||||
bool $can_use_pay_later = false
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
|
@ -62,7 +65,8 @@ class OnboardingProfile extends AbstractDataModel {
|
|||
$this->flags['can_use_card_payments'] = $can_use_card_payments;
|
||||
$this->flags['can_use_subscriptions'] = $can_use_subscriptions;
|
||||
$this->flags['should_skip_payment_methods'] = $should_skip_payment_methods;
|
||||
$this->flags['can_use_fastlane'] = $can_use_fastlane;
|
||||
$this->flags['can_use_fastlane'] = $can_use_fastlane;
|
||||
$this->flags['can_use_pay_later'] = $can_use_pay_later;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -83,9 +83,12 @@ class OnboardingRestEndpoint extends RestEndpoint {
|
|||
'should_skip_payment_methods' => array(
|
||||
'js_name' => 'shouldSkipPaymentMethods',
|
||||
),
|
||||
'can_use_fastlane' => array(
|
||||
'can_use_fastlane' => array(
|
||||
'js_name' => 'canUseFastlane',
|
||||
),
|
||||
'can_use_pay_later' => array(
|
||||
'js_name' => 'canUsePayLater',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue