Skip to content

Commit f6e9857

Browse files
Merge pull request #10 from PaystackOSS/patch/bug-fixes
Patch/bug fixes
2 parents 55e8bfd + ba92e04 commit f6e9857

2 files changed

Lines changed: 21 additions & 20 deletions

File tree

MeprPaystackGateway.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function __construct()
1717
$this->icon = MP_PAYSTACK_IMAGES_URL . '/cards.png';
1818
$this->desc = __('Pay via Paystack', 'memberpress');
1919
$this->set_defaults();
20+
$this->key = __("Paystack", 'memberpress');
2021

2122
$this->capabilities = array(
2223
'process-payments',
@@ -482,7 +483,7 @@ protected function record_subscription_invoice($invoice)
482483
$txn->set_gross((float) $invoice->amount / 100);
483484
}
484485

485-
$txn->expires_at = MeprUtils::ts_to_mysql_date($invoice['subscription']->next_payment_date, 'Y-m-d 23:59:59');
486+
$txn->expires_at = MeprUtils::ts_to_mysql_date(strtotime($invoice->subscription['next_payment_date']), 'Y-m-d 23:59:59');
486487

487488
$txn->store();
488489

@@ -1140,21 +1141,21 @@ public function display_options_form()
11401141
<th scope="row"><label><?php _e('Paystack Webhook URL:', 'memberpress'); ?></label></th>
11411142
<td><?php MeprAppHelper::clipboard_input($this->notify_url('whk')); ?></td>
11421143
</tr>
1143-
<tr valign="top">
1144+
<tr valign="top">
11441145
<td>
1145-
<div class="callout" style="margin-left: 20px;
1146-
max-width: 500px;min-width:300px;">
1147-
<div class="callout-header" style=" padding: 10px 10px;
1148-
background: #011B33;
1149-
font-size: 18px;
1150-
color: white;">Please note</div>
1151-
1152-
<div class="callout-container" style="padding: 5px;
1153-
background-color: #17dcf83d;
1154-
color: black">
1155-
<p style="text-align:start">This plugin only supports weekly, monthly, quarterly and yearly subscription plans.</p>
1156-
</div>
1157-
</td>
1146+
<div class="callout" style="margin-left: 20px;
1147+
max-width: 500px;min-width:300px;">
1148+
<div class="callout-header" style=" padding: 10px 10px;
1149+
background: #011B33;
1150+
font-size: 18px;
1151+
color: white;">Please note</div>
1152+
1153+
<div class="callout-container" style="padding: 5px;
1154+
background-color: #17dcf83d;
1155+
color: black">
1156+
<p style="text-align:start">This plugin only supports weekly, monthly, quarterly and yearly subscription plans.</p>
1157+
</div>
1158+
</td>
11581159
</tr>
11591160
</tbody>
11601161
</table>
@@ -1316,11 +1317,11 @@ public function webhook_listener()
13161317
$this->email_status("Webhook Just Came In (" . $_SERVER['REQUEST_METHOD'] . "):\n" . MeprUtils::object_to_string($_REQUEST, true) . "\n", $this->settings->debug);
13171318
// retrieve the request's body
13181319
$request = @file_get_contents('php://input');
1319-
13201320
if ($this->paystack_api->validate_webhook($request) == true) {
13211321
// parse it as JSON
1322-
$request = (object) json_decode($request, true);
1323-
$_REQUEST['data'] = $obj = (object) $request->data;
1322+
$request = (object)json_decode($request, true);
1323+
$obj = $request->data;
1324+
$_REQUEST['data'] = $request->data;
13241325

13251326
if ($request->event == 'charge.success') {
13261327
$this->email_status("###Event: {$request->event}\n" . MeprUtils::object_to_string($request, true) . "\n", $this->settings->debug);
@@ -1518,4 +1519,4 @@ protected function get_request_data()
15181519
{
15191520
return (object) $_REQUEST['data'];
15201521
}
1521-
}
1522+
}

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Tags: paystack, billing, subscription, payment, memberpress,
33
Requires at least: 5.1
44
Tested up to: 5.9
55
Requires PHP: 7.2
6-
Stable tag: 1.3.0
6+
Stable tag: 1.3.1
77
License: GPLv2 or later
88
License URI: http://www.gnu.org/licenses/gpl-2.0.html
99

0 commit comments

Comments
 (0)