Skip to content

Commit a6f4655

Browse files
committed
stable: fixed bugs and make webhooks more responsive
1 parent bfd30ac commit a6f4655

File tree

2 files changed

+149
-77
lines changed

2 files changed

+149
-77
lines changed

class-gf-paystack-api.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ public function send_request(
6868

6969
if (is_wp_error($res)) {
7070
throw new Exception(sprintf(__('You had an HTTP error connecting to %s', 'gravityformspaystack'), $this->name));
71-
}
71+
}
7272

7373
$body = json_decode($res['body'], true);
74-
74+
7575
if ($body !== null) {
76-
if (isset($json_res['error']) || $body['status'] == false) {
76+
error_log(__METHOD__ . '(): for ' . $uri . ' Paystack Request ' . print_r($arg_array, true) . ' Paystack Response => ' . print_r($body, true));
77+
78+
if (isset($body['error']) || $body['status'] == false) {
7779
throw new Exception("{$body['message']}");
7880
} else {
7981
return $body;
@@ -101,11 +103,8 @@ public function validate_webhook($input)
101103
*/
102104
public function get_headers()
103105
{
104-
return apply_filters(
105-
'mepr_paystack_request_headers',
106-
[
107-
'Authorization' => "Bearer {$this->secret_key}",
108-
]
109-
);
106+
return apply_filters('gf_paystack_request_headers', [
107+
'Authorization' => "Bearer {$this->secret_key}"
108+
]);
110109
}
111110
}

0 commit comments

Comments
 (0)