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
add logging when subscription is suspended (#5430)
* add logging when subscription is suspended:
- because merchant or subscriber (or ?) changed status to on-hold
- because next payment date is 0
* add order (subscription) notes when sub is suspended +
+ use consistent past tense for logging and notes
* log and add order notes after suspending subscription
* add some extra checks that subscription is wcpay / non tokenised, log if incorrect
* use local wcpay sub id in log message + tidy log message (semicolon between values)
* changelong
* fix php unit tests:
- missing require Logger (doh!)
- update test_suspend_subscription mock subscription so it passes the new `is_wcpay_subscription` check
* fix / improve docblock comments:
- suspend executes a suspend on a given subscription
- handle_status handles a specific status transition
* fix temporary unhooking of on-hold status change handler:
- this PR decouples the handler from what it does, as suspend_subscription is used outside this context, and so we can log the status change explicitly
- this commit fixes the places we temporarily unhook the action to refer to new handler
* log a stack trace with suspend due to on-hold status
* clarify invoice.upcoming suspend note / log
Co-authored-by: Rua Haszard <[email protected]>
$subscription->add_order_note( __( 'Suspended WCPay Subscription in invoice.upcoming webhook handler because subscription next_payment date is 0.', 'woocommerce-payments' ) );
77
+
Logger::log(
78
+
sprintf(
79
+
'Suspended WCPay Subscription in invoice.upcoming webhook handler because subscription next_payment date is 0. WC ID: %d; WCPay ID: %s.',
80
+
$subscription->get_id(),
81
+
$wcpay_subscription_id
82
+
)
83
+
);
75
84
}
76
85
} else {
77
86
// Translators: %s Scheduled/upcoming payment date in Y-m-d H:i:s format.
@@ -124,9 +133,9 @@ public function handle_invoice_paid( array $body ) {
124
133
* This ensures the downstream effects take place, e.g. a payment status order note is added and the
125
134
* 'woocommerce_subscription_payment_complete' action is fired.
0 commit comments