From ea857c73d6ba491da2c01c5e558b8354cfda42fe Mon Sep 17 00:00:00 2001 From: Joshua T Flowers Date: Tue, 2 Nov 2021 09:03:04 -0400 Subject: [PATCH] Add WC Pay in person text (https://github.com/woocommerce/woocommerce-admin/pull/7830) * Update WCPay in person text * Remove div wrapping finish setup button * Add changelog entry * Add US specific WooCommerce Payment suggestion * Allow different gateway suggestion IDs for wcpay * Add older fallback version of WCPay * Change check to dev version of 2.9.0 * Use 5.10.0-dev for WC checks --- .../woocommerce-admin/changelogs/update-7719 | 4 + .../components/Action.js | 22 +++-- .../fills/PaymentGatewaySuggestions/index.js | 3 +- .../DefaultPaymentGateways.php | 82 ++++++++++++++++++- 4 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 plugins/woocommerce-admin/changelogs/update-7719 diff --git a/plugins/woocommerce-admin/changelogs/update-7719 b/plugins/woocommerce-admin/changelogs/update-7719 new file mode 100644 index 00000000000..1eb23ad6d94 --- /dev/null +++ b/plugins/woocommerce-admin/changelogs/update-7719 @@ -0,0 +1,4 @@ +Significance: patch +Type: Update + +Update WC Pay card to include in-person information #7830 diff --git a/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/components/Action.js b/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/components/Action.js index a808542a679..9b94d63b1d8 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/components/Action.js +++ b/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/components/Action.js @@ -107,18 +107,16 @@ export const Action = ( { if ( isInstalled && hasPlugins ) { return ( -
- -
+ ); } diff --git a/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/index.js b/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/index.js index 85135ec27cf..012cf8d3c8b 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/index.js +++ b/plugins/woocommerce-admin/client/tasks/fills/PaymentGatewaySuggestions/index.js @@ -169,7 +169,8 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => { // WCPay is handled separately when not installed and configured if ( - gateway.id === 'woocommerce_payments' && + gateway.plugins?.length === 1 && + gateway.plugins[ 0 ] === 'woocommerce-payments' && ! ( gateway.installed && ! gateway.needsSetup ) ) { wcPay.push( gateway ); diff --git a/plugins/woocommerce-admin/src/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php b/plugins/woocommerce-admin/src/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php index 4d1949f3e48..a7c3984f6ba 100644 --- a/plugins/woocommerce-admin/src/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php +++ b/plugins/woocommerce-admin/src/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php @@ -217,10 +217,90 @@ class DefaultPaymentGateways { ), 'image' => plugins_url( 'images/onboarding/wcpay.svg', WC_ADMIN_PLUGIN_FILE ), 'plugins' => array( 'woocommerce-payments' ), - 'description' => 'Try the new way to get paid. Securely accept credit and debit cards on your site. Manage transactions without leaving your WordPress dashboard. Only with WooCommerce Payments.', + 'description' => 'With WooCommerce Payments, you can securely accept major cards, Apple Pay, and payments in over 100 currencies. Track cash flow and manage recurring revenue directly from your store’s dashboard - with no setup costs or monthly fees.', 'is_visible' => array( self::get_rules_for_cbd( false ), self::get_rules_for_countries( self::get_wcpay_countries() ), + (object) array( + 'type' => 'plugin_version', + 'plugin' => 'woocommerce-admin', + 'version' => '2.9.0-dev', + 'operator' => '<', + ), + (object) array( + 'type' => 'plugin_version', + 'plugin' => 'woocommerce', + 'version' => '5.10.0-dev', + 'operator' => '<', + ), + ), + 'recommendation_priority' => 1, + ), + array( + 'id' => 'woocommerce_payments:non-us', + 'title' => __( 'WooCommerce Payments', 'woocommerce-admin' ), + 'content' => __( + 'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.', + 'woocommerce-admin' + ), + 'image' => plugins_url( 'images/onboarding/wcpay.svg', WC_ADMIN_PLUGIN_FILE ), + 'plugins' => array( 'woocommerce-payments' ), + 'description' => 'With WooCommerce Payments, you can securely accept major cards, Apple Pay, and payments in over 100 currencies. Track cash flow and manage recurring revenue directly from your store’s dashboard - with no setup costs or monthly fees.', + 'is_visible' => array( + self::get_rules_for_cbd( false ), + self::get_rules_for_countries( array_diff( self::get_wcpay_countries(), array( 'US' ) ) ), + (object) array( + 'type' => 'or', + // Older versions of WooCommerce Admin require the ID to be `woocommerce-payments` to show the suggestion card. + 'operands' => (object) array( + (object) array( + 'type' => 'plugin_version', + 'plugin' => 'woocommerce-admin', + 'version' => '2.9.0-dev', + 'operator' => '>=', + ), + (object) array( + 'type' => 'plugin_version', + 'plugin' => 'woocommerce', + 'version' => '5.10.0-dev', + 'operator' => '>=', + ), + ), + ), + ), + 'recommendation_priority' => 1, + ), + array( + 'id' => 'woocommerce_payments:us', + 'title' => __( 'WooCommerce Payments', 'woocommerce-admin' ), + 'content' => __( + 'Manage transactions without leaving your WordPress Dashboard. Only with WooCommerce Payments.', + 'woocommerce-admin' + ), + 'image' => plugins_url( 'images/onboarding/wcpay.svg', WC_ADMIN_PLUGIN_FILE ), + 'plugins' => array( 'woocommerce-payments' ), + 'description' => 'With WooCommerce Payments, you can securely accept major cards, Apple Pay, and payments in over 100 currencies – with no setup costs or monthly fees – and you can now accept in-person payments with the Woo mobile app.', + 'is_visible' => array( + self::get_rules_for_cbd( false ), + self::get_rules_for_countries( array( 'US' ) ), + (object) array( + 'type' => 'or', + // Older versions of WooCommerce Admin require the ID to be `woocommerce-payments` to show the suggestion card. + 'operands' => (object) array( + (object) array( + 'type' => 'plugin_version', + 'plugin' => 'woocommerce-admin', + 'version' => '2.9.0-dev', + 'operator' => '>=', + ), + (object) array( + 'type' => 'plugin_version', + 'plugin' => 'woocommerce', + 'version' => '5.10.0-dev', + 'operator' => '>=', + ), + ), + ), ), 'recommendation_priority' => 1, ),