function process_payment_return() { global $label; if ($_REQUEST['key'] != '') { $order_number = $_REQUEST['order_number']; //$order_number = _2CO_SID."-".$order_number; //.Demo mode:The order number used to create the Hash is forced to equal 1. This designates that the order is a demo order. if (_2CO_DEMO == 'Y') { $hash_order_number = 1; } else { $hash_order_number = $order_number; } $card_holder_name = $_REQUEST['card_holder_name']; $street_address = $_REQUEST['street_address']; $city = $_REQUEST['city']; $state = $_REQUEST['state']; $zip = $_REQUEST['zip']; $country = $_REQUEST['country']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; $credit_card_processed = $_REQUEST['credit_card_processed']; // Y = successfull. K = pending $total = $_REQUEST['total']; $product_id = $_REQUEST['product_id']; // c2o product id $quantity = $_REQUEST['quantity']; // quantity $merchant_product_id = $_REQUEST['merchant_product_id']; // $cart_order_id = $_REQUEST['cart_order_id']; $cart_order_id = jb_strip_order_id($cart_order_id); $product_type = substr($cart_order_id, 0, 1); // 'P' or 'S' or 'M' $cart_order_id = substr($cart_order_id, 1); $product_description = $_REQUEST['product_description']; $x_MD5_Hash = strtolower($_REQUEST['key']); // md5 (secret word + vendor number + order number + total) foreach ($_REQUEST as $key => $val) { $req .= "&" . $key . "=" . $val; } _2co_log_entry("2checkout: " . $req); // process order $_2CO = new _2CO(); // load in the constants.. // md5 (secret word + vendor number + order number + total) $md5_str = _2CO_SECRET_WORD . _2CO_SID . $hash_order_number . $total; $hash = md5($md5_str); if (strcmp($hash, $x_MD5_Hash) == 0) { JBPLUG_do_callback('pay_trn_verification_passed', $cart_order_id, $product_type); if ($credit_card_processed == 'Y') { # Credit card processed OK if ($product_type == 'P') { JB_complete_package_invoice($cart_order_id, '2co'); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <?php $label['payment_posts_completed2'] = str_replace("%URL%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER, $label['payment_posts_completed2']); ?> <p><?php echo $label['payment_posts_completed2']; ?> </p> </center> <?php } elseif ($product_type == 'S') { JB_complete_subscription_invoice($cart_order_id, '2co'); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <?php $label['payment_subscription_completed2'] = str_replace("%URL%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER, $label['payment_subscription_completed2']); ?> <p><?php echo $label['payment_subscription_completed2']; ?> </p> </center> <?php } elseif ($product_type == 'M') { JB_complete_membership_invoice($cart_order_id, '2co'); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <p><?php echo $label['payment_membership_completed']; ?> </p> </center> <?php } JBPLUG_do_callback('pay_trn_passed', $cart_order_id, $product_type); JB_debit_transaction($cart_order_id, $total, 'USD', $order_number, $reason, '2co', $product_type); } elseif ($credit_card_processed == 'K') { # credit card pending if ($product_type == 'P') { JB_pend_package_invoice($cart_order_id, '2co', ''); } elseif ($product_type == 'S') { JB_pend_subscription_invoice($cart_order_id, '2co', ''); } elseif ($product_type == 'M') { JB_pend_membership_invoice($cart_order_id, '2co', ''); } JBPLUG_do_callback('pay_trn_pending', $cart_order_id, $product_type); $label['payment_return_pending'] = str_replace("%PAYMENT_GW%", $this->name, $label['payment_return_pending']); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <p><?php echo $label['payment_return_pending']; ?> </p> </center> <?php } } else { JBPLUG_do_callback('pay_trn_verification_failed', $cart_order_id, $product_type); echo "Invalid."; echo "Invalid. Was this a demo transaction?" . "Has does not match...: [{$hash}] != [{$x_MD5_Hash}] (original string: " . $md5_str . ") "; JB__2co_mail_error("Has does not match...: [{$hash}] != [{$x_MD5_Hash}] (original string: " . $md5_str . ") "); } } ?> <p> </p> <p> </p> <p> </p> <p> </p> <?php }
function process_payment_return() { global $label; if ($_REQUEST['key'] != '') { $order_number = $_REQUEST['order_number']; //$order_number = _2CO_SID."-".$order_number; if (_2CO_DEMO == 'Y') { $order_number = 1; } $card_holder_name = $_REQUEST['card_holder_name']; $street_address = $_REQUEST['street_address']; $city = $_REQUEST['city']; $state = $_REQUEST['state']; $zip = $_REQUEST['zip']; $country = $_REQUEST['country']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; $credit_card_processed = $_REQUEST['credit_card_processed']; // Y = successfull. K = pending $total = $_REQUEST['total']; $product_id = $_REQUEST['product_id']; // c2o product id $quantity = $_REQUEST['quantity']; // quantity $merchant_product_id = $_REQUEST['merchant_product_id']; // $cart_order_id = $_REQUEST['cart_order_id']; $product_description = $_REQUEST['product_description']; $x_MD5_Hash = strtolower($_REQUEST['key']); // md5 (secret word + vendor number + order number + total) //.Demo mode:The order number used to create the Hash is forced to equal 1. This designates that the order is a demo order. //$x_MD5_Hash = $_REQUEST['x_MD5_Hash']; // md5 (secret word + vendor number + order number + total) //.Demo mode:The order number used to create the Hash is forced to equal 1. This designates that the order is a demo order. //include ("header.php"); //print_r ($_REQUEST); foreach ($_REQUEST as $key => $val) { $req .= "&" . $key . "=" . $val; } _2co_log_entry($req); // process order $_2CO = new _2CO(); // load in the constants.. // get customer's order $sql = "SELECT * FROM orders where order_id='" . $cart_order_id . "'"; $result = mysql_query($sql) or die(mysql_error() . $sql); $order_row = mysql_fetch_array($result); // md5 (secret word + vendor number + order number + total) $md5_str = _2CO_SECRET_WORD . _2CO_SID . $order_number . format_number($order_row['price']); $hash = md5($md5_str); if (strcmp($hash, $x_MD5_Hash) == 0) { if ($credit_card_processed == 'Y') { # Credit card processed OK complete_order($order_row['user_id'], $cart_order_id); debit_transaction($cart_order_id, $total, 'USD', $order_number, $reason, '_2CO'); ?> <center> <img src="<?php echo SITE_LOGO_URL; ?> "> <h3>Thank you. Your order was sucessfully completed. You may <a href="<?php echo BASE_HTTP_PATH; ?> users/publish.php">manage your pixels</a> now.</h3> </center> <?php } elseif ($credit_card_processed == 'K') { # credit card pending pend_order($order_row['user_id'], $cart_order_id); ?> <center> <img src="<?php echo SITE_LOGO_URL; ?> "> <h3>Thank you. Your order is pending while the funds are cleared by 2Checkout. Go to the <a href="<?php echo BASE_HTTP_PATH; ?> users/index.php">Main Menu.</a></h3> </center> <?php } } else { echo "Invalid."; echo "Invalid. Was this a demo transaction?" . "Has does not match...: [{$hash}] != [{$x_MD5_Hash}] (original string: " . $md5_str . ") "; _2co_mail_error("Has does not match...: [{$hash}] != [{$x_MD5_Hash}] (original string: " . $md5_str . ") "); } } }