Skip to content

Commit b8b5ef2

Browse files
authored
Merge pull request #5 from ibrahimlawal/config/sendinvoice
Invoice Opt-out
2 parents ed711e7 + 8201522 commit b8b5ef2

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

admin/class-paystack-forms-admin.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,19 @@ function kkd_pff_paystack_editor_add_email_data() {
327327
$heading = get_post_meta($post->ID, '_heading', true);
328328
$message = get_post_meta($post->ID, '_message', true);
329329
$sendreceipt = get_post_meta($post->ID, '_sendreceipt', true);
330+
$sendinvoice = get_post_meta($post->ID, '_sendinvoice', true);
330331

331332
if ($subject == "") {$subject = 'Thank you for your payment';}
332333
if ($sendreceipt == "") {$sendreceipt = 'yes';}
334+
if ($sendinvoice == "") {$sendinvoice = 'yes';}
333335
if ($heading == "") {$heading = "We've received your payment";}
334336
if ($message == "") {$message = 'Your payment was received and we appreciate it.';}
335337
// Echo out the field
338+
echo '<p>Send an invoices when a payment is attempted:</p>';
339+
echo '<select class="form-control" name="_sendinvoice" id="parent_id" style="width:100%;">
340+
<option value="no" '.kkd_pff_paystack_txncheck('no',$sendinvoice).'>Don\'t send</option>
341+
<option value="yes" '.kkd_pff_paystack_txncheck('yes',$sendinvoice).'>Send</option>
342+
</select>';
336343
echo '<p>Send Email Receipt:</p>';
337344
echo '<select class="form-control" name="_sendreceipt" id="parent_id" style="width:100%;">
338345
<option value="no" '.kkd_pff_paystack_txncheck('no',$sendreceipt).'>Don\'t send</option>

public/class-paystack-forms-public.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,9 @@ function kkd_pff_paystack_submit_action() {
12491249
$table,
12501250
$insert
12511251
);
1252+
if("yes" == get_post_meta($insert['post_id'],'_sendinvoice',true)){
12521253
kkd_pff_paystack_send_invoice($currency,$insert['amount'],$fullname,$insert['email'],$code);
1254+
}
12531255
}
12541256

12551257
$response = array(

0 commit comments

Comments
 (0)