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 ($_POST['Merchant_Id'] != '') { foreach ($_POST as $key => $value) { $req .= "&{$key}={$value}"; } cc_log_entry('ccAvenue:' . $req); $Checksum = cc_verifychecksum($_POST['Merchant_Id'], $_POST['Order_Id'], $_POST['Amount'], $_POST['AuthDesc'], $_POST['Checksum'], CCAVENUE_WORKING_KEY); $label['payment_ccave_go_back'] = str_replace("%ADV_LINK%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER, $label['payment_ccave_go_back']); $invoice_id = jb_strip_order_id($_POST['Order_Id']); $product_type = substr($invoice_id, 0, 1); // 'P' or 'S' $invoice_id = substr($invoice_id, 1); if ($Checksum == "true") { JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type); } else { JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type); } if ($Checksum == "true" && $_POST['AuthDesc'] == "Y") { if ($product_type == 'P') { JB_complete_package_invoice($invoice_id, 'ccAvenue'); ?> <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($invoice_id, 'ccAvenue'); ?> <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($invoice_id, 'ccAvenue'); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <p><?php echo $label['payment_membership_completed']; ?> </p> </center> <?php } JBPLUG_do_callback('pay_trn_completed', $invoice_id, $product_type); JB_debit_transaction($invoice_id, $_POST['Amount'], CCAVENUE_CURRENCY, $_POST['Order_Id'], $reason, 'ccAvenue', $product_type); //Here you need to put in the routines for a successful //transaction such as sending an email to customer, //setting database status, informing logistics etc etc } else { if ($Checksum == "true" && $_POST['AuthDesc'] == "B") { if ($product_type == 'P') { JB_pend_package_invoice($invoice_id, 'ccAvenue', $_POST['AuthDesc']); } elseif ($product_type == 'S') { JB_pend_subscription_invoice($invoice_id, 'ccAvenue', $_POST['AuthDesc']); } elseif ($product_type == 'M') { JB_pend_membership_invoice($invoice_id, 'ccAvenue', $_POST['AuthDesc']); } JBPLUG_do_callback('pay_trn_pending', $invoice_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 //Here you need to put in the routines/e-mail for a "Batch Processing" order //This is only if payment for this transaction has been made by an American Express Card //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders" } else { if ($Checksum == "true" && $_POST['AuthDesc'] == "N") { JBPLUG_do_callback('pay_trn_failed', $invoice_id, $product_type); $label['payment_return_denied'] = str_replace("%PAYMENT_GW%", $this->name, $label['payment_return_denied']); echo $label["payment_return_denied"]; //Here you need to put in the routines for a failed //transaction such as sending an email to customer //setting database status etc etc ?> <?php } else { echo "<br>Security Error. Illegal access detected"; //Here you need to simply ignore this and dont need //to perform any operation in this condition } } } } ?> <p> </p> <p> </p> <p> </p> <p> </p> <?php }
function process_payment_return() { global $label; /* Note: This should not be executed in the normal course of events. Instead, the code at the top is executed to verify / complete the transaction The code below will check previous transactions to make sure it is not processed twice. */ if ($_REQUEST['x_response_code'] != '') { foreach ($_REQUEST as $key => $value) { $req .= "&{$key}={$value}"; } $invoice_id = jb_strip_order_id($_REQUEST['x_invoice_num']); $product_type = substr($invoice_id, 0, 1); // 'P' or 'S' $invoice_id = substr($invoice_id, 1); $myhash = strtoupper(md5(AUTHNET_MD5_HASH . AUTHNET_LOGIN_ID . $_REQUEST['x_trans_id'] . $_REQUEST['x_amount'])); authnet_log_entry('x_response_code: ' . $_REQUEST['x_response_code'] . ' myhash ' . $myhash . ' md5_hash ' . $_REQUEST['x_MD5_Hash'] . ' invoice_id' . $invoice_id . ' product_type' . $product_type); if ($_REQUEST['x_MD5_Hash'] == $myhash) { authnet_log_entry('authorize.net: (gateway) ' . $req); // log the request switch ($_REQUEST['x_response_code']) { case "1": // approved // check for the transaction $sql = "SELECT * FROM jb_txn WHERE txn_id='" . jb_escape_sql($_REQUEST['x_trans_id']) . "' and `origin`='AuthorizeNet' "; $result = JB_mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { authnet_log_entry($_REQUEST['x_trans_id'] . " already in the database, possibly entered in by the Relay Responce IR: System)"); } else { echo "<p align='center'> " . $label['payment_authnet_completed'] . "</p>"; if ($product_type == 'P') { JB_complete_package_invoice($invoice_id, 'AuthorizeNet'); ?> <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($invoice_id, 'AuthorizeNet'); ?> <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($invoice_id, 'AuthorizeNet'); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <p><?php echo $label['payment_membership_completed']; ?> </p> </center> <?php } JB_debit_transaction($invoice_id, $_REQUEST['x_amount'], AUTHNET_CURRENCY, $_REQUEST['x_trans_id'], $reason, 'AuthorizeNet', $product_type); } //JB_debit_transaction($invoice_id, $_POST['x_amount'], 'USD', $_POST['x_trans_id'], $reason, 'AuthorizeNet', $product_type); break; case "2": // declined $label['payment_return_denied'] = str_replace("%PAYMENT_GW%", $this->name, $label['payment_return_denied']); echo "<p align='center'> " . $label['payment_return_denied'] . "</p>"; break; case "3": // Error echo "<p align='center'>" . $label['payment_return_error'] . "</p>"; break; default: echo "<p align='center'>" . $label['payment_return_error'] . "</p>"; break; } } else { authnet_log_entry("Authorize.net: Invalid signiture (pls verify your md5 hash value)"); } } ?> <p> </p> <p> </p> <p> </p> <p> </p> <?php }
} } } fclose($fp); // if VERIFIED=1 process payment if ($VERIFIED) { JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type); switch ($payment_status) { case "Completed": // Funds successfully transferred if ($product_type == 'P') { JB_complete_package_invoice($invoice_id, 'NOCHEX'); } elseif ($product_type == 'S') { JB_complete_subscription_invoice($invoice_id, 'NOCHEX'); } elseif ($product_type == 'M') { JB_complete_membership_invoice($invoice_id, 'NOCHEX'); } JBPLUG_do_callback('pay_trn_completed', $invoice_id, $product_type); pp_log_entry("Completed NOCHEX: {$product_type} " . $invoice_id); JB_debit_transaction($invoice_id, $amount, 'GBP', $txn_id, $reason, 'NOCHEX', $product_type); break; default: JBPLUG_do_callback('pay_trn_failed', $invoice_id, $product_type); break; } } } } ########################################################################### # Payment Object class NOCHEX
function process_payment_return() { global $label; if ($_POST['PAYMENT_ID'] != '') { foreach ($_POST as $key => $value) { $req .= "&{$key}={$value}"; } eg_log_entry('e-gold: ' . $req); $alt_hash = strtoupper(md5(EGOLD_ALTERNATE_PASSPHRASE)); $hash = strtoupper(md5($_POST['PAYMENT_ID'] . ":" . $_POST['PAYEE_ACCOUNT'] . ":" . $_POST['PAYMENT_AMOUNT'] . ":" . $_POST['PAYMENT_UNITS'] . ":" . $_POST['PAYMENT_METAL_ID'] . ":" . $_POST['PAYMENT_BATCH_NUM'] . ":" . $_POST['PAYER_ACCOUNT'] . ":" . $alt_hash . ":" . $_POST['ACTUAL_PAYMENT_OUNCES'] . ":" . $_POST['USD_PER_OUNCE'] . ":" . $_POST['FEEWEIGHT'] . ":" . $_POST['TIMESTAMPGMT'])); $invoice_id = jb_strip_order_id($_POST['PAYMENT_ID']); $product_type = substr($invoice_id, 0, 1); // 'P' or 'S' or 'M' $invoice_id = substr($invoice_id, 1); if ($hash == $_POST['HANDSHAKE_HASH']) { JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type); if ($product_type == 'P') { JB_complete_package_invoice($invoice_id, 'e-gold'); ?> <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($invoice_id, 'e-gold'); ?> <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($invoice_id, 'e-gold'); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <p><?php echo $label['payment_membership_completed']; ?> </p> </center> <?php } JBPLUG_do_callback('pay_trn_completed', $invoice_id, $product_type); JB_debit_transaction($invoice_id, $_POST['PAYMENT_AMOUNT'], 'USD', $_POST['PAYMENT_ID'], $reason, 'e-gold', $product_type); } else { JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type); echo "Invalid signiture. Please contact the webmaster."; } } ?> <p> </p> <p> </p> <p> </p> <p> </p> <?php }
function process_payment_return() { global $label; if (PAYPAL_USE_CURL == 'YES') { // cannot use cURL for PTD, use for IPN only //return false; } //////////// // Paypal ########################### // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-synch'; $tx_token = $_GET['tx']; $auth_token = PAYPAL_AUTH_TOKEN; $req .= "&tx={$tx_token}&at={$auth_token}"; $result = ''; if (PAYPAL_USE_CURL == 'YES') { // Use curl to post back to PayPAl // and put the result in a file. // open the file using $fp pp_log_entry('PDD - Using cURL to POST to PayPal'); $URL = "https://" . PAYPAL_SERVER . "/cgi-bin/webscr"; $ch = curl_init(); if (PAYPAL_CURL_PROXY != '') { curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE); curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); curl_setopt($ch, CURLOPT_PROXY, PAYPAL_CURL_PROXY); } //$req = "username=test&password=test"; curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_URL, $URL); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $req); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); pp_log_entry('PDT posting to PayPal and using cURL: ' . $result); $result = curl_exec($ch); pp_log_entry(curl_error($ch)); curl_close($ch); pp_log_entry('PDD -Got this from result from cURL: ' . $result); $filename = JB_get_cache_dir() . md5(time() . PAYPAL_AUTH_TOKEN) . 'PDT.paypal'; $fp = fopen($filename, 'w'); fwrite($fp, $result, strlen($result)); $fp = fclose($fp); // open for reading $fp = fopen($filename, 'r'); } else { // post back to PayPal system to validate $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $fp = fsockopen(PAYPAL_SERVER, 80, $errno, $errstr, 30); // If possible, securely post back to paypal using HTTPS // Your PHP server will need to be SSL enabled // $fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30); } if (!$fp) { // HTTP ERROR //echo "fp error"; pp_log_entry('PDD -Could not open socket / file'); } else { if (PAYPAL_USE_CURL != 'YES') { fputs($fp, $header . $req); // post to paypal } // read the body data $res = ''; $headerdone = false; while (!feof($fp)) { $line = fgets($fp, 1024); if (strcmp($line, "\r\n") == 0) { // read the header $headerdone = true; } else { if ($headerdone) { // header has been read. now read the contents $res .= $line; } } } } fclose($fp); if (PAYPAL_USE_CURL == 'YES') { unlink($filename); } // parse the data $lines = explode("\n", $res); $keyarray = array(); if (strcmp($lines[0], "SUCCESS") == 0 || strpos($result, 'SUCCESS') !== false) { pp_log_entry('PDD - Notification verfified'); for ($i = 1; $i < count($lines); $i++) { list($key, $val) = explode("=", $lines[$i]); $keyarray[urldecode($key)] = urldecode($val); } //print_r($_REQUEST); // check the payment_status is Completed // check that txn_id has not been previously processed // check that receiver_email is your Primary PayPal email // check that payment_amount/payment_currency are correct // process payment $firstname = $keyarray['first_name']; $lastname = $keyarray['last_name']; $itemname = $keyarray['item_name']; $amount = $keyarray['payment_gross']; $txn_id = $keyarray['txn_id']; $mc_gross = $keyarray['mc_gross']; $mc_currency = $keyarray['mc_currency']; $payer_email = $keyarray['payer_email']; $payment_status = $keyarray['payment_status']; $invoice_id = jb_strip_order_id($keyarray['invoice']); $product_type = substr($invoice_id, 0, 1); // 'P' or 'S' $invoice_id = substr($invoice_id, 1); JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type); if ($payment_status == 'Completed') { if ($product_type == 'P') { ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <?php $label['payment_posts_completed2'] = str_replace("%URL%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER . 'manager.php', $label['payment_posts_completed2']); ?> <p><?php echo $label['payment_posts_completed2']; ?> </p> </center> <?php } elseif ($product_type == 'S') { ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <?php $label['payment_subscription_completed2'] = str_replace("%URL%", JB_BASE_HTTP_PATH . JB_EMPLOYER_FOLDER . 'search.php', $label['payment_subscription_completed2']); ?> <p><?php echo $label['payment_subscription_completed2']; ?> </p> </center> <?php } elseif ($product_type == 'M') { // membership completed ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <?php //$label['payment_membership_completed'] = str_replace("%URL%", JB_BASE_HTTP_PATH.JB_EMPLOYER_FOLDER, $label['payment_membership_completed']); ?> <p><?php echo $label['payment_membership_completed']; ?> </p> </center> <?php } $sql = "SELECT * FROM jb_txn WHERE txn_id='" . jb_escape_sql($txn_id) . "' and origin='PayPal' "; $result = JB_mysql_query($sql) or die(mysql_error()); if (mysql_num_rows($result) > 0) { // already in the database, possibly entered in by the IPN System } else { if ($product_type == 'P') { JB_complete_package_invoice($invoice_id, 'PayPal'); } elseif ($product_type == 'S') { if (PAYPAL_MANUAL_APPROVE == 'Y') { pp_subscr_manual_approve($invoice_id); } else { JB_complete_subscription_invoice($invoice_id, 'PayPal'); } } elseif ($product_type == 'M') { JB_complete_membership_invoice($invoice_id, 'PayPal'); } JB_debit_transaction($invoice_id, $mc_gross, $mc_currency, $txn_id, $reason_code, 'PayPal', $product_type, $_REQUEST['subscr_id']); } JBPLUG_do_callback('pay_trn_completed', $invoice_id, $product_type); } elseif ($payment_status == 'Pending') { if ($product_type == 'P') { JB_pend_package_invoice($invoice_id, 'PayPal', $reason_code); } elseif ($product_type == 'S') { JB_pend_subscription_invoice($invoice_id, 'PayPal', $reason_code); } elseif ($product_type == 'M') { JB_pend_membership_invoice($invoice_id, 'PayPal', $reason_code); } JBPLUG_do_callback('pay_trn_pending', $invoice_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 { echo "Payment status: {$payment_status}"; } } else { if (strcmp($lines[0], "FAIL") == 0) { // log for manual investigation pp_log_entry('PDD - verification failed'); JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type); echo $label['paypal_ipn_fail']; ?> <?php } } ?> <p> </p> <p> </p> <p> </p> <p> </p> <?php }
<?php if ($_REQUEST['action'] == 'confirm') { //$sql = "update membership_invoices set status='Confirmed' where invoice_id='".$_REQUEST['invoice_id']."'"; //JB_mysql_query($sql) or die(mysql_error()) ; JB_confirm_membership_invoice($_REQUEST['invoice_id']); $JBMarkup->ok_msg('Order Confirmed'); } if ($_REQUEST['action'] == 'complete') { $invoice_row = JB_get_membership_invoice_row($_REQUEST['invoice_id']); if (isset($invoice_row['employer_id'])) { $txn_prefix = 'E'; } else { $txn_prefix = 'P'; } JB_complete_membership_invoice($_REQUEST['invoice_id'], 'Admin'); JB_debit_transaction($_REQUEST['invoice_id'], $invoice_row['amount'], $invoice_row['currency_code'], $txn_prefix . 'M' . $_REQUEST['invoice_id'], $reason_code, 'Admin', 'M'); $JBMarkup->ok_msg('Order Completed'); } if ($_REQUEST['action'] == 'void') { JB_void_membership_invoice($_REQUEST['invoice_id']); $JBMarkup->ok_msg('Order set to Void'); } if ($_REQUEST['action'] == 'cancel') { JB_cancel_membership_invoice($_REQUEST['invoice_id']); $JBMarkup->ok_msg('Order Cancelled'); } if ($_REQUEST['clean_up'] != '') { $sql = "DELETE FROM membership_invoices WHERE status='Void' "; JB_mysql_query($sql) or die(mysql_error()); $JBMarkup->ok_msg('Deleted all Void orders');
function process_payment_return() { global $label; if ($_POST['merchant_id'] != '') { $merchant_id = $_POST['merchant_id']; $transaction_id = $_POST['transaction_id']; $secret = strtoupper(MONEYBOOKERS_SECRET_WORD); $mb_amount = $_POST['mb_amount']; $mb_currency = $_POST['currency']; $status = $_POST['status']; $md5sig = $_POST['md5sig']; $status = $_POST['Status']; foreach ($_POST as $key => $value) { $req .= "&{$key}={$value}"; } mb_log_entry('moneybookers: ' . $req); $working_sig = strtoupper(md5($merchant_id . $transaction_id . $secret . $mb_amount . $mb_currency . $status)); $invoice_id = jb_strip_order_id($transaction_id); $product_type = substr($invoice_id, 0, 1); // 'P' or 'S' $invoice_id = substr($invoice_id, 1); if ($working_sig == $md5sig) { JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type); switch ($status) { case "-2": // failed $label['payment_return_denied'] = str_replace("%PAYMENT_GW%", $this->name, $label['payment_return_denied']); echo "<p align='center'> " . $label['payment_return_denied'] . "</p>"; JBPLUG_do_callback('pay_trn_failed', $invoice_id, $product_type); break; case "2": // processed ?> <?php if ($product_type == 'P') { JB_complete_package_invoice($invoice_id, 'moneybookers.com'); ?> <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($invoice_id, 'moneybookers.com'); ?> <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($invoice_id, 'moneybookers.com'); ?> <center> <img src="<?php echo JB_SITE_LOGO_URL; ?> "> <p><?php echo $label['payment_membership_completed']; ?> </p> </center> <?php } JBPLUG_do_callback('pay_trn_completed', $invoice_id, $product_type); JB_debit_transaction($transaction_id, $mb_amount, MONEYBOOKERS_CURRENCY, $_POST['transaction_id'], $reason, 'moneybookers.com', $product_type); break; case "1": // scheduled (wait for 2 or -2) break; case "0": // pending if ($product_type == 'P') { JB_pend_package_invoice($invoice_id, 'moneybookers.com'); } elseif ($product_type == 'S') { JB_pend_subscription_invoice($invoice_id, 'moneybookers.com'); } JBPLUG_do_callback('pay_trn_pending', $invoice_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 break; case "-1": // cancelled break; } } else { JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type); echo "Invalid signiture"; } } ?> <!-- <p align="center"> Your order is being processed. To get the status of your order, please go to the <a href="credits.php">Credits Page</a> or <a href="subscriptions.php">Subscription Page</a></p> --> <p> </p> <p> </p> <p> </p> <p> </p> <?php }