Skip to content

Commit 6c59c83

Browse files
authored
Merge pull request #227 from saucal/feature/woo-feeback
Feature/woo feeback
2 parents 3ec17a4 + b7f142e commit 6c59c83

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

includes/admin/class-wc-amazon-payments-advanced-admin.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ protected function get_admin_notices() {
180180
);
181181
}
182182

183-
if ( ! WC_Amazon_Payments_Advanced_API::get_amazon_keys_set() && 'yes' === $this->settings['enabled'] ) {
183+
if ( ! WC_Amazon_Payments_Advanced_API::get_amazon_keys_set() && 'yes' === $this->settings['enabled'] && $current_section !== 'amazon_payments_advanced' ) {
184184
$notices[] = array(
185185
'dismiss_action' => 'amazon_pay_dismiss_enable_notice',
186186
'class' => 'amazon-pay-enable-notice',
187187
'text' => sprintf(
188188
// translators: 1) The URL to the Amazon Pay settings screen.
189-
__( 'Amazon Pay is now enabled for WooCommerce and ready to accept live payments. Please check the <a href="%1$s">configuration</a>. to make sure everything is set correctly.', 'woocommerce-gateway-amazon-payments-advanced' ),
189+
__( 'Amazon Pay is now enabled for WooCommerce. Please check the <a href="%1$s">configuration</a>. to make sure everything is set correctly to accept live payments.', 'woocommerce-gateway-amazon-payments-advanced' ),
190190
esc_url( $this->get_settings_url() )
191191
),
192192
'is_dismissable' => true,
@@ -332,15 +332,20 @@ public function admin_notices() {
332332
public function review_prompt() {
333333
global $current_section;
334334

335-
$anniversary_date = get_option( 'amazon_payments_advanced_anniversary_date' );
335+
// Bail early and always if we don't have the keys set.
336+
if ( ! WC_Amazon_Payments_Advanced_API::get_amazon_keys_set() ) {
337+
return;
338+
}
339+
340+
$anniversary_date = get_option( 'amazon_payments_advanced_enabled_anniversary_date' );
336341
$hidden_until_date = get_option( 'amazon_payments_advanced_hidden_until_date' );
337342

338343
// Set up the dates.
339344
// We do this here, so its on admin side but not dependant on user visiting the plugin's settings.
340345
if ( ! $anniversary_date || ! $hidden_until_date ) {
341346
$anniversary_date = time();
342347
$hidden_until_date = strtotime( '+1 month' );
343-
update_option( 'amazon_payments_advanced_anniversary_date', $anniversary_date );
348+
update_option( 'amazon_payments_advanced_enabled_anniversary_date', $anniversary_date );
344349
update_option( 'amazon_payments_advanced_hidden_until_date', $hidden_until_date );
345350
}
346351

@@ -407,7 +412,7 @@ public function review_prompt() {
407412
public function ajax_dismiss_review_prompt() {
408413
check_ajax_referer( 'amazon_pay_dismiss_review_prompt', 'nonce' );
409414

410-
$anniversary_date = get_option( 'amazon_payments_advanced_anniversary_date' );
415+
$anniversary_date = get_option( 'amazon_payments_advanced_enabled_anniversary_date' );
411416

412417
// Start from the stored anniversary date.
413418
// Add a year in each loop until the result is in the future.

includes/class-wc-gateway-amazon-payments-advanced-abstract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ abstract class WC_Gateway_Amazon_Payments_Advanced_Abstract extends WC_Payment_G
177177
*/
178178
public function __construct() {
179179
$this->method_title = __( 'Amazon Pay', 'woocommerce-gateway-amazon-payments-advanced' );
180-
$this->method_description = __( 'Amazon Pay is embedded directly into your existing web site, and all the buyer interactions with Amazon Pay and Login with Amazon take place in embedded widgets so that the buyer never leaves your site. Buyers can log in using their Amazon account, select a shipping address and payment method, and then confirm their order. Requires an Amazon Pay seller account and supports USA, UK, Germany, France, Italy, Spain, Luxembourg, the Netherlands, Sweden, Portugal, Hungary, Denmark, and Japan.', 'woocommerce-gateway-amazon-payments-advanced' );
180+
$this->method_description = __( 'Amazon Pay allows 300M+ active buyers to checkout using their Amazon account and is embedded directly into your existing website.', 'woocommerce-gateway-amazon-payments-advanced' );
181181
$this->id = 'amazon_payments_advanced';
182182
$this->icon = apply_filters( 'woocommerce_amazon_pa_logo', wc_apa()->plugin_url . '/build/images/amazon-payments.png' );
183183
$this->view_transaction_url = $this->get_transaction_url_format();
@@ -389,7 +389,7 @@ public function get_form_fields() {
389389
),
390390
'manual_notice' => array(
391391
'type' => 'custom',
392-
'html' => '<p>Problems with automatic setup? <a href="#" class="wcapa-toggle-section" data-toggle="#manual-settings-container, #automatic-settings-container">Click here</a> to manually enter your keys.</p>',
392+
'html' => '<p>Problems with automatic setup? Toggle here <a href="#" class="wcapa-toggle-section" data-toggle="#manual-settings-container, #automatic-settings-container"><span class="woocommerce-input-toggle woocommerce-input-toggle--disabled" aria-label="' . esc_attr( __( 'Manually enter your keys', 'woocommerce-gateway-amazon-payments-advanced' ) ) . '">' . esc_attr__( 'Yes', 'woocommerce' ) . '</span></a> to manually enter your keys.</p>',
393393
),
394394
'manual_container_start' => array(
395395
'type' => 'custom',

src/js/non-block/amazon-wc-admin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@
351351
toggle_visibility: function( e ) {
352352
e.preventDefault();
353353
var target = $( $( this ).data( 'toggle' ) );
354+
$(this).find( 'span' ).toggleClass( 'woocommerce-input-toggle--disabled', 'woocommerce-input-toggle--enabled' );
354355
target.toggleClass( 'hidden' );
355356
if ( ! $( this ).hasClass( 'wcapa-toggle-scroll' ) ) {
356357
return;

src/sass/style-admin.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@
55
.json_key_valid {
66
border: 1px solid #18ff59;
77
}
8+
9+
.wcapa-toggle-section:focus {
10+
outline: 0;
11+
box-shadow: none
12+
}

0 commit comments

Comments
 (0)