Skip to content

Commit 9403d19

Browse files
committed
Added support for sub account
1 parent ff21820 commit 9403d19

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed

README.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://paystack.com/demo
44
Tags: paystack, recurrent payments, nigeria, mastercard, visa, target,Naira,payments,verve
55
Requires at least: 3.1
66
Tested up to: 4.6.1
7-
Stable tag: 1.1.0
7+
Stable tag: 2.0.1
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -84,6 +84,9 @@ You can also follow us on Twitter! **[@paystack](http://twitter.com/paystack)**
8484

8585

8686
== Changelog ==
87+
= 2.0.1 =
88+
* Added option to use subaccount on a form.
89+
* General bug fixes.
8790
= 2.0.0 =
8891
* Fixed compatibility for PHP 5.3 and below.
8992
* Added option to redirect to page after payment.

admin/class-paystack-forms-admin.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ function kkd_pff_paystack_editor_add_extra_metaboxes() {
259259
add_meta_box('kkd_pff_paystack_editor_add_email_data', 'Email Receipt Settings', 'kkd_pff_paystack_editor_add_email_data', 'paystack_form', 'normal', 'default');
260260
add_meta_box('kkd_pff_paystack_editor_add_quantity_data', 'Quantity Payment', 'kkd_pff_paystack_editor_add_quantity_data', 'paystack_form', 'side', 'default');
261261
add_meta_box('kkd_pff_paystack_editor_add_agreement_data', 'Agreement checkbox', 'kkd_pff_paystack_editor_add_agreement_data', 'paystack_form', 'side', 'default');
262+
add_meta_box('kkd_pff_paystack_editor_add_subaccount_data', 'Sub Account', 'kkd_pff_paystack_editor_add_subaccount_data', 'paystack_form', 'side', 'default');
262263

263264
}
264265

@@ -414,6 +415,22 @@ function kkd_pff_paystack_editor_add_agreement_data() {
414415
echo '<p>Agreement Page Link:</p>';
415416
echo '<input type="text" name="_agreementlink" value="' . $agreementlink . '" class="widefat" />';
416417

418+
}
419+
function kkd_pff_paystack_editor_add_subaccount_data() {
420+
global $post;
421+
422+
// Noncename needed to verify where the data originated
423+
echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' .
424+
wp_create_nonce( plugin_basename(__FILE__) ) . '" />';
425+
426+
// Get the location data if its already been entered
427+
$subaccount = get_post_meta($post->ID, '_subaccount', true);
428+
429+
430+
if ($subaccount == "") {$subaccount = '';}
431+
echo '<p>Sub Account code:</p>';
432+
echo '<input type="text" name="_subaccount" value="' . $subaccount . '" class="widefat" />';
433+
417434
}
418435
function kkd_pff_paystack_save_data($post_id, $post) {
419436

@@ -447,6 +464,7 @@ function kkd_pff_paystack_save_data($post_id, $post) {
447464

448465
$form_meta['_useagreement'] = $_POST['_useagreement'];
449466
$form_meta['_agreementlink'] = $_POST['_agreementlink'];
467+
$form_meta['_subaccount'] = $_POST['_subaccount'];
450468

451469
// Add values of $form_meta as custom fields
452470

includes/paystack-invoice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function kkd_format_metadata($data){
7474

7575
<div class="span12 unit">
7676
<label class="label inline">Date:</label>
77-
<strong><?php echo $currency.number_format($dbdata->amount); ?></strong>
77+
<strong><?php echo $dbdata->created_at; ?></strong>
7878
</div>
7979
<?php if($dbdata->paid == 1) {?>
8080
<div class="span12 unit">

paystack-forms.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Payment forms for Paystack
44
Plugin URI: https://github.com/Kendysond/Wordpress-paystack-forms
55
Description: Payment forms for Paystack allows you create forms that will be used to bill clients for goods and services via Paystack.
6-
Version: 2.0.0
6+
Version: 2.0.1
77
Author: Douglas Kendyson
88
Author URI: http://kendyson.com
99
License: GPL-2.0+

public/class-paystack-forms-public.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ function kkd_pff_paystack_submit_action() {
885885
$currency = get_post_meta($_POST["pf-id"],'_currency',true);
886886
$formamount = get_post_meta($_POST["pf-id"],'_amount',true);
887887
$recur = get_post_meta($_POST["pf-id"],'_recur',true);
888+
$subaccount = get_post_meta($_POST["pf-id"],'_subaccount',true);
888889

889890
$txncharge = get_post_meta($_POST["pf-id"],'_txncharge',true);
890891
$amount = (int)str_replace(' ', '', $_POST["pf-amount"]);
@@ -1060,7 +1061,8 @@ function kkd_pff_paystack_submit_action() {
10601061
'email' => $insert['email'],
10611062
'name' => $fullname,
10621063
'total' => $insert['amount']*100,
1063-
'custom_fields' => $fixedmetadata
1064+
'custom_fields' => $fixedmetadata,
1065+
'subaccount' => $subaccount
10641066
);
10651067
echo json_encode($response);
10661068

public/js/paystack-forms-public.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@
155155
amount: data.total,
156156
firstname: firstName,
157157
lastname: lastName,
158-
ref: data.code,
158+
subaccount:data.subaccount,
159+
ref: data.code,
159160
metadata: {'custom_fields': data.custom_fields},
160161
callback: function(response){
161162
$.blockUI({ message: 'Please wait...' });

0 commit comments

Comments
 (0)