diff --git a/.gitignore b/.gitignore
index 9b188c6da..ae438ab55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,7 +5,8 @@ node_modules
.phpunit.result.cache
yarn-error.log
modules/ppcp-button/assets/*
-modules/ppcp-wc-gateway/assets/*
+modules/ppcp-wc-gateway/assets/js
+modules/ppcp-wc-gateway/assets/css
*.zip
.env
auth.json
diff --git a/modules/ppcp-api-client/services.php b/modules/ppcp-api-client/services.php
index 32184c6a3..b68911ee0 100644
--- a/modules/ppcp-api-client/services.php
+++ b/modules/ppcp-api-client/services.php
@@ -127,7 +127,6 @@ return array(
return new PartnerReferrals(
$container->get( 'api.host' ),
$container->get( 'api.bearer' ),
- $container->get( 'api.repository.partner-referrals-data' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
@@ -209,9 +208,8 @@ return array(
},
'api.repository.partner-referrals-data' => static function ( ContainerInterface $container ) : PartnerReferralsData {
- $merchant_email = $container->get( 'api.merchant_email' );
$dcc_applies = $container->get( 'api.helpers.dccapplies' );
- return new PartnerReferralsData( $merchant_email, $dcc_applies );
+ return new PartnerReferralsData( $dcc_applies );
},
'api.repository.cart' => static function ( ContainerInterface $container ): CartRepository {
$factory = $container->get( 'api.factory.purchase-unit' );
diff --git a/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php b/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
index 38526927f..0f188f025 100644
--- a/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
+++ b/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
@@ -12,7 +12,6 @@ namespace WooCommerce\PayPalCommerce\ApiClient\Endpoint;
use WooCommerce\PayPalCommerce\ApiClient\Authentication\Bearer;
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
-use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
use Psr\Log\LoggerInterface;
/**
@@ -36,13 +35,6 @@ class PartnerReferrals {
*/
private $bearer;
- /**
- * The PartnerReferralsData.
- *
- * @var PartnerReferralsData
- */
- private $data;
-
/**
* The logger.
*
@@ -53,32 +45,29 @@ class PartnerReferrals {
/**
* PartnerReferrals constructor.
*
- * @param string $host The host.
- * @param Bearer $bearer The bearer.
- * @param PartnerReferralsData $data The partner referrals data.
- * @param LoggerInterface $logger The logger.
+ * @param string $host The host.
+ * @param Bearer $bearer The bearer.
+ * @param LoggerInterface $logger The logger.
*/
public function __construct(
string $host,
Bearer $bearer,
- PartnerReferralsData $data,
LoggerInterface $logger
) {
$this->host = $host;
$this->bearer = $bearer;
- $this->data = $data;
$this->logger = $logger;
}
/**
* Fetch the signup link.
*
+ * @param array $data The partner referrals data.
* @return string
* @throws RuntimeException If the request fails.
*/
- public function signup_link(): string {
- $data = $this->data->data();
+ public function signup_link( array $data ): string {
$bearer = $this->bearer->bearer();
$args = array(
'method' => 'POST',
diff --git a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php
index d893e9c91..cdcdabac5 100644
--- a/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php
+++ b/modules/ppcp-api-client/src/Repository/PartnerReferralsData.php
@@ -15,14 +15,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
* Class PartnerReferralsData
*/
class PartnerReferralsData {
-
- /**
- * The merchant email.
- *
- * @var string
- */
- private $merchant_email;
-
/**
* The DCC Applies Helper object.
*
@@ -30,19 +22,39 @@ class PartnerReferralsData {
*/
private $dcc_applies;
+ /**
+ * The list of products ('PPCP', 'EXPRESS_CHECKOUT').
+ *
+ * @var string[]
+ */
+ private $products;
+
/**
* PartnerReferralsData constructor.
*
- * @param string $merchant_email The email of the merchant.
* @param DccApplies $dcc_applies The DCC Applies helper.
*/
public function __construct(
- string $merchant_email,
DccApplies $dcc_applies
) {
+ $this->dcc_applies = $dcc_applies;
+ $this->products = array(
+ $this->dcc_applies->for_country_currency() ? 'PPCP' : 'EXPRESS_CHECKOUT',
+ );
+ }
- $this->merchant_email = $merchant_email;
- $this->dcc_applies = $dcc_applies;
+ /**
+ * Returns a new copy of this object with the given value set.
+ *
+ * @param string[] $products The list of products ('PPCP', 'EXPRESS_CHECKOUT').
+ * @return static
+ */
+ public function with_products( array $products ): self {
+ $obj = clone $this;
+
+ $obj->products = $products;
+
+ return $obj;
}
/**
@@ -60,17 +72,6 @@ class PartnerReferralsData {
* @return array
*/
public function data(): array {
- $data = $this->default_data();
- return $data;
- }
-
- /**
- * Returns the default data.
- *
- * @return array
- */
- private function default_data(): array {
-
return array(
'partner_config_override' => array(
'partner_logo_url' => 'https://connect.woocommerce.com/images/woocommerce_logo.png',
@@ -84,9 +85,7 @@ class PartnerReferralsData {
),
'show_add_credit_card' => true,
),
- 'products' => array(
- $this->dcc_applies->for_country_currency() ? 'PPCP' : 'EXPRESS_CHECKOUT',
- ),
+ 'products' => $this->products,
'legal_consents' => array(
array(
'type' => 'SHARE_DATA_CONSENT',
diff --git a/modules/ppcp-button/services.php b/modules/ppcp-button/services.php
index fba90a1c8..f068cf5bb 100644
--- a/modules/ppcp-button/services.php
+++ b/modules/ppcp-button/services.php
@@ -52,7 +52,7 @@ return array(
*
* @var State $state
*/
- if ( $state->current_state() <= State::STATE_PROGRESSIVE ) {
+ if ( $state->current_state() !== State::STATE_ONBOARDED ) {
return new DisabledSmartButton();
}
$settings = $container->get( 'wcgateway.settings' );
diff --git a/modules/ppcp-onboarding/assets/css/onboarding.css b/modules/ppcp-onboarding/assets/css/onboarding.css
index affc68415..98cc7608f 100644
--- a/modules/ppcp-onboarding/assets/css/onboarding.css
+++ b/modules/ppcp-onboarding/assets/css/onboarding.css
@@ -2,41 +2,28 @@
display: none;
}
-#field-merchant_email_production,
-#field-ppcp_disconnect_sandbox,
-#field-ppcp_disconnect_production,
-#field-merchant_id_production,
-#field-client_id_production,
-#field-client_secret_production,
-#field-merchant_email_sandbox,
-#field-merchant_id_sandbox,
-#field-client_id_sandbox,
-#field-client_secret_sandbox{
+.ppcp-onboarded .ppcp-onboarding-element:not(.ppcp-always-shown-element) {
display: none;
}
-#field-merchant_email_production.show,
-#field-ppcp_disconnect_sandbox.show,
-#field-ppcp_disconnect_production.show,
-#field-merchant_id_production.show,
-#field-client_id_production.show,
-#field-client_secret_production.show,
-#field-merchant_email_sandbox.show,
-#field-merchant_id_sandbox.show,
-#field-client_id_sandbox.show,
-#field-client_secret_sandbox.show {
+
+.ppcp-onboarding .ppcp-settings-field:not(.ppcp-onboarding-element):not(.ppcp-always-shown-element) {
+ display: none;
+}
+
+.ppcp-settings-field.hide {
+ display: none;
+}
+
+.ppcp-settings-field.show {
display: table-row;
}
-#field-toggle_manual_input span.hide,
-#field-toggle_manual_input.show span.show{
- display: none;
-}
-#field-toggle_manual_input.show span.hide {
- display: unset;
+label.error {
+ color: red;
+ font-weight: bold;
}
-#field-production_toggle_manual_input button,
-#field-sandbox_toggle_manual_input button {
+#field-toggle_manual_input button {
color: #0073aa;
transition-property: border, background, color;
transition-duration: .05s;
@@ -49,39 +36,8 @@
padding: 0;
}
-#field-sandbox_toggle_manual_input.onboarded,
-#field-production_toggle_manual_input.onboarded {
- display: none;
-}
-
-
-#field-ppcp_disconnect_sandbox.onboarded,
-#field-ppcp_disconnect_production.onboarded,
-#field-merchant_email_sandbox.onboarded,
-#field-merchant_id_sandbox.onboarded,
-#field-client_id_sandbox.onboarded,
-#field-client_secret_sandbox.onboarded,
-#field-merchant_email_production.onboarded,
-#field-merchant_id_production.onboarded,
-#field-client_id_production.onboarded,
-#field-client_secret_production.onboarded {
- display:table-row;
-}
-#field-ppcp_disconnect_sandbox.onboarded.hide,
-#field-ppcp_disconnect_production.onboarded.hide,
-#field-merchant_email_sandbox.onboarded.hide,
-#field-merchant_id_sandbox.onboarded.hide,
-#field-client_id_sandbox.onboarded.hide,
-#field-client_secret_sandbox.onboarded.hide,
-#field-merchant_email_production.onboarded.hide,
-#field-merchant_id_production.onboarded.hide,
-#field-client_id_production.onboarded.hide,
-#field-client_secret_production.onboarded.hide {
- display:none;
-}
-
/* Probably not the best location for this but will do until there's a general purpose settings CSS file. */
-.ppcp-settings-field-heading td, .ppcp-settings-field-heading th {
+.ppcp-settings-field-heading td, .ppcp-settings-field-heading th, .ppcp-settings-no-title-col td {
padding-left: 0;
}
@@ -92,3 +48,40 @@
.input-text[pattern]:invalid {
border: red solid 2px;
}
+
+ul.ppcp-onboarding-options, ul.ppcp-onboarding-options-sublist {
+ list-style: none;
+}
+
+ul.ppcp-onboarding-options-sublist {
+ margin-left: 15px;
+}
+
+.ppcp-muted-text {
+ opacity: 0.6;
+}
+
+.ppcp-onboarding-header {
+ display: flex;
+ width: 1000px;
+}
+
+.ppcp-onboarding-header-left, .ppcp-onboarding-header-right {
+ flex: 50%;
+}
+
+.ppcp-onboarding-header h2 {
+ margin-top: 0;
+}
+
+.ppcp-onboarding-header-cards img, .ppcp-onboarding-header-paypal-logos img {
+ margin: 5px;
+}
+
+.ppcp-onboarding-header-cards img {
+ height: 40px;
+}
+
+.ppcp-onboarding-header-paypal-logos img {
+ height: 45px;
+}
diff --git a/modules/ppcp-onboarding/assets/js/onboarding.js b/modules/ppcp-onboarding/assets/js/onboarding.js
index fd63915ff..4db2ad4ec 100644
--- a/modules/ppcp-onboarding/assets/js/onboarding.js
+++ b/modules/ppcp-onboarding/assets/js/onboarding.js
@@ -1,9 +1,11 @@
-// Onboarding.
const ppcp_onboarding = {
BUTTON_SELECTOR: '[data-paypal-onboard-button]',
PAYPAL_JS_ID: 'ppcp-onboarding-paypal-js',
_timeout: false,
+ STATE_START: 'start',
+ STATE_ONBOARDED: 'onboarded',
+
init: function() {
document.addEventListener('DOMContentLoaded', this.reload);
},
@@ -15,7 +17,7 @@ const ppcp_onboarding = {
return;
}
- // Add event listeners to buttons.
+ // Add event listeners to buttons preventing link clicking if PayPal init failed.
buttons.forEach(
(element) => {
if (element.hasAttribute('data-ppcp-button-initialized')) {
@@ -89,8 +91,6 @@ const ppcp_onboarding = {
}
);
},
-
-
};
function ppcp_onboarding_sandboxCallback(...args) {
@@ -101,150 +101,142 @@ function ppcp_onboarding_productionCallback(...args) {
return ppcp_onboarding.loginSeller('production', ...args);
}
-/**
- * Since the PayPal modal will redirect the user a dirty form
- * provokes an alert if the user wants to leave the page. Since the user
- * needs to toggle the sandbox switch, we disable this dirty state with the
- * following workaround for checkboxes.
- *
- * @param event
- */
-const checkBoxOnClick = (event) => {
- const value = event.target.checked;
- if (event.target.getAttribute('id') === 'ppcp-sandbox_on') {
- toggleSandboxProduction(! value);
- }
- event.preventDefault();
- event.stopPropagation();
- setTimeout( () => {
- event.target.checked = value;
- },1
- );
-};
-
-/**
- * Toggles the credential input fields.
- *
- * @param forProduction
- */
-const credentialToggle = (forProduction) => {
-
- const sandboxClassSelectors = [
- '#field-ppcp_disconnect_sandbox',
- '#field-merchant_email_sandbox',
- '#field-merchant_id_sandbox',
- '#field-client_id_sandbox',
- '#field-client_secret_sandbox',
- ];
- const productionClassSelectors = [
- '#field-ppcp_disconnect_production',
- '#field-merchant_email_production',
- '#field-merchant_id_production',
- '#field-client_id_production',
- '#field-client_secret_production',
- ];
-
- const selectors = forProduction ? productionClassSelectors : sandboxClassSelectors;
- document.querySelectorAll(selectors.join()).forEach(
- (element) => {element.classList.toggle('show')}
- )
-};
-
-/**
- * Toggles the visibility of the sandbox/production input fields.
- *
- * @param showProduction
- */
-const toggleSandboxProduction = (showProduction) => {
- const productionDisplaySelectors = [
- '#field-credentials_production_heading',
- '#field-production_toggle_manual_input',
- '#field-ppcp_onboarding_production',
- ];
- const productionClassSelectors = [
-
- '#field-ppcp_disconnect_production',
- '#field-merchant_email_production',
- '#field-merchant_id_production',
- '#field-client_id_production',
- '#field-client_secret_production',
- ];
- const sandboxDisplaySelectors = [
- '#field-credentials_sandbox_heading',
- '#field-sandbox_toggle_manual_input',
- '#field-ppcp_onboarding_sandbox',
- ];
- const sandboxClassSelectors = [
- '#field-ppcp_disconnect_sandbox',
- '#field-merchant_email_sandbox',
- '#field-merchant_id_sandbox',
- '#field-client_id_sandbox',
- '#field-client_secret_sandbox',
- ];
-
- if (showProduction) {
- document.querySelectorAll(productionDisplaySelectors.join()).forEach(
- (element) => {element.style.display = ''}
- );
- document.querySelectorAll(sandboxDisplaySelectors.join()).forEach(
- (element) => {element.style.display = 'none'}
- );
- document.querySelectorAll(productionClassSelectors.join()).forEach(
- (element) => {element.classList.remove('hide')}
- );
- document.querySelectorAll(sandboxClassSelectors.join()).forEach(
- (element) => {
- element.classList.remove('show');
- element.classList.add('hide');
- }
- );
- return;
- }
- document.querySelectorAll(productionDisplaySelectors.join()).forEach(
- (element) => {element.style.display = 'none'}
- );
- document.querySelectorAll(sandboxDisplaySelectors.join()).forEach(
- (element) => {element.style.display = ''}
- );
-
- document.querySelectorAll(sandboxClassSelectors.join()).forEach(
- (element) => {element.classList.remove('hide')}
- );
- document.querySelectorAll(productionClassSelectors.join()).forEach(
- (element) => {
- element.classList.remove('show');
- element.classList.add('hide');
- }
- )
-};
-
-const disconnect = (event) => {
- event.preventDefault();
- const fields = event.target.classList.contains('production') ? [
- '#field-merchant_email_production input',
- '#field-merchant_id_production input',
- '#field-client_id_production input',
- '#field-client_secret_production input',
- ] : [
- '#field-merchant_email_sandbox input',
- '#field-merchant_id_sandbox input',
- '#field-client_id_sandbox input',
- '#field-client_secret_sandbox input',
- ];
-
- document.querySelectorAll(fields.join()).forEach(
- (element) => {
- element.value = '';
- }
- );
- document.querySelector('.woocommerce-save-button').click();
-};
-
(() => {
- const sandboxSwitchElement = document.querySelector('#ppcp-sandbox_on');
- if (sandboxSwitchElement) {
- toggleSandboxProduction(! sandboxSwitchElement.checked);
- }
+ const productionCredentialElementsSelectors = [
+ '#field-merchant_email_production',
+ '#field-merchant_id_production',
+ '#field-client_id_production',
+ '#field-client_secret_production',
+ ];
+ const sandboxCredentialElementsSelectors = [
+ '#field-merchant_email_sandbox',
+ '#field-merchant_id_sandbox',
+ '#field-client_id_sandbox',
+ '#field-client_secret_sandbox',
+ ];
+
+ const updateOptionsState = () => {
+ const cardsChk = document.querySelector('#ppcp-onboarding-accept-cards');
+ if (!cardsChk) {
+ return;
+ }
+
+ document.querySelectorAll('#ppcp-onboarding-dcc-options input').forEach(input => {
+ input.disabled = !cardsChk.checked;
+ });
+
+ const basicRb = document.querySelector('#ppcp-onboarding-dcc-basic');
+
+ const isExpress = !cardsChk.checked || basicRb.checked;
+
+ const expressButtonSelectors = [
+ '#field-ppcp_onboarding_production_express',
+ '#field-ppcp_onboarding_sandbox_express',
+ ];
+ const ppcpButtonSelectors = [
+ '#field-ppcp_onboarding_production_ppcp',
+ '#field-ppcp_onboarding_sandbox_ppcp',
+ ];
+
+ document.querySelectorAll(expressButtonSelectors.join()).forEach(
+ element => element.style.display = isExpress ? '' : 'none'
+ );
+ document.querySelectorAll(ppcpButtonSelectors.join()).forEach(
+ element => element.style.display = !isExpress ? '' : 'none'
+ );
+ };
+
+ const updateManualInputControls = (shown, isSandbox, isAnyEnvOnboarded) => {
+ const productionElementsSelectors = productionCredentialElementsSelectors;
+ const sandboxElementsSelectors = sandboxCredentialElementsSelectors;
+ const otherElementsSelectors = [
+ '.woocommerce-save-button',
+ ];
+ if (!isAnyEnvOnboarded) {
+ otherElementsSelectors.push('#field-sandbox_on');
+ }
+
+ document.querySelectorAll(productionElementsSelectors.join()).forEach(
+ element => {
+ element.classList.remove('hide', 'show');
+ element.classList.add((shown && !isSandbox) ? 'show' : 'hide');
+ }
+ );
+ document.querySelectorAll(sandboxElementsSelectors.join()).forEach(
+ element => {
+ element.classList.remove('hide', 'show');
+ element.classList.add((shown && isSandbox) ? 'show' : 'hide');
+ }
+ );
+ document.querySelectorAll(otherElementsSelectors.join()).forEach(
+ element => element.style.display = shown ? '' : 'none'
+ );
+ };
+
+ const updateEnvironmentControls = (isSandbox) => {
+ const productionElementsSelectors = [
+ '#field-ppcp_disconnect_production',
+ '#field-credentials_production_heading',
+ ];
+ const sandboxElementsSelectors = [
+ '#field-ppcp_disconnect_sandbox',
+ '#field-credentials_sandbox_heading',
+ ];
+
+ document.querySelectorAll(productionElementsSelectors.join()).forEach(
+ element => element.style.display = !isSandbox ? '' : 'none'
+ );
+ document.querySelectorAll(sandboxElementsSelectors.join()).forEach(
+ element => element.style.display = isSandbox ? '' : 'none'
+ );
+ };
+
+ let isDisconnecting = false;
+
+ const disconnect = (event) => {
+ event.preventDefault();
+ const fields = event.target.classList.contains('production') ? productionCredentialElementsSelectors : sandboxCredentialElementsSelectors;
+
+ document.querySelectorAll(fields.map(f => f + ' input').join()).forEach(
+ (element) => {
+ element.value = '';
+ }
+ );
+
+ isDisconnecting = true;
+
+ document.querySelector('.woocommerce-save-button').click();
+ };
+
+ // Prevent the message about unsaved checkbox/radiobutton when reloading the page.
+ // (WC listens for changes on all inputs and sets dirty flag until form submission)
+ const preventDirtyCheckboxPropagation = event => {
+ event.preventDefault();
+ event.stopPropagation();
+
+ const value = event.target.checked;
+ setTimeout( () => {
+ event.target.checked = value;
+ }, 1
+ );
+ };
+
+ const sandboxSwitchElement = document.querySelector('#ppcp-sandbox_on');
+
+ const validate = () => {
+ const selectors = sandboxSwitchElement.checked ? sandboxCredentialElementsSelectors : productionCredentialElementsSelectors;
+ const values = selectors.map(s => document.querySelector(s + ' input')).map(el => el.value);
+
+ const errors = [];
+ if (values.some(v => !v)) {
+ errors.push(PayPalCommerceGatewayOnboarding.error_messages.no_credentials);
+ }
+
+ return errors;
+ };
+
+ const isAnyEnvOnboarded = PayPalCommerceGatewayOnboarding.sandbox_state === ppcp_onboarding.STATE_ONBOARDED ||
+ PayPalCommerceGatewayOnboarding.production_state === ppcp_onboarding.STATE_ONBOARDED;
document.querySelectorAll('.ppcp-disconnect').forEach(
(button) => {
@@ -255,43 +247,89 @@ const disconnect = (event) => {
}
);
- // Prevent a possibly dirty form arising from this particular checkbox.
- if (sandboxSwitchElement) {
- sandboxSwitchElement.addEventListener(
- 'click',
- (event) => {
- const value = event.target.checked;
+ document.querySelectorAll('.ppcp-onboarding-options input').forEach(
+ (element) => {
+ element.addEventListener('click', event => {
+ updateOptionsState();
- toggleSandboxProduction( ! value );
+ preventDirtyCheckboxPropagation(event);
+ });
+ }
+ );
- event.preventDefault();
- event.stopPropagation();
- setTimeout( () => {
- event.target.checked = value;
- }, 1
- );
- }
- );
- }
+ const isSandboxInBackend = PayPalCommerceGatewayOnboarding.current_env === 'sandbox';
+ if (sandboxSwitchElement.checked !== isSandboxInBackend) {
+ sandboxSwitchElement.checked = isSandboxInBackend;
+ }
- // document.querySelectorAll('#mainform input[type="checkbox"]').forEach(
- // (checkbox) => {
- // checkbox.addEventListener('click', checkBoxOnClick);
- // }
- // );
+ updateOptionsState();
- document.querySelectorAll('#field-sandbox_toggle_manual_input button, #field-production_toggle_manual_input button').forEach(
- (button) => {
- button.addEventListener(
- 'click',
- (event) => {
- event.preventDefault();
- const isProduction = event.target.classList.contains('production-toggle');
- credentialToggle(isProduction);
- }
- )
- }
- );
+ const settingsContainer = document.querySelector('#mainform .form-table');
+
+ const markCurrentOnboardingState = (isOnboarded) => {
+ settingsContainer.classList.remove('ppcp-onboarded', 'ppcp-onboarding');
+ settingsContainer.classList.add(isOnboarded ? 'ppcp-onboarded' : 'ppcp-onboarding');
+ }
+
+ markCurrentOnboardingState(PayPalCommerceGatewayOnboarding.current_state === ppcp_onboarding.STATE_ONBOARDED);
+
+ const manualInputToggleButton = document.querySelector('#field-toggle_manual_input button');
+ let isManualInputShown = PayPalCommerceGatewayOnboarding.current_state === ppcp_onboarding.STATE_ONBOARDED;
+
+ manualInputToggleButton.addEventListener(
+ 'click',
+ (event) => {
+ event.preventDefault();
+
+ isManualInputShown = !isManualInputShown;
+
+ updateManualInputControls(isManualInputShown, sandboxSwitchElement.checked, isAnyEnvOnboarded);
+ }
+ );
+
+ sandboxSwitchElement.addEventListener(
+ 'click',
+ (event) => {
+ const isSandbox = sandboxSwitchElement.checked;
+
+ if (isAnyEnvOnboarded) {
+ const onboardingState = isSandbox ? PayPalCommerceGatewayOnboarding.sandbox_state : PayPalCommerceGatewayOnboarding.production_state;
+ const isOnboarded = onboardingState === ppcp_onboarding.STATE_ONBOARDED;
+
+ markCurrentOnboardingState(isOnboarded);
+ isManualInputShown = isOnboarded;
+ }
+
+ updateManualInputControls(isManualInputShown, isSandbox, isAnyEnvOnboarded);
+
+ updateEnvironmentControls(isSandbox);
+
+ preventDirtyCheckboxPropagation(event);
+ }
+ );
+
+ updateManualInputControls(isManualInputShown, sandboxSwitchElement.checked, isAnyEnvOnboarded);
+
+ updateEnvironmentControls(sandboxSwitchElement.checked);
+
+ document.querySelector('#mainform').addEventListener('submit', e => {
+ if (isDisconnecting) {
+ return;
+ }
+
+ const errors = validate();
+ if (errors.length) {
+ e.preventDefault();
+
+ const errorLabel = document.querySelector('#ppcp-form-errors-label');
+ errorLabel.parentElement.parentElement.classList.remove('hide');
+
+ errorLabel.innerHTML = errors.join('
');
+
+ errorLabel.scrollIntoView();
+ window.scrollBy(0, -120); // WP + WC floating header
+ }
+ });
// Onboarding buttons.
ppcp_onboarding.init();
diff --git a/modules/ppcp-onboarding/assets/js/settings.js b/modules/ppcp-onboarding/assets/js/settings.js
index e30b45856..9af409f07 100644
--- a/modules/ppcp-onboarding/assets/js/settings.js
+++ b/modules/ppcp-onboarding/assets/js/settings.js
@@ -23,7 +23,7 @@ document.addEventListener(
}
group.forEach( (elementToShow) => {
- document.querySelector(elementToShow).style.display = 'table-row';
+ document.querySelector(elementToShow).style.display = '';
})
if('ppcp-message_enabled' === event.target.getAttribute('id')){
@@ -56,7 +56,7 @@ document.addEventListener(
return;
}
if (value === elementToToggle.value && domElement.style.display !== 'none') {
- domElement.style.display = 'table-row';
+ domElement.style.display = '';
return;
}
domElement.style.display = 'none';
@@ -69,7 +69,7 @@ document.addEventListener(
const value = event.target.value;
group.forEach( (elementToToggle) => {
if (value === elementToToggle.value) {
- document.querySelector(elementToToggle.selector).style.display = 'table-row';
+ document.querySelector(elementToToggle.selector).style.display = '';
return;
}
document.querySelector(elementToToggle.selector).style.display = 'none';
diff --git a/modules/ppcp-onboarding/services.php b/modules/ppcp-onboarding/services.php
index cb0e17590..81e25ad31 100644
--- a/modules/ppcp-onboarding/services.php
+++ b/modules/ppcp-onboarding/services.php
@@ -18,6 +18,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
use WooCommerce\PayPalCommerce\Onboarding\Assets\OnboardingAssets;
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
+use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer;
use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingRenderer;
use WooCommerce\PayPalCommerce\Onboarding\OnboardingRESTController;
@@ -117,9 +118,8 @@ return array(
);
},
'onboarding.state' => function( ContainerInterface $container ) : State {
- $environment = $container->get( 'onboarding.environment' );
$settings = $container->get( 'wcgateway.settings' );
- return new State( $environment, $settings );
+ return new State( $settings );
},
'onboarding.environment' => function( ContainerInterface $container ) : Environment {
$settings = $container->get( 'wcgateway.settings' );
@@ -132,6 +132,7 @@ return array(
return new OnboardingAssets(
$container->get( 'onboarding.url' ),
$state,
+ $container->get( 'onboarding.environment' ),
$login_seller_endpoint
);
},
@@ -188,7 +189,6 @@ return array(
return new PartnerReferrals(
CONNECT_WOO_SANDBOX_URL,
new ConnectBearer(),
- $container->get( 'api.repository.partner-referrals-data' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
@@ -197,7 +197,6 @@ return array(
return new PartnerReferrals(
CONNECT_WOO_URL,
new ConnectBearer(),
- $container->get( 'api.repository.partner-referrals-data' ),
$container->get( 'woocommerce.logger.woocommerce' )
);
},
@@ -205,13 +204,18 @@ return array(
$partner_referrals = $container->get( 'api.endpoint.partner-referrals-production' );
$partner_referrals_sandbox = $container->get( 'api.endpoint.partner-referrals-sandbox' );
+ $partner_referrals_data = $container->get( 'api.repository.partner-referrals-data' );
$settings = $container->get( 'wcgateway.settings' );
return new OnboardingRenderer(
$settings,
$partner_referrals,
- $partner_referrals_sandbox
+ $partner_referrals_sandbox,
+ $partner_referrals_data
);
},
+ 'onboarding.render-options' => static function ( ContainerInterface $container ) : OnboardingOptionsRenderer {
+ return new OnboardingOptionsRenderer();
+ },
'onboarding.rest' => static function( $container ) : OnboardingRESTController {
return new OnboardingRESTController( $container );
},
diff --git a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php
index 57a632860..b05bd3023 100644
--- a/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php
+++ b/modules/ppcp-onboarding/src/Assets/OnboardingAssets.php
@@ -10,6 +10,7 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Onboarding\Assets;
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
+use WooCommerce\PayPalCommerce\Onboarding\Environment;
use WooCommerce\PayPalCommerce\Onboarding\State;
/**
@@ -31,6 +32,13 @@ class OnboardingAssets {
*/
private $state;
+ /**
+ * The Environment.
+ *
+ * @var Environment
+ */
+ private $environment;
+
/**
* The LoginSeller Endpoint.
*
@@ -43,16 +51,19 @@ class OnboardingAssets {
*
* @param string $module_url The URL to the module.
* @param State $state The State object.
+ * @param Environment $environment The Environment.
* @param LoginSellerEndpoint $login_seller_endpoint The LoginSeller endpoint.
*/
public function __construct(
string $module_url,
State $state,
+ Environment $environment,
LoginSellerEndpoint $login_seller_endpoint
) {
$this->module_url = untrailingslashit( $module_url );
$this->state = $state;
+ $this->environment = $environment;
$this->login_seller_endpoint = $login_seller_endpoint;
}
@@ -103,9 +114,16 @@ class OnboardingAssets {
*/
public function get_script_data() {
return array(
- 'endpoint' => home_url( \WC_AJAX::get_endpoint( LoginSellerEndpoint::ENDPOINT ) ),
- 'nonce' => wp_create_nonce( $this->login_seller_endpoint::nonce() ),
- 'paypal_js_url' => 'https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js',
+ 'endpoint' => home_url( \WC_AJAX::get_endpoint( LoginSellerEndpoint::ENDPOINT ) ),
+ 'nonce' => wp_create_nonce( $this->login_seller_endpoint::nonce() ),
+ 'paypal_js_url' => 'https://www.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js',
+ 'sandbox_state' => State::get_state_name( $this->state->sandbox_state() ),
+ 'production_state' => State::get_state_name( $this->state->production_state() ),
+ 'current_state' => State::get_state_name( $this->state->current_state() ),
+ 'current_env' => $this->environment->current_environment(),
+ 'error_messages' => array(
+ 'no_credentials' => __( 'Enter the credentials.', 'woocommerce-paypal-payments' ),
+ ),
);
}
diff --git a/modules/ppcp-onboarding/src/OnboardingModule.php b/modules/ppcp-onboarding/src/OnboardingModule.php
index d05b9509f..0960c7b6c 100644
--- a/modules/ppcp-onboarding/src/OnboardingModule.php
+++ b/modules/ppcp-onboarding/src/OnboardingModule.php
@@ -65,16 +65,15 @@ class OnboardingModule implements ModuleInterface {
if ( 'ppcp_onboarding' !== $config['type'] ) {
return $field;
}
- $renderer = $c->get( 'onboarding.render' );
- $is_production = 'production' === $config['env'];
- /**
- * The OnboardingRenderer.
- *
- * @var OnboardingRenderer $renderer
- */
+ $renderer = $c->get( 'onboarding.render' );
+ assert( $renderer instanceof OnboardingRenderer );
+
+ $is_production = 'production' === $config['env'];
+ $products = $config['products'];
+
ob_start();
- $renderer->render( $is_production );
+ $renderer->render( $is_production, $products );
$content = ob_get_contents();
ob_end_clean();
return $content;
diff --git a/modules/ppcp-onboarding/src/OnboardingRESTController.php b/modules/ppcp-onboarding/src/OnboardingRESTController.php
index 9a5fae43a..209534564 100644
--- a/modules/ppcp-onboarding/src/OnboardingRESTController.php
+++ b/modules/ppcp-onboarding/src/OnboardingRESTController.php
@@ -10,7 +10,6 @@ declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\Onboarding;
use Psr\Container\ContainerInterface;
-use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
/**
@@ -138,13 +137,13 @@ class OnboardingRESTController {
return array(
'environment' => $environment->current_environment(),
'onboarded' => ( $state->current_state() >= State::STATE_ONBOARDED ),
- 'state' => $this->get_onboarding_state_name( $state->current_state() ),
+ 'state' => State::get_state_name( $state->current_state() ),
'sandbox' => array(
- 'state' => $this->get_onboarding_state_name( $state->sandbox_state() ),
+ 'state' => State::get_state_name( $state->sandbox_state() ),
'onboarded' => ( $state->sandbox_state() >= State::STATE_ONBOARDED ),
),
'production' => array(
- 'state' => $this->get_onboarding_state_name( $state->production_state() ),
+ 'state' => State::get_state_name( $state->production_state() ),
'onboarded' => ( $state->production_state() >= State::STATE_ONBOARDED ),
),
);
@@ -265,34 +264,6 @@ class OnboardingRESTController {
return add_query_arg( $this->return_url_args, $url );
}
- /**
- * Translates an onboarding state to a string.
- *
- * @param int $state An onboarding state to translate as returned by {@link State} methods.
- * @return string A string representing the state: "start", "progressive" or "onboarded".
- * @see State::current_state(), State::sandbox_state(), State::production_state().
- */
- public function get_onboarding_state_name( $state ) {
- $name = 'unknown';
-
- switch ( absint( $state ) ) {
- case State::STATE_START:
- $name = 'start';
- break;
- case State::STATE_PROGRESSIVE:
- $name = 'progressive';
- break;
- case State::STATE_ONBOARDED:
- $name = 'onboarded';
- break;
- default:
- break;
-
- }
-
- return $name;
- }
-
/**
* Generates a signup link for onboarding for a given environment and optionally adding certain URL arguments
* to the URL users are redirected after completing the onboarding flow.
diff --git a/modules/ppcp-onboarding/src/Render/OnboardingOptionsRenderer.php b/modules/ppcp-onboarding/src/Render/OnboardingOptionsRenderer.php
new file mode 100644
index 000000000..852a60ad9
--- /dev/null
+++ b/modules/ppcp-onboarding/src/Render/OnboardingOptionsRenderer.php
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+ ' . $this->render_dcc( $is_shop_supports_dcc ) . '
+';
+ }
+
+ /**
+ * Renders the onboarding DCC options.
+ *
+ * @param bool $is_shop_supports_dcc Whether the shop can use DCC (country, currency).
+ */
+ private function render_dcc( bool $is_shop_supports_dcc ): string {
+ $items = array();
+
+ if ( $is_shop_supports_dcc ) {
+ $items[] = '
+
+
+';
+ }
+
+ $items[] = '
+
+
+';
+
+ return '' .
+ implode( '', $items ) .
+ '
';
+ }
+}
diff --git a/modules/ppcp-onboarding/src/Render/OnboardingRenderer.php b/modules/ppcp-onboarding/src/Render/OnboardingRenderer.php
index cc2fa38f1..2b3021cc1 100644
--- a/modules/ppcp-onboarding/src/Render/OnboardingRenderer.php
+++ b/modules/ppcp-onboarding/src/Render/OnboardingRenderer.php
@@ -11,6 +11,7 @@ namespace WooCommerce\PayPalCommerce\Onboarding\Render;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
+use WooCommerce\PayPalCommerce\ApiClient\Repository\PartnerReferralsData;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
/**
@@ -39,31 +40,50 @@ class OnboardingRenderer {
*/
private $sandbox_partner_referrals;
+ /**
+ * The default partner referrals data.
+ *
+ * @var PartnerReferralsData
+ */
+ private $partner_referrals_data;
+
/**
* OnboardingRenderer constructor.
*
- * @param Settings $settings The settings.
- * @param PartnerReferrals $production_partner_referrals The PartnerReferrals for production.
- * @param PartnerReferrals $sandbox_partner_referrals The PartnerReferrals for sandbox.
+ * @param Settings $settings The settings.
+ * @param PartnerReferrals $production_partner_referrals The PartnerReferrals for production.
+ * @param PartnerReferrals $sandbox_partner_referrals The PartnerReferrals for sandbox.
+ * @param PartnerReferralsData $partner_referrals_data The default partner referrals data.
*/
- public function __construct( Settings $settings, PartnerReferrals $production_partner_referrals, PartnerReferrals $sandbox_partner_referrals ) {
+ public function __construct(
+ Settings $settings,
+ PartnerReferrals $production_partner_referrals,
+ PartnerReferrals $sandbox_partner_referrals,
+ PartnerReferralsData $partner_referrals_data
+ ) {
$this->settings = $settings;
$this->production_partner_referrals = $production_partner_referrals;
$this->sandbox_partner_referrals = $sandbox_partner_referrals;
+ $this->partner_referrals_data = $partner_referrals_data;
}
/**
* Returns the action URL for the onboarding button/link.
*
- * @param boolean $is_production Whether the production or sandbox button should be rendered.
+ * @param boolean $is_production Whether the production or sandbox button should be rendered.
+ * @param string[] $products The list of products ('PPCP', 'EXPRESS_CHECKOUT').
* @return string URL.
*/
- public function get_signup_link( bool $is_production ) {
+ public function get_signup_link( bool $is_production, array $products ) {
$args = array(
'displayMode' => 'minibrowser',
);
- $url = $is_production ? $this->production_partner_referrals->signup_link() : $this->sandbox_partner_referrals->signup_link();
+ $data = $this->partner_referrals_data
+ ->with_products( $products )
+ ->data();
+
+ $url = $is_production ? $this->production_partner_referrals->signup_link( $data ) : $this->sandbox_partner_referrals->signup_link( $data );
$url = add_query_arg( $args, $url );
return $url;
@@ -72,14 +92,18 @@ class OnboardingRenderer {
/**
* Renders the "Connect to PayPal" button.
*
- * @param bool $is_production Whether the production or sandbox button should be rendered.
+ * @param bool $is_production Whether the production or sandbox button should be rendered.
+ * @param string[] $products The list of products ('PPCP', 'EXPRESS_CHECKOUT').
*/
- public function render( bool $is_production ) {
+ public function render( bool $is_production, array $products ) {
try {
+ $id = 'connect-to' . ( $is_production ? 'production' : 'sandbox' ) . strtolower( implode( '-', $products ) );
+
$this->render_button(
- $this->get_signup_link( $is_production ),
- $is_production ? 'connect-to-production' : 'connect-to-sandbox',
- $is_production ? __( 'Connect to PayPal', 'woocommerce-paypal-payments' ) : __( 'Connect to PayPal Sandbox', 'woocommerce-paypal-payments' ),
+ $this->get_signup_link( $is_production, $products ),
+ $id,
+ $is_production ? __( 'Connect with PayPal', 'woocommerce-paypal-payments' ) : __( 'Test payments with PayPal sandbox', 'woocommerce-paypal-payments' ),
+ $is_production ? 'primary' : 'secondary',
$is_production ? 'production' : 'sandbox'
);
} catch ( RuntimeException $exception ) {
@@ -96,13 +120,14 @@ class OnboardingRenderer {
* @param string $url The url of the button.
* @param string $id The ID of the button.
* @param string $label The button text.
+ * @param string $class The CSS class for button ('primary', 'secondary').
* @param string $env The environment ('production' or 'sandbox').
*/
- private function render_button( string $url, string $id, string $label, string $env ) {
+ private function render_button( string $url, string $id, string $label, string $class, string $env ) {
?>
environment = $environment;
- $this->settings = $settings;
+ $this->settings = $settings;
+ }
+
+ /**
+ * Returns the state of the specified environment (or the active environment if null).
+ *
+ * @param string|null $environment 'sandbox', 'production'.
+ * @return int
+ */
+ public function environment_state( ?string $environment = null ): int {
+ switch ( $environment ) {
+ case Environment::PRODUCTION:
+ return $this->production_state();
+ case Environment::SANDBOX:
+ return $this->sandbox_state();
+ }
+ return $this->current_state();
}
/**
@@ -57,9 +62,6 @@ class State {
public function current_state(): int {
return $this->state_by_keys(
- array(
- 'merchant_email',
- ),
array(
'merchant_email',
'merchant_id',
@@ -77,9 +79,6 @@ class State {
public function sandbox_state() : int {
return $this->state_by_keys(
- array(
- 'merchant_email_sandbox',
- ),
array(
'merchant_email_sandbox',
'merchant_id_sandbox',
@@ -97,9 +96,6 @@ class State {
public function production_state() : int {
return $this->state_by_keys(
- array(
- 'merchant_email_production',
- ),
array(
'merchant_email_production',
'merchant_id_production',
@@ -110,36 +106,36 @@ class State {
}
/**
- * Returns the state based on progressive and onboarded values being looked up in the settings.
+ * Translates an onboarding state to a string.
+ *
+ * @param int $state An onboarding state to translate.
+ * @return string A string representing the state: "start" or "onboarded".
+ */
+ public static function get_state_name( int $state ) : string {
+ switch ( $state ) {
+ case self::STATE_START:
+ return 'start';
+ case self::STATE_ONBOARDED:
+ return 'onboarded';
+ default:
+ return 'unknown';
+ }
+ }
+
+ /**
+ * Returns the state based on onboarding settings values.
*
- * @param array $progressive_keys The keys which need to be present to be at least in progressive state.
* @param array $onboarded_keys The keys which need to be present to be in onboarded state.
*
* @return int
*/
- private function state_by_keys( array $progressive_keys, array $onboarded_keys ) : int {
- $state = self::STATE_START;
- $is_progressive = true;
- foreach ( $progressive_keys as $key ) {
- if ( ! $this->settings->has( $key ) || ! $this->settings->get( $key ) ) {
- $is_progressive = false;
- }
- }
- if ( $is_progressive ) {
- $state = self::STATE_PROGRESSIVE;
- }
-
- $is_onboarded = true;
+ private function state_by_keys( array $onboarded_keys ) : int {
foreach ( $onboarded_keys as $key ) {
if ( ! $this->settings->has( $key ) || ! $this->settings->get( $key ) ) {
- $is_onboarded = false;
+ return self::STATE_START;
}
}
- if ( $is_onboarded ) {
- $state = self::STATE_ONBOARDED;
- }
-
- return $state;
+ return self::STATE_ONBOARDED;
}
}
diff --git a/modules/ppcp-wc-gateway/assets/images/paylater-button.png b/modules/ppcp-wc-gateway/assets/images/paylater-button.png
new file mode 100644
index 000000000..f7aaa4c44
Binary files /dev/null and b/modules/ppcp-wc-gateway/assets/images/paylater-button.png differ
diff --git a/modules/ppcp-wc-gateway/assets/images/paypal-button.png b/modules/ppcp-wc-gateway/assets/images/paypal-button.png
new file mode 100644
index 000000000..277d5119e
Binary files /dev/null and b/modules/ppcp-wc-gateway/assets/images/paypal-button.png differ
diff --git a/modules/ppcp-wc-gateway/assets/images/paypal.png b/modules/ppcp-wc-gateway/assets/images/paypal.png
new file mode 100644
index 000000000..c96468364
Binary files /dev/null and b/modules/ppcp-wc-gateway/assets/images/paypal.png differ
diff --git a/modules/ppcp-wc-gateway/assets/images/venmo-button.png b/modules/ppcp-wc-gateway/assets/images/venmo-button.png
new file mode 100644
index 000000000..029e51a68
Binary files /dev/null and b/modules/ppcp-wc-gateway/assets/images/venmo-button.png differ
diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php
index 1442531a2..2eafb4ccb 100644
--- a/modules/ppcp-wc-gateway/services.php
+++ b/modules/ppcp-wc-gateway/services.php
@@ -17,6 +17,7 @@ use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache;
use WooCommerce\PayPalCommerce\ApiClient\Helper\DccApplies;
use WooCommerce\PayPalCommerce\Button\Helper\MessagesDisclaimers;
use WooCommerce\PayPalCommerce\Onboarding\Environment;
+use WooCommerce\PayPalCommerce\Onboarding\Render\OnboardingOptionsRenderer;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
use WooCommerce\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
@@ -254,78 +255,207 @@ return array(
'wcgateway.settings.fields' => static function ( ContainerInterface $container ): array {
$state = $container->get( 'onboarding.state' );
+ assert( $state instanceof State );
+
$messages_disclaimers = $container->get( 'button.helper.messages-disclaimers' );
+ $dcc_applies = $container->get( 'api.helpers.dccapplies' );
+ assert( $dcc_applies instanceof DccApplies );
+
+ $is_shop_supports_dcc = $dcc_applies->for_country_currency();
+
+ $onboarding_options_renderer = $container->get( 'onboarding.render-options' );
+ assert( $onboarding_options_renderer instanceof OnboardingOptionsRenderer );
+
+ $module_url = $container->get( 'wcgateway.url' );
+
$fields = array(
- 'sandbox_on' => array(
+ 'ppcp_onboarading_header' => array(
+ 'type' => 'ppcp-text',
+ 'classes' => array( 'ppcp-onboarding-element' ),
+ 'text' => '
+',
+ 'screens' => array(
+ State::STATE_START,
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ ),
+
+ 'credentials_production_heading' => array(
+ 'heading' => __( 'API Credentials', 'woocommerce-paypal-payments' ),
+ 'type' => 'ppcp-heading',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'state_from' => Environment::PRODUCTION,
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ ),
+ 'credentials_sandbox_heading' => array(
+ 'heading' => __( 'Sandbox API Credentials', 'woocommerce-paypal-payments' ),
+ 'type' => 'ppcp-heading',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'state_from' => Environment::SANDBOX,
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ 'description' => __( 'Your account is connected to sandbox, no real charging takes place. To accept live payments, disconnect and connect your live PayPal account.', 'woocommerce-paypal-payments' ),
+ ),
+
+ 'ppcp_onboarading_options' => array(
+ 'type' => 'ppcp-text',
+ 'classes' => array( 'ppcp-onboarding-element' ),
+ 'text' => $onboarding_options_renderer->render( $is_shop_supports_dcc ),
+ 'raw' => true,
+ 'screens' => array(
+ State::STATE_START,
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ ),
+
+ // We need to have a button for each option (ppcp, express)
+ // because currently the only documented way to use the PayPal onboarding JS library
+ // is to have the buttons before loading the script.
+ 'ppcp_onboarding_production_ppcp' => array(
+ 'type' => 'ppcp_onboarding',
+ 'classes' => array( 'ppcp-onboarding-element' ),
+ 'screens' => array(
+ State::STATE_START,
+ ),
+ 'state_from' => Environment::PRODUCTION,
+ 'env' => Environment::PRODUCTION,
+ 'products' => array( 'PPCP' ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ ),
+ 'ppcp_onboarding_production_express' => array(
+ 'type' => 'ppcp_onboarding',
+ 'classes' => array( 'ppcp-onboarding-element' ),
+ 'screens' => array(
+ State::STATE_START,
+ ),
+ 'state_from' => Environment::PRODUCTION,
+ 'env' => Environment::PRODUCTION,
+ 'products' => array( 'EXPRESS_CHECKOUT' ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ ),
+ 'ppcp_onboarding_sandbox_ppcp' => array(
+ 'type' => 'ppcp_onboarding',
+ 'classes' => array( 'ppcp-onboarding-element' ),
+ 'screens' => array(
+ State::STATE_START,
+ ),
+ 'state_from' => Environment::SANDBOX,
+ 'env' => Environment::SANDBOX,
+ 'products' => array( 'PPCP' ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ 'description' => __( 'Prior to accepting live payments, you can test payments on your WooCommerce platform in a safe PayPal sandbox environment.', 'woocommerce-paypal-payments' ),
+ ),
+ 'ppcp_onboarding_sandbox_express' => array(
+ 'type' => 'ppcp_onboarding',
+ 'classes' => array( 'ppcp-onboarding-element' ),
+ 'screens' => array(
+ State::STATE_START,
+ ),
+ 'state_from' => Environment::SANDBOX,
+ 'env' => Environment::SANDBOX,
+ 'products' => array( 'EXPRESS_CHECKOUT' ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ 'description' => __( 'Prior to accepting live payments, you can test payments on your WooCommerce platform in a safe PayPal sandbox environment.', 'woocommerce-paypal-payments' ),
+ ),
+
+ 'ppcp_disconnect_production' => array(
+ 'title' => __( 'Disconnect from PayPal', 'woocommerce-paypal-payments' ),
+ 'type' => 'ppcp-text',
+ 'text' => '',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'state_from' => Environment::PRODUCTION,
+ 'env' => Environment::PRODUCTION,
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ 'description' => __( 'Click to reset current credentials and use another account.', 'woocommerce-paypal-payments' ),
+ ),
+ 'ppcp_disconnect_sandbox' => array(
+ 'title' => __( 'Disconnect from PayPal Sandbox', 'woocommerce-paypal-payments' ),
+ 'type' => 'ppcp-text',
+ 'text' => '',
+ 'screens' => array(
+ State::STATE_ONBOARDED,
+ ),
+ 'state_from' => Environment::SANDBOX,
+ 'env' => Environment::SANDBOX,
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ 'description' => __( 'Click to reset current credentials and use another account.', 'woocommerce-paypal-payments' ),
+ ),
+ 'toggle_manual_input' => array(
+ 'type' => 'ppcp-text',
+ 'text' => '',
+ 'classes' => array( 'ppcp-onboarding-element' ),
+ 'screens' => array(
+ State::STATE_START,
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ ),
+ 'error_label' => array(
+ 'type' => 'ppcp-text',
+ 'text' => '',
+ 'classes' => array( 'hide', 'ppcp-always-shown-element' ),
+ 'screens' => array(
+ State::STATE_START,
+ State::STATE_ONBOARDED,
+ ),
+ 'requirements' => array(),
+ 'gateway' => 'paypal',
+ ),
+ 'sandbox_on' => array(
'title' => __( 'Sandbox', 'woocommerce-paypal-payments' ),
+ 'classes' => array( 'ppcp-onboarding-element', 'ppcp-always-shown-element' ),
'type' => 'checkbox',
'label' => __( 'To test your WooCommerce installation, you can use the sandbox mode.', 'woocommerce-paypal-payments' ),
'default' => 0,
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
-
- // Production credentials.
- 'credentials_production_heading' => array(
- 'heading' => __( 'API Credentials', 'woocommerce-paypal-payments' ),
- 'type' => 'ppcp-heading',
- 'screens' => array(
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'requirements' => array(),
- 'gateway' => 'paypal',
- ),
- 'ppcp_onboarding_production' => array(
- 'title' => __( 'Connect to PayPal', 'woocommerce-paypal-payments' ),
- 'type' => 'ppcp_onboarding',
- 'screens' => array(
- State::STATE_START,
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'env' => 'production',
- 'requirements' => array(),
- 'gateway' => 'paypal',
- 'description' => __( 'Setup or link an existing PayPal account.', 'woocommerce-paypal-payments' ),
- ),
- 'ppcp_disconnect_production' => array(
- 'title' => __( 'Disconnect from PayPal', 'woocommerce-paypal-payments' ),
- 'type' => 'ppcp-text',
- 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '' ),
- 'text' => '',
- 'screens' => array(
- State::STATE_START,
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'env' => 'production',
- 'requirements' => array(),
- 'gateway' => 'paypal',
- 'description' => __( 'Click to reset current credentials and use another account.', 'woocommerce-paypal-payments' ),
- ),
- 'production_toggle_manual_input' => array(
- 'type' => 'ppcp-text',
- 'title' => __( 'Manual mode', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '' ),
- 'text' => '',
- 'screens' => array(
- State::STATE_START,
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'requirements' => array(),
- 'gateway' => 'paypal',
- ),
- 'merchant_email_production' => array(
+ 'merchant_email_production' => array(
'title' => __( 'Live Email address', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'text',
'required' => true,
'desc_tip' => true,
@@ -333,115 +463,57 @@ return array(
'default' => '',
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'merchant_id_production' => array(
+ 'merchant_id_production' => array(
'title' => __( 'Live Merchant Id', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'ppcp-text-input',
'desc_tip' => true,
'description' => __( 'The merchant id of your account ', 'woocommerce-paypal-payments' ),
'default' => false,
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'client_id_production' => array(
+ 'client_id_production' => array(
'title' => __( 'Live Client Id', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'ppcp-text-input',
'desc_tip' => true,
'description' => __( 'The client id of your api ', 'woocommerce-paypal-payments' ),
'default' => false,
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'client_secret_production' => array(
+ 'client_secret_production' => array(
'title' => __( 'Live Secret Key', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->production_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'ppcp-password',
'desc_tip' => true,
'description' => __( 'The secret key of your api', 'woocommerce-paypal-payments' ),
'default' => false,
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- // Sandbox credentials.
- 'credentials_sandbox_heading' => array(
- 'heading' => __( 'Sandbox API Credentials', 'woocommerce-paypal-payments' ),
- 'type' => 'ppcp-heading',
- 'screens' => array(
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'requirements' => array(),
- 'gateway' => 'paypal',
- 'description' => __( 'Your account setting is set to sandbox, no real charging takes place. To accept live payments, switch your environment to live and connect your PayPal account.', 'woocommerce-paypal-payments' ),
- ),
-
- 'ppcp_onboarding_sandbox' => array(
- 'title' => __( 'Connect to PayPal', 'woocommerce-paypal-payments' ),
- 'type' => 'ppcp_onboarding',
- 'screens' => array(
- State::STATE_START,
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'env' => 'sandbox',
- 'requirements' => array(),
- 'gateway' => 'paypal',
- 'description' => __( 'Setup or link an existing PayPal Sandbox account.', 'woocommerce-paypal-payments' ),
- ),
- 'ppcp_disconnect_sandbox' => array(
- 'title' => __( 'Disconnect from PayPal Sandbox', 'woocommerce-paypal-payments' ),
- 'type' => 'ppcp-text',
- 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '' ),
- 'text' => '',
- 'screens' => array(
- State::STATE_START,
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'env' => 'production',
- 'requirements' => array(),
- 'gateway' => 'paypal',
- 'description' => __( 'Click to reset current credentials and use another account.', 'woocommerce-paypal-payments' ),
- ),
- 'sandbox_toggle_manual_input' => array(
- 'type' => 'ppcp-text',
- 'title' => __( 'Manual mode', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '' ),
- 'text' => '',
- 'screens' => array(
- State::STATE_START,
- State::STATE_PROGRESSIVE,
- State::STATE_ONBOARDED,
- ),
- 'requirements' => array(),
- 'gateway' => 'paypal',
- ),
- 'merchant_email_sandbox' => array(
+ 'merchant_email_sandbox' => array(
'title' => __( 'Sandbox Email address', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'text',
'required' => true,
'desc_tip' => true,
@@ -449,69 +521,65 @@ return array(
'default' => '',
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'merchant_id_sandbox' => array(
+ 'merchant_id_sandbox' => array(
'title' => __( 'Sandbox Merchant Id', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'ppcp-text-input',
'desc_tip' => true,
'description' => __( 'The merchant id of your account ', 'woocommerce-paypal-payments' ),
'default' => false,
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'client_id_sandbox' => array(
+ 'client_id_sandbox' => array(
'title' => __( 'Sandbox Client Id', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'ppcp-text-input',
'desc_tip' => true,
'description' => __( 'The client id of your api ', 'woocommerce-paypal-payments' ),
'default' => false,
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'client_secret_sandbox' => array(
+ 'client_secret_sandbox' => array(
'title' => __( 'Sandbox Secret Key', 'woocommerce-paypal-payments' ),
- 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '' ),
+ 'classes' => array( State::STATE_ONBOARDED === $state->sandbox_state() ? 'onboarded' : '', 'ppcp-always-shown-element' ),
'type' => 'ppcp-password',
'desc_tip' => true,
'description' => __( 'The secret key of your api', 'woocommerce-paypal-payments' ),
'default' => false,
'screens' => array(
State::STATE_START,
- State::STATE_PROGRESSIVE,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'checkout_settings_heading' => array(
+ 'checkout_settings_heading' => array(
'heading' => __( 'PayPal Checkout Settings', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'title' => array(
+ 'title' => array(
'title' => __( 'Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
'description' => __(
@@ -521,13 +589,13 @@ return array(
'default' => __( 'PayPal', 'woocommerce-paypal-payments' ),
'desc_tip' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'dcc_enabled' => array(
+ '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' ),
@@ -542,7 +610,7 @@ return array(
State::STATE_ONBOARDED,
),
),
- 'dcc_gateway_title' => array(
+ 'dcc_gateway_title' => array(
'title' => __( 'Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
'description' => __(
@@ -559,7 +627,7 @@ return array(
),
'gateway' => 'dcc',
),
- 'description' => array(
+ 'description' => array(
'title' => __( 'Description', 'woocommerce-paypal-payments' ),
'type' => 'text',
'desc_tip' => true,
@@ -572,13 +640,13 @@ return array(
'woocommerce-paypal-payments'
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'intent' => array(
+ 'intent' => array(
'title' => __( 'Intent', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -594,12 +662,13 @@ return array(
'authorize' => __( 'Authorize', 'woocommerce-paypal-payments' ),
),
'screens' => array(
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'capture_for_virtual_only' => array(
+ 'capture_for_virtual_only' => array(
'title' => __( 'Capture Virtual-Only Orders ', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'default' => false,
@@ -610,12 +679,13 @@ return array(
),
'label' => __( 'Capture Virtual-Only Orders', 'woocommerce-paypal-payments' ),
'screens' => array(
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'payee_preferred' => array(
+ 'payee_preferred' => array(
'title' => __( 'Instant Payments ', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'default' => false,
@@ -626,13 +696,13 @@ return array(
),
'label' => __( 'Require Instant Payment', 'woocommerce-paypal-payments' ),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'brand_name' => array(
+ 'brand_name' => array(
'title' => __( 'Brand Name', 'woocommerce-paypal-payments' ),
'type' => 'text',
'default' => get_bloginfo( 'name' ),
@@ -642,13 +712,13 @@ return array(
'woocommerce-paypal-payments'
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'landing_page' => array(
+ 'landing_page' => array(
'title' => __( 'Landing Page', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -664,27 +734,22 @@ return array(
ApplicationContext::LANDING_PAGE_BILLING => __( 'Billing (Non-PayPal account)', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'disable_funding' => array(
+ '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' ),
- '',
- ''
+ 'desc_tip' => true,
+ 'description' => __(
+ 'By default all possible funding sources will be shown. You can disable some sources, if you wish.',
+ 'woocommerce-paypal-payments'
),
'options' => array(
'card' => _x( 'Credit or debit cards', 'Name of payment method', 'woocommerce-paypal-payments' ),
@@ -702,13 +767,13 @@ return array(
'venmo' => _x( 'Venmo', 'Name of payment method', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'vault_enabled' => array(
+ 'vault_enabled' => array(
'title' => __( 'Vaulting', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'desc_tip' => true,
@@ -729,7 +794,7 @@ return array(
'requirements' => array(),
'gateway' => array( 'paypal', 'dcc' ),
),
- 'logging_enabled' => array(
+ 'logging_enabled' => array(
'title' => __( 'Logging', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'desc_tip' => true,
@@ -738,13 +803,13 @@ return array(
'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-payments' ),
'default' => false,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'prefix' => array(
+ 'prefix' => array(
'title' => __( 'Invoice prefix', 'woocommerce-paypal-payments' ),
'type' => 'text',
'desc_tip' => true,
@@ -760,7 +825,7 @@ return array(
return substr( $letters, 0, 6 ) . '-';
} )(),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
@@ -768,30 +833,30 @@ return array(
),
// General button styles.
- 'button_style_heading' => array(
+ 'button_style_heading' => array(
'heading' => __( 'Checkout', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of PayPal Checkout on the checkout page.', 'woocommerce-paypal-payments' ),
),
- 'button_enabled' => array(
+ 'button_enabled' => array(
'title' => __( 'Enable buttons on Checkout', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Checkout', 'woocommerce-paypal-payments' ),
'default' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_layout' => array(
+ 'button_layout' => array(
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -807,13 +872,13 @@ return array(
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_tagline' => array(
+ 'button_tagline' => array(
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'default' => true,
@@ -824,13 +889,13 @@ return array(
'woocommerce-paypal-payments'
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_label' => array(
+ 'button_label' => array(
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -848,13 +913,13 @@ return array(
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_color' => array(
+ 'button_color' => array(
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -872,13 +937,13 @@ return array(
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_shape' => array(
+ 'button_shape' => array(
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -894,17 +959,17 @@ return array(
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'message_heading' => array(
+ 'message_heading' => array(
'heading' => __( 'Pay Later on Checkout', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
@@ -912,19 +977,19 @@ return array(
'description' => str_replace( '', '', __( 'Displays Pay Later messaging for available offers. Restrictions apply. Click here to learn more. Pay Later button will show for eligible buyers and PayPal determines eligibility.', 'woocommerce-paypal-payments' ) ),
'class' => array( 'ppcp-subheading' ),
),
- 'message_enabled' => array(
+ 'message_enabled' => array(
'title' => __( 'Enable message on Checkout', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Checkout', 'woocommerce-paypal-payments' ),
'default' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_layout' => array(
+ 'message_layout' => array(
'title' => __( 'Pay Later Messaging layout', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -940,13 +1005,13 @@ return array(
'flex' => __( 'Flex', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_logo' => array(
+ 'message_logo' => array(
'title' => __( 'Pay Later Messaging logo', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -964,13 +1029,13 @@ return array(
'none' => __( 'None', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_position' => array(
+ 'message_position' => array(
'title' => __( 'Pay Later Messaging logo position', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -987,13 +1052,13 @@ return array(
'top' => __( 'Top', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_color' => array(
+ 'message_color' => array(
'title' => __( 'Pay Later Messaging text color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1011,13 +1076,13 @@ return array(
'grayscale' => __( 'Grayscale', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_flex_color' => array(
+ 'message_flex_color' => array(
'title' => __( 'Pay Later Messaging color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1038,13 +1103,13 @@ return array(
'grayscale' => __( 'Grayscale', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_flex_ratio' => array(
+ 'message_flex_ratio' => array(
'title' => __( 'Pay Later Messaging ratio', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1062,7 +1127,7 @@ return array(
'20x1' => __( '20x1', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
@@ -1070,30 +1135,30 @@ return array(
),
// Single product page.
- 'button_product_heading' => array(
+ 'button_product_heading' => array(
'heading' => __( 'Single Product Page', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of PayPal Checkout on the single product page.', 'woocommerce-paypal-payments' ),
),
- 'button_product_enabled' => array(
+ 'button_product_enabled' => array(
'title' => __( 'Enable buttons on Single Product', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Single Product', 'woocommerce-paypal-payments' ),
'default' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_product_layout' => array(
+ 'button_product_layout' => array(
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1109,13 +1174,13 @@ return array(
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_product_tagline' => array(
+ 'button_product_tagline' => array(
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
@@ -1126,13 +1191,13 @@ return array(
'woocommerce-paypal-payments'
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_product_label' => array(
+ 'button_product_label' => array(
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1150,13 +1215,13 @@ return array(
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_product_color' => array(
+ 'button_product_color' => array(
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1174,13 +1239,13 @@ return array(
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_product_shape' => array(
+ 'button_product_shape' => array(
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1196,18 +1261,18 @@ return array(
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'message_product_heading' => array(
+ 'message_product_heading' => array(
'heading' => __( 'Pay Later on Single Product Page', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
@@ -1215,19 +1280,19 @@ return array(
'description' => str_replace( '', '', __( 'Displays Pay Later messaging for available offers. Restrictions apply. Click here to learn more. Pay Later button will show for eligible buyers and PayPal determines eligibility.', 'woocommerce-paypal-payments' ) ),
'class' => array( 'ppcp-subheading' ),
),
- 'message_product_enabled' => array(
+ 'message_product_enabled' => array(
'title' => __( 'Enable message on Single Product', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Single Product', 'woocommerce-paypal-payments' ),
'default' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_product_layout' => array(
+ 'message_product_layout' => array(
'title' => __( 'Pay Later Messaging layout', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1243,13 +1308,13 @@ return array(
'flex' => __( 'Flex', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_product_logo' => array(
+ 'message_product_logo' => array(
'title' => __( 'Pay Later Messaging logo', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1267,13 +1332,13 @@ return array(
'none' => __( 'None', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_product_position' => array(
+ 'message_product_position' => array(
'title' => __( 'Pay Later Messaging logo position', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1290,13 +1355,13 @@ return array(
'top' => __( 'Top', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_product_color' => array(
+ 'message_product_color' => array(
'title' => __( 'Pay Later Messaging text color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1314,13 +1379,13 @@ return array(
'grayscale' => __( 'Grayscale', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_product_flex_color' => array(
+ 'message_product_flex_color' => array(
'title' => __( 'Pay Later Messaging color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1341,13 +1406,13 @@ return array(
'grayscale' => __( 'Grayscale', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_product_flex_ratio' => array(
+ 'message_product_flex_ratio' => array(
'title' => __( 'Pay Later Messaging ratio', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1365,7 +1430,7 @@ return array(
'20x1' => __( '20x1', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
@@ -1373,30 +1438,30 @@ return array(
),
// Cart settings.
- 'button_cart_heading' => array(
+ 'button_cart_heading' => array(
'heading' => __( 'Cart', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of PayPal Checkout on the cart page.', 'woocommerce-paypal-payments' ),
),
- 'button_cart_enabled' => array(
+ 'button_cart_enabled' => array(
'title' => __( 'Buttons on Cart', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Cart', 'woocommerce-paypal-payments' ),
'default' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_cart_layout' => array(
+ 'button_cart_layout' => array(
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1412,13 +1477,13 @@ return array(
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_cart_tagline' => array(
+ 'button_cart_tagline' => array(
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
@@ -1429,13 +1494,13 @@ return array(
'woocommerce-paypal-payments'
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_cart_label' => array(
+ 'button_cart_label' => array(
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1453,13 +1518,13 @@ return array(
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_cart_color' => array(
+ 'button_cart_color' => array(
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1477,13 +1542,13 @@ return array(
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_cart_shape' => array(
+ 'button_cart_shape' => array(
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1499,18 +1564,18 @@ return array(
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'message_cart_heading' => array(
+ 'message_cart_heading' => array(
'heading' => __( 'Pay Later on Cart', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
@@ -1518,19 +1583,19 @@ return array(
'description' => str_replace( '', '', __( 'Displays Pay Later messaging for available offers. Restrictions apply. Click here to learn more. Pay Later button will show for eligible buyers and PayPal determines eligibility.', 'woocommerce-paypal-payments' ) ),
'class' => array( 'ppcp-subheading' ),
),
- 'message_cart_enabled' => array(
+ 'message_cart_enabled' => array(
'title' => __( 'Enable message on Cart', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Cart', 'woocommerce-paypal-payments' ),
'default' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_cart_layout' => array(
+ 'message_cart_layout' => array(
'title' => __( 'Pay Later Messaging layout', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1546,13 +1611,13 @@ return array(
'flex' => __( 'Flex', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_cart_logo' => array(
+ 'message_cart_logo' => array(
'title' => __( 'Pay Later Messaging logo', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1570,13 +1635,13 @@ return array(
'none' => __( 'None', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_cart_position' => array(
+ 'message_cart_position' => array(
'title' => __( 'Pay Later Messaging logo position', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1593,13 +1658,13 @@ return array(
'top' => __( 'Top', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_cart_color' => array(
+ 'message_cart_color' => array(
'title' => __( 'Pay Later Messaging text color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1617,13 +1682,13 @@ return array(
'grayscale' => __( 'Grayscale', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_cart_flex_color' => array(
+ 'message_cart_flex_color' => array(
'title' => __( 'Pay Later Messaging color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1644,13 +1709,13 @@ return array(
'grayscale' => __( 'Grayscale', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
),
- 'message_cart_flex_ratio' => array(
+ 'message_cart_flex_ratio' => array(
'title' => __( 'Pay Later Messaging ratio', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1668,7 +1733,7 @@ return array(
'20x1' => __( '20x1', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array( 'messages' ),
@@ -1676,30 +1741,30 @@ return array(
),
// Mini cart settings.
- 'button_mini-cart_heading' => array(
+ 'button_mini-cart_heading' => array(
'heading' => __( 'Mini Cart', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of PayPal Checkout on the Mini Cart.', 'woocommerce-paypal-payments' ),
),
- 'button_mini-cart_enabled' => array(
+ 'button_mini-cart_enabled' => array(
'title' => __( 'Buttons on Mini Cart', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Mini Cart', 'woocommerce-paypal-payments' ),
'default' => true,
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_mini-cart_layout' => array(
+ 'button_mini-cart_layout' => array(
'title' => __( 'Button Layout', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1715,13 +1780,13 @@ return array(
'horizontal' => __( 'Horizontal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_mini-cart_tagline' => array(
+ 'button_mini-cart_tagline' => array(
'title' => __( 'Tagline', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable tagline', 'woocommerce-paypal-payments' ),
@@ -1732,13 +1797,13 @@ return array(
'woocommerce-paypal-payments'
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_mini-cart_label' => array(
+ 'button_mini-cart_label' => array(
'title' => __( 'Button Label', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1756,13 +1821,13 @@ return array(
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_mini-cart_color' => array(
+ 'button_mini-cart_color' => array(
'title' => __( 'Color', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1780,13 +1845,13 @@ return array(
'black' => __( 'Black', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_mini-cart_shape' => array(
+ 'button_mini-cart_shape' => array(
'title' => __( 'Shape', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
@@ -1802,27 +1867,27 @@ return array(
'rect' => __( 'Rectangle', 'woocommerce-paypal-payments' ),
),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'button_mini-cart_height' => array(
+ 'button_mini-cart_height' => array(
'title' => __( 'Button Height', 'woocommerce-paypal-payments' ),
'type' => 'number',
'default' => '35',
'desc_tip' => true,
'description' => __( 'Add a value from 25 to 55.', 'woocommerce-paypal-payments' ),
'screens' => array(
- State::STATE_PROGRESSIVE,
+ State::STATE_START,
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => 'paypal',
),
- 'disable_cards' => array(
+ 'disable_cards' => array(
'title' => __( 'Disable specific credit cards', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-multiselect',
'class' => array(),
@@ -1850,7 +1915,7 @@ return array(
),
'gateway' => 'dcc',
),
- 'card_icons' => array(
+ 'card_icons' => array(
'title' => __( 'Show logo of the following credit cards', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-multiselect',
'class' => array(),
@@ -1878,7 +1943,7 @@ return array(
),
'gateway' => 'dcc',
),
- '3d_secure_heading' => array(
+ '3d_secure_heading' => array(
'heading' => __( '3D Secure', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'description' => wp_kses_post(
@@ -1906,7 +1971,7 @@ return array(
),
'gateway' => 'dcc',
),
- '3d_secure_contingency' => array(
+ '3d_secure_contingency' => array(
'title' => __( 'Contingency for 3D Secure', 'woocommerce-paypal-payments' ),
'type' => 'select',
'description' => sprintf(
@@ -1919,12 +1984,12 @@ return array(
),
'class' => array(),
'input_class' => array( 'wc-enhanced-select' ),
- 'default' => $container->get( 'api.shop.is-psd2-country' ) ? 'SCA_WHEN_REQUIRED' : 'NO_3D_SECURE',
+ 'default' => $container->get( 'api.shop.is-psd2-country' ) ? '3D_SECURE' : 'NO_3D_SECURE',
'desc_tip' => true,
'options' => array(
'NO_3D_SECURE' => __( 'No 3D Secure (transaction will be denied if 3D Secure is required)', 'woocommerce-paypal-payments' ),
'SCA_WHEN_REQUIRED' => __( '3D Secure when required', 'woocommerce-paypal-payments' ),
- 'SCA_ALWAYS' => __( 'Always trigger 3D Secure', 'woocommerce-paypal-payments' ),
+ '3D_SECURE' => __( 'Always trigger 3D Secure', 'woocommerce-paypal-payments' ),
),
'screens' => array(
State::STATE_ONBOARDED,
@@ -1939,26 +2004,10 @@ return array(
unset( $fields['vault_enabled'] );
}
- if ( State::STATE_ONBOARDED === $state->production_state() ) {
- unset( $fields['ppcp_onboarding_production'] );
- } else {
- unset( $fields['ppcp_disconnect_production'] );
- }
- if ( State::STATE_ONBOARDED === $state->sandbox_state() ) {
- unset( $fields['ppcp_onboarding_sandbox'] );
- } else {
- unset( $fields['ppcp_disconnect_sandbox'] );
- }
-
/**
* Depending on your store location, some credit cards can't be used.
* Here, we filter them out.
- *
- * The DCC Applies object.
- *
- * @var DccApplies $dcc_applies
*/
- $dcc_applies = $container->get( 'api.helpers.dccapplies' );
$card_options = $fields['disable_cards']['options'];
foreach ( $card_options as $card => $label ) {
if ( $dcc_applies->can_process_card( $card ) ) {
diff --git a/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php b/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php
index 25b880d74..319f2c844 100644
--- a/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php
+++ b/modules/ppcp-wc-gateway/src/Notice/ConnectAdminNotice.php
@@ -71,6 +71,6 @@ class ConnectAdminNotice {
* @return bool
*/
protected function should_display(): bool {
- return $this->state->current_state() < State::STATE_PROGRESSIVE;
+ return $this->state->current_state() !== State::STATE_ONBOARDED;
}
}
diff --git a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php
index 39c6c8390..3deef7f48 100644
--- a/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php
+++ b/modules/ppcp-wc-gateway/src/Settings/SettingsRenderer.php
@@ -377,8 +377,18 @@ $data_rows_html
?>
+
+ |
+ |
+
+ fields as $field => $config ) :
- if ( ! in_array( $this->state->current_state(), $config['screens'], true ) ) {
+ if ( ! in_array( $this->state->environment_state( $config['state_from'] ?? null ), $config['screens'], true ) ) {
continue;
}
if ( ! $this->field_matches_page( $config, $this->page_id ) ) {
@@ -406,14 +416,18 @@ $data_rows_html
$key = 'ppcp[' . $field . ']';
$id = 'ppcp-' . $field;
$config['id'] = $id;
- $colspan = 'ppcp-heading' !== $config['type'] ? 1 : 2;
+ $colspan = ( 'ppcp-heading' !== $config['type'] && isset( $config['title'] ) ) ? 1 : 2;
$classes = isset( $config['classes'] ) ? $config['classes'] : array();
+ $classes[] = 'ppcp-settings-field';
$classes[] = sprintf( 'ppcp-settings-field-%s', str_replace( 'ppcp-', '', $config['type'] ) );
- $description = isset( $config['description'] ) ? $config['description'] : '';
+ if ( 1 !== $colspan ) {
+ $classes[] = 'ppcp-settings-no-title-col';
+ }
+ $description = isset( $config['description'] ) ? $config['description'] : '';
unset( $config['description'] );
?>
-
+
|