@@ -405,18 +405,9 @@ function PffPaystackFee()
405405 ) ;
406406 }
407407 ) ;
408- $ ( ".pf-txncharge" )
409- . hide ( )
410- . html ( "NGN0" )
411- . show ( )
412- . digits ( ) ;
413- $ ( ".pf-txntotal" )
414- . hide ( )
415- . html ( "NGN0" )
416- . show ( )
417- . digits ( ) ;
418-
419- $ . unblockUI ( ) ;
408+ calculateFees ( ) ;
409+
410+ $ . unblockUI ( ) ;
420411 } else {
421412 self . before ( '<div class="alert-danger">' + data . message + '</div>' ) ;
422413 $ . unblockUI ( ) ;
@@ -500,47 +491,25 @@ function PffPaystackFee()
500491 $ . post (
501492 $form . attr ( "action" ) ,
502493 {
503- action : "kkd_pff_paystack_rconfirm_payment " ,
494+ action : "pff_paystack_confirm_payment " ,
504495 code : response . trxref ,
505- quantity : quantity
506- } ,
496+ quantity : quantity ,
497+ retry : true ,
498+ } ,
507499 function ( newdata ) {
508500 data = JSON . parse ( newdata ) ;
509501 if ( data . result == "success2" ) {
510502 window . location . href = data . link ;
511503 }
512504 if ( data . result == "success" ) {
513- $ ( ".retry-form" ) [ 0 ] . reset ( ) ;
514- $ ( "html,body" ) . animate (
515- { scrollTop : $ ( ".retry-form" ) . offset ( ) . top - 110 } ,
516- 500
517- ) ;
505+ // Get the current URL
506+ const currentUrl = window . location . href ;
518507
519- self . before ( '<div class="alert-success">' + data . message + '</div>' ) ;
520- $ ( this )
521- . find ( "input, select, textarea" )
522- . each (
523- function ( ) {
524- $ ( this ) . css (
525- {
526- "border-color" : "#d1d1d1" ,
527- "background-color" : "#fff"
528- }
529- ) ;
530- }
531- ) ;
532- $ ( ".pf-txncharge" )
533- . hide ( )
534- . html ( "NGN0" )
535- . show ( )
536- . digits ( ) ;
537- $ ( ".pf-txntotal" )
538- . hide ( )
539- . html ( "NGN0" )
540- . show ( )
541- . digits ( ) ;
542- $ ( "#submitbtn" ) . remove ( ) ;
543- $ . unblockUI ( ) ;
508+ // Use URL object to parse the current URL
509+ const url = new URL ( currentUrl ) ;
510+
511+ // Redirect to the same URL without query parameters
512+ window . location . href = url . origin + url . pathname ;
544513 } else {
545514 self . before ( '<div class="alert-success">' + data . message + '</div>' ) ;
546515 $ . unblockUI ( ) ;
@@ -570,46 +539,24 @@ function PffPaystackFee()
570539 $ . post (
571540 $form . attr ( "action" ) ,
572541 {
573- action : "kkd_pff_paystack_rconfirm_payment" ,
574- code : response . trxref
542+ action : "pff_paystack_confirm_payment" ,
543+ code : response . trxref ,
544+ retry : true ,
575545 } ,
576546 function ( newdata ) {
577547 data = JSON . parse ( newdata ) ;
578548 if ( data . result == "success2" ) {
579549 window . location . href = data . link ;
580550 }
581551 if ( data . result == "success" ) {
582- $ ( ".retry-form" ) [ 0 ] . reset ( ) ;
583- $ ( "html,body" ) . animate (
584- { scrollTop : $ ( ".retry-form" ) . offset ( ) . top - 110 } ,
585- 500
586- ) ;
552+ // Get the current URL
553+ const currentUrl = window . location . href ;
587554
588- self . before ( '<div class="alert-success">' + data . message + '</div>' ) ;
589- $ ( this )
590- . find ( "input, select, textarea" )
591- . each (
592- function ( ) {
593- $ ( this ) . css (
594- {
595- "border-color" : "#d1d1d1" ,
596- "background-color" : "#fff"
597- }
598- ) ;
599- }
600- ) ;
601- $ ( ".pf-txncharge" )
602- . hide ( )
603- . html ( "NGN0" )
604- . show ( )
605- . digits ( ) ;
606- $ ( ".pf-txntotal" )
607- . hide ( )
608- . html ( "NGN0" )
609- . show ( )
610- . digits ( ) ;
611- $ ( "#submitbtn" ) . remove ( ) ;
612- $ . unblockUI ( ) ;
555+ // Use URL object to parse the current URL
556+ const url = new URL ( currentUrl ) ;
557+
558+ // Redirect to the same URL without query parameters
559+ window . location . href = url . origin + url . pathname ;
613560 } else {
614561 self . before ( '<div class="alert-danger">' + data . message + '</div>' ) ;
615562 $ . unblockUI ( ) ;
0 commit comments