From 473cc3108dbf9508fbdfb2d17f786452d701bc21 Mon Sep 17 00:00:00 2001 From: David Remer Date: Tue, 18 Aug 2020 09:23:41 +0300 Subject: [PATCH] seperate title and description of the two gateways --- modules.local/ppcp-wc-gateway/services.php | 35 +++++++++++++++++++ .../src/Gateway/CreditCardGateway.php | 12 ++++--- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/modules.local/ppcp-wc-gateway/services.php b/modules.local/ppcp-wc-gateway/services.php index 85d4ceab9..043615044 100644 --- a/modules.local/ppcp-wc-gateway/services.php +++ b/modules.local/ppcp-wc-gateway/services.php @@ -258,6 +258,22 @@ return [ 'requirements' => [], 'gateway' => 'paypal', ], + 'dcc_gateway_title' => [ + 'title' => __('Title', 'woocommerce-paypal-commerce-gateway'), + 'type' => 'text', + 'description' => __( + 'This controls the title which the user sees during checkout.', + 'woocommerce-paypal-commerce-gateway' + ), + 'default' => __('PayPal', 'woocommerce-paypal-commerce-gateway'), + 'desc_tip' => true, + 'screens' => [ + State::STATE_PROGRESSIVE, + State::STATE_ONBOARDED, + ], + 'requirements' => [], + 'gateway' => 'dcc', + ], 'description' => [ 'title' => __('Description', 'woocommerce-paypal-commerce-gateway'), 'type' => 'text', @@ -277,6 +293,25 @@ return [ 'requirements' => [], 'gateway' => 'paypal', ], + 'dcc_gateway_description' => [ + 'title' => __('Description', 'woocommerce-paypal-commerce-gateway'), + 'type' => 'text', + 'desc_tip' => true, + 'description' => __( + 'This controls the description which the user sees during checkout.', + 'woocommerce-paypal-commerce-gateway' + ), + 'default' => __( + 'Pay via PayPal; you can pay with your credit card if you don\'t have a PayPal account.', + 'woocommerce-paypal-commerce-gateway' + ), + 'screens' => [ + State::STATE_PROGRESSIVE, + State::STATE_ONBOARDED, + ], + 'requirements' => [], + 'gateway' => 'dcc', + ], 'intent' => [ 'title' => __('Intent', 'woocommerce-paypal-commerce-gateway'), 'type' => 'select', diff --git a/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php b/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php index 85d69d349..9d13cceff 100644 --- a/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php +++ b/modules.local/ppcp-wc-gateway/src/Gateway/CreditCardGateway.php @@ -45,15 +45,15 @@ class CreditCardGateway extends PayPalGateway ]; } - $this->method_title = __('Credit Card Payments', 'woocommerce-paypal-commerce-gateway'); + $this->method_title = __('PayPal Credit Card', 'woocommerce-paypal-commerce-gateway'); $this->method_description = __( 'Provide your customers with the option to pay with credit card.', 'woocommerce-paypal-commerce-gateway' ); - $this->title = $this->config->has('title') ? - $this->config->get('title') : $this->method_title; - $this->description = $this->config->has('description') ? - $this->config->get('description') : $this->method_description; + $this->title = $this->config->has('dcc_gateway_title') ? + $this->config->get('dcc_gateway_title') : $this->method_title; + $this->description = $this->config->has('dcc_gateway_description') ? + $this->config->get('dcc_gateway_description') : $this->method_description; $this->init_form_fields(); $this->init_settings(); @@ -66,6 +66,8 @@ class CreditCardGateway extends PayPalGateway ] ); } + + public function generate_ppcp_html(): string {