Skip to content

Commit 7f7ba60

Browse files
committed
Log test notification
1 parent 9014a4d commit 7f7ba60

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

plugins/bcc-login/includes/class-bcc-coreapi-client.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,11 @@ public function send_notification($group_uids, $type, $workflow, $payload, $test
355355
? array("personUid" => $test_person_uid, "notificationPayload" => $payload)
356356
: array("groupUids" => array_values($group_uids), "notificationPayload" => $payload);
357357

358+
if ($test_person_uid) {
359+
error_log('TEST SEND - POST ' . $request_url);
360+
error_log('TEST SEND - Request body: ' . json_encode($request_body, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
361+
}
362+
358363
$response = wp_remote_post($request_url, array(
359364
"body" => wp_json_encode( $request_body ),
360365
"headers" => array(
@@ -367,10 +372,14 @@ public function send_notification($group_uids, $type, $workflow, $payload, $test
367372
wp_die( $response->get_error_message() );
368373
}
369374

375+
if ($test_person_uid) {
376+
error_log('TEST SEND - Response (' . $response['response']['code'] . '): ' . $response['body']);
377+
}
378+
370379
if ($response['response']['code'] != 200) {
371380
wp_die("Could not send notification: " . print_r($response, true));
372381
}
373-
}
382+
}
374383

375384
public function get_coreapi_token() {
376385
$cached_token = $this->_storage->get('coreapi_token');

0 commit comments

Comments
 (0)