Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions MeprPaystackGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function __construct()
$this->icon = MP_PAYSTACK_IMAGES_URL . '/cards.png';
$this->desc = __('Pay via Paystack', 'memberpress');
$this->set_defaults();
$this->key = __("Paystack", 'memberpress');

$this->capabilities = array(
'process-payments',
Expand Down Expand Up @@ -482,7 +483,7 @@ protected function record_subscription_invoice($invoice)
$txn->set_gross((float) $invoice->amount / 100);
}

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

$txn->store();

Expand Down Expand Up @@ -1140,21 +1141,21 @@ public function display_options_form()
<th scope="row"><label><?php _e('Paystack Webhook URL:', 'memberpress'); ?></label></th>
<td><?php MeprAppHelper::clipboard_input($this->notify_url('whk')); ?></td>
</tr>
<tr valign="top">
<tr valign="top">
<td>
<div class="callout" style="margin-left: 20px;
max-width: 500px;min-width:300px;">
<div class="callout-header" style=" padding: 10px 10px;
background: #011B33;
font-size: 18px;
color: white;">Please note</div>
<div class="callout-container" style="padding: 5px;
background-color: #17dcf83d;
color: black">
<p style="text-align:start">This plugin only supports weekly, monthly, quarterly and yearly subscription plans.</p>
</div>
</td>
<div class="callout" style="margin-left: 20px;
max-width: 500px;min-width:300px;">
<div class="callout-header" style=" padding: 10px 10px;
background: #011B33;
font-size: 18px;
color: white;">Please note</div>

<div class="callout-container" style="padding: 5px;
background-color: #17dcf83d;
color: black">
<p style="text-align:start">This plugin only supports weekly, monthly, quarterly and yearly subscription plans.</p>
</div>
</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -1316,11 +1317,11 @@ public function webhook_listener()
$this->email_status("Webhook Just Came In (" . $_SERVER['REQUEST_METHOD'] . "):\n" . MeprUtils::object_to_string($_REQUEST, true) . "\n", $this->settings->debug);
// retrieve the request's body
$request = @file_get_contents('php://input');

if ($this->paystack_api->validate_webhook($request) == true) {
// parse it as JSON
$request = (object) json_decode($request, true);
$_REQUEST['data'] = $obj = (object) $request->data;
$request = (object)json_decode($request, true);
$obj = $request->data;
$_REQUEST['data'] = $request->data;

if ($request->event == 'charge.success') {
$this->email_status("###Event: {$request->event}\n" . MeprUtils::object_to_string($request, true) . "\n", $this->settings->debug);
Expand Down Expand Up @@ -1518,4 +1519,4 @@ protected function get_request_data()
{
return (object) $_REQUEST['data'];
}
}
}
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Tags: paystack, billing, subscription, payment, memberpress,
Requires at least: 5.1
Tested up to: 5.9
Requires PHP: 7.2
Stable tag: 1.3.0
Stable tag: 1.3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down