Skip to content

Commit 55e8bfd

Browse files
Merge pull request #8 from PaystackHQ/patch/format-intervals
add support for weekly, quarterly and yearly plans
2 parents d390227 + a9971e1 commit 55e8bfd

4 files changed

Lines changed: 36 additions & 5 deletions

File tree

MeprPaystackGateway.php

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,22 @@ public function display_options_form()
11401140
<th scope="row"><label><?php _e('Paystack Webhook URL:', 'memberpress'); ?></label></th>
11411141
<td><?php MeprAppHelper::clipboard_input($this->notify_url('whk')); ?></td>
11421142
</tr>
1143+
<tr valign="top">
1144+
<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>
1158+
</tr>
11431159
</tbody>
11441160
</table>
11451161
<?php
@@ -1385,10 +1401,22 @@ public function create_new_plan($sub)
13851401
// There's no plan like that so let's create one
13861402
if ($sub->period_type == 'weeks') {
13871403
$interval = 'weekly';
1388-
// for test purpose
1389-
// $interval = 'hourly';
1404+
if($sub->period >= 3){
1405+
$interval = 'monthly';
1406+
}
13901407
} else if ($sub->period_type == 'months') {
1391-
$interval = 'monthly';
1408+
if($sub->period == 1){
1409+
$interval = 'monthly';
1410+
}
1411+
else if($sub->period >= 3 || $sub->period <= 6){
1412+
$interval = 'quarterly';
1413+
}
1414+
else if($sub->period > 6){
1415+
$interval = 'annually';
1416+
}
1417+
else{
1418+
$interval = 'monthly';
1419+
}
13921420
} else if ($sub->period_type == 'years') {
13931421
$interval = 'annually';
13941422
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Gateway - This should be set to "Paystack" and will not show up on the frontend.
5757
## Capabilities of the Paystack Integration
5858

5959
* Process One-Time Payments
60-
* Process Recurring Payments
60+
* Process Recurring Payments (Supports weekly, monthly, quarterly and yearly plans)
6161
* Process Refunds
6262
* Cancel Recurring Payments
6363
* Change Credit Card for Recurring Subscription

main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin Name: MemberPress Paystack
55
* Plugin URI: https://wordpress.org/plugins/paystack-memberpress/
66
* Description: Paystack integration for MemberPress.
7-
* Version: 1.3.0
7+
* Version: 1.3.1
88
* Author: Paystack
99
* Author URI: https://paystack.com/
1010
* Developer: Wisdom Ebong

readme.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,6 @@ Gateway - This should be set to "Paystack" and will not show up on the frontend.
8181
Here you can browse the source, look at open issues and keep track of development.
8282

8383
== Changelog ==
84+
85+
= 1.3.1 - May 9, 2022 =
86+
* Fix: Add support for weekly, quarterly, and yearly plans

0 commit comments

Comments
 (0)