import { __ } from '@wordpress/i18n'; import SettingsCard from '../../../ReusableComponents/SettingsCard'; import { PaymentMethodsBlock } from '../../../ReusableComponents/SettingsBlocks'; import { PaymentHooks } from '../../../../data'; import { useActiveModal } from '../../../../data/common/hooks'; import Modal from '../Components/Payment/Modal'; const TabPaymentMethods = () => { const methods = PaymentHooks.usePaymentMethods(); const { setPersistent, changePaymentSettings } = PaymentHooks.useStore(); const { activeModal, setActiveModal } = useActiveModal(); const getActiveMethod = () => { if ( ! activeModal ) { return null; } return methods.all.find( ( method ) => method.id === activeModal ); }; return (
{ activeModal && ( setActiveModal( null ) } onSave={ ( methodId, settings ) => { changePaymentSettings( methodId, { title: settings.checkoutPageTitle, description: settings.checkoutPageDescription, } ); if ( 'paypalShowLogo' in settings ) { // TODO: Create a dedicated setter for this value. setPersistent( 'paypalShowLogo', settings.paypalShowLogo ); } if ( 'threeDSecure' in settings ) { // TODO: Create a dedicated setter for this value. setPersistent( 'threeDSecure', settings.threeDSecure ); } if ( 'fastlaneCardholderName' in settings ) { // TODO: Create a dedicated setter for this value. setPersistent( 'fastlaneCardholderName', settings.fastlaneCardholderName ); } if ( 'fastlaneDisplayWatermark' in settings ) { // TODO: Create a dedicated setter for this value. setPersistent( 'fastlaneDisplayWatermark', settings.fastlaneDisplayWatermark ); } setActiveModal( null ); } } /> ) }
); }; export default TabPaymentMethods;