mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Additional fixes. Fix logic for Google Pay and Apple Pay
This commit is contained in:
parent
78d14f4858
commit
e72b7deb09
5 changed files with 17 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
import React, { useEffect } from 'react';
|
||||
import { PayLaterMessagingHooks } from '../../../data';
|
||||
import { useEffect } from '@wordpress/element';
|
||||
|
||||
const TabPayLaterMessaging = () => {
|
||||
const {
|
||||
|
|
|
@ -78,12 +78,12 @@ const Features = () => {
|
|||
contentContainer={ false }
|
||||
>
|
||||
<ContentWrapper>
|
||||
{ features.map( ( { id, isEligible, ...feature } ) => (
|
||||
{ features.map( ( { id, enabled, ...feature } ) => (
|
||||
<FeatureItem
|
||||
key={ id }
|
||||
isBusy={ isRefreshing }
|
||||
isSandbox={ merchant.isSandbox }
|
||||
enabled={ isEligible }
|
||||
enabled={ enabled }
|
||||
{ ...feature }
|
||||
/>
|
||||
) ) }
|
||||
|
|
|
@ -168,6 +168,7 @@ export const useMerchantInfo = () => {
|
|||
const { features } = useHooks();
|
||||
const merchant = useMerchant();
|
||||
const { refreshMerchantData, setMerchant } = useDispatch( STORE_NAME );
|
||||
const { isReady } = useStore();
|
||||
|
||||
const verifyLoginStatus = useCallback( async () => {
|
||||
const result = await refreshMerchantData();
|
||||
|
@ -193,6 +194,7 @@ export const useMerchantInfo = () => {
|
|||
merchant, // Merchant details
|
||||
features, // Eligible merchant features
|
||||
verifyLoginStatus, // Callback
|
||||
isReady,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@ export const useStore = () => {
|
|||
|
||||
export const useTodos = () => {
|
||||
const { todos, fetchTodos, dismissTodo, setTodoCompleted } = useHooks();
|
||||
return { todos, fetchTodos, dismissTodo, setTodoCompleted };
|
||||
const { isReady } = useStore();
|
||||
return { todos, fetchTodos, dismissTodo, setTodoCompleted, isReady };
|
||||
};
|
||||
|
||||
export const useDismissedTodos = () => {
|
||||
|
|
|
@ -479,13 +479,13 @@ return array(
|
|||
$container->get( 'googlepay.eligible' ) && $capabilities['google_pay'] && ! $gateways['google_pay'],
|
||||
);
|
||||
},
|
||||
'settings.rest.features' => static function ( ContainerInterface $container ) : FeaturesRestEndpoint {
|
||||
'settings.rest.features' => static function ( ContainerInterface $container ) : FeaturesRestEndpoint {
|
||||
return new FeaturesRestEndpoint(
|
||||
$container->get( 'settings.data.definition.features' ),
|
||||
$container->get( 'settings.rest.settings' )
|
||||
);
|
||||
},
|
||||
'settings.data.definition.features' => static function ( ContainerInterface $container ) : FeaturesDefinition {
|
||||
'settings.data.definition.features' => static function ( ContainerInterface $container ) : FeaturesDefinition {
|
||||
$features = apply_filters(
|
||||
'woocommerce_paypal_payments_rest_common_merchant_features',
|
||||
array()
|
||||
|
@ -511,8 +511,8 @@ return array(
|
|||
'save_paypal' => $capabilities['save_paypal'], // Save PayPal and Venmo eligibility.
|
||||
'acdc' => $capabilities['acdc'] && ! $gateways['card-button'], // Advanced credit and debit cards eligibility.
|
||||
'apm' => $capabilities['apm'], // Alternative payment methods eligibility.
|
||||
'google_pay' => $capabilities['acdc'] && ! $capabilities['google_pay'], // Google Pay eligibility.
|
||||
'apple_pay' => $capabilities['acdc'] && ! $capabilities['apple_pay'], // Apple Pay eligibility.
|
||||
'google_pay' => $capabilities['acdc'] && $capabilities['google_pay'], // Google Pay eligibility.
|
||||
'apple_pay' => $capabilities['acdc'] && $capabilities['apple_pay'], // Apple Pay eligibility.
|
||||
'pay_later' => $capabilities['paylater'],
|
||||
);
|
||||
return new FeaturesDefinition(
|
||||
|
@ -521,7 +521,7 @@ return array(
|
|||
$merchant_capabilities
|
||||
);
|
||||
},
|
||||
'settings.service.features_eligibilities' => static function( ContainerInterface $container ): FeaturesEligibilityService {
|
||||
'settings.service.features_eligibilities' => static function( ContainerInterface $container ): FeaturesEligibilityService {
|
||||
|
||||
$messages_apply = $container->get( 'button.helper.messages-apply' );
|
||||
assert( $messages_apply instanceof MessagesApply );
|
||||
|
@ -540,4 +540,9 @@ return array(
|
|||
$pay_later_eligible, // Pay Later eligibility.
|
||||
);
|
||||
},
|
||||
'settings.service.todos_sorting' => static function ( ContainerInterface $container ) : TodosSortingAndFilteringService {
|
||||
return new TodosSortingAndFilteringService(
|
||||
$container->get( 'settings.data.todos' )
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue