From 25b0e4823411c4cb4a8cab6d14fea843670b6886 Mon Sep 17 00:00:00 2001
From: Tunbosun Ayinla
Date: Tue, 19 Sep 2023 10:04:22 +0100
Subject: [PATCH 1/6] Refactor add metaboxes and register cpt
---
admin/class-paystack-forms-cpt.php | 333 ++++++++++++++++++
.../partials/metaboxes/agreement-checkbox.php | 35 ++
.../metaboxes/email-receipt-settings.php | 85 +++++
.../metaboxes/extra-form-description.php | 194 ++++++++++
admin/partials/metaboxes/plan-start-date.php | 41 +++
admin/partials/metaboxes/quantity-payment.php | 123 +++++++
.../partials/metaboxes/recurring-payment.php | 34 ++
admin/partials/metaboxes/sub-account.php | 43 +++
8 files changed, 888 insertions(+)
create mode 100644 admin/class-paystack-forms-cpt.php
create mode 100644 admin/partials/metaboxes/agreement-checkbox.php
create mode 100644 admin/partials/metaboxes/email-receipt-settings.php
create mode 100644 admin/partials/metaboxes/extra-form-description.php
create mode 100644 admin/partials/metaboxes/plan-start-date.php
create mode 100644 admin/partials/metaboxes/quantity-payment.php
create mode 100644 admin/partials/metaboxes/recurring-payment.php
create mode 100644 admin/partials/metaboxes/sub-account.php
diff --git a/admin/class-paystack-forms-cpt.php b/admin/class-paystack-forms-cpt.php
new file mode 100644
index 0000000..69d1a46
--- /dev/null
+++ b/admin/class-paystack-forms-cpt.php
@@ -0,0 +1,333 @@
+plugin_name = $plugin_name;
+ $this->version = $version;
+ }
+
+ public function register_paystack_form_cpt() {
+
+ $labels = array(
+ 'name' => _x( 'Paystack Forms', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'singular_name' => _x( 'Paystack Form', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'add_new' => _x( 'Add New', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'add_new_item' => _x( 'Add Paystack Form', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'edit_item' => _x( 'Edit Paystack Form', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'new_item' => _x( 'Paystack Form', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'view_item' => _x( 'View Paystack Form', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'all_items' => _x( 'All Forms', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'search_items' => _x( 'Search Paystack Forms', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'not_found' => _x( 'No Paystack Forms found', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'not_found_in_trash' => _x( 'No Paystack Forms found in Trash', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'parent_item_colon' => _x( 'Parent Paystack Form:', 'paystack_form', 'payment-forms-for-paystack' ),
+ 'menu_name' => _x( 'Paystack Forms', 'paystack_form', 'payment-forms-for-paystack' ),
+ );
+
+ $args = array(
+ 'labels' => $labels,
+ 'hierarchical' => true,
+ 'description' => __( 'Paystack Forms filterable by genre', 'payment-forms-for-paystack' ),
+ 'supports' => array( 'title', 'editor' ),
+ 'public' => true,
+ 'show_ui' => true,
+ 'show_in_menu' => true,
+ 'menu_position' => 5,
+ 'menu_icon' => plugins_url( '../images/logo.png', __FILE__ ),
+ 'show_in_nav_menus' => false,
+ 'publicly_queryable' => false,
+ 'exclude_from_search' => true,
+ 'has_archive' => false,
+ 'query_var' => true,
+ 'can_export' => true,
+ 'rewrite' => false,
+ 'comments' => false,
+ 'capability_type' => 'post',
+ );
+
+ register_post_type( 'paystack_form', $args );
+ }
+
+ public function save_payment_form_data( $post_id ) {
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
+ return;
+ }
+
+ if ( empty( $_POST['payment_forms_for_paystack_nonce'] ) ) {
+ return;
+ }
+
+ if ( ! wp_verify_nonce( $_POST['payment_forms_for_paystack_nonce'], 'payment-forms-for-paystack-nonce' ) ) {
+ return;
+ }
+
+ $post = get_post( $post_id );
+
+ if ( empty( $post ) ) {
+ return;
+ }
+
+ // Is the user allowed to edit the post or page?
+ if ( ! current_user_can( 'edit_post', $post->ID ) ) {
+ return;
+ }
+
+ $form_meta['_inventory'] = $_POST['_inventory'] ?? '0';
+ $form_meta['_useinventory'] = $_POST['_inventory'] ?? '0';
+ $form_meta['_amount'] = $_POST['_amount'];
+ $form_meta['_hidetitle'] = $_POST['_hidetitle'] ?? '0';
+ $form_meta['_minimum'] = $_POST['_minimum'] ?? '0';
+
+ $form_meta['_variableamount'] = $_POST['_variableamount'];
+ $form_meta['_usevariableamount'] = $_POST['_usevariableamount'] ?? '0';
+
+ $form_meta['_paybtn'] = $_POST['_paybtn'];
+ $form_meta['_currency'] = $_POST['_currency'];
+ $form_meta['_successmsg'] = $_POST['_successmsg'];
+ $form_meta['_txncharge'] = $_POST['_txncharge'];
+ $form_meta['_loggedin'] = $_POST['_loggedin'];
+ $form_meta['_filelimit'] = $_POST['_filelimit'];
+ $form_meta['_redirect'] = $_POST['_redirect'];
+
+ $form_meta['_subject'] = $_POST['_subject'];
+ $form_meta['_merchant'] = $_POST['_merchant'];
+ $form_meta['_heading'] = $_POST['_heading'];
+ $form_meta['_message'] = $_POST['_message'];
+ $form_meta['_sendreceipt'] = $_POST['_sendreceipt'];
+ $form_meta['_sendinvoice'] = $_POST['_sendinvoice'];
+
+ $form_meta['_recur'] = $_POST['_recur'];
+ $form_meta['_recurplan'] = $_POST['_recurplan'];
+ $form_meta['_usequantity'] = $_POST['_usequantity'];
+ $form_meta['_quantity'] = $_POST['_quantity'] ?? '1';
+ $form_meta['_sold'] = $_POST['_sold'] ?? '0';
+ $form_meta['_quantityunit'] = $_POST['_quantityunit'] ?? __( 'Quantity', 'payment-forms-for-paystack' );
+
+ $form_meta['_useagreement'] = $_POST['_useagreement'];
+ $form_meta['_agreementlink'] = $_POST['_agreementlink'];
+ $form_meta['_subaccount'] = $_POST['_subaccount'];
+ $form_meta['_txnbearer'] = $_POST['_txnbearer'];
+ $form_meta['_merchantamount'] = $_POST['_merchantamount'];
+ // Add values of $form_meta as custom fields
+
+ //Custom Plan with Start Date
+ $form_meta['_startdate_days'] = $_POST['_startdate_days'];
+ $form_meta['_startdate_plan_code'] = $_POST['_startdate_plan_code'];
+ $form_meta['_startdate_enabled'] = $_POST['_startdate_enabled'] ?? '0';
+
+ foreach ( $form_meta as $key => $value ) { // Cycle through the $form_meta array!
+ if ( 'revision' === $post->post_type ) {
+ return; // Don't store custom data twice
+ }
+ $value = implode( ',', (array) $value ); // If $value is an array, make it a CSV (unlikely)
+ if ( get_post_meta( $post->ID, $key, false ) ) { // If the custom field already has a value
+ update_post_meta( $post->ID, $key, $value );
+ } else { // If the custom field doesn't have a value
+ add_post_meta( $post->ID, $key, $value );
+ }
+ if ( ! $value ) {
+ delete_post_meta( $post->ID, $key ); // Delete if blank
+ }
+ }
+ }
+
+ public function disable_wyswyg( $default ) {
+
+ global $post_type;
+
+ if ( 'paystack_form' === $post_type ) {
+ echo '';
+ add_filter( 'user_can_richedit', '__return_false', 50 );
+ remove_action( 'media_buttons', 'media_buttons' );
+ add_filter( 'quicktags_settings', array( $this, 'remove_fullscreen_quicktag' ) );
+ }
+
+ return $default;
+ }
+
+ public function remove_fullscreen_quicktag( $qt_init ) {
+ $qt_init['buttons'] = 'fullscreen';
+ return $qt_init;
+ }
+
+ public function add_help_section_meta_box( $post ) {
+ do_meta_boxes( null, 'paystack_payment_forms_cpt_meta_box', $post );
+ }
+
+ public function help_section_meta_box() {
+ ?>
+
+
+
+
+ required="required" to the shortcode', 'payment-forms-for-paystack' ),
+ array(
+ 'code' => array(),
+ )
+ )
+ ?>
+
+
+ [text name="Full Name" required="required" ]', 'payment-forms-for-paystack' ),
+ array(
+ 'code' => array(),
+ )
+ )
+ ?>
+
+
+ Warning: Using the file input field may cause data overload on your server. Be sure you have enough server space before using it. You also have the ability to set file upload limits', 'payment-forms-for-paystack' ),
+ array(
+ 'strong' => array(
+ 'style' => array(),
+ ),
+ )
+ )
+ ?>
+
+
+
+
+
+
+
+
+
+
+ version,
+ true,
+ );
+ }
+}
diff --git a/admin/partials/metaboxes/agreement-checkbox.php b/admin/partials/metaboxes/agreement-checkbox.php
new file mode 100644
index 0000000..7555744
--- /dev/null
+++ b/admin/partials/metaboxes/agreement-checkbox.php
@@ -0,0 +1,35 @@
+ID, '_useagreement', true );
+$agreementlink = get_post_meta( $post->ID, '_agreementlink', true );
+
+if ( empty( $useagreement ) ) {
+ $useagreement = 'no';
+}
+if ( empty( $agreementlink ) ) {
+ $agreementlink = '';
+}
+?>
+
+
+
+
+
+
+ >
+
+
+ >
+
+
+
+
+
+
diff --git a/admin/partials/metaboxes/email-receipt-settings.php b/admin/partials/metaboxes/email-receipt-settings.php
new file mode 100644
index 0000000..917bf0d
--- /dev/null
+++ b/admin/partials/metaboxes/email-receipt-settings.php
@@ -0,0 +1,85 @@
+ID, '_subject', true );
+$merchant = get_post_meta( $post->ID, '_merchant', true );
+$heading = get_post_meta( $post->ID, '_heading', true );
+$message = get_post_meta( $post->ID, '_message', true );
+$send_receipt = get_post_meta( $post->ID, '_sendreceipt', true );
+$send_invoice = get_post_meta( $post->ID, '_sendinvoice', true );
+
+if ( empty( $subject ) ) {
+ $subject = __( 'Thank you for your payment', 'payment-forms-for-paystack' );
+}
+if ( empty( $send_receipt ) ) {
+ $send_receipt = 'yes';
+}
+if ( empty( $send_invoice ) ) {
+ $send_invoice = 'yes';
+}
+if ( empty( $heading ) ) {
+ $heading = __( 'We’ve received your payment', 'payment-forms-for-paystack' );
+}
+if ( empty( $message ) ) {
+ $message = __( 'Your payment was received and we appreciate it.', 'payment-forms-for-paystack' );
+}
+?>
+
+
+
+
+
+
+
+
+ >
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/partials/metaboxes/extra-form-description.php b/admin/partials/metaboxes/extra-form-description.php
new file mode 100644
index 0000000..5590760
--- /dev/null
+++ b/admin/partials/metaboxes/extra-form-description.php
@@ -0,0 +1,194 @@
+ID, '_amount', true );
+$paybtn = get_post_meta( $post->ID, '_paybtn', true );
+$successmsg = get_post_meta( $post->ID, '_successmsg', true );
+$txncharge = get_post_meta( $post->ID, '_txncharge', true );
+$loggedin = get_post_meta( $post->ID, '_loggedin', true );
+$currency = get_post_meta( $post->ID, '_currency', true );
+$filelimit = get_post_meta( $post->ID, '_filelimit', true );
+$redirect = get_post_meta( $post->ID, '_redirect', true );
+$minimum = get_post_meta( $post->ID, '_minimum', true );
+$usevariableamount = get_post_meta( $post->ID, '_usevariableamount', true );
+$variableamount = get_post_meta( $post->ID, '_variableamount', true );
+$hidetitle = get_post_meta( $post->ID, '_hidetitle', true );
+
+if ( empty( $amount ) ) {
+ $amount = 0;
+}
+if ( empty( $filelimit ) ) {
+ $filelimit = 2;
+}
+if ( empty( $paybtn ) ) {
+ $paybtn = 'Pay';
+}
+if ( empty( $successmsg ) ) {
+ $successmsg = 'Thank you for paying!';
+}
+if ( empty( $currency ) ) {
+ $currency = 'NGN';
+}
+if ( empty( $txncharge ) ) {
+ $txncharge = 'merchant';
+}
+if ( empty( $minimum ) ) {
+ $minimum = 0;
+}
+if ( empty( $usevariableamount ) ) {
+ $usevariableamount = 0;
+}
+if ( empty( $hidetitle ) ) {
+ $hidetitle = 0;
+}
+?>
+
+
+
+
+
+
+
+
+
+
+ here for more information.', 'payment-forms-for-paystack' ),
+ array(
+ 'a' => array(
+ 'href' => array(),
+ 'target' => array(),
+ ),
+ )
+ )
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+ Format(option:amount): Option 1:10000,Option 2:3000 Separate options with ","', 'payment-forms-for-paystack' ),
+ array(
+ 'code' => array(),
+ )
+ )
+ ?>
+
+
+
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Configure ', 'payment-forms-for-paystack' ),
+ array(
+ 'a' => array(
+ 'href' => array(),
+ 'target' => array(),
+ ),
+ )
+ ),
+ esc_url( get_admin_url() . 'edit.php?post_type=paystack_form&page=class-paystack-forms-admin.php#paystack_setting_fees' )
+ );
+ ?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/partials/metaboxes/plan-start-date.php b/admin/partials/metaboxes/plan-start-date.php
new file mode 100644
index 0000000..246617d
--- /dev/null
+++ b/admin/partials/metaboxes/plan-start-date.php
@@ -0,0 +1,41 @@
+ID, '_startdate_days', true );
+$plan = get_post_meta( $post->ID, '_startdate_plan_code', true );
+$enabled = get_post_meta( $post->ID, '_startdate_enabled', true );
+
+if ( empty( $days ) ) {
+ $days = '';
+}
+if ( empty( $plan ) ) {
+ $plan = '';
+}
+if ( empty( $enabled ) ) {
+ $enabled = 0;
+}
+?>
+
+
+
+
+
+
diff --git a/admin/partials/metaboxes/quantity-payment.php b/admin/partials/metaboxes/quantity-payment.php
new file mode 100644
index 0000000..b3f416a
--- /dev/null
+++ b/admin/partials/metaboxes/quantity-payment.php
@@ -0,0 +1,123 @@
+ID, '_usequantity', true );
+$useinventory = get_post_meta( $post->ID, '_useinventory', true );
+$inventory = get_post_meta( $post->ID, '_inventory', true );
+$sold = get_post_meta( $post->ID, '_sold', true );
+$quantity = get_post_meta( $post->ID, '_quantity', true );
+$quantityunit = get_post_meta( $post->ID, '_quantityunit', true );
+$recur = get_post_meta( $post->ID, '_recur', true );
+
+if ( empty( $usequantity ) ) {
+ $usequantity = 'no';
+}
+if ( empty( $useinventory ) ) {
+ $useinventory = 'no';
+}
+if ( empty( $quantity ) ) {
+ $quantity = '1';
+}
+if ( empty( $inventory ) ) {
+ if ( '' !== $sold ) {
+ $inventory = $sold;
+ } else {
+ $inventory = '1';
+ }
+}
+if ( empty( $sold ) ) {
+ $sold = '0';
+}
+$stock = $inventory - $sold;
+if ( empty( $quantityunit ) ) {
+ $quantityunit = __( 'Quantity', 'payment-forms-for-paystack' );
+}
+?>
+
+
+
+
+
+
+
+ >
+
+
+
+
+
+ >
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Quantity', 'payment-forms-for-paystack' ),
+ array(
+ 'code' => array(),
+ )
+ )
+ ?>
+
+
+
+
+
+
+
+
+
+ >
+
+
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/partials/metaboxes/recurring-payment.php b/admin/partials/metaboxes/recurring-payment.php
new file mode 100644
index 0000000..0af4c9e
--- /dev/null
+++ b/admin/partials/metaboxes/recurring-payment.php
@@ -0,0 +1,34 @@
+ID, '_recur', true );
+$recurplan = get_post_meta( $post->ID, '_recurplan', true );
+
+if ( empty( $recur ) ) {
+ $recur = 'no';
+}
+if ( empty( $recurplan ) ) {
+ $recurplan = '';
+}
+?>
+
+
+
+
diff --git a/admin/partials/metaboxes/sub-account.php b/admin/partials/metaboxes/sub-account.php
new file mode 100644
index 0000000..581ef4a
--- /dev/null
+++ b/admin/partials/metaboxes/sub-account.php
@@ -0,0 +1,43 @@
+ID, '_subaccount', true );
+$txnbearer = get_post_meta( $post->ID, '_txnbearer', true );
+$merchantamount = get_post_meta( $post->ID, '_merchantamount', true );
+
+if ( empty( $subaccount ) ) {
+ $subaccount = '';
+}
+if ( empty( $merchantamount ) ) {
+ $merchantamount = '';
+}
+?>
+
+
+
+
+
+
+
+
+ >
+
+
+ >
+
+
+
+
+
+
From 87524e293b7da6fa27cb04850ef67f58984c3ec1 Mon Sep 17 00:00:00 2001
From: Tunbosun Ayinla
Date: Tue, 19 Sep 2023 10:04:57 +0100
Subject: [PATCH 2/6] Add quicktags.js script
---
admin/js/quicktags.js | 93 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)
create mode 100644 admin/js/quicktags.js
diff --git a/admin/js/quicktags.js b/admin/js/quicktags.js
new file mode 100644
index 0000000..1d5f7e2
--- /dev/null
+++ b/admin/js/quicktags.js
@@ -0,0 +1,93 @@
+//this function is used to retrieve the selected text from the text editor
+function getSel() {
+ var txtarea = document.getElementById( "content" );
+ var start = txtarea.selectionStart;
+ var finish = txtarea.selectionEnd;
+ return txtarea.value.substring( start, finish );
+}
+
+QTags.addButton(
+ "t_shortcode",
+ "Insert Text",
+ insertText
+);
+
+function insertText() {
+ QTags.insertContent( '[text name="Text Title"]' );
+}
+QTags.addButton(
+ "ta_shortcode",
+ "Insert Textarea",
+ insertTextarea
+);
+
+function insertTextarea() {
+ QTags.insertContent( '[textarea name="Text Title"]' );
+}
+QTags.addButton(
+ "s_shortcode",
+ "Insert Select Dropdown",
+ insertSelectb
+);
+
+function insertSelectb() {
+ QTags.insertContent( '[select name="Text Title" options="option 1,option 2,option 3"]' );
+}
+QTags.addButton(
+ "r_shortcode",
+ "Insert Radio Options",
+ insertRadiob
+);
+
+function insertRadiob() {
+ QTags.insertContent( '[radio name="Text Title" options="option 1,option 2,option 3"]' );
+}
+QTags.addButton(
+ "cb_shortcode",
+ "Insert Checkbox Options",
+ insertCheckboxb
+);
+
+function insertCheckboxb() {
+ QTags.insertContent( '[checkbox name="Text Title" options="option 1,option 2,option 3"]' );
+}
+QTags.addButton(
+ "dp_shortcode",
+ "Insert Datepicker",
+ insertDatepickerb
+);
+
+function insertDatepickerb() {
+ QTags.insertContent( '[datepicker name="Datepicker Title"]' );
+}
+QTags.addButton(
+ "i_shortcode",
+ "Insert File Upload",
+ insertInput
+);
+
+function insertInput() {
+ QTags.insertContent( '[input name="File Name"]' );
+}
+QTags.addButton(
+ "ngs_shortcode",
+ "Insert Nigerian States",
+ insertSelectStates
+);
+
+function insertSelectStates() {
+ QTags.insertContent(
+ '[select name="State" options="Abia,Adamawa,Akwa Ibom,Anambra,Bauchi,Bayelsa,Benue,Borno,Cross River,Delta,Ebonyi,Edo,Ekiti,Enugu,FCT,Gombe,Imo,Jigawa,Kaduna,Kano,Katsina,Kebbi,Kogi,Kwara,Lagos,Nasarawa,Niger,Ogun,Ondo,Osun,Oyo,Plateau,Rivers,Sokoto,Taraba,Yobe,Zamfara"]'
+ );
+}
+QTags.addButton(
+ "ctys_shortcode",
+ "Insert All Countries",
+ insertSelectCountries
+);
+
+function insertSelectCountries() {
+ QTags.insertContent(
+ '[select name="country" options="Afghanistan, Albania, Algeria, American Samoa, Andorra, Angola, Anguilla, Antarctica, Antigua and Barbuda, Argentina, Armenia, Aruba, Australia, Austria, Azerbaijan, Bahamas, Bahrain, Bangladesh, Barbados, Belarus, Belgium, Belize, Benin, Bermuda, Bhutan, Bolivia, Bosnia and Herzegovina, Botswana, Bouvet Island, Brazil, British Indian Ocean Territory, Brunei Darussalam, Bulgaria, Burkina Faso, Burundi, Cambodia, Cameroon, Canada, Cape Verde, Cayman Islands, Central African Republic, Chad, Chile, China, Christmas Island, Cocos (Keeling) Islands, Colombia, Comoros, Congo, Congo, The Democratic Republic of The, Cook Islands, Costa Rica, Cote D’ivoire, Croatia, Cuba, Cyprus, Czech Republic, Denmark, Djibouti, Dominica, Dominican Republic, Ecuador, Egypt, El Salvador, Equatorial Guinea, Eritrea, Estonia, Ethiopia, Falkland Islands (Malvinas), Faroe Islands, Fiji, Finland, France, French Guiana, French Polynesia, French Southern Territories, Gabon, Gambia, Georgia, Germany, Ghana, Gibraltar, Greece, Greenland, Grenada, Guadeloupe, Guam, Guatemala, Guinea, Guinea-bissau, Guyana, Haiti, Heard Island and Mcdonald Islands, Holy See (Vatican City State), Honduras, Hong Kong, Hungary, Iceland, India, Indonesia, Iran, Islamic Republic of, Iraq, Ireland, Israel, Italy, Jamaica, Japan, Jordan, Kazakhstan, Kenya, Kiribati, Korea, Democratic People’s Republic of, Korea, Republic of, Kuwait, Kyrgyzstan, Lao People’s Democratic Republic, Latvia, Lebanon, Lesotho, Liberia, Libyan Arab Jamahiriya, Liechtenstein, Lithuania, Luxembourg, Macao, Macedonia, The Former Yugoslav Republic of, Madagascar, Malawi, Malaysia, Maldives, Mali, Malta, Marshall Islands, Martinique, Mauritania, Mauritius, Mayotte, Mexico, Micronesia, Federated States of, Moldova, Republic of, Monaco, Mongolia, Montserrat, Morocco, Mozambique, Myanmar, Namibia, Nauru, Nepal, Netherlands, Netherlands Antilles, New Caledonia, New Zealand, Nicaragua, Niger, Nigeria, Niue, Norfolk Island, Northern Mariana Islands, Norway, Oman, Pakistan, Palau, Palestinian Territory, Occupied, Panama, Papua New Guinea, Paraguay, Peru, Philippines, Pitcairn, Poland, Portugal, Puerto Rico, Qatar, Reunion, Romania, Russian Federation, Rwanda, Saint Helena, Saint Kitts and Nevis, Saint Lucia, Saint Pierre and Miquelon, Saint Vincent and The Grenadines, Samoa, San Marino, Sao Tome and Principe, Saudi Arabia, Senegal, Serbia and Montenegro, Seychelles, Sierra Leone, Singapore, Slovakia, Slovenia, Solomon Islands, Somalia, South Africa, South Georgia and The South Sandwich Islands, Spain, Sri Lanka, Sudan, Suriname, Svalbard and Jan Mayen, Swaziland, Sweden, Switzerland, Syrian Arab Republic, Taiwan, Province of China, Tajikistan, Tanzania, United Republic of, Thailand, Timor-leste, Togo, Tokelau, Tonga, Trinidad and Tobago, Tunisia, Turkey, Turkmenistan, Turks and Caicos Islands, Tuvalu, Uganda, Ukraine, United Arab Emirates, United Kingdom, United States, United States Minor Outlying Islands, Uruguay, Uzbekistan, Vanuatu, Venezuela, Viet Nam, Virgin Islands, British, Virgin Islands, U.S., Wallis and Futuna, Western Sahara, Yemen, Zambia, Zimbabwe"] '
+ );
+}
\ No newline at end of file
From 8e7a5c6ca2b5528acf8c26aeb4192ee6b33c0ebb Mon Sep 17 00:00:00 2001
From: Tunbosun Ayinla
Date: Tue, 19 Sep 2023 10:11:36 +0100
Subject: [PATCH 3/6] Remove unused file
---
...s-paystack-forms-public-for-old-themes.php | 1932 -----------------
1 file changed, 1932 deletions(-)
delete mode 100644 public/class-paystack-forms-public-for-old-themes.php
diff --git a/public/class-paystack-forms-public-for-old-themes.php b/public/class-paystack-forms-public-for-old-themes.php
deleted file mode 100644
index d1fac5e..0000000
--- a/public/class-paystack-forms-public-for-old-themes.php
+++ /dev/null
@@ -1,1932 +0,0 @@
-plugin_name = $plugin_name;
- $this->version = $version;
- }
- public function enqueue_styles()
- {
- wp_enqueue_style($this->plugin_name.'1', plugin_dir_url(__FILE__) . 'css/pff-paystack-style.css', array(), $this->version, 'all');
- wp_enqueue_style($this->plugin_name.'2', plugin_dir_url(__FILE__) . 'css/font-awesome.min.css', array(), $this->version, 'all');
- }
-
- public static function fetchPublicKey()
- {
- $mode = esc_attr(get_option('mode'));
- if ($mode == 'test') {
- $key = esc_attr(get_option('tpk'));
- } else {
- $key = esc_attr(get_option('lpk'));
- }
- return $key;
- }
-
- public static function fetchFeeSettings()
- {
- $ret = [];
- $ret['prc'] = intval(floatval(esc_attr(get_option('prc', 1.5))) * 100) / 10000;
- $ret['ths'] = intval(floatval(esc_attr(get_option('ths', 2500))) * 100);
- $ret['adc'] = intval(floatval(esc_attr(get_option('adc', 100))) * 100);
- $ret['cap'] = intval(floatval(esc_attr(get_option('cap', 2000))) * 100);
- return $ret;
- }
-
- public function enqueue_scripts()
- {
- wp_enqueue_script('blockUI', plugin_dir_url(__FILE__) . 'js/jquery.blockUI.min.js', false, $this->version);
- wp_enqueue_script('jquery-ui-core');
- wp_register_script('Paystack', 'https://js.paystack.co/v1/inline.js', false, '1');
- wp_enqueue_script('Paystack');
- wp_enqueue_script('paystack_frontend', plugin_dir_url(__FILE__) . 'js/paystack-forms-public.js', false, $this->version);
- wp_localize_script('paystack_frontend', 'kkd_pff_settings', array('key'=> Kkd_Pff_Paystack_Public::fetchPublicKey(), 'fee'=>Kkd_Pff_Paystack_Public::fetchFeeSettings()), $this->version, true, true);
- }
-}
-
-define('KKD_PFF_PAYSTACK_PERCENTAGE', 0.015);
-define('KKD_PFF_PAYSTACK_CROSSOVER_TOTAL', 250000);
-define('KKD_PFF_PAYSTACK_ADDITIONAL_CHARGE', 10000);
-define('KKD_PFF_PAYSTACK_LOCAL_CAP', 200000);
-
-define('KKD_PFF_PAYSTACK_CHARGE_DIVIDER', floatval(1-KKD_PFF_PAYSTACK_PERCENTAGE));
-define('KKD_PFF_PAYSTACK_CROSSOVER_AMOUNT', intval((KKD_PFF_PAYSTACK_CROSSOVER_TOTAL*KKD_PFF_PAYSTACK_CHARGE_DIVIDER)-KKD_PFF_PAYSTACK_ADDITIONAL_CHARGE));
-define('KKD_PFF_PAYSTACK_FLATLINE_AMOUNT_PLUS_CHARGE', intval((KKD_PFF_PAYSTACK_LOCAL_CAP-KKD_PFF_PAYSTACK_ADDITIONAL_CHARGE)/KKD_PFF_PAYSTACK_PERCENTAGE));
-define('KKD_PFF_PAYSTACK_FLATLINE_AMOUNT', KKD_PFF_PAYSTACK_FLATLINE_AMOUNT_PLUS_CHARGE - KKD_PFF_PAYSTACK_LOCAL_CAP);
-
-function kkd_pff_paystack_add_paystack_charge($amount)
-{
- // $amountinkobo = $amount; // * 100;
- $charge = 0;
- $amount = intval($amount);
- if ($amount <= 2500) {
- $charge = floatval($amount*KKD_PFF_PAYSTACK_PERCENTAGE);
- } else {
- $charge = floatval($amount*KKD_PFF_PAYSTACK_PERCENTAGE)+100;
- }
- // echo $charge;
- if ($charge > 2000) {
- $charge = 2000;
- }
- $amount += $charge;
- return $amount;
- // if ($amountinkobo > KKD_PFF_PAYSTACK_FLATLINE_AMOUNT)
- // return ($amountinkobo + KKD_PFF_PAYSTACK_LOCAL_CAP)/100;
- // elseif ($amountinkobo > KKD_PFF_PAYSTACK_CROSSOVER_AMOUNT)
- // return (intval(($amountinkobo + KKD_PFF_PAYSTACK_ADDITIONAL_CHARGE) / KKD_PFF_PAYSTACK_CHARGE_DIVIDER))/100;
- // else
- // return (intval($amountinkobo / KKD_PFF_PAYSTACK_CHARGE_DIVIDER))/100;
-}
-
-add_filter("wp_mail_content_type", "kkd_pff_paystack_mail_content_type");
-function kkd_pff_paystack_mail_content_type()
-{
- return "text/html";
-}
-add_filter("wp_mail_from_name", "kkd_pff_paystack_mail_from_name");
-function kkd_pff_paystack_mail_from_name()
-{
- $name = get_option('blogname');
- return $name;
-}
-
-
-function kkd_pff_paystack_send_invoice($currency, $amount, $name, $email, $code)
-{
- // echo date('F j,Y');
- $user_email = stripslashes($email);
-
- $email_subject = "Payment Invoice for ".$currency.' '.number_format($amount);
-
- ob_start(); ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- You're getting this email because you tried making a payment to .
-
-
-
- Use this link below to try again, if you encountered any issue while trying to make the payment.
-
-
-
- Try Again
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- " . "\r\n");
- $headers = "From: ".$website."<$admin_email>" . "\r\n";
- wp_mail($user_email, $email_subject, $message, $headers);
-}
-function kkd_pff_paystack_send_receipt($id, $currency, $amount, $name, $email, $code, $metadata)
-{
- // echo date('F j,Y');
- $user_email = stripslashes($email);
- $subject = get_post_meta($id, '_subject', true);
- $merchant = get_post_meta($id, '_merchant', true);
- $heading = get_post_meta($id, '_heading', true);
- $sitemessage = get_post_meta($id, '_message', true);
-
- $email_subject =$subject;
-
- ob_start(); ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Hello ,
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Your Details
-
-
-
-
- Amount :
- Email :
- $item) {
- if ($item->type == 'text') {
- echo $item->display_name." :".$item->value." ";
- } else {
- echo $item->display_name." : link ";
- }
- }
- } else {
- $text = '';
- if (count($new) > 0) {
- foreach ($new as $key => $item) {
- echo $key." :".$item." ";
- }
- }
- } ?>
- Transaction code:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Notice
- You're getting this email because you've made a payment of to .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- " . "\r\n");
- $headers = "From: ".$website."<$admin_email>" . "\r\n";
- wp_mail($user_email, $email_subject, $message, $headers);
-}
-function kkd_pff_paystack_send_receipt_owner($id, $currency, $amount, $name, $email, $code, $metadata)
-{
- // echo date('F j,Y');
- $user_email = stripslashes($email);
- $subject = "You just received a payment";
- $heading = get_post_meta($id, '_heading', true);
- $sitemessage = get_post_meta($id, '_message', true);
-
- $email_subject =$subject;
-
- ob_start(); ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- You just received a payment
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Payment Details
-
-
-
-
- Amount :
- Email :
- $item) {
- if ($item->type == 'text') {
- echo $item->display_name." :".$item->value." ";
- } else {
- echo $item->display_name." : link ";
- }
- }
- } else {
- $text = '';
- if (count($new) > 0) {
- foreach ($new as $key => $item) {
- echo $key." :".$item." ";
- }
- }
- } ?>
- Transaction code:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Notice
- You're getting this email because someone made a payment of to .
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- " . "\r\n");
- $headers = "From: ".$website."<$admin_email>" . "\r\n";
- wp_mail($admin_email, $email_subject, $message, $headers);
-}
-function kkd_pff_paystack_fetch_plan($code)
-{
- $mode = esc_attr(get_option('mode'));
- if ($mode == 'test') {
- $key = esc_attr(get_option('tsk'));
- } else {
- $key = esc_attr(get_option('lsk'));
- }
- $paystack_url = 'https://api.paystack.co/plan/' . $code;
- $headers = array(
- 'Authorization' => 'Bearer ' . $key
- );
- $args = array(
- 'headers' => $headers,
- 'timeout' => 60
- );
- $request = wp_remote_get($paystack_url, $args);
- if (! is_wp_error($request)) {
- $paystack_response = json_decode(wp_remote_retrieve_body($request));
- }
- return $paystack_response;
-}
-function kkd_pff_paystack_form_shortcode($atts)
-{
- ob_start();
-
- global $current_user;
- $user_id = $current_user->ID;
- $email = $current_user->user_email;
- $fname = $current_user->user_firstname;
- $lname = $current_user->user_lastname;
- if ($fname == '' && $lname == '') {
- $fullname = '';
- } else {
- $fullname = $fname.' '.$lname;
- }
- extract(
- shortcode_atts(
- array(
- 'id' => 0,
- ),
- $atts
- )
- );
- $pk = Kkd_Pff_Paystack_Public::fetchPublicKey();
- if (!$pk) {
- $settingslink = get_admin_url().'edit.php?post_type=paystack_form&page=class-paystack-forms-admin.php';
- echo "You must set your Paystack API keys first settings ";
- } elseif ($id != 0) {
- $obj = get_post($id);
- if ($obj->post_type == 'paystack_form') {
- $amount = get_post_meta($id, '_amount', true);
- $thankyou = get_post_meta($id, '_successmsg', true);
- $paybtn = get_post_meta($id, '_paybtn', true);
- $loggedin = get_post_meta($id, '_loggedin', true);
- $txncharge = get_post_meta($id, '_txncharge', true);
- $currency = get_post_meta($id, '_currency', true);
- $recur = get_post_meta($id, '_recur', true);
- $recurplan = get_post_meta($id, '_recurplan', true);
- $usequantity = get_post_meta($id, '_usequantity', true);
- $quantity = get_post_meta($id, '_quantity', true);
- $useagreement = get_post_meta($id, '_useagreement', true);
- $agreementlink = get_post_meta($id, '_agreementlink', true);
- $minimum = get_post_meta($id, '_minimum', true);
- $variableamount = get_post_meta($id, '_variableamount', true);
- $usevariableamount = get_post_meta($id, '_usevariableamount', true);
- $hidetitle = get_post_meta($id, '_hidetitle', true);
- if ($minimum == "") {
- $minimum = 0;
- }
- if ($usevariableamount == "") {
- $usevariableamount = 0;
- }
-
- if ($usevariableamount == 1) {
- $paymentoptions = explode(',', $variableamount);
- // echo "";
- // print_r($paymentoptions);
- // echo " ";
- // die();
- }
- $showbtn = true;
- $planerrorcode = 'Input Correct Recurring Plan Code';
- if ($recur == 'plan') {
- if ($recurplan == '' || $recurplan == null) {
- $showbtn = false;
- } else {
- $plan = kkd_pff_paystack_fetch_plan($recurplan);
- if (isset($plan->data->amount)) {
- $planamount = $plan->data->amount/100;
- } else {
- $showbtn = false;
- }
- }
- }
- if ((($user_id != 0) && ($loggedin == 'yes')) || $loggedin == 'no') {
- if ($hidetitle != 1) {
- echo "";
- }
- echo '';
- } else {
- echo "You must be logged in to make payment ";
- }
- }
- }
-
-
-
- return ob_get_clean();
-}
-add_shortcode('pff-paystack', 'kkd_pff_paystack_form_shortcode');
-
-function kkd_pff_paystack_datepicker_shortcode($atts)
-{
- extract(
- shortcode_atts(
- array(
- 'name' => 'Title',
- 'required' => '0',
- ),
- $atts
- )
- );
- $code = '
-
'.$name;
- if ($required == 'required') {
- $code.= ' * ';
- }
- $code.= '
-
-
';
- return $code;
-}
-add_shortcode('datepicker', 'kkd_pff_paystack_datepicker_shortcode');
-
-
-function kkd_pff_paystack_text_shortcode($atts)
-{
- extract(
- shortcode_atts(
- array(
- 'name' => 'Title',
- 'required' => '0',
- ),
- $atts
- )
- );
- $code = '
-
'.$name;
- if ($required == 'required') {
- $code.= ' * ';
- }
- $code.= '
-
-
';
- return $code;
-}
-add_shortcode('text', 'kkd_pff_paystack_text_shortcode');
-function kkd_pff_paystack_select_shortcode($atts)
-{
- extract(
- shortcode_atts(
- array(
- 'name' => 'Title',
- 'options' => '',
- 'required' => '0',
- ),
- $atts
- )
- );
- $code = '
-
'.$name;
- if ($required == 'required') {
- $code.= ' * ';
- }
- $code.= '
-
- ";
-
- $soptions = explode(',', $options);
- if (count($soptions) > 0) {
- foreach ($soptions as $key => $option) {
- $code.= ''.$option.' ';
- }
- }
- $code.= '"
';
- return $code;
-}
-add_shortcode('select', 'kkd_pff_paystack_select_shortcode');
-function kkd_pff_paystack_radio_shortcode($atts)
-{
- extract(
- shortcode_atts(
- array(
- 'name' => 'Title',
- 'options' => '',
- 'required' => '0',
- ),
- $atts
- )
- );
- $code = '
-
'.$name;
- if ($required == 'required') {
- $code.= ' * ';
- }
- $code.= '
-
- ';
- $soptions = explode(',', $options);
- if (count($soptions) > 0) {
- foreach ($soptions as $key => $option) {
- // $code.= ''.$option.' ';
- $code.= '
-
-
- '.$option.'
- ';
- }
- }
- $code.= '
';
- return $code;
-}
-add_shortcode('radio', 'kkd_pff_paystack_radio_shortcode');
-function kkd_pff_paystack_checkbox_shortcode($atts)
-{
- extract(
- shortcode_atts(
- array(
- 'name' => 'Title',
- 'options' => '',
- 'required' => '0',
- ),
- $atts
- )
- );
- $code = '
-
'.$name;
- if ($required == 'required') {
- $code.= ' * ';
- }
- $code.= '
-
- ';
- //
-
- $soptions = explode(',', $options);
- if (count($soptions) > 0) {
- foreach ($soptions as $key => $option) {
- // $code.= '
'.$option.' ';
- $code.= '
-
-
- '.$option.'
- ';
- }
- }
- $code.= '
';
- return $code;
-}
-add_shortcode('checkbox', 'kkd_pff_paystack_checkbox_shortcode');
-function kkd_pff_paystack_textarea_shortcode($atts)
-{
- extract(
- shortcode_atts(
- array(
- 'name' => 'Title',
- 'required' => '0',
- ),
- $atts
- )
- );
- $code = '
-
'.$name;
- if ($required == 'required') {
- $code.= ' * ';
- }
- $code.= '
-
-
';
- return $code;
-}
-add_shortcode('textarea', 'kkd_pff_paystack_textarea_shortcode');
-function kkd_pff_paystack_input_shortcode($atts)
-{
- extract(
- shortcode_atts(
- array(
- 'name' => 'Title',
- 'required' => '0',
- ),
- $atts
- )
- );
-
- $uniqq = kkd_pff_paystack_generate_new_code();
- $code = '
-
'.$name;
- if ($required == 'required') {
- $code.= ' * ';
- }
- $code.= '
-
';
- return $code;
-}
-add_shortcode('input', 'kkd_pff_paystack_input_shortcode');
-
-// Save the Metabox Data
-function kkd_pff_paystack_generate_new_code($length = 10)
-{
- $characters = '06EFGHI9KL'.time().'MNOPJRSUVW01YZ923234'.time().'ABCD5678QXT';
- $charactersLength = strlen($characters);
- $randomString = '';
- for ($i = 0; $i < $length; $i++) {
- $randomString .= $characters[rand(0, $charactersLength - 1)];
- }
- return time()."_".$randomString;
-}
-function kkd_pff_paystack_check_code($code)
-{
- global $wpdb;
- $table = $wpdb->prefix.KKD_PFF_PAYSTACK_TABLE;
- $o_exist = $wpdb->get_results("SELECT * FROM $table WHERE txn_code = '".$code."'");
-
- if (count($o_exist) > 0) {
- $result = true;
- } else {
- $result = false;
- }
-
- return $result;
-}
-function kkd_pff_paystack_generate_code()
-{
- $code = 0;
- $check = true;
- while ($check) {
- $code = kkd_pff_paystack_generate_new_code();
- $check = kkd_pff_paystack_check_code($code);
- }
-
- return $code;
-}
-function kkd_pff_paystack_get_the_user_ip()
-{
- if (! empty($_SERVER['HTTP_CLIENT_IP'])) {
- $ip = $_SERVER['HTTP_CLIENT_IP'];
- } elseif (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
- } else {
- $ip = $_SERVER['REMOTE_ADDR'];
- }
- return $ip;
-}
-
-add_action('wp_ajax_kkd_pff_paystack_submit_action', 'kkd_pff_paystack_submit_action');
-add_action('wp_ajax_nopriv_kkd_pff_paystack_submit_action', 'kkd_pff_paystack_submit_action');
-function kkd_pff_paystack_submit_action()
-{
- if (trim($_POST['pf-pemail']) == '') {
- $response['result'] = 'failed';
- $response['message'] = 'Email is required';
-
- // Exit here, for not processing further because of the error
- exit(json_encode($response));
- }
-
- // Hookable location. Allows other plugins use a fresh submission before it is saved to the database.
- // Such a plugin only needs do
- // add_action( 'kkd_pff_paystack_before_save', 'function_to_use_posted_values' );
- // somewhere in their code;
- do_action('kkd_pff_paystack_before_save');
-
- global $wpdb;
- $code = kkd_pff_paystack_generate_code();
-
- $table = $wpdb->prefix.KKD_PFF_PAYSTACK_TABLE;
- $metadata = $_POST;
- $fullname = $_POST['pf-fname'];
- $recur = $_POST['pf-recur'];
- unset($metadata['action']);
- unset($metadata['pf-recur']);
- unset($metadata['pf-id']);
- unset($metadata['pf-pemail']);
- unset($metadata['pf-amount']);
- unset($metadata['pf-user_id']);
- unset($metadata['pf-interval']);
-
- // echo '';
- // print_r($_POST);
-
- $fixedmetadata = kkd_pff_paystack_meta_as_custom_fields($metadata);
- // print_r($fixedmetadata );
- $filelimit = get_post_meta($_POST["pf-id"], '_filelimit', true);
- $currency = get_post_meta($_POST["pf-id"], '_currency', true);
- $formamount = get_post_meta($_POST["pf-id"], '_amount', true);/// From form
- $recur = get_post_meta($_POST["pf-id"], '_recur', true);
- $subaccount = get_post_meta($_POST["pf-id"], '_subaccount', true);
- $txnbearer = get_post_meta($_POST["pf-id"], '_txnbearer', true);
- $transaction_charge = get_post_meta($_POST["pf-id"], '_merchantamount', true);
- $transaction_charge = $transaction_charge*100;
-
- $txncharge = get_post_meta($_POST["pf-id"], '_txncharge', true);
- $minimum = get_post_meta($_POST["pf-id"], '_minimum', true);
- $variableamount = get_post_meta($_POST["pf-id"], '_variableamount', true);
- $usevariableamount = get_post_meta($_POST["pf-id"], '_usevariableamount', true);
- $amount = (int)str_replace(' ', '', $_POST["pf-amount"]);
- $variablename = $_POST["pf-vname"];
- // pf-vname
- $originalamount = $amount;
- $quantity = 1;
- $usequantity = get_post_meta($_POST["pf-id"], '_usequantity', true);
-
- if (($recur == 'no') && ($formamount != 0)) {
- $amount = (int)str_replace(' ', '', $formamount);
- }
- if ($minimum == 1 && $formamount != 0) {
- if ($originalamount < $formamount) {
- $amount = $formamount;
- } else {
- $amount = $originalamount;
- }
- }
- if ($usevariableamount == 1) {
- $paymentoptions = explode(',', $variableamount);
- if (count($paymentoptions) > 0) {
- foreach ($paymentoptions as $key => $paymentoption) {
- list($a, $b) = explode(':', $paymentoption);
- if ($variablename == $a) {
- $amount = $b;
- }
- }
- }
- }
- $fixedmetadata[] = array(
- 'display_name' => 'Unit Price',
- 'variable_name' => 'Unit_Price',
- 'type' => 'text',
- 'value' => $currency.number_format($amount)
- );
- if ($usequantity != 'no') {
- $quantity = $_POST["pf-quantity"];
- $unitamount = (int)str_replace(' ', '', $amount);
- $amount = $quantity*$unitamount;
- }
-
-
-
- if ($txncharge == 'customer') {
- $amount = kkd_pff_paystack_add_paystack_charge($amount);
- }
- $maxFileSize = $filelimit * 1024 * 1024;
-
- if (!empty($_FILES)) {
- foreach ($_FILES as $keyname => $value) {
- if ($value['size'] > 0) {
- if ($value['size'] > $maxFileSize) {
- $response['result'] = 'failed';
- $response['message'] = 'Max upload size is '.$filelimit."MB";
- exit(json_encode($response));
- } else {
- $attachment_id = media_handle_upload($keyname, $_POST["pf-id"]);
- $url = wp_get_attachment_url($attachment_id);
- $fixedmetadata[] = array(
- 'display_name' => ucwords(str_replace("_", " ", $keyname)),
- 'variable_name' => $keyname,
- 'type' => 'link',
- 'value' => $url
- );
- }
- } else {
- $fixedmetadata[] = array(
- 'display_name' => ucwords(str_replace("_", " ", $keyname)),
- 'variable_name' => $keyname,
- 'type' => 'text',
- 'value' => 'No file Uploaded'
- );
- }
- }
- }
- $plancode = 'none';
- if ($recur != 'no') {
- if ($recur == 'optional') {
- $interval = $_POST['pf-interval'];
- if ($interval != 'no') {
- unset($metadata['pf-interval']);
- $mode = esc_attr(get_option('mode'));
- if ($mode == 'test') {
- $key = esc_attr(get_option('tsk'));
- } else {
- $key = esc_attr(get_option('lsk'));
- }
- $koboamount = $amount*100;
- //Create Plan
- $paystack_url = 'https://api.paystack.co/plan';
- $check_url = 'https://api.paystack.co/plan?amount='.$koboamount.'&interval='.$interval;
- $headers = array(
- 'Content-Type' => 'application/json',
- 'Authorization' => 'Bearer ' . $key
- );
-
- $checkargs = array(
- 'headers' => $headers,
- 'timeout' => 60
- );
- // Check if plan exist
- $checkrequest = wp_remote_get($check_url, $checkargs);
- if (!is_wp_error($checkrequest)) {
- $response = json_decode(wp_remote_retrieve_body($checkrequest));
- if ($response->meta->total >= 1) {
- $plan = $response->data[0];
- $plancode = $plan->plan_code;
- $fixedmetadata[] = array(
- 'display_name' => 'Plan Interval',
- 'variable_name' => 'Plan Interval',
- 'type' => 'text',
- 'value' => $plan->interval
- );
- } else {
- //Create Plan
- $body = array(
- 'name' => $currency.number_format($originalamount).' ['.$currency.number_format($amount).'] - '.$interval,
- 'amount' => $koboamount,
- 'interval' => $interval
- );
- $args = array(
- 'body' => json_encode($body),
- 'headers' => $headers,
- 'timeout' => 60
- );
-
- $request = wp_remote_post($paystack_url, $args);
- if (! is_wp_error($request)) {
- $paystack_response = json_decode(wp_remote_retrieve_body($request));
- $plancode = $paystack_response->data->plan_code;
- $fixedmetadata[] = array(
- 'display_name' => 'Plan Interval',
- 'variable_name' => 'Plan Interval',
- 'type' => 'text',
- 'value' => $paystack_response->data->interval
- );
- }
- }
- }
- }
- } else {
- //Use Plan Code
- $plancode = $_POST['pf-plancode'];
- unset($metadata['pf-plancode']);
- }
- }
-
- if ($plancode != 'none') {
- $fixedmetadata[] = array(
- 'display_name' => 'Plan',
- 'variable_name' => 'Plan',
- 'type' => 'text',
- 'value' => $plancode
- );
- }
-
- $insert = array(
- 'post_id' => strip_tags($_POST["pf-id"], ""),
- 'email' => strip_tags($_POST["pf-pemail"], ""),
- 'user_id' => strip_tags($_POST["pf-user_id"], ""),
- 'amount' => strip_tags($amount, ""),
- 'plan' => strip_tags($plancode, ""),
- 'ip' => kkd_pff_paystack_get_the_user_ip(),
- 'txn_code' => $code,
- 'metadata' => json_encode($fixedmetadata)
- );
- $exist = $wpdb->get_results(
- "SELECT * FROM $table WHERE (post_id = '".$insert['post_id']."'
- AND email = '".$insert['email']."'
- AND user_id = '".$insert['user_id']."'
- AND amount = '".$insert['amount']."'
- AND plan = '".$insert['plan']."'
- AND ip = '".$insert['ip']."'
- AND paid = '0'
- AND metadata = '". $insert['metadata'] ."')"
- );
- if (count($exist) > 0) {
- // $insert['txn_code'] = $code;
- // $insert['plan'] = $exist[0]->plan;
- $wpdb->update($table, array( 'txn_code' => $code,'plan' =>$insert['plan']), array('id'=>$exist[0]->id));
- } else {
- $wpdb->insert(
- $table,
- $insert
- );
- // if("yes" == get_post_meta($insert['post_id'],'_sendinvoice',true)){
- kkd_pff_paystack_send_invoice($currency, $insert['amount'], $fullname, $insert['email'], $code);
- // }
- }
- if ($subaccount == "" || !isset($subaccount)) {
- $subaccount = null;
- $txnbearer = null;
- $transaction_charge = null;
- }
- if ($transaction_charge == "" || $transaction_charge == 0 || $transaction_charge == null) {
- $transaction_charge = null;
- }
-
- $amount = floatval($insert['amount'])*100;
- $response = array(
- 'result' => 'success',
- 'code' => $insert['txn_code'],
- 'plan' => $insert['plan'],
- 'quantity' => $quantity,
- 'email' => $insert['email'],
- 'name' => $fullname,
- 'total' => round($amount),
- 'custom_fields' => $fixedmetadata,
- 'currency' => $currency,
- 'subaccount' => $subaccount,
- 'txnbearer' => $txnbearer,
- 'transaction_charge' => $transaction_charge
- );
- // print_r($response);
- echo json_encode($response, JSON_NUMERIC_CHECK);
-
- die();
-}
-
-function kkd_pff_paystack_meta_as_custom_fields($metadata)
-{
- $custom_fields = array();
- foreach ($metadata as $key => $value) {
- if (is_array($value)) {
- $value = implode(', ', $value);
- }
- if ($key == 'pf-fname') {
- $custom_fields[] = array(
- 'display_name' => 'Full Name',
- 'variable_name' => 'Full_Name',
- 'type' => 'text',
- 'value' => $value
- );
- } elseif ($key == 'pf-plancode') {
- $custom_fields[] = array(
- 'display_name' => 'Plan',
- 'variable_name' => 'Plan',
- 'type' => 'text',
- 'value' => $value
- );
- } elseif ($key == 'pf-vname') {
- $custom_fields[] = array(
- 'display_name' => 'Payment Option',
- 'variable_name' => 'Payment Option',
- 'type' => 'text',
- 'value' => $value
- );
- } elseif ($key == 'pf-interval') {
- $custom_fields[] = array(
- 'display_name' => 'Plan Interval',
- 'variable_name' => 'Plan Interval',
- 'type' => 'text',
- 'value' => $value
- );
- } elseif ($key == 'pf-quantity') {
- $custom_fields[] = array(
- 'display_name' => 'Quantity',
- 'variable_name' => 'Quantity',
- 'type' => 'text',
- 'value' => $value
- );
- } else {
- $custom_fields[] = array(
- 'display_name' => ucwords(str_replace("_", " ", $key)),
- 'variable_name' => $key,
- 'type' => 'text',
- 'value' => $value
- );
- }
- }
- return $custom_fields;
-}
-
-add_action('wp_ajax_kkd_pff_paystack_confirm_payment', 'kkd_pff_paystack_confirm_payment');
-add_action('wp_ajax_nopriv_kkd_pff_paystack_confirm_payment', 'kkd_pff_paystack_confirm_payment');
-
-function kkd_pff_paystack_confirm_payment()
-{
- if (trim($_POST['code']) == '') {
- $response['error'] = true;
- $response['error_message'] = "Did you make a payment?";
-
- exit(json_encode($response));
- }
- global $wpdb;
- $table = $wpdb->prefix.KKD_PFF_PAYSTACK_TABLE;
- $code = $_POST['code'];
- $record = $wpdb->get_results("SELECT * FROM $table WHERE (txn_code = '".$code."')");
- if (array_key_exists("0", $record)) {
- $payment_array = $record[0];
- $amount = get_post_meta($payment_array->post_id, '_amount', true);
- $recur = get_post_meta($payment_array->post_id, '_recur', true);
- $currency = get_post_meta($payment_array->post_id, '_currency', true);
- $txncharge = get_post_meta($payment_array->post_id, '_txncharge', true);
- $redirect = get_post_meta($payment_array->post_id, '_redirect', true);
- $minimum = get_post_meta($payment_array->post_id, '_minimum', true);
- $usevariableamount = get_post_meta($payment_array->post_id, '_usevariableamount', true);
- $variableamount = get_post_meta($payment_array->post_id, '_variableamount', true);
-
- if ($minimum == 1 && $amount != 0) {
- if ($payment_array->amount < $formamount) {
- $amount = $formamount;
- } else {
- $amount = $payment_array->amount;
- }
- }
- $oamount = $amount;
- $mode = esc_attr(get_option('mode'));
- if ($mode == 'test') {
- $key = esc_attr(get_option('tsk'));
- } else {
- $key = esc_attr(get_option('lsk'));
- }
- $paystack_url = 'https://api.paystack.co/transaction/verify/' . $code;
- $headers = array(
- 'Authorization' => 'Bearer ' . $key
- );
- $args = array(
- 'headers' => $headers,
- 'timeout' => 60
- );
- $request = wp_remote_get($paystack_url, $args);
- if (! is_wp_error($request) && 200 == wp_remote_retrieve_response_code($request)) {
- $paystack_response = json_decode(wp_remote_retrieve_body($request));
- if ('success' == $paystack_response->data->status) {
- $customer_code = $paystack_response->data->customer->customer_code;
- $amount_paid = $paystack_response->data->amount / 100;
- $paystack_ref = $paystack_response->data->reference;
- $paid_at = $paystack_response->data->transaction_date;
- if ($recur == 'optional' || $recur == 'plan') {
- $wpdb->update($table, array( 'paid' => 1,'amount' => $amount_paid, 'paid_at' => $paid_at), array('txn_code'=>$paystack_ref));
- $thankyou = get_post_meta($payment_array->post_id, '_successmsg', true);
- $message = $thankyou;
- $result = "success";
- } else {
- if ($amount == 0 || $usevariableamount == 1) {
- $wpdb->update($table, array( 'paid' => 1,'amount' => $amount_paid, 'paid_at' => $paid_at), array('txn_code'=>$paystack_ref));
- $thankyou = get_post_meta($payment_array->post_id, '_successmsg', true);
- $message = $thankyou;
- $result = "success";
- // kkd_pff_paystack_send_receipt($currency,$amount,$name,$payment_array->email,$code,$metadata)
- } else {
- $usequantity = get_post_meta($payment_array->post_id, '_usequantity', true);
- if ($usequantity == 'no') {
- $oamount = (int)str_replace(' ', '', $amount);
- } else {
- $quantity = $_POST["quantity"];
- $unitamount = (int)str_replace(' ', '', $amount);
- $oamount = $quantity*$unitamount;
- }
- if ($txncharge == 'customer') {
- if ($minimum == 0 && $amount != 0) {
- $oamount = kkd_pff_paystack_add_paystack_charge($oamount);
- }
- }
-
- // if ($txncharge == 'customer') {
- // $amount = kkd_pff_paystack_add_paystack_charge($amount);
- // }
- if ($oamount != $amount_paid) {
- // echo $oamount. ' - '.$amount_paid;
- $message = "Invalid amount Paid. Amount required is ".$currency."".number_format($oamount)." ";
- $result = "failed";
- } else {
- $wpdb->update($table, array( 'paid' => 1, 'paid_at' => $paid_at), array('txn_code'=>$paystack_ref));
- $thankyou = get_post_meta($payment_array->post_id, '_successmsg', true);
- $message = $thankyou;
- $result = "success";
- }
- }
- }
- } else {
- $message = "Transaction Failed/Invalid Code";
- $result = "failed";
- }
- } else {
- $message = "Payment Verifiction Failed";
- $result = "failed";
- }
- } else {
- $message = "Payment Verification Failed.";
- $result = "failed";
- }
-
- if ($result == 'success') {
- ///
- //Create Plan
- $enabled_custom_plan = get_post_meta($payment_array->post_id, '_startdate_enabled', true);
- if ($enabled_custom_plan == 1) {
- $mode = esc_attr(get_option('mode'));
- if ($mode == 'test') {
- $key = esc_attr(get_option('tsk'));
- } else {
- $key = esc_attr(get_option('lsk'));
- }
- //Create Plan
- $paystack_url = 'https://api.paystack.co/subscription';
- $headers = array(
- 'Content-Type' => 'application/json',
- 'Authorization' => 'Bearer ' . $key
- );
- $custom_plan = get_post_meta($payment_array->post_id, '_startdate_plan_code', true);
- $days = get_post_meta($payment_array->post_id, '_startdate_days', true);
-
- $start_date = date("c", strtotime("+".$days." days"));
- $body = array(
- 'start_date' => $start_date,
- 'plan' => $custom_plan,
- 'customer' => $customer_code
- );
- $args = array(
- 'body' => json_encode($body),
- 'headers' => $headers,
- 'timeout' => 60
- );
-
- $request = wp_remote_post($paystack_url, $args);
- if (! is_wp_error($request)) {
- $paystack_response = json_decode(wp_remote_retrieve_body($request));
- $plancode = $paystack_response->data->subscription_code;
- // $message.= $message.'Subscribed '.$plancode.'sssss';
- }
- }
-
- $sendreceipt = get_post_meta($payment_array->post_id, '_sendreceipt', true);
- if ($sendreceipt == 'yes') {
- $decoded = json_decode($payment_array->metadata);
- $fullname = $decoded[0]->value;
- kkd_pff_paystack_send_receipt($payment_array->post_id, $currency, $amount_paid, $fullname, $payment_array->email, $paystack_ref, $payment_array->metadata);
- kkd_pff_paystack_send_receipt_owner($payment_array->post_id, $currency, $amount_paid, $fullname, $payment_array->email, $paystack_ref, $payment_array->metadata);
- }
- }
- $response = array(
- 'result' => $result,
- 'message' => $message,
- );
- if ($result == 'success' && $redirect != '') {
- $response['result'] = 'success2';
- $response['link'] = $redirect;
- }
-
-
- echo json_encode($response);
-
- die();
-}
-
-
-add_action('wp_ajax_kkd_pff_paystack_retry_action', 'kkd_pff_paystack_retry_action');
-add_action('wp_ajax_nopriv_kkd_pff_paystack_retry_action', 'kkd_pff_paystack_retry_action');
-function kkd_pff_paystack_retry_action()
-{
- if (trim($_POST['code']) == '') {
- $response['result'] = 'failed';
- $response['message'] = 'Cde is required';
-
- // Exit here, for not processing further because of the error
- exit(json_encode($response));
- }
- do_action('kkd_pff_paystack_before_save');
-
- global $wpdb;
- $code = $_POST['code'];
- $newcode = kkd_pff_paystack_generate_code();
- $newcode = $newcode.'_2';
- $insert = array();
- $table = $wpdb->prefix.KKD_PFF_PAYSTACK_TABLE;
- $record = $wpdb->get_results("SELECT * FROM $table WHERE (txn_code = '".$code."')");
- if (array_key_exists("0", $record)) {
- $dbdata = $record[0];
- $plan = $dbdata->plan;
- $quantity = 1;
- $wpdb->update($table, array( 'txn_code_2' => $newcode), array('txn_code' => $code));
-
- $currency = get_post_meta($dbdata->post_id, '_currency', true);
- $subaccount = get_post_meta($dbdata->post_id, '_subaccount', true);
- $txnbearer = get_post_meta($dbdata->post_id, '_txnbearer', true);
- $transaction_charge = get_post_meta($dbdata->post_id, '_merchantamount', true);
- $transaction_charge = $transaction_charge*100;
- $fixedmetadata = kkd_pff_paystack_meta_as_custom_fields($dbdata->metadata);
- $nmeta = json_decode($dbdata->metadata);
- foreach ($nmeta as $nkey => $nvalue) {
- if ($nvalue->variable_name == 'Quantity') {
- $quantity = $nvalue->value;
- }
- if ($nvalue->variable_name == 'Full_Name') {
- $fullname = $nvalue->value;
- }
- }
- }
- if ($subaccount == "" || !isset($subaccount)) {
- $subaccount = null;
- $txnbearer = null;
- $transaction_charge = null;
- }
- if ($transaction_charge == "" || $transaction_charge == 0 || $transaction_charge == null || !isset($transaction_charge)) {
- $transaction_charge = null;
- }
- $response = array(
- 'result' => 'success',
- 'code' => $newcode,
- 'plan' => $plan,
- 'quantity' => $quantity,
- 'email' => $dbdata->email,
- 'name' => $fullname,
- 'total' => $dbdata->amount*100,
- 'custom_fields' => $fixedmetadata,
- 'subaccount' => $subaccount,
- 'txnbearer' => $txnbearer,
- 'transaction_charge' => $transaction_charge
- );
- echo json_encode($response);
-
- die();
-}
-add_action('wp_ajax_kkd_pff_paystack_rconfirm_payment', 'kkd_pff_paystack_rconfirm_payment');
-add_action('wp_ajax_nopriv_kkd_pff_paystack_rconfirm_payment', 'kkd_pff_paystack_rconfirm_payment');
-
-function kkd_pff_paystack_rconfirm_payment()
-{
- if (trim($_POST['code']) == '') {
- $response['error'] = true;
- $response['error_message'] = "Did you make a payment?";
-
- exit(json_encode($response));
- }
- global $wpdb;
- $table = $wpdb->prefix.KKD_PFF_PAYSTACK_TABLE;
- $code = $_POST['code'];
- $record = $wpdb->get_results("SELECT * FROM $table WHERE (txn_code_2 = '".$code."')");
- if (array_key_exists("0", $record)) {
- $payment_array = $record[0];
- $amount = get_post_meta($payment_array->post_id, '_amount', true);
- $recur = get_post_meta($payment_array->post_id, '_recur', true);
- $currency = get_post_meta($payment_array->post_id, '_currency', true);
- $txncharge = get_post_meta($payment_array->post_id, '_txncharge', true);
- $redirect = get_post_meta($payment_array->post_id, '_redirect', true);
-
-
- $mode = esc_attr(get_option('mode'));
- if ($mode == 'test') {
- $key = esc_attr(get_option('tsk'));
- } else {
- $key = esc_attr(get_option('lsk'));
- }
- $paystack_url = 'https://api.paystack.co/transaction/verify/' . $code;
- $headers = array(
- 'Authorization' => 'Bearer ' . $key
- );
- $args = array(
- 'headers' => $headers,
- 'timeout' => 60
- );
- $request = wp_remote_get($paystack_url, $args);
- if (! is_wp_error($request) && 200 == wp_remote_retrieve_response_code($request)) {
- $paystack_response = json_decode(wp_remote_retrieve_body($request));
- if ('success' == $paystack_response->data->status) {
- $amount_paid = $paystack_response->data->amount / 100;
- $paystack_ref = $paystack_response->data->reference;
- $paid_at = $paystack_response->data->transaction_date;
- if ($recur == 'optional' || $recur == 'plan') {
- $wpdb->update($table, array( 'paid' => 1,'amount' =>$amount_paid,'paid_at' => $paid_at), array('txn_code_2'=>$paystack_ref));
- $thankyou = get_post_meta($payment_array->post_id, '_successmsg', true);
- $message = $thankyou;
- $result = "success";
- } else {
- if ($amount == 0) {
- $wpdb->update($table, array( 'paid' => 1,'amount' =>$amount_paid,'paid_at' => $paid_at), array('txn_code_2'=>$paystack_ref));
- $thankyou = get_post_meta($payment_array->post_id, '_successmsg', true);
- $message = $thankyou;
- $result = "success";
- // kkd_pff_paystack_send_receipt($currency,$amount,$name,$payment_array->email,$code,$metadata)
- } else {
- $usequantity = get_post_meta($payment_array->post_id, '_usequantity', true);
- if ($usequantity == 'no') {
- $amount = (int)str_replace(' ', '', $amount);
- } else {
- $quantity = $_POST["quantity"];
- $unitamount = (int)str_replace(' ', '', $amount);
- $amount = $quantity*$unitamount;
- }
-
-
- if ($txncharge == 'customer') {
- $amount = kkd_pff_paystack_add_paystack_charge($amount);
- }
- if ($amount != $amount_paid) {
- $message = "Invalid amount Paid. Amount required is ".$currency."".number_format($amount)." ";
- $result = "failed";
- } else {
- $wpdb->update($table, array( 'paid' => 1, 'paid_at' => $paid_at), array('txn_code_2'=>$paystack_ref));
- $thankyou = get_post_meta($payment_array->post_id, '_successmsg', true);
- $message = $thankyou;
- $result = "success";
- }
- }
- }
- } else {
- $message = "Transaction Failed/Invalid Code";
- $result = "failed";
- }
- }
- } else {
- $message = "Payment Verification Failed.";
- $result = "failed";
- }
-
- if ($result == 'success') {
- $sendreceipt = get_post_meta($payment_array->post_id, '_sendreceipt', true);
- if ($sendreceipt == 'yes') {
- $decoded = json_decode($payment_array->metadata);
- $fullname = $decoded[0]->value;
- kkd_pff_paystack_send_receipt($payment_array->post_id, $currency, $amount_paid, $fullname, $payment_array->email, $paystack_ref, $payment_array->metadata);
- kkd_pff_paystack_send_receipt_owner($payment_array->post_id, $currency, $amount_paid, $fullname, $payment_array->email, $paystack_ref, $payment_array->metadata);
- }
- }
- $response = array(
- 'result' => $result,
- 'message' => $message,
- );
- if ($result == 'success' && $redirect != '') {
- $response['result'] = 'success2';
- $response['link'] = $redirect;
- }
-
-
- echo json_encode($response);
-
- die();
-}
From 5bda9ccf061f0b276093d534604d417efdd7aa2a Mon Sep 17 00:00:00 2001
From: Tunbosun Ayinla
Date: Tue, 19 Sep 2023 10:30:47 +0100
Subject: [PATCH 4/6] Add settings partial
---
admin/partials/settings.php | 127 ++++++++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 admin/partials/settings.php
diff --git a/admin/partials/settings.php b/admin/partials/settings.php
new file mode 100644
index 0000000..9829c18
--- /dev/null
+++ b/admin/partials/settings.php
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+ here.', 'payment-forms-for-paystack' ),
+ array(
+ 'a' => array(
+ 'href' => array(),
+ 'target' => array(),
+ ),
+ )
+ )
+ ?>
+
+
+
+
From 6757ea643241ce225cadc93ddf73e16b62c796e0 Mon Sep 17 00:00:00 2001
From: Tunbosun Ayinla
Date: Tue, 19 Sep 2023 10:39:10 +0100
Subject: [PATCH 5/6] Refactor Paystack plugin tracker class
---
public/class-paystack-plugin-tracker.php | 47 ++++++++++--------------
1 file changed, 19 insertions(+), 28 deletions(-)
diff --git a/public/class-paystack-plugin-tracker.php b/public/class-paystack-plugin-tracker.php
index 30ecbe1..50f032a 100644
--- a/public/class-paystack-plugin-tracker.php
+++ b/public/class-paystack-plugin-tracker.php
@@ -1,38 +1,29 @@
plugin_name = $plugin;
- $this->public_key = $pk;
- }
+namespace Paystack_Plugins\Payment_Forms;
+class Paystack_Plugin_Tracker {
- function log_transaction_success($trx_ref){
- //send reference to logger along with plugin name and public key
- $url = "https://plugin-tracker.paystackintegrations.com/log/charge_success";
+ public static function log_transaction( $txn_ref ) {
- $fields = [
- 'plugin_name' => $this->plugin_name,
- 'transaction_reference' => $trx_ref,
- 'public_key' => $this->public_key
- ];
+ $public_key = paystack_forms_get_public_key();
- $fields_string = http_build_query($fields);
+ if ( empty( $public_key ) ) {
+ return;
+ }
- $ch = curl_init();
+ $url = 'https://plugin-tracker.paystackintegrations.com/log/charge_success';
- curl_setopt($ch,CURLOPT_URL, $url);
- curl_setopt($ch,CURLOPT_POST, true);
- curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
+ $body = array(
+ 'public_key' => $public_key,
+ 'plugin_name' => 'pff-paystack',
+ 'transaction_reference' => $txn_ref,
+ );
- curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
+ $args = array(
+ 'body' => $body,
+ );
- //execute post
- $result = curl_exec($ch);
- // echo $result;
- }
-}
+ wp_remote_post( $url, $args );
+ }
+}
From cfa1c46d36281679ce7ebea438e250612f18afa2 Mon Sep 17 00:00:00 2001
From: Tunbosun Ayinla
Date: Tue, 19 Sep 2023 10:39:29 +0100
Subject: [PATCH 6/6] Formatting.
---
admin/partials/metaboxes/quantity-payment.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/admin/partials/metaboxes/quantity-payment.php b/admin/partials/metaboxes/quantity-payment.php
index b3f416a..3098c29 100644
--- a/admin/partials/metaboxes/quantity-payment.php
+++ b/admin/partials/metaboxes/quantity-payment.php
@@ -41,9 +41,9 @@
- >
-
-
+ >
+
+