@@ -477,6 +477,7 @@ public function common_check_ipn_response($config = array()) {
477477 $ checkout = false ;
478478 $ k = new Billmate ($ this ->eid ,$ this ->secret ,true ,$ testmode == 'yes ' ,false );
479479 $ payment_note = '' ;
480+ $ redirect = '' ;
480481
481482 if (!empty ($ _GET ['method ' ]) && $ _GET ['method ' ] == 'checkout ' )
482483 $ checkout = true ;
@@ -968,6 +969,11 @@ public function common_check_ipn_response($config = array()) {
968969 && $ storeOrderTotalCompare + 300 >= $ billmateOrderTotalCompare
969970 ) {
970971 // Set order as paid if paid amount matches order total amount
972+ if (version_compare (WC_VERSION , '2.0.0 ' , '< ' )) {
973+ $ redirect = add_query_arg ('key ' , $ order ->order_key , add_query_arg ('order ' , $ order_id , get_permalink (get_option ('woocommerce_thanks_page_id ' ))));
974+ } else {
975+ $ redirect = $ this ->get_return_url ($ order );
976+ }
971977 $ order ->payment_complete ();
972978 if ($ this ->order_status != 'default ' ) {
973979 $ order ->update_status ($ this ->order_status );
@@ -1109,13 +1115,14 @@ public function common_check_ipn_response($config = array()) {
11091115 }
11101116
11111117 if ( $ accept_url_hit ){
1112- $ redirect = '' ;
11131118 WC ()->cart ->empty_cart ();
11141119 delete_transient ($ transientPrefix .$ order_id );
1115- if (version_compare (WC_VERSION , '2.0.0 ' , '< ' )){
1116- $ redirect = add_query_arg ('key ' , $ order ->order_key , add_query_arg ('order ' , $ order_id , get_permalink (get_option ('woocommerce_thanks_page_id ' ))));
1117- } else {
1118- $ redirect = $ this ->get_return_url ($ order );
1120+ if ($ redirect == '' ) {
1121+ if (version_compare (WC_VERSION , '2.0.0 ' , '< ' )) {
1122+ $ redirect = add_query_arg ('key ' , $ order ->order_key , add_query_arg ('order ' , $ order_id , get_permalink (get_option ('woocommerce_thanks_page_id ' ))));
1123+ } else {
1124+ $ redirect = $ this ->get_return_url ($ order );
1125+ }
11191126 }
11201127 WC ()->session ->__unset ( 'billmate_checkout_hash ' );
11211128 WC ()->session ->__unset ( 'billmate_checkout_order ' );
@@ -1129,10 +1136,12 @@ public function common_check_ipn_response($config = array()) {
11291136 if ( $ accept_url_hit ) {
11301137 // Remove cart
11311138 WC ()->cart ->empty_cart ();
1132- if (version_compare (WC_VERSION , '2.0.0 ' , '< ' )){
1133- $ redirect = add_query_arg ('key ' , $ order ->order_key , add_query_arg ('order ' , $ order_id , get_permalink (get_option ('woocommerce_thanks_page_id ' ))));
1134- } else {
1135- $ redirect = $ this ->get_return_url ($ order );
1139+ if ($ redirect == '' ) {
1140+ if (version_compare (WC_VERSION , '2.0.0 ' , '< ' )) {
1141+ $ redirect = add_query_arg ('key ' , $ order ->order_key , add_query_arg ('order ' , $ order_id , get_permalink (get_option ('woocommerce_thanks_page_id ' ))));
1142+ } else {
1143+ $ redirect = $ this ->get_return_url ($ order );
1144+ }
11361145 }
11371146 WC ()->session ->__unset ( 'billmate_checkout_hash ' );
11381147 WC ()->session ->__unset ( 'billmate_checkout_order ' );
0 commit comments