woocommerce-paypal-payments/modules.local/ppcp-wc-gateway/services.php

556 lines
26 KiB
PHP
Raw Normal View History

2020-04-02 08:38:00 +03:00
<?php
2020-04-02 08:38:00 +03:00
declare(strict_types=1);
namespace Inpsyde\PayPalCommerce\WcGateway;
use Dhii\Data\Container\ContainerInterface;
2020-07-13 08:24:56 +03:00
use Inpsyde\PayPalCommerce\ApiClient\Entity\ApplicationContext;
2020-06-15 11:48:37 +03:00
use Inpsyde\PayPalCommerce\Onboarding\State;
2020-04-23 11:19:09 +03:00
use Inpsyde\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
use Inpsyde\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
use Inpsyde\PayPalCommerce\WcGateway\Checkout\CheckoutPayPalAddressPreset;
2020-04-02 08:38:00 +03:00
use Inpsyde\PayPalCommerce\WcGateway\Checkout\DisableGateways;
use Inpsyde\PayPalCommerce\WcGateway\Gateway\WcGateway;
2020-04-13 22:30:57 +03:00
use Inpsyde\PayPalCommerce\WcGateway\Notice\AuthorizeOrderActionNotice;
use Inpsyde\PayPalCommerce\WcGateway\Notice\ConnectAdminNotice;
use Inpsyde\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor;
2020-04-28 13:32:48 +03:00
use Inpsyde\PayPalCommerce\WcGateway\Processor\OrderProcessor;
2020-04-09 14:02:35 +03:00
use Inpsyde\PayPalCommerce\WcGateway\Settings\Settings;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsListener;
use Inpsyde\PayPalCommerce\WcGateway\Settings\SettingsRenderer;
2020-07-09 09:18:16 +03:00
use WpOop\TransientCache\CachePoolFactory;
2020-04-02 08:38:00 +03:00
return [
2020-04-28 12:31:12 +03:00
'wcgateway.gateway' => static function (ContainerInterface $container): WcGateway {
2020-04-28 13:32:48 +03:00
$orderProcessor = $container->get('wcgateway.order-processor');
$settingsRenderer = $container->get('wcgateway.settings.render');
2020-04-28 13:32:48 +03:00
$authorizedPayments = $container->get('wcgateway.processor.authorized-payments');
2020-04-28 12:31:12 +03:00
$notice = $container->get('wcgateway.notice.authorize-order-action');
2020-07-02 14:30:03 +03:00
$settings = $container->get('wcgateway.settings');
2020-06-30 08:35:28 +03:00
return new WcGateway(
$settingsRenderer,
2020-04-28 13:32:48 +03:00
$orderProcessor,
$authorizedPayments,
2020-06-15 11:48:37 +03:00
$notice,
2020-07-28 12:27:42 +03:00
$settings
);
2020-04-02 08:38:00 +03:00
},
2020-04-28 12:31:12 +03:00
'wcgateway.disabler' => static function (ContainerInterface $container): DisableGateways {
2020-04-02 08:38:00 +03:00
$sessionHandler = $container->get('session.handler');
$settings = $container->get('wcgateway.settings');
2020-07-28 12:27:42 +03:00
return new DisableGateways($sessionHandler, $settings);
2020-04-06 11:16:18 +03:00
},
2020-04-28 12:31:12 +03:00
'wcgateway.settings' => static function (ContainerInterface $container): Settings {
2020-07-02 14:30:03 +03:00
return new Settings();
2020-04-09 14:02:35 +03:00
},
2020-04-28 12:31:12 +03:00
'wcgateway.notice.connect' => static function (ContainerInterface $container): ConnectAdminNotice {
2020-06-15 11:48:37 +03:00
$state = $container->get('onboarding.state');
$settings = $container->get('wcgateway.settings');
2020-06-15 11:48:37 +03:00
return new ConnectAdminNotice($state, $settings);
},
2020-04-13 22:30:57 +03:00
'wcgateway.notice.authorize-order-action' =>
2020-04-28 12:31:12 +03:00
static function (ContainerInterface $container): AuthorizeOrderActionNotice {
2020-04-13 22:30:57 +03:00
return new AuthorizeOrderActionNotice();
},
'wcgateway.settings.render' => static function (ContainerInterface $container): SettingsRenderer {
$settings = $container->get('wcgateway.settings');
2020-06-15 11:48:37 +03:00
$state = $container->get('onboarding.state');
$fields = $container->get('wcgateway.settings.fields');
$dccApplies = $container->get('api.helpers.dccapplies');
return new SettingsRenderer($settings, $state, $fields, $dccApplies);
},
'wcgateway.settings.listener' => static function (ContainerInterface $container): SettingsListener {
$settings = $container->get('wcgateway.settings');
$fields = $container->get('wcgateway.settings.fields');
$webhookRegistrar = $container->get('webhook.registrar');
$state = $container->get('onboarding.state');
2020-07-09 09:10:35 +03:00
global $wpdb;
$cacheFactory = new CachePoolFactory($wpdb);
$pool = $cacheFactory->createCachePool('ppcp-token');
return new SettingsListener($settings, $fields, $webhookRegistrar, $pool, $state);
2020-04-09 14:36:52 +03:00
},
2020-04-28 13:32:48 +03:00
'wcgateway.order-processor' => static function (ContainerInterface $container): OrderProcessor {
$sessionHandler = $container->get('session.handler');
$cartRepository = $container->get('api.repository.cart');
$orderEndpoint = $container->get('api.endpoint.order');
$paymentsEndpoint = $container->get('api.endpoint.payments');
$orderFactory = $container->get('api.factory.order');
$threeDsecure = $container->get('button.helper.three-d-secure');
2020-04-28 13:32:48 +03:00
return new OrderProcessor(
$sessionHandler,
$cartRepository,
$orderEndpoint,
$paymentsEndpoint,
$orderFactory,
$threeDsecure
2020-04-28 13:32:48 +03:00
);
},
2020-04-28 12:31:12 +03:00
'wcgateway.processor.authorized-payments' => static function (ContainerInterface $container): AuthorizedPaymentsProcessor {
$orderEndpoint = $container->get('api.endpoint.order');
$paymentsEndpoint = $container->get('api.endpoint.payments');
return new AuthorizedPaymentsProcessor($orderEndpoint, $paymentsEndpoint);
},
2020-04-28 12:31:12 +03:00
'wcgateway.admin.order-payment-status' => static function (ContainerInterface $container): PaymentStatusOrderDetail {
2020-04-23 11:19:09 +03:00
return new PaymentStatusOrderDetail();
},
2020-04-28 12:31:12 +03:00
'wcgateway.admin.orders-payment-status-column' => static function (ContainerInterface $container): OrderTablePaymentStatusColumn {
$settings = $container->get('wcgateway.settings');
2020-04-23 11:19:09 +03:00
return new OrderTablePaymentStatusColumn($settings);
2020-04-28 12:31:12 +03:00
},
2020-07-02 12:48:40 +03:00
'wcgateway.settings.fields' => static function (ContainerInterface $container): array {
$settings = $container->get('wcgateway.settings');
$sandboxText = $settings->has('sandbox_on') && $settings->get('sandbox_on') ?
__(
'You are currently in the sandbox mode to test your installation. You can switch this, by clicking <button name="%1$s" value="%2$s">Reset</button>',
'woocommerce-paypal-commerce-gateway'
) : __(
'You are in live mode. This means, you can receive money into your account. You can switch this, by clicking <button name="%1$s" value="%2$s">Reset</button>',
'woocommerce-paypal-commerce-gateway'
);
$sandboxText = sprintf(
$sandboxText,
'save',
'reset'
);
$merchantEmailText = sprintf(
__(
'You are connected with your email address <mark>%1$s</mark>.
If you want to change this settings, please click <button name="%2$s" value="%3$s">Reset</button>',
'woocommerce-paypal-commerce-gateway'
),
$settings->has('merchant_email') ? $settings->get('merchant_email') : '',
'save',
'reset'
);
return [
2020-07-02 13:10:53 +03:00
'ppcp_onboarding' => [
2020-07-10 08:51:02 +03:00
'title' => __('Connect to PayPal', 'woocommerce-paypal-commerce-gateway'),
2020-07-02 13:10:53 +03:00
'type' => 'ppcp_onboarding',
'screens' => [
State::STATE_PROGRESSIVE,
],
'requirements' => [],
2020-07-02 13:10:53 +03:00
],
'sandbox_on' => [
2020-07-10 08:51:02 +03:00
'title' => __('Sandbox', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('To test your Woocommerce installation, you can use the sandbox mode.', 'woocommerce-paypal-commerce-gateway'),
'default' => 0,
'screens' => [
State::STATE_START,
],
'requirements' => [],
],
'sandbox_on_info' => [
2020-07-10 08:51:02 +03:00
'title' => __('Sandbox', 'woocommerce-paypal-commerce-gateway'),
'type' => 'ppcp-text',
'text' => $sandboxText,
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'hidden' => 'sandbox_on',
'requirements' => [],
],
'merchant_email' => [
2020-07-10 08:51:02 +03:00
'title' => __('Email address', 'woocommerce-paypal-commerce-gateway'),
'type' => 'text',
'required' => true,
'desc_tip' => true,
2020-07-10 08:51:02 +03:00
'description' => __('The email address of your PayPal account.', 'woocommerce-paypal-commerce-gateway'),
'default' => '',
'screens' => [
State::STATE_START,
],
'requirements' => [],
],
'merchant_email_info' => [
2020-07-10 08:51:02 +03:00
'title' => __('Email address', 'woocommerce-paypal-commerce-gateway'),
'type' => 'ppcp-text',
'text' => $merchantEmailText,
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'hidden' => 'merchant_email',
'requirements' => [],
],
'toggle_manual_input' => [
'type' => 'ppcp-text',
'title' => __('Manual mode', 'woocommerce-paypla-commerce-gateway'),
'text' => '<button id="ppcp[toggle_manual_input]">' . __('Toggle to manual credential input', 'woocommerce-paypal-commerce-gateway') . '</button>',
'screens' => [
State::STATE_START,
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'client_id' => [
'title' => __('Client Id', 'woocommerce-paypal-commerce-gateway'),
'type' => 'ppcp-text-input',
'desc_tip' => true,
'description' => __('The client id of your api ', 'woocommerce-paypal-commerce-gateway'),
'default' => false,
'screens' => [
State::STATE_START,
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'client_secret' => [
'title' => __('Secret Key', 'woocommerce-paypal-commerce-gateway'),
'type' => 'ppcp-password',
'desc_tip' => true,
'description' => __('The secret key of your api', 'woocommerce-paypal-commerce-gateway'),
'default' => false,
'screens' => [
State::STATE_START,
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'title' => [
2020-07-10 08:51:02 +03:00
'title' => __('Title', 'woocommerce-paypal-commerce-gateway'),
'type' => 'text',
'description' => __(
'This controls the title which the user sees during checkout.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
2020-07-10 08:51:02 +03:00
'default' => __('PayPal', 'woocommerce-paypal-commerce-gateway'),
'desc_tip' => true,
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'description' => [
2020-07-10 08:51:02 +03:00
'title' => __('Description', 'woocommerce-paypal-commerce-gateway'),
'type' => 'text',
'desc_tip' => true,
'description' => __(
'This controls the description which the user sees during checkout.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
'default' => __(
'Pay via PayPal; you can pay with your credit card if you don\'t have a PayPal account.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'intent' => [
2020-07-10 08:51:02 +03:00
'title' => __('Intent', 'woocommerce-paypal-commerce-gateway'),
'type' => 'select',
'class' => ['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.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
'options' => [
2020-07-10 08:51:02 +03:00
'capture' => __('Capture', 'woocommerce-paypal-commerce-gateway'),
'authorize' => __('Authorize', 'woocommerce-paypal-commerce-gateway'),
],
'screens' => [
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'button_single_product_enabled' => [
2020-07-10 08:51:02 +03:00
'title' => __('Buttons on Single Product', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('Enable on Single Product', 'woocommerce-paypal-commerce-gateway'),
2020-07-10 09:08:50 +03:00
'default' => true,
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'button_mini_cart_enabled' => [
2020-07-10 08:51:02 +03:00
'title' => __('Buttons on Mini Cart', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('Enable on Mini Cart', 'woocommerce-paypal-commerce-gateway'),
2020-07-10 09:08:50 +03:00
'default' => true,
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'button_cart_enabled' => [
2020-07-10 08:51:02 +03:00
'title' => __('Buttons on Cart', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('Enable on Cart', 'woocommerce-paypal-commerce-gateway'),
2020-07-10 09:08:50 +03:00
'default' => true,
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
2020-07-10 10:27:03 +03:00
'button_label' => [
'title' => __('Button Label', 'woocommerce-paypal-commerce-gateway'),
'type' => 'select',
'class' => ['wc-enhanced-select'],
'default' => 'paypal',
'desc_tip' => true,
'description' => __(
'This controls the label on the primary button.',
'woocommerce-paypal-commerce-gateway'
),
'options' => [
'paypal' => __('PayPal', 'woocommerce-paypal-commerce-gateway'),
'checkout' => __('PayPal Checkout', 'woocommerce-paypal-commerce-gateway'),
'buynow' => __('PayPal Buy Now', 'woocommerce-paypal-commerce-gateway'),
'pay' => __('Pay with PayPal', 'woocommerce-paypal-commerce-gateway'),
],
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
2020-07-10 10:27:03 +03:00
],
2020-07-10 11:50:11 +03:00
'brand_name' => [
'title' => __('Brand Name', 'woocommerce-paypal-commerce-gateway'),
'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-commerce-gateway'
),
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
2020-07-13 08:24:56 +03:00
],
'requirements' => [],
2020-07-13 08:24:56 +03:00
],
'landing_page' => [
'title' => __('Landing Page', 'woocommerce-paypal-commerce-gateway'),
'type' => 'select',
'class' => ['wc-enhanced-select'],
'default' => 'gold',
'desc_tip' => true,
'description' => __(
2020-07-22 13:22:41 +03:00
'Type of PayPal page to display.',
2020-07-13 08:24:56 +03:00
'woocommerce-paypal-commerce-gateway'
),
'options' => [
ApplicationContext::LANDING_PAGE_LOGIN => __('Login (PayPal account login)', 'woocommerce-paypal-commerce-gateway'),
ApplicationContext::LANDING_PAGE_BILLING => __('Billing (Non-PayPal account)', 'woocommerce-paypal-commerce-gateway'),
],
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
2020-07-10 11:50:11 +03:00
],
'requirements' => [],
2020-07-10 11:50:11 +03:00
],
'button_color' => [
2020-07-10 08:51:02 +03:00
'title' => __('Color', 'woocommerce-paypal-commerce-gateway'),
'type' => 'select',
'class' => ['wc-enhanced-select'],
'default' => 'gold',
'desc_tip' => true,
'description' => __(
'Controls the background color of the primary button. Use "Gold" to leverage PayPal\'s recognition and preference, or change it to match your site design or aesthetic.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
'options' => [
2020-07-10 08:51:02 +03:00
'gold' => __('Gold (Recommended)', 'woocommerce-paypal-commerce-gateway'),
'blue' => __('Blue', 'woocommerce-paypal-commerce-gateway'),
'silver' => __('Silver', 'woocommerce-paypal-commerce-gateway'),
'black' => __('Black', 'woocommerce-paypal-commerce-gateway'),
],
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'button_shape' => [
2020-07-10 08:51:02 +03:00
'title' => __('Shape', 'woocommerce-paypal-commerce-gateway'),
'type' => 'select',
'class' => ['wc-enhanced-select'],
'default' => 'rect',
'desc_tip' => true,
'description' => __(
'The pill-shaped button\'s unique and powerful shape signifies PayPal in people\'s minds. Use the rectangular button as an alternative when pill-shaped buttons might pose design challenges.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
'options' => [
2020-07-10 08:51:02 +03:00
'pill' => __('Pill', 'woocommerce-paypal-commerce-gateway'),
'rect' => __('Rectangle', 'woocommerce-paypal-commerce-gateway'),
],
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'disable_funding' => [
2020-07-10 08:51:02 +03:00
'title' => __('Disable funding sources', 'woocommerce-paypal-commerce-gateway'),
'type' => 'ppcp-multiselect',
'class' => ['wc-enhanced-select'],
'default' => [],
'desc_tip' => true,
'description' => __(
'By default all possible funding sources will be shown. You can disable some sources, if you wish.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
'options' => [
2020-07-10 08:51:02 +03:00
'card' => _x('Credit or debit cards', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'credit' => _x('PayPal Credit', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'sepa' => _x('SEPA-Lastschrift', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'bancontact' => _x('Bancontact', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'eps' => _x('eps', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'giropay' => _x('giropay', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'ideal' => _x('iDEAL', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'mybank' => _x('MyBank', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'p24' => _x('Przelewy24', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
'sofort' => _x('Sofort', 'Name of payment method', 'woocommerce-paypal-commerce-gateway'),
],
'screens' => [
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'vault_enabled' => [
'title' => __('Vaulting', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
'desc_tip' => true,
'label' => __('Enable vaulting', 'woocommerce-paypal-commerce-gateway'),
'description' => __('Enables you to store payment tokens for subscriptions.', 'woocommerce-paypal-commerce-gateway'),
'default' => true,
'screens' => [
State::STATE_ONBOARDED,
],
'requirements' => [],
],
'dcc_cart_enabled' => [
2020-07-10 08:51:02 +03:00
'title' => __('Enable credit card on cart', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('Allow your customers to pay with credit card directly in your cart.', 'woocommerce-paypal-commerce-gateway'),
2020-07-10 09:08:50 +03:00
'default' => true,
'screens' => [
State::STATE_ONBOARDED,
],
'requirements' => [
'dcc',
],
],
'dcc_mini_cart_enabled' => [
2020-07-10 08:51:02 +03:00
'title' => __('Enable credit card on mini cart', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('Allow your customers to pay with credit card directly in your mini cart.', 'woocommerce-paypal-commerce-gateway'),
2020-07-10 09:08:50 +03:00
'default' => true,
'screens' => [
State::STATE_ONBOARDED,
],
'requirements' => [
'dcc',
],
],
'dcc_checkout_enabled' => [
2020-07-10 08:51:02 +03:00
'title' => __('Enable credit card on checkout', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('Allow your customers to pay with credit card in the checkout.', 'woocommerce-paypal-commerce-gateway'),
2020-07-10 09:08:50 +03:00
'default' => true,
'screens' => [
State::STATE_ONBOARDED,
],
'requirements' => [
'dcc',
],
],
'dcc_single_product_enabled' => [
2020-07-10 08:51:02 +03:00
'title' => __('Enable credit card on products', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
2020-07-10 08:51:02 +03:00
'label' => __('Allow your customers to pay with credit card instantly on the product page.', 'woocommerce-paypal-commerce-gateway'),
2020-07-10 09:08:50 +03:00
'default' => true,
'screens' => [
State::STATE_ONBOARDED,
],
'requirements' => [
'dcc',
],
],
'disable_cards' => [
2020-07-28 12:31:55 +03:00
'title' => __('Disable specific credit cards', 'woocommerce-paypal-commerce-gateway'),
'type' => 'ppcp-multiselect',
'class' => ['wc-enhanced-select'],
'default' => [],
'desc_tip' => true,
'description' => __(
'By default all possible credit cards will be shown. You can disable some cards, if you wish.',
2020-07-10 08:51:02 +03:00
'woocommerce-paypal-commerce-gateway'
),
'options' => [
2020-07-10 08:51:02 +03:00
'visa' => _x('Visa', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'),
'mastercard' => _x('Mastercard', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'),
'amex' => _x('American Express', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'),
'discover' => _x('Discover', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'),
'jcb' => _x('JCB', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'),
'elo' => _x('Elo', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'),
'hiper' => _x('Hiper', 'Name of credit card', 'woocommerce-paypal-commerce-gateway'),
],
'screens' => [
State::STATE_ONBOARDED,
],
'requirements' => [
'dcc',
],
],
2020-07-10 15:45:49 +03:00
'logging_enabled' => [
'title' => __('Logging', 'woocommerce-paypal-commerce-gateway'),
'type' => 'checkbox',
'desc_tip' => true,
'label' => __('Enable logging', 'woocommerce-paypal-commerce-gateway'),
'description' => __('Enable logging of unexpected behavior. This can also log private data and should only be enabled in a development or stage environment.', 'woocommerce-paypal-commerce-gateway'),
'default' => false,
'screens' => [
State::STATE_START,
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
2020-07-10 15:45:49 +03:00
],
2020-07-28 07:03:15 +03:00
'prefix' => [
'title' => __('Installation prefix', 'woocommerce-paypal-commerce-gateway'),
'type' => 'text',
'desc_tip' => true,
'description' => __('If you use your PayPal account with more than one installation, please use a distinct prefix to seperate those installations. Please do not use numbers in your prefix.', 'woocommerce-paypal-commerce-gateway'),
'default' => 'WC-',
'screens' => [
State::STATE_START,
State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
],
'requirements' => [],
],
];
2020-07-02 12:48:40 +03:00
},
'wcgateway.checkout.address-preset' => static function(ContainerInterface $container): CheckoutPayPalAddressPreset {
return new CheckoutPayPalAddressPreset(
$container->get('session.handler')
);
},
2020-04-02 08:38:00 +03:00
];