Skip to content

Commit af05887

Browse files
committed
Adjust the feedback prompt trigger moment
Sent only after the keys are set
1 parent 3d22c50 commit af05887

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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.

0 commit comments

Comments
 (0)