@@ -868,7 +868,29 @@ function kkd_pff_paystack_submit_action() {
868868
869869 $ filelimit = get_post_meta ($ _POST ["pf-id " ],'_filelimit ' ,true );
870870 $ currency = get_post_meta ($ _POST ["pf-id " ],'_currency ' ,true );
871+ $ formamount = get_post_meta ($ _POST ["pf-id " ],'_amount ' ,true );
872+ $ recur = get_post_meta ($ _POST ["pf-id " ],'_recur ' ,true );
871873
874+ $ txncharge = get_post_meta ($ _POST ["pf-id " ],'_txncharge ' ,true );
875+ $ amount = (int )str_replace (' ' , '' , $ _POST ["pf-amount " ]);
876+
877+ if (($ recur == 'no ' ) && ($ formamount != 0 )){
878+ $ amount = (int )str_replace (' ' , '' , $ formamount );
879+ }
880+ if ($ txncharge == 'customer ' ) {
881+ $ percent = (1.55 /100 )*$ amount ;
882+ if ($ percent > 2000 ) {
883+ $ newamount = $ amount + 2000 ;
884+ }else {
885+ if ($ amount > 2500 ) {
886+ $ newamount = $ amount + $ percent +100 ;
887+ }else {
888+ $ newamount = $ amount + $ percent ;
889+ }
890+ }
891+
892+ $ amount = $ newamount ;
893+ }
872894 $ maxFileSize = $ filelimit * 1024 * 1024 ;
873895
874896 if (!empty ($ _FILES )){
@@ -917,7 +939,6 @@ function kkd_pff_paystack_submit_action() {
917939 'Content-Type ' => 'application/json ' ,
918940 'Authorization ' => 'Bearer ' . $ key
919941 );
920- $ amount = (int )str_replace (' ' , '' , $ _POST ["pf-amount " ]);
921942 $ koboamount = $ amount *100 ;
922943 $ body = array (
923944 'name ' => $ fullname .'_ ' .$ code ,
@@ -958,7 +979,7 @@ function kkd_pff_paystack_submit_action() {
958979 'post_id ' => strip_tags ($ _POST ["pf-id " ], "" ),
959980 'email ' => strip_tags ($ _POST ["pf-pemail " ], "" ),
960981 'user_id ' => strip_tags ($ _POST ["pf-user_id " ], "" ),
961- 'amount ' => strip_tags ($ _POST [ " pf- amount" ] , "" ),
982+ 'amount ' => strip_tags ($ amount , "" ),
962983 'plan ' => strip_tags ($ plancode , "" ),
963984 'ip ' => kkd_pff_paystack_get_the_user_ip (),
964985 'txn_code ' => $ code ,
@@ -1041,6 +1062,7 @@ function kkd_pff_paystack_confirm_payment() {
10411062 $ amount = get_post_meta ($ payment_array ->post_id ,'_amount ' ,true );
10421063 $ recur = get_post_meta ($ payment_array ->post_id ,'_recur ' ,true );
10431064 $ currency = get_post_meta ($ payment_array ->post_id ,'_currency ' ,true );
1065+ $ txncharge = get_post_meta ($ payment_array ->post_id ,'_txncharge ' ,true );
10441066
10451067
10461068 $ mode = esc_attr ( get_option ('mode ' ) );
@@ -1077,6 +1099,20 @@ function kkd_pff_paystack_confirm_payment() {
10771099 $ result = "success " ;
10781100 // kkd_pff_paystack_send_receipt($currency,$amount,$name,$payment_array->email,$code,$metadata)
10791101 }else {
1102+ if ($ txncharge == 'customer ' ) {
1103+ $ percent = (1.55 /100 )*$ amount ;
1104+ if ($ percent > 2000 ) {
1105+ $ newamount = $ amount + 2000 ;
1106+ }else {
1107+ if ($ amount > 2500 ) {
1108+ $ newamount = $ amount + $ percent +100 ;
1109+ }else {
1110+ $ newamount = $ amount + $ percent ;
1111+ }
1112+ }
1113+
1114+ $ amount = $ newamount ;
1115+ }
10801116 if ( $ amount != $ amount_paid ) {
10811117 $ message = "Invalid amount Paid. Amount required is " .$ currency ."<b> " .number_format ($ amount )."</b> " ;
10821118 $ result = "failed " ;
0 commit comments