static function ( ContainerInterface $container ): PayPalGateway { $order_processor = $container->get( 'wcgateway.order-processor' ); $settings_renderer = $container->get( 'wcgateway.settings.render' ); $funding_source_renderer = $container->get( 'wcgateway.funding-source.renderer' ); $settings = $container->get( 'wcgateway.settings' ); $session_handler = $container->get( 'session.handler' ); $refund_processor = $container->get( 'wcgateway.processor.refunds' ); $state = $container->get( 'onboarding.state' ); $transaction_url_provider = $container->get( 'wcgateway.transaction-url-provider' ); $subscription_helper = $container->get( 'subscription.helper' ); $page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' ); $payment_token_repository = $container->get( 'vaulting.repository.payment-token' ); $environment = $container->get( 'onboarding.environment' ); $logger = $container->get( 'woocommerce.logger.woocommerce' ); $api_shop_country = $container->get( 'api.shop.country' ); return new PayPalGateway( $settings_renderer, $funding_source_renderer, $order_processor, $settings, $session_handler, $refund_processor, $state, $transaction_url_provider, $subscription_helper, $page_id, $environment, $payment_token_repository, $logger, $api_shop_country, $container->get( 'api.endpoint.order' ) ); }, 'wcgateway.credit-card-gateway' => static function ( ContainerInterface $container ): CreditCardGateway { $order_processor = $container->get( 'wcgateway.order-processor' ); $settings_renderer = $container->get( 'wcgateway.settings.render' ); $settings = $container->get( 'wcgateway.settings' ); $module_url = $container->get( 'wcgateway.url' ); $session_handler = $container->get( 'session.handler' ); $refund_processor = $container->get( 'wcgateway.processor.refunds' ); $state = $container->get( 'onboarding.state' ); $transaction_url_provider = $container->get( 'wcgateway.transaction-url-provider' ); $subscription_helper = $container->get( 'subscription.helper' ); $payments_endpoint = $container->get( 'api.endpoint.payments' ); $logger = $container->get( 'woocommerce.logger.woocommerce' ); $vaulted_credit_card_handler = $container->get( 'vaulting.credit-card-handler' ); return new CreditCardGateway( $settings_renderer, $order_processor, $settings, $module_url, $session_handler, $refund_processor, $state, $transaction_url_provider, $subscription_helper, $logger, $payments_endpoint, $vaulted_credit_card_handler ); }, 'wcgateway.card-button-gateway' => static function ( ContainerInterface $container ): CardButtonGateway { return new CardButtonGateway( $container->get( 'wcgateway.settings.render' ), $container->get( 'wcgateway.order-processor' ), $container->get( 'wcgateway.settings' ), $container->get( 'session.handler' ), $container->get( 'wcgateway.processor.refunds' ), $container->get( 'onboarding.state' ), $container->get( 'wcgateway.transaction-url-provider' ), $container->get( 'subscription.helper' ), $container->get( 'wcgateway.settings.allow_card_button_gateway.default' ), $container->get( 'onboarding.environment' ), $container->get( 'vaulting.repository.payment-token' ), $container->get( 'woocommerce.logger.woocommerce' ) ); }, 'wcgateway.disabler' => static function ( ContainerInterface $container ): DisableGateways { $session_handler = $container->get( 'session.handler' ); $settings = $container->get( 'wcgateway.settings' ); $settings_status = $container->get( 'wcgateway.settings.status' ); return new DisableGateways( $session_handler, $settings, $settings_status ); }, 'wcgateway.is-wc-payments-page' => static function ( ContainerInterface $container ): bool { $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : ''; return 'wc-settings' === $page && 'checkout' === $tab; }, 'wcgateway.is-wc-gateways-list-page' => static function ( ContainerInterface $container ): bool { return $container->get( 'wcgateway.is-wc-payments-page' ) && ! isset( $_GET['section'] ); }, 'wcgateway.is-ppcp-settings-page' => static function ( ContainerInterface $container ): bool { if ( ! $container->get( 'wcgateway.is-wc-payments-page' ) ) { return false; } $section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : ''; return in_array( $section, array( Settings::CONNECTION_TAB_ID, PayPalGateway::ID, CreditCardGateway::ID, PayUponInvoiceGateway::ID, CardButtonGateway::ID, OXXOGateway::ID, Settings::PAY_LATER_TAB_ID, ), true ); }, 'wcgateway.current-ppcp-settings-page-id' => static function ( ContainerInterface $container ): string { if ( ! $container->get( 'wcgateway.is-ppcp-settings-page' ) ) { return ''; } $section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : ''; $ppcp_tab = isset( $_GET[ SectionsRenderer::KEY ] ) ? sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) ) : ''; $state = $container->get( 'onboarding.state' ); assert( $state instanceof State ); if ( ! $ppcp_tab && PayPalGateway::ID === $section && $state->current_state() !== State::STATE_ONBOARDED ) { return Settings::CONNECTION_TAB_ID; } return $ppcp_tab ? $ppcp_tab : $section; }, 'wcgateway.settings' => static function ( ContainerInterface $container ): Settings { $default_button_locations = $container->get( 'wcgateway.button.default-locations' ); return new Settings( $default_button_locations ); }, 'wcgateway.notice.connect' => static function ( ContainerInterface $container ): ConnectAdminNotice { $state = $container->get( 'onboarding.state' ); $settings = $container->get( 'wcgateway.settings' ); return new ConnectAdminNotice( $state, $settings ); }, 'wcgateway.notice.dcc-without-paypal' => static function ( ContainerInterface $container ): GatewayWithoutPayPalAdminNotice { return new GatewayWithoutPayPalAdminNotice( CreditCardGateway::ID, $container->get( 'onboarding.state' ), $container->get( 'wcgateway.settings' ), $container->get( 'wcgateway.is-wc-payments-page' ), $container->get( 'wcgateway.is-ppcp-settings-page' ) ); }, 'wcgateway.notice.card-button-without-paypal' => static function ( ContainerInterface $container ): GatewayWithoutPayPalAdminNotice { return new GatewayWithoutPayPalAdminNotice( CardButtonGateway::ID, $container->get( 'onboarding.state' ), $container->get( 'wcgateway.settings' ), $container->get( 'wcgateway.is-wc-payments-page' ), $container->get( 'wcgateway.is-ppcp-settings-page' ) ); }, 'wcgateway.notice.authorize-order-action' => static function ( ContainerInterface $container ): AuthorizeOrderActionNotice { return new AuthorizeOrderActionNotice(); }, 'wcgateway.settings.sections-renderer' => static function ( ContainerInterface $container ): SectionsRenderer { return new SectionsRenderer( $container->get( 'wcgateway.current-ppcp-settings-page-id' ), $container->get( 'onboarding.state' ), $container->get( 'wcgateway.helper.dcc-product-status' ), $container->get( 'api.helpers.dccapplies' ), $container->get( 'button.helper.messages-apply' ), $container->get( 'wcgateway.pay-upon-invoice-product-status' ) ); }, 'wcgateway.settings.header-renderer' => static function ( ContainerInterface $container ): HeaderRenderer { return new HeaderRenderer( $container->get( 'wcgateway.current-ppcp-settings-page-id' ), $container->get( 'wcgateway.url' ) ); }, 'wcgateway.settings.status' => static function ( ContainerInterface $container ): SettingsStatus { $settings = $container->get( 'wcgateway.settings' ); return new SettingsStatus( $settings ); }, 'wcgateway.settings.render' => static function ( ContainerInterface $container ): SettingsRenderer { $settings = $container->get( 'wcgateway.settings' ); $state = $container->get( 'onboarding.state' ); $fields = $container->get( 'wcgateway.settings.fields' ); $dcc_applies = $container->get( 'api.helpers.dccapplies' ); $messages_apply = $container->get( 'button.helper.messages-apply' ); $dcc_product_status = $container->get( 'wcgateway.helper.dcc-product-status' ); $settings_status = $container->get( 'wcgateway.settings.status' ); $page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' ); $api_shop_country = $container->get( 'api.shop.country' ); return new SettingsRenderer( $settings, $state, $fields, $dcc_applies, $messages_apply, $dcc_product_status, $settings_status, $page_id, $api_shop_country ); }, 'wcgateway.settings.listener' => static function ( ContainerInterface $container ): SettingsListener { $settings = $container->get( 'wcgateway.settings' ); $fields = $container->get( 'wcgateway.settings.fields' ); $webhook_registrar = $container->get( 'webhook.registrar' ); $state = $container->get( 'onboarding.state' ); $cache = new Cache( 'ppcp-paypal-bearer' ); $bearer = $container->get( 'api.bearer' ); $page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' ); $signup_link_cache = $container->get( 'onboarding.signup-link-cache' ); $signup_link_ids = $container->get( 'onboarding.signup-link-ids' ); $pui_status_cache = $container->get( 'pui.status-cache' ); $dcc_status_cache = $container->get( 'dcc.status-cache' ); return new SettingsListener( $settings, $fields, $webhook_registrar, $cache, $state, $bearer, $page_id, $signup_link_cache, $signup_link_ids, $pui_status_cache, $dcc_status_cache, $container->get( 'http.redirector' ) ); }, 'wcgateway.order-processor' => static function ( ContainerInterface $container ): OrderProcessor { $session_handler = $container->get( 'session.handler' ); $order_endpoint = $container->get( 'api.endpoint.order' ); $order_factory = $container->get( 'api.factory.order' ); $threed_secure = $container->get( 'button.helper.three-d-secure' ); $authorized_payments_processor = $container->get( 'wcgateway.processor.authorized-payments' ); $settings = $container->get( 'wcgateway.settings' ); $environment = $container->get( 'onboarding.environment' ); $logger = $container->get( 'woocommerce.logger.woocommerce' ); $subscription_helper = $container->get( 'subscription.helper' ); $order_helper = $container->get( 'api.order-helper' ); return new OrderProcessor( $session_handler, $order_endpoint, $order_factory, $threed_secure, $authorized_payments_processor, $settings, $logger, $environment, $subscription_helper, $order_helper ); }, 'wcgateway.processor.refunds' => static function ( ContainerInterface $container ): RefundProcessor { $order_endpoint = $container->get( 'api.endpoint.order' ); $payments_endpoint = $container->get( 'api.endpoint.payments' ); $logger = $container->get( 'woocommerce.logger.woocommerce' ); return new RefundProcessor( $order_endpoint, $payments_endpoint, $logger ); }, 'wcgateway.processor.authorized-payments' => static function ( ContainerInterface $container ): AuthorizedPaymentsProcessor { $order_endpoint = $container->get( 'api.endpoint.order' ); $payments_endpoint = $container->get( 'api.endpoint.payments' ); $logger = $container->get( 'woocommerce.logger.woocommerce' ); $notice = $container->get( 'wcgateway.notice.authorize-order-action' ); $settings = $container->get( 'wcgateway.settings' ); $subscription_helper = $container->get( 'subscription.helper' ); return new AuthorizedPaymentsProcessor( $order_endpoint, $payments_endpoint, $logger, $notice, $settings, $subscription_helper ); }, 'wcgateway.admin.render-authorize-action' => static function ( ContainerInterface $container ): RenderAuthorizeAction { $column = $container->get( 'wcgateway.admin.orders-payment-status-column' ); return new RenderAuthorizeAction( $column ); }, 'wcgateway.admin.order-payment-status' => static function ( ContainerInterface $container ): PaymentStatusOrderDetail { $column = $container->get( 'wcgateway.admin.orders-payment-status-column' ); return new PaymentStatusOrderDetail( $column ); }, 'wcgateway.admin.orders-payment-status-column' => static function ( ContainerInterface $container ): OrderTablePaymentStatusColumn { $settings = $container->get( 'wcgateway.settings' ); return new OrderTablePaymentStatusColumn( $settings ); }, 'wcgateway.admin.fees-renderer' => static function ( ContainerInterface $container ): FeesRenderer { return new FeesRenderer(); }, 'wcgateway.settings.should-render-settings' => static function ( ContainerInterface $container ): bool { $sections = array( Settings::CONNECTION_TAB_ID => __( 'Connection', 'woocommerce-paypal-payments' ), PayPalGateway::ID => __( 'Standard Payments', 'woocommerce-paypal-payments' ), Settings::PAY_LATER_TAB_ID => __( 'Pay Later', 'woocommerce-paypal-payments' ), CreditCardGateway::ID => __( 'Advanced Card Processing', 'woocommerce-paypal-payments' ), CardButtonGateway::ID => __( 'Standard Card Button', 'woocommerce-paypal-payments' ), ); $current_page_id = $container->get( 'wcgateway.current-ppcp-settings-page-id' ); return array_key_exists( $current_page_id, $sections ); }, 'wcgateway.settings.fields' => static function ( ContainerInterface $container ): array { $should_render_settings = $container->get( 'wcgateway.settings.should-render-settings' ); if ( ! $should_render_settings ) { return array(); } $state = $container->get( 'onboarding.state' ); assert( $state instanceof State ); $dcc_applies = $container->get( 'api.helpers.dccapplies' ); assert( $dcc_applies instanceof DccApplies ); $onboarding_options_renderer = $container->get( 'onboarding.render-options' ); assert( $onboarding_options_renderer instanceof OnboardingOptionsRenderer ); $subscription_helper = $container->get( 'subscription.helper' ); assert( $subscription_helper instanceof SubscriptionHelper ); $fields = array( 'checkout_settings_heading' => array( 'heading' => __( 'Standard Payments Settings', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-heading', 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'title' => array( 'title' => __( 'Title', 'woocommerce-paypal-payments' ), 'type' => 'text', 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-paypal-payments' ), 'default' => __( 'PayPal', 'woocommerce-paypal-payments' ), 'desc_tip' => true, 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'dcc_enabled' => array( 'title' => __( 'Enable/Disable', 'woocommerce-paypal-payments' ), 'desc_tip' => true, 'description' => __( 'Once enabled, the Credit Card option will show up in the checkout.', 'woocommerce-paypal-payments' ), 'label' => __( 'Enable Advanced Card Processing', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'default' => false, 'gateway' => 'dcc', 'requirements' => array( 'dcc', ), 'screens' => array( State::STATE_ONBOARDED, ), ), 'dcc_gateway_title' => array( 'title' => __( 'Title', 'woocommerce-paypal-payments' ), 'type' => 'text', 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-paypal-payments' ), 'default' => __( 'Credit Cards', 'woocommerce-paypal-payments' ), 'desc_tip' => true, 'screens' => array( State::STATE_ONBOARDED, ), 'requirements' => array( 'dcc', ), 'gateway' => 'dcc', ), 'description' => array( 'title' => __( 'Description', 'woocommerce-paypal-payments' ), 'type' => 'text', 'desc_tip' => true, 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-paypal-payments' ), 'default' => __( 'Pay via PayPal; you can pay with your credit card if you don\'t have a PayPal account.', 'woocommerce-paypal-payments' ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'intent' => array( 'title' => __( 'Intent', 'woocommerce-paypal-payments' ), 'type' => 'select', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), 'default' => 'capture', 'desc_tip' => true, 'description' => __( 'The intent to either capture payment immediately or authorize a payment for an order after order creation.', 'woocommerce-paypal-payments' ), 'options' => array( 'capture' => __( 'Capture', 'woocommerce-paypal-payments' ), 'authorize' => __( 'Authorize', 'woocommerce-paypal-payments' ), ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'capture_on_status_change' => array( 'title' => __( 'Capture On Status Change', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'default' => false, 'desc_tip' => true, 'description' => __( 'The transaction will be captured automatically when the order status changes to Processing or Completed.', 'woocommerce-paypal-payments' ), 'label' => __( 'Capture On Status Change', 'woocommerce-paypal-payments' ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'capture_for_virtual_only' => array( 'title' => __( 'Capture Virtual-Only Orders ', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'default' => false, 'desc_tip' => true, 'description' => __( 'If the order contains exclusively virtual items, enable this to immediately capture, rather than authorize, the transaction.', 'woocommerce-paypal-payments' ), 'label' => __( 'Capture Virtual-Only Orders', 'woocommerce-paypal-payments' ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'payee_preferred' => array( 'title' => __( 'Instant Payments ', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'default' => false, 'desc_tip' => true, 'description' => __( 'If you enable this setting, PayPal will be instructed not to allow the buyer to use funding sources that take additional time to complete (for example, eChecks). Instead, the buyer will be required to use an instant funding source, such as an instant transfer, a credit/debit card, or Pay Later.', 'woocommerce-paypal-payments' ), 'label' => __( 'Require Instant Payment', 'woocommerce-paypal-payments' ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'brand_name' => array( 'title' => __( 'Brand Name', 'woocommerce-paypal-payments' ), 'type' => 'text', 'default' => get_bloginfo( 'name' ), 'desc_tip' => true, 'description' => __( 'Control the name of your shop, customers will see in the PayPal process.', 'woocommerce-paypal-payments' ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'landing_page' => array( 'title' => __( 'Landing Page', 'woocommerce-paypal-payments' ), 'type' => 'select', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), 'default' => ApplicationContext::LANDING_PAGE_LOGIN, 'desc_tip' => true, 'description' => __( 'Type of PayPal page to display.', 'woocommerce-paypal-payments' ), 'options' => array( ApplicationContext::LANDING_PAGE_LOGIN => __( 'Login (PayPal account login)', 'woocommerce-paypal-payments' ), ApplicationContext::LANDING_PAGE_BILLING => __( 'Billing (Non-PayPal account)', 'woocommerce-paypal-payments' ), ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'disable_funding' => array( 'title' => __( 'Hide Funding Source(s)', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-multiselect', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), 'default' => array(), 'desc_tip' => false, 'description' => sprintf( // translators: %1$s and %2$s are the opening and closing of HTML tag. __( 'By default, all possible funding sources will be shown. This setting can disable funding sources such as Credit Cards, Pay Later, Venmo, or other %1$sAlternative Payment Methods%2$s.', 'woocommerce-paypal-payments' ), '', '' ), 'options' => $container->get( 'wcgateway.settings.funding-sources' ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'card_billing_data_mode' => array( 'title' => __( 'Card billing data handling', 'woocommerce-paypal-payments' ), 'type' => 'select', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), 'desc_tip' => true, 'description' => __( 'Using the WC form data increases convenience for the customers, but can cause issues if card details do not match the billing data in the checkout form.', 'woocommerce-paypal-payments' ), 'default' => $container->get( 'wcgateway.settings.card_billing_data_mode.default' ), 'options' => array( CardBillingMode::USE_WC => __( 'Use WC checkout form data (do not show any address fields)', 'woocommerce-paypal-payments' ), CardBillingMode::MINIMAL_INPUT => __( 'Request only name and postal code', 'woocommerce-paypal-payments' ), CardBillingMode::NO_WC => __( 'Do not use WC checkout form data (request all address fields)', 'woocommerce-paypal-payments' ), ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => array( 'paypal', CardButtonGateway::ID ), ), 'allow_card_button_gateway' => array( 'title' => __( 'Separate Card Button from PayPal gateway', 'woocommerce-paypal-payments' ), 'type' => 'checkbox', 'desc_tip' => true, 'label' => __( 'Enable a separate payment gateway for the branded PayPal Debit or Credit Card button.', 'woocommerce-paypal-payments' ), 'description' => __( 'By default, the Debit or Credit Card button is displayed in the Standard Payments payment gateway. This setting creates a second gateway for the Card button.', 'woocommerce-paypal-payments' ), 'default' => $container->get( 'wcgateway.settings.allow_card_button_gateway.default' ), 'screens' => array( State::STATE_START, State::STATE_ONBOARDED, ), 'requirements' => array(), 'gateway' => 'paypal', ), 'disable_cards' => array( 'title' => __( 'Disable specific credit cards', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-multiselect', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), 'default' => array(), 'desc_tip' => true, 'description' => __( 'By default all possible credit cards will be accepted. You can disable some cards, if you wish.', 'woocommerce-paypal-payments' ), 'options' => array( 'visa' => _x( 'Visa', 'Name of credit card', 'woocommerce-paypal-payments' ), 'mastercard' => _x( 'Mastercard', 'Name of credit card', 'woocommerce-paypal-payments' ), 'amex' => _x( 'American Express', 'Name of credit card', 'woocommerce-paypal-payments' ), 'discover' => _x( 'Discover', 'Name of credit card', 'woocommerce-paypal-payments' ), 'jcb' => _x( 'JCB', 'Name of credit card', 'woocommerce-paypal-payments' ), 'elo' => _x( 'Elo', 'Name of credit card', 'woocommerce-paypal-payments' ), 'hiper' => _x( 'Hiper', 'Name of credit card', 'woocommerce-paypal-payments' ), ), 'screens' => array( State::STATE_ONBOARDED, ), 'requirements' => array( 'dcc', ), 'gateway' => 'dcc', ), 'card_icons' => array( 'title' => __( 'Show logo of the following credit cards', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-multiselect', 'class' => array(), 'input_class' => array( 'wc-enhanced-select' ), 'default' => array(), 'desc_tip' => true, 'description' => __( 'Define which cards you want to display in your checkout.', 'woocommerce-paypal-payments' ), 'options' => array( 'visa' => _x( 'Visa (light)', 'Name of credit card', 'woocommerce-paypal-payments' ), 'visa-dark' => _x( 'Visa (dark)', 'Name of credit card', 'woocommerce-paypal-payments' ), 'mastercard' => _x( 'Mastercard (light)', 'Name of credit card', 'woocommerce-paypal-payments' ), 'mastercard-dark' => _x( 'Mastercard (dark)', 'Name of credit card', 'woocommerce-paypal-payments' ), 'amex' => _x( 'American Express', 'Name of credit card', 'woocommerce-paypal-payments' ), 'discover' => _x( 'Discover', 'Name of credit card', 'woocommerce-paypal-payments' ), 'jcb' => _x( 'JCB', 'Name of credit card', 'woocommerce-paypal-payments' ), 'elo' => _x( 'Elo', 'Name of credit card', 'woocommerce-paypal-payments' ), 'hiper' => _x( 'Hiper', 'Name of credit card', 'woocommerce-paypal-payments' ), ), 'screens' => array( State::STATE_ONBOARDED, ), 'requirements' => array( 'dcc', ), 'gateway' => 'dcc', ), '3d_secure_heading' => array( 'heading' => __( '3D Secure', 'woocommerce-paypal-payments' ), 'type' => 'ppcp-heading', 'description' => wp_kses_post( sprintf( // translators: %1$s and %2$s is a link tag. __( '3D Secure benefits cardholders and merchants by providing an additional layer of verification using Verified by Visa, MasterCard SecureCode and American Express SafeKey. %1$sLearn more about 3D Secure.%2$s', 'woocommerce-paypal-payments' ), '', '' ) ), 'screens' => array( State::STATE_ONBOARDED, ), 'requirements' => array( 'dcc', ), 'gateway' => 'dcc', ), '3d_secure_contingency' => array( 'title' => __( 'Contingency for 3D Secure', 'woocommerce-paypal-payments' ), 'type' => 'select', 'description' => sprintf( // translators: %1$s and %2$s opening and closing ul tag, %3$s and %4$s opening and closing li tag. __( '%1$s%3$sNo 3D Secure will cause transactions to be denied if 3D Secure is required by the bank of the cardholder.%4$s%3$sSCA_WHEN_REQUIRED returns a 3D Secure contingency when it is a mandate in the region where you operate.%4$s%3$sSCA_ALWAYS triggers 3D Secure for every transaction, regardless of SCA requirements.%4$s%2$s', 'woocommerce-paypal-payments' ), '
'; $vaulting_label .= sprintf( // translators: %1$s, %2$s, %3$s and %4$s are the opening and closing of HTML tag. __( 'This will disable all %1$sPay Later%2$s features and %3$sAlternative Payment Methods%4$s on your site.', 'woocommerce-paypal-payments' ), '', '', '', '' ); $vaulting_label .= '
'; return $vaulting_label; }, 'wcgateway.settings.card_billing_data_mode.default' => static function ( ContainerInterface $container ): string { return $container->get( 'api.shop.is-latin-america' ) ? CardBillingMode::MINIMAL_INPUT : CardBillingMode::USE_WC; }, 'wcgateway.settings.card_billing_data_mode' => static function ( ContainerInterface $container ): string { $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof ContainerInterface ); return $settings->has( 'card_billing_data_mode' ) ? (string) $settings->get( 'card_billing_data_mode' ) : $container->get( 'wcgateway.settings.card_billing_data_mode.default' ); }, 'wcgateway.settings.allow_card_button_gateway.default' => static function ( ContainerInterface $container ): bool { return $container->get( 'api.shop.is-latin-america' ); }, 'wcgateway.settings.allow_card_button_gateway' => static function ( ContainerInterface $container ): bool { $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof ContainerInterface ); return $settings->has( 'allow_card_button_gateway' ) ? (bool) $settings->get( 'allow_card_button_gateway' ) : $container->get( 'wcgateway.settings.allow_card_button_gateway.default' ); }, 'wcgateway.settings.has_enabled_separate_button_gateways' => static function ( ContainerInterface $container ): bool { return (bool) $container->get( 'wcgateway.settings.allow_card_button_gateway' ); }, 'order-tracking.is-tracking-available' => static function ( ContainerInterface $container ): bool { try { $bearer = $container->get( 'api.bearer' ); assert( $bearer instanceof Bearer ); $token = $bearer->bearer(); return $token->is_tracking_available(); } catch ( RuntimeException $exception ) { return false; } }, 'wcgateway.settings.should-disable-tracking-checkbox' => static function ( ContainerInterface $container ): bool { $pui_helper = $container->get( 'wcgateway.pay-upon-invoice-helper' ); assert( $pui_helper instanceof PayUponInvoiceHelper ); $is_tracking_available = $container->get( 'order-tracking.is-tracking-available' ); if ( ! $is_tracking_available ) { return true; } if ( $pui_helper->is_pui_gateway_enabled() ) { return true; } return false; }, 'wcgateway.settings.should-disable-fraudnet-checkbox' => static function( ContainerInterface $container ): bool { $pui_helper = $container->get( 'wcgateway.pay-upon-invoice-helper' ); assert( $pui_helper instanceof PayUponInvoiceHelper ); if ( $pui_helper->is_pui_gateway_enabled() ) { return true; } return false; }, 'wcgateway.settings.fraudnet-label' => static function ( ContainerInterface $container ): string { $label = sprintf( // translators: %1$s and %2$s are the opening and closing of HTML tag. __( 'Manage online risk with %1$sFraudNet%2$s.', 'woocommerce-paypal-payments' ), '', '' ); if ( 'DE' === $container->get( 'api.shop.country' ) ) { $label .= '%1$s %2$s
', $dcc_enabled ? $enabled_status_text : $disabled_status_text, $dcc_enabled ? '' : '', $dcc_enabled ? '_self' : '_blank', esc_url( $dcc_button_url ), esc_html( $dcc_button_text ) ); }, 'wcgateway.settings.connection.pui-status-text' => static function ( ContainerInterface $container ): string { $pui_product_status = $container->get( 'wcgateway.pay-upon-invoice-product-status' ); assert( $pui_product_status instanceof PayUponInvoiceProductStatus ); $environment = $container->get( 'onboarding.environment' ); assert( $environment instanceof Environment ); $pui_enabled = $pui_product_status->pui_is_active(); $enabled_status_text = esc_html__( 'Status: Available', 'woocommerce-paypal-payments' ); $disabled_status_text = esc_html__( 'Status: Not yet enabled', 'woocommerce-paypal-payments' ); $enable_pui_url = $environment->current_environment_is( Environment::PRODUCTION ) ? $container->get( 'wcgateway.enable-pui-url-live' ) : $container->get( 'wcgateway.enable-pui-url-sandbox' ); $pui_button_url = $pui_enabled ? admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=ppcp-pay-upon-invoice-gateway' ) : $enable_pui_url; $pui_button_text = $pui_enabled ? esc_html__( 'Settings', 'woocommerce-paypal-payments' ) : esc_html__( 'Enable Pay upon Invoice', 'woocommerce-paypal-payments' ); return sprintf( '%1$s %2$s
', $pui_enabled ? $enabled_status_text : $disabled_status_text, $pui_enabled ? '' : '', $pui_enabled ? '_self' : '_blank', esc_url( $pui_button_url ), esc_html( $pui_button_text ) ); }, 'pui.status-cache' => static function( ContainerInterface $container ): Cache { return new Cache( 'ppcp-paypal-pui-status-cache' ); }, 'dcc.status-cache' => static function( ContainerInterface $container ): Cache { return new Cache( 'ppcp-paypal-dcc-status-cache' ); }, 'wcgateway.button.locations' => static function( ContainerInterface $container ): array { return array( 'product' => 'Single Product', 'cart' => 'Cart', 'checkout' => 'Checkout', 'mini-cart' => 'Mini Cart', ); }, 'wcgateway.settings.pay-later.messaging-locations' => static function( ContainerInterface $container ): array { $button_locations = $container->get( 'wcgateway.button.locations' ); unset( $button_locations['mini-cart'] ); return $button_locations; }, 'wcgateway.button.default-locations' => static function( ContainerInterface $container ): array { return array_keys( $container->get( 'wcgateway.settings.pay-later.messaging-locations' ) ); }, 'wcgateway.settings.pay-later.button-locations' => static function( ContainerInterface $container ): array { $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof Settings ); $button_locations = $container->get( 'wcgateway.button.locations' ); $smart_button_selected_locations = $settings->has( 'smart_button_locations' ) ? $settings->get( 'smart_button_locations' ) : array(); return array_intersect_key( $button_locations, array_flip( $smart_button_selected_locations ) ); }, 'wcgateway.ppcp-gateways' => static function ( ContainerInterface $container ): array { return array( PayPalGateway::ID, CreditCardGateway::ID, PayUponInvoiceGateway::ID, CardButtonGateway::ID, OXXOGateway::ID, ); }, 'wcgateway.gateway-repository' => static function ( ContainerInterface $container ): GatewayRepository { return new GatewayRepository( $container->get( 'wcgateway.ppcp-gateways' ) ); }, 'wcgateway.is-fraudnet-enabled' => static function ( ContainerInterface $container ): bool { $settings = $container->get( 'wcgateway.settings' ); assert( $settings instanceof Settings ); return $settings->has( 'fraudnet_enabled' ) && $settings->get( 'fraudnet_enabled' ); }, 'wcgateway.fraudnet-assets' => function( ContainerInterface $container ) : FraudNetAssets { return new FraudNetAssets( $container->get( 'wcgateway.url' ), $container->get( 'ppcp.asset-version' ), $container->get( 'wcgateway.fraudnet' ), $container->get( 'onboarding.environment' ), $container->get( 'wcgateway.settings' ), $container->get( 'wcgateway.gateway-repository' ), $container->get( 'session.handler' ), $container->get( 'wcgateway.is-fraudnet-enabled' ) ); }, );