Merge branch 'trunk' into pcp-917-preview

# Conflicts:
#	modules/ppcp-wc-gateway/resources/js/gateway-settings.js
#	modules/ppcp-wc-gateway/services.php
#	modules/ppcp-wc-gateway/src/Assets/SettingsPageAssets.php
#	modules/ppcp-wc-gateway/src/WCGatewayModule.php
#	tests/PHPUnit/WcGateway/Assets/SettingsPagesAssetsTest.php
This commit is contained in:
Narek Zakarian 2022-11-02 18:01:37 +04:00
commit 469c3ce9c3
9 changed files with 136 additions and 39 deletions

View file

@ -347,14 +347,19 @@ return function ( ContainerInterface $container, array $fields ): array {
),
'credentials_feature_onboarding_heading' => array(
'heading' => __( 'Feature Onboarding', 'woocommerce-paypal-payments' ),
'heading' => __( 'Advanced feature availability & sign-up', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => Settings::CONNECTION_TAB_ID,
'description' => __( 'See which features are available.', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__( 'Displays whether available advanced features are enabled for the connected PayPal account. More information about advanced features is available in the %1$sFeature sign-up documentation%2$s.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#feature-signup" target="_blank">',
'</a>'
),
),
'ppcp_dcc_status' => array(
'title' => __( 'Advanced Credit and Debit Card Payments', 'woocommerce-paypal-payments' ),
@ -367,7 +372,7 @@ return function ( ContainerInterface $container, array $fields ): array {
'gateway' => Settings::CONNECTION_TAB_ID,
),
'ppcp_pui_status' => array(
'title' => __( 'Pay Upon Invoice', 'woocommerce-paypal-payments' ),
'title' => __( 'Pay upon Invoice', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-text',
'text' => $container->get( 'wcgateway.settings.connection.pui-status-text' ),
'screens' => array(
@ -377,7 +382,7 @@ return function ( ContainerInterface $container, array $fields ): array {
'gateway' => Settings::CONNECTION_TAB_ID,
),
'tracking_enabled' => array(
'title' => __( 'Tracking', 'woocommerce-paypal-payments' ),
'title' => __( 'Shipment Tracking', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'desc_tip' => true,
'label' => $container->get( 'wcgateway.settings.tracking-label' ),
@ -392,14 +397,19 @@ return function ( ContainerInterface $container, array $fields ): array {
),
'credentials_integration_configuration_heading' => array(
'heading' => __( 'Integration configuration', 'woocommerce-paypal-payments' ),
'heading' => __( 'General integration configuration', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_ONBOARDED,
),
'requirements' => array(),
'gateway' => Settings::CONNECTION_TAB_ID,
'description' => __( 'See which features are available.', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__( 'Configure integration specific settings such as a unique invoice prefix, or logging for potential %1$stroubleshooting%2$s.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#troubleshooting" target="_blank">',
'</a>'
),
),
'prefix' => array(
'title' => __( 'Invoice prefix', 'woocommerce-paypal-payments' ),

View file

@ -141,10 +141,6 @@ import Renderer from '../../../ppcp-button/resources/js/modules/Renderer/Rendere
vaultingCheckboxes.forEach(node => node.addEventListener('change', togglePayLater));
if(PayPalCommerceGatewaySettings.is_subscriptions_plugin_active !== '1') {
document.getElementById('field-subscription_behavior_when_vault_fails').style.display = 'none';
}
let oldScriptSettings = getPaypalScriptSettings();
form.on('change', ':input', debounce(() => {

View file

@ -22,6 +22,7 @@ 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\Subscription\Helper\SubscriptionHelper;
use WooCommerce\PayPalCommerce\WcGateway\Admin\FeesRenderer;
use WooCommerce\PayPalCommerce\WcGateway\Admin\OrderTablePaymentStatusColumn;
use WooCommerce\PayPalCommerce\WcGateway\Admin\PaymentStatusOrderDetail;
@ -409,6 +410,9 @@ return array(
</div>';
};
$subscription_helper = $container->get( 'subscription.helper' );
assert( $subscription_helper instanceof SubscriptionHelper );
$fields = array(
'checkout_settings_heading' => array(
'heading' => __( 'Standard Payments Settings', 'woocommerce-paypal-payments' ),
@ -622,7 +626,7 @@ return array(
'subscription_behavior_when_vault_fails' => array(
'title' => __( 'Subscription capture behavior if Vault fails', 'woocommerce-paypal-payments' ),
'type' => 'select',
'class' => array(),
'classes' => $subscription_helper->plugin_is_active() ? array() : array( 'hide' ),
'input_class' => array( 'wc-enhanced-select' ),
'default' => 'void_auth',
'desc_tip' => true,
@ -676,7 +680,7 @@ return array(
// General button styles.
'button_style_heading' => array(
'heading' => __( 'Checkout', 'woocommerce-paypal-payments' ),
'heading' => __( 'Checkout Buttons', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_START,
@ -684,7 +688,12 @@ return array(
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of Standard Payments on the checkout page.', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__( 'Customize the appearance of the PayPal smart buttons on the %1$sCheckout page%2$s.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-checkout" target="_blank">',
'</a>'
),
),
'button_enabled' => array(
'title' => __( 'Enable buttons on Checkout', 'woocommerce-paypal-payments' ),
@ -753,7 +762,7 @@ return array(
),
'options' => array(
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Standard Payments', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
@ -820,7 +829,7 @@ return array(
'gateway' => 'paypal',
),
'message_heading' => array(
'heading' => __( 'Pay Later on Checkout', 'woocommerce-paypal-payments' ),
'heading' => __( 'Pay Later messaging on Checkout', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_START,
@ -828,7 +837,14 @@ return array(
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
'description' => str_replace( '<a>', '<a href="' . $messages_disclaimers->link_for_country() . '" target="_blank">', __( 'Displays Pay Later messaging for available offers. Restrictions apply. <a>Click here to learn more</a>. Pay Later button will show for eligible buyers and PayPal determines eligibility.', 'woocommerce-paypal-payments' ) ),
'description' => sprintf(
// translators: %1$s, %2$s, %3$s and %4$s are the opening and closing of HTML <a> tag.
__( 'Displays Pay Later messaging on the Checkout page for available offers. Restrictions apply. %1$sClick here to learn more%2$s. This setting does not %3$sdisable the Pay Later button%4$s which will show for eligible buyers.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#pay-later-messaging" target="_blank">',
'</a>',
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#disable-pay-later" target="_blank">',
'</a>'
),
'class' => array( 'ppcp-subheading' ),
),
'message_enabled' => array(
@ -990,7 +1006,7 @@ return array(
// Single product page.
'button_product_heading' => array(
'heading' => __( 'Single Product Page', 'woocommerce-paypal-payments' ),
'heading' => __( 'Single Product Page Buttons', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_START,
@ -998,7 +1014,12 @@ return array(
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of Standard Payments on the single product page.', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__( 'Customize the appearance of the PayPal smart buttons on the %1$sSingle Product Page%2$s.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-single-product" target="_blank">',
'</a>'
),
),
'button_product_enabled' => array(
'title' => __( 'Enable buttons on Single Product', 'woocommerce-paypal-payments' ),
@ -1067,7 +1088,7 @@ return array(
),
'options' => array(
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Standard Payments', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
@ -1135,7 +1156,7 @@ return array(
),
'message_product_heading' => array(
'heading' => __( 'Pay Later on Single Product Page', 'woocommerce-paypal-payments' ),
'heading' => __( 'Pay Later messaging on Single Product Page', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_START,
@ -1143,7 +1164,14 @@ return array(
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
'description' => str_replace( '<a>', '<a href="' . $messages_disclaimers->link_for_country() . '" target="_blank">', __( 'Displays Pay Later messaging for available offers. Restrictions apply. <a>Click here to learn more</a>. Pay Later button will show for eligible buyers and PayPal determines eligibility.', 'woocommerce-paypal-payments' ) ),
'description' => sprintf(
// translators: %1$s, %2$s, %3$s and %4$s are the opening and closing of HTML <a> tag.
__( 'Displays Pay Later messaging on the Single Product Page for available offers. Restrictions apply. %1$sClick here to learn more%2$s. This setting does not %3$sdisable the Pay Later button%4$s which will show for eligible buyers.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#pay-later-messaging" target="_blank">',
'</a>',
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#disable-pay-later" target="_blank">',
'</a>'
),
'class' => array( 'ppcp-subheading' ),
),
'message_product_enabled' => array(
@ -1305,7 +1333,7 @@ return array(
// Cart settings.
'button_cart_heading' => array(
'heading' => __( 'Cart', 'woocommerce-paypal-payments' ),
'heading' => __( 'Cart Buttons', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_START,
@ -1313,10 +1341,15 @@ return array(
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of Standard Payments on the cart page.', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__( 'Customize the appearance of the PayPal smart buttons %1$son the Cart page%2$s.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-cart" target="_blank">',
'</a>'
),
),
'button_cart_enabled' => array(
'title' => __( 'Buttons on Cart', 'woocommerce-paypal-payments' ),
'title' => __( 'Enable buttons on Cart', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Cart', 'woocommerce-paypal-payments' ),
'default' => true,
@ -1382,7 +1415,7 @@ return array(
),
'options' => array(
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Standard Payments', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
@ -1450,7 +1483,7 @@ return array(
),
'message_cart_heading' => array(
'heading' => __( 'Pay Later on Cart', 'woocommerce-paypal-payments' ),
'heading' => __( 'Pay Later messaging on Cart', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_START,
@ -1458,7 +1491,14 @@ return array(
),
'requirements' => array( 'messages' ),
'gateway' => 'paypal',
'description' => str_replace( '<a>', '<a href="' . $messages_disclaimers->link_for_country() . '" target="_blank">', __( 'Displays Pay Later messaging for available offers. Restrictions apply. <a>Click here to learn more</a>. Pay Later button will show for eligible buyers and PayPal determines eligibility.', 'woocommerce-paypal-payments' ) ),
'description' => sprintf(
// translators: %1$s, %2$s, %3$s and %4$s are the opening and closing of HTML <a> tag.
__( 'Displays Pay Later messaging on the Cart page for available offers. Restrictions apply. %1$sClick here to learn more%2$s. This setting does not %3$sdisable the Pay Later button%4$s which will show for eligible buyers.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#pay-later-messaging" target="_blank">',
'</a>',
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#disable-pay-later" target="_blank">',
'</a>'
),
'class' => array( 'ppcp-subheading' ),
),
'message_cart_enabled' => array(
@ -1620,7 +1660,7 @@ return array(
// Mini cart settings.
'button_mini-cart_heading' => array(
'heading' => __( 'Mini Cart', 'woocommerce-paypal-payments' ),
'heading' => __( 'Mini Cart Buttons', 'woocommerce-paypal-payments' ),
'type' => 'ppcp-heading',
'screens' => array(
State::STATE_START,
@ -1628,10 +1668,15 @@ return array(
),
'requirements' => array(),
'gateway' => 'paypal',
'description' => __( 'Customize the appearance of Standard Payments on the Mini Cart.', 'woocommerce-paypal-payments' ),
'description' => sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__( 'Customize the appearance of the PayPal smart buttons %1$son the Mini Cart page%2$s.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#button-on-mini-cart" target="_blank">',
'</a>'
),
),
'button_mini-cart_enabled' => array(
'title' => __( 'Buttons on Mini Cart', 'woocommerce-paypal-payments' ),
'title' => __( 'Enable buttons on Mini Cart', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Enable on Mini Cart', 'woocommerce-paypal-payments' ),
'default' => true,
@ -1697,7 +1742,7 @@ return array(
),
'options' => array(
'paypal' => __( 'PayPal', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Standard Payments', 'woocommerce-paypal-payments' ),
'checkout' => __( 'Checkout', 'woocommerce-paypal-payments' ),
'buynow' => __( 'PayPal Buy Now', 'woocommerce-paypal-payments' ),
'pay' => __( 'Pay with PayPal', 'woocommerce-paypal-payments' ),
),
@ -2238,7 +2283,12 @@ return array(
return false;
},
'wcgateway.settings.tracking-label' => static function ( ContainerInterface $container ): string {
$tracking_label = __( 'Enable tracking information feature on your store.', 'woocommerce-paypal-payments' );
$tracking_label = sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__( 'Enable shipment tracking information to be sent to PayPal for seller protection features. Required when %1$sPay upon Invoice%2$s is used.', 'woocommerce-paypal-payments' ),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#pay-upon-invoice-PUI" target="_blank">',
'</a>'
);
$is_tracking_available = $container->get( 'order-tracking.is-tracking-available' );
if ( $is_tracking_available ) {
@ -2327,7 +2377,7 @@ return array(
$pui_button_text = $pui_enabled
? esc_html__( 'Settings', 'woocommerce-paypal-payments' )
: esc_html__( 'Enable Pay Upon Invoice', 'woocommerce-paypal-payments' );
: esc_html__( 'Enable Pay upon Invoice', 'woocommerce-paypal-payments' );
return sprintf(
'<p>%1$s %2$s</p><p><a target="%3$s" href="%4$s" class="button">%5$s</a></p>',