You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
case1: // Case 1 (Nominal case): Most recent = success
248
-
returnsprintf(
279
+
$message =sprintf(
249
280
$test_mode ?
250
281
/* translators: 1) date and time of last webhook received, e.g. 2020-06-28 10:30:50 UTC */
251
282
__( 'The most recent test webhook, timestamped %s, was processed successfully.', 'woocommerce-gateway-stripe' ) :
252
283
/* translators: 1) date and time of last webhook received, e.g. 2020-06-28 10:30:50 UTC */
253
284
__( 'The most recent live webhook, timestamped %s, was processed successfully.', 'woocommerce-gateway-stripe' ),
254
285
gmdate( $date_format, $last_success_at )
255
286
);
287
+
break;
256
288
case2: // Case 2: No webhooks received yet
257
-
returnsprintf(
289
+
$message =sprintf(
258
290
$test_mode ?
259
291
/* translators: 1) date and time webhook monitoring began, e.g. 2020-06-28 10:30:50 UTC */
260
292
__( 'No test webhooks have been received since monitoring began at %s.', 'woocommerce-gateway-stripe' ) :
261
293
/* translators: 1) date and time webhook monitoring began, e.g. 2020-06-28 10:30:50 UTC */
262
294
__( 'No live webhooks have been received since monitoring began at %s.', 'woocommerce-gateway-stripe' ),
263
295
gmdate( $date_format, $monitoring_began_at )
264
296
);
297
+
break;
265
298
case3: // Case 3: Failure after success
266
-
returnsprintf(
299
+
$message =sprintf(
267
300
$test_mode ?
268
301
/*
269
302
* translators: 1) date and time of last failed webhook e.g. 2020-06-28 10:30:50 UTC
@@ -279,10 +312,11 @@ public static function get_webhook_status_message() {
279
312
__( 'Warning: The most recent live webhook, received at %1$s, could not be processed. Reason: %2$s. (The last live webhook to process successfully was timestamped %3$s.)', 'woocommerce-gateway-stripe' ),
280
313
gmdate( $date_format, $last_failure_at ),
281
314
$last_error,
282
-
gmdate( $date_format, $last_success_at )
315
+
gmdate( $date_format, $last_success_at ),
283
316
);
317
+
break;
284
318
default: // Case 4: Failure with no prior success
285
-
returnsprintf(
319
+
$message =sprintf(
286
320
$test_mode ?
287
321
/* translators: 1) date and time of last failed webhook e.g. 2020-06-28 10:30:50 UTC
288
322
* translators: 2) reason webhook failed
@@ -296,9 +330,24 @@ public static function get_webhook_status_message() {
296
330
__( 'Warning: The most recent live webhook, received at %1$s, could not be processed. Reason: %2$s. (No live webhooks have been processed successfully since monitoring began at %3$s.)', 'woocommerce-gateway-stripe' ),
$expected_message = '/Warning: The most recent [mode] webhook, received at (.*), could not be processed. Reason: (.*) \(The last [mode] webhook to process successfully was timestamped/';
174
+
$expected_message = '/Warning: The most recent [mode] webhook, received at (.*), could not be processed. Reason: (.*) \(The last [mode] webhook to process successfully was timestamped (.*).\). There are approximately (\d+) webhooks pending./';
171
175
// Live
172
176
$this->set_testmode( 'no' );
173
177
// Process successful webhook.
@@ -193,7 +197,7 @@ public function test_get_webhook_status_message_failure_after_success() {
$expected_message = '/Warning: The most recent [mode] webhook, received at (.*), could not be processed. Reason: (.*) \(No [mode] webhooks have been processed successfully since monitoring began at/';
200
+
$expected_message = '/Warning: The most recent [mode] webhook, received at (.*), could not be processed. Reason: (.*) \(No [mode] webhooks have been processed successfully since monitoring began at (.*).\). There are approximately (\d+) webhooks pending./';
197
201
// Live
198
202
$this->set_testmode( 'no' );
199
203
// Fail webhook.
@@ -208,6 +212,12 @@ public function test_get_webhook_status_message_failure_with_no_prior_success()
0 commit comments