Changeset 2389794
- Timestamp:
- 09/28/2020 03:32:09 PM (6 years ago)
- Location:
- girocheckout/trunk
- Files:
-
- 11 edited
-
girocheckout.php (modified) (4 diffs)
-
library/GiroCheckout_Utility.php (modified) (2 diffs)
-
payments/gc_bluecode.php (modified) (4 diffs)
-
payments/gc_creditcard.php (modified) (5 diffs)
-
payments/gc_directdebit.php (modified) (4 diffs)
-
payments/gc_eps.php (modified) (4 diffs)
-
payments/gc_giropay.php (modified) (4 diffs)
-
payments/gc_ideal.php (modified) (4 diffs)
-
payments/gc_maestro.php (modified) (4 diffs)
-
payments/gc_paydirekt.php (modified) (5 diffs)
-
payments/gc_sofortuw.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
girocheckout/trunk/girocheckout.php
r2346265 r2389794 10 10 * Plugin Name: GiroCheckout 11 11 * Description: Plugin to integrate the GiroCheckout payment methods into WooCommerce. 12 * Version: 4.0. 812 * Version: 4.0.9 13 13 * Author: GiroSolution GmbH 14 14 * Author URI: http://www.girosolution.de … … 23 23 add_action('plugins_loaded', 'woocommerce_girocheckout_init', 0); 24 24 add_action('admin_init', 'girocheckout_update_admin_options', 1); 25 register_activation_hook( __FILE__, 'girocheckout_install' ); 26 register_deactivation_hook(__FILE__ ,'girocheckout_uninstall'); 25 27 26 28 function woocommerce_girocheckout_init() { … … 39 41 include_once $filename; 40 42 } 43 44 // Create the table 'wp_girocheckout_orders_status' 45 girocheckout_install(); 41 46 42 47 /** … … 115 120 add_filter('woocommerce_payment_gateways', 'woocommerce_add_girocheckout_gateway'); 116 121 } 122 123 /** 124 * Create table 'wp_girocheckout_orders_status'. 125 * To management the orders status payment notification 126 */ 127 function girocheckout_install() { 128 129 global $wpdb; 130 $charset_collate = $wpdb->get_charset_collate(); 131 $table_name = $wpdb->prefix . 'girocheckout_orders_status'; 132 133 $sql = "CREATE TABLE IF NOT EXISTS $table_name ( 134 orderid varchar(30) NOT NULL, 135 time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 136 status smallint(5) DEFAULT 1 NOT NULL, 137 UNIQUE KEY orderid (orderid) 138 ) $charset_collate;"; 139 140 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 141 dbDelta( $sql ); 142 } 143 144 /** 145 * Drop the table 'wp_girocheckout_orders_status' 146 */ 147 function girocheckout_uninstall() { 148 149 global $wpdb; 150 151 $table_name = $wpdb->prefix . 'girocheckout_orders_status'; 152 $sql = "drop table if exists $table_name"; 153 $wpdb->query($sql); 154 } -
girocheckout/trunk/library/GiroCheckout_Utility.php
r2346265 r2389794 19 19 */ 20 20 public static function getVersion() { 21 return '4.0. 8';21 return '4.0.9'; 22 22 } 23 23 … … 119 119 return false; 120 120 } 121 122 public static function getOrderStatusInitial() 123 { 124 return 1; 125 } 126 127 public static function getOrderStatusRedirect() 128 { 129 return 2; 130 } 131 132 public static function getOrderStatusNotify() 133 { 134 return 3; 135 } 136 137 public static function getOrderStatusZero() 138 { 139 return 0; 140 } 141 142 public static function registerOrderStatus($orderId, $status) 143 { 144 global $wpdb; 145 $table_name = $wpdb->prefix . 'girocheckout_orders_status'; 146 147 // save data to order notification status table 148 $wpdb->query($wpdb->prepare('INSERT INTO '.$table_name.' (orderid, time, status) VALUES (%s,%s,%s)', 149 array( 150 $orderId, 151 date('Y-m-d H:i:s', time()), 152 $status 153 ))); 154 } 155 156 public static function updateOrderStatus($orderId, $status) 157 { 158 global $wpdb; 159 $table_name = $wpdb->prefix . 'girocheckout_orders_status'; 160 161 $wpdb->query($wpdb->prepare('UPDATE '.$table_name.' SET status="%s" WHERE orderid="%s"', 162 array( 163 $status, 164 $orderId 165 ))); 166 } 167 168 public static function readOrderStatus($orderId) 169 { 170 global $wpdb; 171 $table_name = $wpdb->prefix . 'girocheckout_orders_status'; 172 173 $orderStatus = $wpdb->get_results($wpdb->prepare('SELECT status FROM '.$table_name.' WHERE orderid="%s"', 174 array( 175 $orderId 176 )),ARRAY_A); 177 178 if (isset($orderStatus[0]['status'])) { 179 return $orderStatus[0]['status']; 180 } else { 181 return self::getOrderStatusZero(); 182 } 183 } 121 184 } -
girocheckout/trunk/payments/gc_bluecode.php
r2125825 r2389794 264 264 265 265 if ($reqPayment->requestHasSucceeded()) { 266 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 267 266 268 // Add the girocheckout transaction Id value to the order 267 269 if (!add_post_meta($orderID, '_girocheckout_reference', $reqPayment->getResponseParam('reference'), true)) { … … 332 334 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($iReturnCodeTrx, $this->lang); 333 335 $urlRedirect = $this->get_return_url($order); 334 335 if ($order->get_status() != 'completed' && $order->get_status() != 'processing') { 336 $order->add_order_note($paymentMsg); 336 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 337 338 // If the status is initial (1) redirect run first, then set order status to redirect(2) 339 // If the status is zero, not record found, then insert the record with order status redirect(2) 340 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 341 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 342 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 343 } else { 344 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 345 } 346 } 347 348 if ($order->get_status() != 'completed' && $order->get_status() != 'processing' && 349 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 337 350 338 351 // Checks if the payment was successful and redirects the user 352 $order->add_order_note($paymentMsg); 353 339 354 if( $bPaymentSuccess ) { 340 355 $order->payment_complete(); … … 401 416 402 417 $order = new WC_Order( $iOrderId ); 403 404 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 405 $order->add_order_note($paymentMsg); 418 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 419 420 // If the status is initial (1) notify run first, then set order status to notify(3) 421 // If the status is zero, not record found, then insert the record with order status notify(3) 422 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 423 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 424 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 425 } else { 426 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 427 } 428 429 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 430 $order->add_order_note($paymentMsg); 431 } 406 432 407 433 // Order already processed? 408 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 434 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 435 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 409 436 $notify->sendOkStatus(); 410 437 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 419 446 // Checks if the payment was successful 420 447 if ($notify->paymentSuccessful()) { 421 $order->payment_complete(); 422 // Remove cart 423 $woocommerce->cart->empty_cart(); 448 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 449 $order->payment_complete(); 450 // Remove cart 451 $woocommerce->cart->empty_cart(); 452 } 424 453 425 454 $notify->sendOkStatus(); -
girocheckout/trunk/payments/gc_creditcard.php
r2125825 r2389794 345 345 if ($request->requestHasSucceeded()) { 346 346 $strUrlRedirect = $request->getResponseParam('redirect'); 347 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 347 348 348 349 // Add the girocheckout transaction Id value to the order … … 414 415 $bPaymentSuccess = $notify->paymentSuccessful(); 415 416 $urlRedirect = $this->get_return_url($order); 416 417 if ($order->get_status() != 'completed' && $order->get_status() != 'processing') { 417 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 418 419 // If the status is initial (1) redirect run first, then set order status to redirect(2) 420 // If the status is zero, not record found, then insert the record with order status redirect(2) 421 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 422 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 423 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 424 } else { 425 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 426 } 427 } 428 429 if ($order->get_status() != 'completed' && $order->get_status() != 'processing' && 430 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 431 418 432 // Checks if the payment was successful and redirects the user 419 433 $order->add_order_note($paymentMsg); … … 479 493 480 494 $order = new WC_Order( $iOrderId ); 481 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 482 $order->add_order_note($paymentMsg); 495 496 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 497 498 // If the status is initial (1) notify run first, then set order status to notify(3) 499 // If the status is zero, not record found, then insert the record with order status notify(3) 500 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 501 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 502 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 503 } else { 504 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 505 } 506 507 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 508 $order->add_order_note($paymentMsg); 509 } 483 510 484 511 // Order already processed? 485 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 512 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 513 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 514 486 515 $notify->sendOkStatus(); 487 516 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 496 525 // Checks if the payment was successful 497 526 if ($notify->paymentSuccessful()) { 498 $order->payment_complete(); 499 // Remove cart 500 $woocommerce->cart->empty_cart(); 527 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 528 $order->payment_complete(); 529 // Remove cart 530 $woocommerce->cart->empty_cart(); 531 } 501 532 502 533 $notify->sendOkStatus(); … … 508 539 echo $notify->getNotifyResponseStringJson(); 509 540 exit; 510 } else { 541 } 542 else { 511 543 $order->update_status('failed'); 512 544 exit; -
girocheckout/trunk/payments/gc_directdebit.php
r2346265 r2389794 306 306 307 307 if ($request->requestHasSucceeded()) { 308 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 309 308 310 // Add the girocheckout transaction Id value to the order 309 311 if (!add_post_meta($orderID, '_girocheckout_reference', $request->getResponseParam('reference'), true)) { … … 378 380 $bPaymentSuccess = $notify->paymentSuccessful(); 379 381 $urlRedirect = $this->get_return_url($order); 380 381 if ($order->get_status() != 'processing' && $order->get_status() != 'completed') { 382 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 383 384 // If the status is initial (1) redirect run first, then set order status to redirect(2) 385 // If the status is zero, not record found, then insert the record with order status redirect(2) 386 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 387 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 388 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 389 } else { 390 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 391 } 392 } 393 394 if ($order->get_status() != 'processing' && $order->get_status() != 'completed' && 395 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 396 382 397 // Checks if the payment was successful and redirects the user 383 398 $order->add_order_note($paymentMsg); … … 443 458 444 459 $order = new WC_Order( $iOrderId ); 445 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 446 $order->add_order_note($paymentMsg); 460 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 461 462 // If the status is initial (1) notify run first, then set order status to notify(3) 463 // If the status is zero, not record found, then insert the record with order status notify(3) 464 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 465 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 466 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 467 } else { 468 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 469 } 470 471 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 472 $order->add_order_note($paymentMsg); 473 } 447 474 448 475 // Order already processed? 449 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 476 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 477 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 450 478 $notify->sendOkStatus(); 451 479 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 460 488 // Checks if the payment was successful 461 489 if ($notify->paymentSuccessful()) { 462 $order->payment_complete(); 463 // Remove cart 464 $woocommerce->cart->empty_cart(); 490 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 491 $order->payment_complete(); 492 // Remove cart 493 $woocommerce->cart->empty_cart(); 494 } 465 495 466 496 $notify->sendOkStatus(); -
girocheckout/trunk/payments/gc_eps.php
r2346265 r2389794 258 258 259 259 if ($reqPayment->requestHasSucceeded()) { 260 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 261 260 262 // Add the girocheckout transaction Id value to the order 261 263 if (!add_post_meta($orderID, '_girocheckout_reference', $reqPayment->getResponseParam('reference'), true)) { … … 324 326 $bPaymentSuccess = $notify->paymentSuccessful(); 325 327 $urlRedirect = $this->get_return_url($order); 326 327 if ($order->get_status() != 'processing' && $order->get_status() != 'completed') { 328 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 329 330 // If the status is initial (1) redirect run first, then set order status to redirect(2) 331 // If the status is zero, not record found, then insert the record with order status redirect(2) 332 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 333 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 334 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 335 } else { 336 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 337 } 338 } 339 340 if ($order->get_status() != 'processing' && $order->get_status() != 'completed' && 341 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 342 328 343 // Checks if the payment was successful and redirects the user 329 344 $order->add_order_note($paymentMsg); … … 391 406 392 407 $order = new WC_Order( $iOrderId ); 393 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 394 $order->add_order_note($paymentMsg); 408 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 409 410 // If the status is initial (1) notify run first, then set order status to notify(3) 411 // If the status is zero, not record found, then insert the record with order status notify(3) 412 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 413 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 414 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 415 } else { 416 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 417 } 418 419 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 420 $order->add_order_note($paymentMsg); 421 } 395 422 396 423 // Order already processed? 397 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 424 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 425 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 398 426 $notify->sendOkStatus(); 399 427 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 406 434 } 407 435 408 // Checks if the payment was successful 436 // Checks if the payment was successful 409 437 if ($notify->paymentSuccessful()) { 410 $order->payment_complete(); 411 // Remove cart 412 $woocommerce->cart->empty_cart(); 438 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 439 $order->payment_complete(); 440 // Remove cart 441 $woocommerce->cart->empty_cart(); 442 } 413 443 414 444 $notify->sendOkStatus(); -
girocheckout/trunk/payments/gc_giropay.php
r2346265 r2389794 257 257 258 258 if ($reqPayment->requestHasSucceeded()) { 259 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 260 259 261 // Add the girocheckout transaction Id value to the order 260 262 if (!add_post_meta($orderID, '_girocheckout_reference', $reqPayment->getResponseParam('reference'), true)) { … … 325 327 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($iReturnCodeTrx, $this->lang); 326 328 $iReturnCodeAVS = $notify->getResponseParam('gcResultAVS'); 329 327 330 if( !empty($iReturnCodeAVS) && $iReturnCodeAVS != $iReturnCodeTrx ) { 328 331 $paymentMsg .= ", " . $notify->getResponseMessage($iReturnCodeAVS, $this->lang); 329 332 } 333 330 334 $urlRedirect = $this->get_return_url($order); 331 332 if ($order->get_status() != 'completed' && $order->get_status() != 'processing') { 335 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 336 337 // If the status is initial (1) redirect run first, then set order status to redirect(2) 338 // If the status is zero, not record found, then insert the record with order status redirect(2) 339 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 340 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 341 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 342 } else { 343 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 344 } 345 } 346 347 if ($order->get_status() != 'completed' && $order->get_status() != 'processing' && 348 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 349 350 // Checks if the payment was successful and redirects the user 333 351 $order->add_order_note($paymentMsg); 334 335 // Checks if the payment was successful and redirects the user 352 336 353 if( $bPaymentSuccess ) { 337 354 $order->payment_complete(); … … 396 413 397 414 $order = new WC_Order( $iOrderId ); 398 399 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 400 $iReturnCodeAVS = $notify->getResponseParam('gcResultAVS'); 401 if( !empty($iReturnCodeAVS) ) { 402 $paymentMsg .= ", " . $notify->getResponseMessage($iReturnCodeAVS, $this->lang); 403 } 404 $order->add_order_note($paymentMsg); 415 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 416 417 // If the status is initial (1) notify run first, then set order status to notify(3) 418 // If the status is zero, not record found, then insert the record with order status notify(3) 419 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 420 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 421 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 422 } else { 423 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 424 } 425 426 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 427 $iReturnCodeAVS = $notify->getResponseParam('gcResultAVS'); 428 429 if (!empty($iReturnCodeAVS)) { 430 $paymentMsg .= ", " . $notify->getResponseMessage($iReturnCodeAVS, $this->lang); 431 } 432 433 $order->add_order_note($paymentMsg); 434 } 405 435 406 436 // Order already processed? 407 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 437 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 438 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 408 439 $notify->sendOkStatus(); 409 440 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 416 447 } 417 448 418 // Checks if the payment was successful 449 // Checks if the payment was successful 419 450 if ($notify->paymentSuccessful()) { 420 $order->payment_complete(); 421 // Remove cart 422 $woocommerce->cart->empty_cart(); 451 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 452 $order->payment_complete(); 453 // Remove cart 454 $woocommerce->cart->empty_cart(); 455 } 423 456 424 457 $notify->sendOkStatus(); -
girocheckout/trunk/payments/gc_ideal.php
r2346265 r2389794 290 290 291 291 if ($request->requestHasSucceeded()) { 292 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 293 292 294 // Add the girocheckout transaction Id value to the order 293 295 if (!add_post_meta($orderID, '_girocheckout_reference', $request->getResponseParam('reference'), true)) { … … 358 360 $bPaymentSuccess = $notify->paymentSuccessful(); 359 361 $urlRedirect = $this->get_return_url($order); 360 361 if ($order->get_status() != 'completed' && $order->get_status() != 'processing') { 362 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 363 364 // If the status is initial (1) redirect run first, then set order status to redirect(2) 365 // If the status is zero, not record found, then insert the record with order status redirect(2) 366 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 367 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 368 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 369 } else { 370 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 371 } 372 } 373 374 if ($order->get_status() != 'completed' && $order->get_status() != 'processing' && 375 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 376 362 377 // Checks if the payment was successful and redirects the user 363 378 $order->add_order_note($paymentMsg); … … 422 437 423 438 $order = new WC_Order( $iOrderId ); 424 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 425 $order->add_order_note($paymentMsg); 439 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 440 441 // If the status is initial (1) notify run first, then set order status to notify(3) 442 // If the status is zero, not record found, then insert the record with order status notify(3) 443 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 444 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 445 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 446 } else { 447 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 448 } 449 450 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 451 $order->add_order_note($paymentMsg); 452 } 426 453 427 454 // Order already processed? 428 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 455 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 456 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 429 457 $notify->sendOkStatus(); 430 458 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 437 465 } 438 466 439 // Checks if the payment was successful 467 // Checks if the payment was successful 440 468 if ($notify->paymentSuccessful()) { 441 442 $order->payment_complete(); 443 // Remove cart 444 $woocommerce->cart->empty_cart(); 469 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 470 $order->payment_complete(); 471 // Remove cart 472 $woocommerce->cart->empty_cart(); 473 } 445 474 446 475 $notify->sendOkStatus(); -
girocheckout/trunk/payments/gc_maestro.php
r2125825 r2389794 267 267 268 268 if ($request->requestHasSucceeded()) { 269 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 270 269 271 // Add the girocheckout transaction Id value to the order 270 272 if (!add_post_meta($orderID, '_girocheckout_reference', $request->getResponseParam('reference'), true)) { … … 336 338 $bPaymentSuccess = $notify->paymentSuccessful(); 337 339 $urlRedirect = $this->get_return_url($order); 338 339 if ($order->get_status() != 'completed' && $order->get_status() != 'processing') { 340 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 341 342 // If the status is initial (1) redirect run first, then set order status to redirect(2) 343 // If the status is zero, not record found, then insert the record with order status redirect(2) 344 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 345 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 346 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 347 } else { 348 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 349 } 350 } 351 352 if ($order->get_status() != 'completed' && $order->get_status() != 'processing' && 353 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 354 340 355 // Checks if the payment was successful and redirects the user 341 356 $order->add_order_note($paymentMsg); … … 400 415 401 416 $order = new WC_Order( $iOrderId ); 402 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 403 $order->add_order_note($paymentMsg); 417 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 418 419 // If the status is initial (1) notify run first, then set order status to notify(3) 420 // If the status is zero, not record found, then insert the record with order status notify(3) 421 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 422 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 423 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 424 } else { 425 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 426 } 427 428 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 429 $order->add_order_note($paymentMsg); 430 } 404 431 405 432 // Order already processed? 406 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 433 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 434 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 407 435 $notify->sendOkStatus(); 408 436 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 417 445 // Checks if the payment was successful 418 446 if ($notify->paymentSuccessful()) { 419 $order->payment_complete(); 420 // Remove cart 421 $woocommerce->cart->empty_cart(); 447 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 448 $order->payment_complete(); 449 // Remove cart 450 $woocommerce->cart->empty_cart(); 451 } 422 452 423 453 $notify->sendOkStatus(); -
girocheckout/trunk/payments/gc_paydirekt.php
r2346265 r2389794 267 267 try { 268 268 $order = new WC_Order($order_id); 269 270 if( method_exists($order, 'get_id')) { 271 $orderID = $order->get_id(); 272 } 273 else { 274 $orderID = $order->get_id(); 275 } 269 $orderID = $order->get_id(); 276 270 $amountTotal = $order->get_total(); 277 271 $currency = get_woocommerce_currency(); … … 434 428 ->submit(); 435 429 436 if ($request->requestHasSucceeded($request)) { 430 if ($request->requestHasSucceeded()) { 431 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 432 437 433 // Add the girocheckout transaction Id value to the order 438 434 if (!add_post_meta($orderID, '_girocheckout_reference', $request->getResponseParam('reference'), true)) { … … 506 502 $bPaymentSuccess = $notify->paymentSuccessful(); 507 503 $urlRedirect = $this->get_return_url($order); 508 509 if ($order->get_status() != 'completed' && $order->get_status() != 'processing') { 504 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 505 506 // If the status is initial (1) redirect run first, then set order status to redirect(2) 507 // If the status is zero, not record found, then insert the record with order status redirect(2) 508 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 509 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 510 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 511 } else { 512 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 513 } 514 } 515 516 if ($order->get_status() != 'completed' && $order->get_status() != 'processing' && 517 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 518 510 519 // Checks if the payment was successful and redirects the user 511 520 $order->add_order_note($paymentMsg); … … 572 581 573 582 $order = new WC_Order( $iOrderId ); 574 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 575 $order->add_order_note($paymentMsg); 583 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 584 585 // If the status is initial (1) notify run first, then set order status to notify(3) 586 // If the status is zero, not record found, then insert the record with order status notify(3) 587 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 588 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 589 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 590 } else { 591 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 592 } 593 594 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 595 $order->add_order_note($paymentMsg); 596 } 576 597 577 598 // Order already processed? 578 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 599 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 600 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 579 601 $notify->sendOkStatus(); 580 602 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 589 611 // Checks if the payment was successful 590 612 if ($notify->paymentSuccessful()) { 591 $order->payment_complete(); 592 // Remove cart 593 $woocommerce->cart->empty_cart(); 613 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 614 $order->payment_complete(); 615 // Remove cart 616 $woocommerce->cart->empty_cart(); 617 } 594 618 595 619 $notify->sendOkStatus(); -
girocheckout/trunk/payments/gc_sofortuw.php
r2125825 r2389794 257 257 258 258 if ($request->requestHasSucceeded()) { 259 GiroCheckout_Utility::registerOrderStatus($transaction_id, GiroCheckout_Utility::getOrderStatusInitial()); 260 259 261 // Add the girocheckout transaction Id value to the order 260 262 if (!add_post_meta($orderID, '_girocheckout_reference', $request->getResponseParam('reference'), true)) { … … 324 326 $bPaymentSuccess = $notify->paymentSuccessful(); 325 327 $urlRedirect = $this->get_return_url($order); 326 327 if ($order->get_status() != 'completed' && $order->get_status() != 'processing') { 328 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 329 330 // If the status is initial (1) redirect run first, then set order status to redirect(2) 331 // If the status is zero, not record found, then insert the record with order status redirect(2) 332 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 333 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 334 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 335 } else { 336 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusRedirect()); 337 } 338 } 339 340 if ($order->get_status() != 'completed' && $order->get_status() != 'processing' && 341 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 342 328 343 // Checks if the payment was successful and redirects the user 329 344 $order->add_order_note($paymentMsg); … … 390 405 391 406 $order = new WC_Order( $iOrderId ); 392 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 393 $order->add_order_note($paymentMsg); 407 $statusNotificationOrder = GiroCheckout_Utility::readOrderStatus($notify->getResponseParam('gcMerchantTxId')); 408 409 // If the status is initial (1) notify run first, then set order status to notify(3) 410 // If the status is zero, not record found, then insert the record with order status notify(3) 411 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 412 if ($statusNotificationOrder == GiroCheckout_Utility::getOrderStatusZero()) { 413 GiroCheckout_Utility::registerOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 414 } else { 415 GiroCheckout_Utility::updateOrderStatus($notify->getResponseParam('gcMerchantTxId'), GiroCheckout_Utility::getOrderStatusNotify()); 416 } 417 418 $paymentMsg = GiroCheckout_SDK_ResponseCode_helper::getMessage($notify->getResponseParam('gcResultPayment'), $this->lang); 419 $order->add_order_note($paymentMsg); 420 } 394 421 395 422 // Order already processed? 396 if ($order->get_status() == 'processing' || $order->get_status() == 'completed') { 423 if (($order->get_status() == 'processing' || $order->get_status() == 'completed') && 424 $statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 397 425 $notify->sendOkStatus(); 398 426 $notify->setNotifyResponseParam('Result', 'ERROR'); … … 407 435 // Checks if the payment was successful 408 436 if ($notify->paymentSuccessful()) { 409 $order->payment_complete(); 410 // Remove cart 411 $woocommerce->cart->empty_cart(); 437 if ($statusNotificationOrder <= GiroCheckout_Utility::getOrderStatusInitial()) { 438 $order->payment_complete(); 439 // Remove cart 440 $woocommerce->cart->empty_cart(); 441 } 412 442 413 443 $notify->sendOkStatus();
Note: See TracChangeset
for help on using the changeset viewer.