Skip to content

Commit 2fb9f65

Browse files
committed
Fixing the UAT error with the minimum amount.
1 parent 909abbd commit 2fb9f65

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

assets/js/paystack-public.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ function PffPaystackFee()
164164
}
165165
}
166166
);
167+
167168
if ($("#pf-quantity").length) {
169+
$( "#pf-quantity" ).on( 'change', function(event){
170+
checkMinimumVal();
171+
} );
168172
calculateTotal();
169173
};
170174

@@ -202,7 +206,6 @@ function PffPaystackFee()
202206
.find("#pf-amount")
203207
.val();
204208
}
205-
206209

207210
if (Number(amount) > 0) {
208211
} else {
@@ -225,6 +228,7 @@ function PffPaystackFee()
225228
);
226229
return false;
227230
}
231+
228232
if (checkMinimumVal() == false) {
229233
$(this)
230234
.find("#pf-amount")
@@ -593,11 +597,18 @@ function PffPaystackFee()
593597
}
594598
);
595599

596-
597600
function checkMinimumVal() {
598-
if ($("#pf-minimum-hidden").length) {
599-
var min_amount = Number($("#pf-minimum-hidden").val());
601+
if ( $("#pf-amount").length ) {
602+
var min_amount = Number($("#pf-amount").attr('min'));
600603
var amt = Number($("#pf-amount").val());
604+
var quantity = 1;
605+
606+
if ( $("#pf-quantity").length ) {
607+
quantity = $("#pf-quantity").val();
608+
}
609+
610+
amt = amt * quantity;
611+
601612
if (min_amount > 0 && amt < min_amount) {
602613
$("#pf-min-val-warn").text( "Amount cannot be less than the minimum amount");
603614
return false;

includes/classes/class-form-shortcode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ public function get_amount_field() {
390390
$html[] = '<small>Transaction Charge: <b class="pf-txncharge"></b>, Total:<b class="pf-txntotal"></b></small>';
391391
}
392392

393+
$html[] = '<div style="color:red;"><small id="pf-min-val-warn"></small></div>';
394+
393395
$html[] = '</div></div>';
394396

395397
return implode( '', $html );

paystack-forms.php

Lines changed: 2 additions & 2 deletions
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/PaystackHQ/Wordpress-Payment-forms-for-Paystack
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: 4.0.2
6+
Version: 4.0.4
77
Author: Paystack
88
Author URI: http://paystack.com
99
License: GPL-2.0+
@@ -16,7 +16,7 @@
1616
define( 'PFF_PAYSTACK_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
1717
define( 'PFF_PAYSTACK_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
1818
define( 'PFF_PAYSTACK_MAIN_FILE', __FILE__ );
19-
define( 'PFF_PAYSTACK_VERSION', '4.0.2' );
19+
define( 'PFF_PAYSTACK_VERSION', '4.0.4' );
2020
define( 'PFF_PAYSTACK_TABLE', 'paystack_forms_payments' );
2121
define( 'PFF_PLUGIN_BASENAME', plugin_basename(__FILE__) );
2222
define( 'PFF_PLUGIN_NAME', 'pff-paystack' );

readme.txt

Lines changed: 1 addition & 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, donation, forms, payments
55
Requires at least: 5.0
66
Tested up to: 6.7
7-
Stable tag: 4.0.2
7+
Stable tag: 4.0.4
88
Requires PHP: 7.4
99
License: GPLv2 or later
1010
License URI: http://www.gnu.org/licenses/gpl-2.0.html

0 commit comments

Comments
 (0)