Exemplo n.º 1
0
function completeOrderUser($order)
{
    $ret = array();
    $gatewaymodule = "bitshares";
    $GATEWAY = getGatewayVariables($gatewaymodule);
    # Checks invoice ID is a valid invoice number or ends processing
    $invoiceid = checkCbInvoiceID($order['order_id'], $GATEWAY["name"]);
    $transid = $order['trx_id'];
    checkCbTransID($transid);
    # Checks transaction number isn't already in the database and ends processing if it does
    # Successful
    $fee = 0;
    $amount = $order['amount'];
    // left blank, this will auto-fill as the full balance
    addInvoicePayment($invoiceid, $transid, $amount, $fee, $gatewaymodule);
    # Apply Payment to Invoice
    $ret['url'] = baseURL . 'viewinvoice.php?id=' . $order['order_id'];
    logTransaction($GATEWAY["name"], $order, $order['status']);
    return $ret;
}
Exemplo n.º 2
0
    }
    if (!$invoiceid) {
        $query = "SELECT tblinvoices.id,tblinvoices.userid FROM tblinvoiceitems INNER JOIN tblinvoices ON tblinvoices.id=tblinvoiceitems.invoiceid INNER JOIN tblhosting ON tblhosting.id=tblinvoiceitems.relid WHERE tblhosting.subscriptionid='" . db_escape_string($transid) . "' AND tblinvoiceitems.type='Hosting' AND tblinvoices.status='Unpaid' ORDER BY tblinvoices.id ASC";
        $result = full_query($query);
        $data = mysql_fetch_array($result);
        $invoiceid = $data[0];
        $userid = $data[1];
    }
    if (!$invoiceid) {
        $query = "SELECT tblinvoices.id,tblinvoices.userid FROM tblinvoiceitems INNER JOIN tblinvoices ON tblinvoices.id=tblinvoiceitems.invoiceid INNER JOIN tblhosting ON tblhosting.id=tblinvoiceitems.relid WHERE tblhosting.subscriptionid='" . db_escape_string($transid) . "' AND tblinvoiceitems.type='Hosting' AND tblinvoices.status='Paid' ORDER BY tblinvoices.id DESC";
        $result = full_query($query);
        $data = mysql_fetch_array($result);
        $invoiceid = $data[0];
        $userid = $data[1];
    }
    checkCbTransID($recurringtransid);
    if (!$invoiceid && !$serviceid) {
        logTransaction($GATEWAY['name'], array_merge(array("InvoiceLookup" => "No Service ID Found in Callback"), $_POST), "Recurring Error");
    }
    if (!$invoiceid) {
        logTransaction($GATEWAY['name'], array_merge(array("InvoiceLookup" => "No invoice match found for Service ID " . $serviceid . " or Subscription ID"), $_POST), "Recurring Error");
    }
    logTransaction($GATEWAY['name'], $_POST, "Recurring Success");
    $amount = tcoconvertcurrency($amount, $currency, $invoiceid);
    addInvoicePayment($invoiceid, $recurringtransid, $amount, $fee, $gatewaymodule);
    if ($serviceid && $transid) {
        update_query("tblhosting", array("subscriptionid" => $transid), array("id" => $serviceid));
        return 1;
    }
} else {
    if ($message_type == "RECURRING_INSTALLMENT_FAILED") {
Exemplo n.º 3
0
$GATEWAY = getGatewayVariables("moneybookers");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
header("HTTP/1.1 200 OK");
$_POST['transaction_id'];
$transid = $_POST['mb_transaction_id'];
$merchant_id = $_POST['merchant_id'];
$mb_amount = $_POST['mb_amount'];
$amount = $_POST['amount'];
$mb_currency = $_POST['mb_currency'];
$currency = $_POST['currency'];
$invoiceid = $_POST['md5sig'];
$md5sig = header("Status: 200 OK");
$status = $_POST['status'];
checkCbTransID($_POST['mb_transaction_id']);
if ($GATEWAY['secretword']) {
    if (strtoupper(md5($merchant_id . $invoiceid . strtoupper(md5($GATEWAY['secretword'])) . $mb_amount . $mb_currency . $status)) != $md5sig) {
        logTransaction("Moneybookers", $_REQUEST, "MD5 Signature Failure");
        exit;
    }
}
$result = select_query("tblcurrencies", "id", array("code" => $currency));
$data = mysql_fetch_array($result);
$currencyid = $data['id'];
if (!$currencyid) {
    logTransaction("Moneybookers", $_REQUEST, "Unrecognised Currency");
    exit;
}
if ($GATEWAY['convertto']) {
    $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid));
Exemplo n.º 4
0
$mc_gross = $_POST['mc_gross'];
$mc_fee = $_POST['mc_fee'];
$idnumber = $_POST['custom'];
$paypalcurrency = $_REQUEST['mc_currency'];
$paypalemails = explode(",", strtolower($GATEWAY['email']));
array_walk($paypalemails, "paypal_email_trim");
if (!in_array(strtolower($paypalemail), $paypalemails)) {
    logTransaction("PayPal", $orgipn, "Invalid Receiver Email");
    exit;
}
if ($payment_status == "Pending") {
    logTransaction("PayPal", $orgipn, "Pending");
    exit;
}
if ($txn_id) {
    checkCbTransID($txn_id);
}
if (!is_numeric($idnumber)) {
    $idnumber = "";
}
if ($txn_type == "web_accept" && $_POST['invoice'] && $payment_status == "Completed") {
    update_query("tblaccounts", array("fees" => $mc_fee), array("transid" => $txn_id));
}
$result = select_query("tblcurrencies", "", array("code" => $paypalcurrency));
$data = mysql_fetch_array($result);
$paypalcurrencyid = $data['id'];
$currencyconvrate = $data['rate'];
if (!$paypalcurrencyid) {
    logTransaction("PayPal", $orgipn, "Unrecognised Currency");
    exit;
}
Exemplo n.º 5
0
 $aps = explode("&", $response);
 foreach ($aps as $ap) {
     $ele = explode("=", $ap);
     $info[$ele[0]] = $ele[1];
 }
 $result = select_query("tblcurrencies", "", array("code" => $info['ap_currency']));
 $data = mysql_fetch_array($result);
 $currencyid = $data['id'];
 if (!$currencyid) {
     logTransaction("Payza", $response, "Unrecognised Currency");
     exit;
 }
 if ($info['ap_status'] == "Success") {
     $_REQUEST = $info;
     $id = checkCbInvoiceID($info['apc_1'], "Payza");
     checkCbTransID($info['ap_referencenumber']);
     $amount = $info['ap_totalamount'];
     $fees = $info['ap_feeamount'];
     $result = select_query("tblinvoices", "userid,total", array("id" => $id));
     $data = mysql_fetch_array($result);
     $userid = $data['userid'];
     $total = $data['total'];
     $currency = getCurrency($userid);
     if ($currencyid != $currency['id']) {
         $amount = convertCurrency($amount, $currencyid, $currency['id']);
         $fees = convertCurrency($fees, $currencyid, $currency['id']);
         if ($total < $amount + 1 && $amount - 1 < $total) {
             $amount = $total;
         }
     }
     addInvoicePayment($info['apc_1'], $info['ap_referencenumber'], $amount, $fees, "Payza");
Exemplo n.º 6
0
$gatewayParams = getGatewayVariables("paymentwallbrick");
// Die if module is not active.
if (!$gatewayParams['type']) {
    die("Module Not Activated");
}
if (!class_exists("Paymentwall_Config")) {
    require_once dirname(__FILE__) . "/lib/paymentwall.php";
}
if ($gatewayParams["test_mode"] == "on") {
    Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $gatewayParams['test_public_key'], 'private_key' => $gatewayParams['test_private_key']));
} else {
    Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $gatewayParams['public_key'], 'private_key' => $gatewayParams['private_key']));
}
$charge_id = $_GET["ref"];
$invoice_id = $_GET["goodsid"];
$status = $_GET['type'];
$charge = new Paymentwall_Charge($_GET["ref"]);
logTransaction($gatewayParams["name"], $_GET, "PingBack");
$charge->get();
if ($status == 201 && $charge->isCaptured()) {
    $invoiceId = checkCbInvoiceID($invoice_id, $gatewayParams['name']);
    checkCbTransID($charge_id);
    logTransaction($gatewayParams["name"], var_export($charge, true), "Charge Approved via PingBack");
    addInvoicePayment($invoiceId, $charge_id, null, null, "paymentwallbrick");
} elseif ($status == 202) {
    $invoiceId = checkCbInvoiceID($invoice_id, $gatewayParams['name']);
    checkCbTransID($charge_id);
    logTransaction($gatewayParams["name"], var_export($charge, true), "Charge Declined via PingBack");
    sendMessage("Credit Card Payment Failed", $invoiceId);
}
echo "OK";
$order = $json->order;
$id = $order->id;
$completed_at = $order->completed_at;
$status = $order->status;
$total_btc_cents = $order->total_btc->cents;
$total_btc_currency = $order->total_btc->currency_iso;
$total_native_cents = $order->total_native->cents;
$total_native_currency = $order->total_native->currency_iso;
$invoice_id = $order->custom;
$trans_id = $order->transaction->hash;
$confirmation = $order->transaction->confirmation;
$fee = '0.00';
$amount = number_format($total_native_cents / 100, 2, '.', '');
$invoice_id = checkCbInvoiceID($invoice_id, $GATEWAY["name"]);
# Checks invoice ID is a valid invoice number or ends processing
checkCbTransID($trans_id);
# Checks transaction number isn't already in the database and ends processing if it does
if ($status == "completed") {
    # Successful
    # http://docs.whmcs.com/API:Update_Invoice - add BTC currency conversion in invoice notes
    $command = "updateinvoice";
    $values["invoiceid"] = $invoice_id;
    #changeme
    $values["notes"] = "BTC:{$total_btc_cents};USD:{$total_native_cents};";
    #changeme
    $results = localAPI($command, $values, $adminuser);
    //addInvoicePayment($invoice_id,$trans_id,$amount,$fee,$gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
    $command = "addinvoicepayment";
    $values["invoiceid"] = $invoice_id;
    $values["transid"] = $trans_id;
    $values["amount"] = $amount;
    $checkout_parsed = simplexml_load_string($retorno_curl);
    if ($checkout_parsed->code) {
        $result = '<form action="https://pagseguro.uol.com.br/v2/checkout/payment.html" method="get">' . "\n";
        $result .= '    <input type="hidden" name="code" value="' . $checkout_parsed->code . '">' . "\n";
        $result .= '    <input type="submit" value="Pagar Agora">' . "\n";
        $result .= '</form>' . "\n";
    } else {
        $result = '<font style="color:red">Ocorreu um erro na comunicação com o PagSeguro</font>';
        logTransaction($params['name'], $retorno_curl . print_r($params, true) . ($checkout_parsed ? " / " . $checkout_parsed : ""), 'Unsuccessful');
    }
    return $result;
}
if (basename(__FILE__) == basename($_SERVER['SCRIPT_NAME'])) {
    if (!array_key_exists('notificationCode', $_POST) || !array_key_exists('notificationType', $_POST)) {
        header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
        die;
    }
    require '../../init.php';
    require '../../includes/invoicefunctions.php';
    require '../../includes/gatewayfunctions.php';
    $GATEWAY = getGatewayVariables('pagseguroapilite');
    $curl = curl_init('https://ws.pagseguro.uol.com.br/v3/transactions/notifications/' . $_POST['notificationCode'] . '?email=' . $GATEWAY['email'] . '&token=' . $GATEWAY['token']);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    $xml = simplexml_load_string(curl_exec($curl));
    logTransaction($GATEWAY['name'], print_r($_POST, true) . print_r($xml, true), 'Successful');
    $invoiceid = checkCbInvoiceID($xml->reference, $GATEWAY["name"]);
    checkCbTransID($xml->code);
    if ($xml->status == 3 || $xml->status == 4) {
        addInvoicePayment($invoiceid, $xml->code, (double) $xml->grossAmount, 0, 'pagseguroapilite');
    }
}
Exemplo n.º 9
0
 // Get user and transaction currencies
 $userCurrency = getCurrency($transaction['userid']);
 $transactionCurrency = select_query('tblcurrencies', '', array('id' => $transaction['currencyid']));
 $transactionCurrency = mysql_fetch_assoc($transactionCurrency);
 // Check payment
 $mollie = new Mollie_API_Client();
 $mollie->setApiKey($_GATEWAY['key']);
 $payment = $mollie->payments->get($_POST['id']);
 if ($payment->isPaid()) {
     // Add conversion, when there is need to. WHMCS only supports currencies per user. WHY?!
     if ($transactionCurrency['id'] != $userCurrency['id']) {
         $transaction['amount'] = convertCurrency($transaction['amount'], $transaction['currencyid'], $userCurrency['id']);
     }
     // Check invoice
     $invoiceid = checkCbInvoiceID($transaction['invoiceid'], $_GATEWAY['paymentmethod']);
     checkCbTransID($transaction['paymentid']);
     // Add invoice
     addInvoicePayment($invoiceid, $transaction['paymentid'], $transaction['amount'], '', $_GATEWAY['paymentmethod']);
     update_query('gateway_mollie', array('status' => 'paid', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id']));
     logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Paid)');
     header('HTTP/1.1 200 OK');
     exit;
 } else {
     if ($payment->isOpen() == FALSE) {
         update_query('gateway_mollie', array('status' => 'closed', 'updated' => date('Y-m-d H:i:s', time())), array('id' => $transaction['id']));
         logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Successful (Closed)');
         header('HTTP/1.1 200 OK');
         exit;
     } else {
         logTransaction($_GATEWAY['paymentmethod'], array_merge($transaction, $_POST), 'Callback - Failure 1 (Payment not open or paid)');
         header('HTTP/1.1 500 Payment not open or paid');
Exemplo n.º 10
0
require_once dirname(__FILE__) . '/../paytm-sdk/encdec_paytm.php';
$gatewaymodule = "paytm";
$GATEWAY = getGatewayVariables($gatewaymodule);
$response = array();
$response = $_POST;
if (isset($response['ORDERID']) && isset($response['STATUS']) && isset($response['RESPCODE']) && $response['RESPCODE'] != 325) {
    $txnid = $response['ORDERID'];
    $txnid = checkCbInvoiceID($txnid, 'paytm');
    $status = $response['STATUS'];
    $paytm_trans_id = $response['TXNID'];
    $checksum_recv = '';
    $amount = $response['TXNAMOUNT'];
    if (isset($response['CHECKSUMHASH'])) {
        $checksum_recv = $response['CHECKSUMHASH'];
    }
    checkCbTransID($paytm_trans_id);
    $checksum_status = verifychecksum_e($response, html_entity_decode($GATEWAY['merchant_key']), $checksum_recv);
    if ($status == 'TXN_SUCCESS' && $checksum_status == "TRUE") {
        $gatewayresult = "success";
        addInvoicePayment($txnid, $paytm_trans_id, $amount, $gatewaymodule);
        logTransaction($GATEWAY["name"], $response, $response['RESPMSG']);
    } elseif ($status == "TXN_SUCCESS" && $checksum_status != "TRUE") {
        logTransaction($GATEWAY["name"], $response, "Checksum Mismatch");
    } else {
        logTransaction($GATEWAY["name"], $response, $response['RESPMSG']);
    }
    $protocol = 'http://';
    $host = '';
    if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == '1')) {
        $protocol = 'https://';
    }
Exemplo n.º 11
0
 *
 **/
require "../../../init.php";
$whmcs->load_function("gateway");
$whmcs->load_function("invoice");
$GATEWAY = getGatewayVariables("worldpay");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
if ($GATEWAY['prpassword']) {
    if ($GATEWAY['prpassword'] != $_REQUEST['callbackPW']) {
        logTransaction($GATEWAY['name'], $_REQUEST, "Payment Response Password Mismatch");
        exit;
    }
}
$invoiceid = checkCbInvoiceID($_POST['cartId'], "WorldPay");
echo "<WPDISPLAY ITEM=\"banner\">";
if ($_POST['transStatus'] == "Y") {
    if ($invoiceid) {
        checkCbTransID($_POST['transId']);
        addInvoicePayment($invoiceid, $_POST['transId'], "", "", "worldpay");
        logTransaction("WorldPay", $_POST, "Successful");
        echo "<p align=\"center\"><a href=\"" . $CONFIG['SystemURL'] . "/viewinvoice.php?id=" . $invoiceid . "&paymentsuccess=true\">Click here to return to " . $CONFIG['CompanyName'] . "</a></p>";
        exit;
    } else {
        logTransaction("WorldPay", $_POST, "Error");
    }
} else {
    logTransaction("WorldPay", $_POST, "Unsuccessful");
}
echo "<p align=\"center\"><a href=\"" . $CONFIG['SystemURL'] . "/viewinvoice.php?id=" . $invoiceid . "&paymentfailed=true\">Click here to return to " . $CONFIG['CompanyName'] . "</a></p>";
    $transactionMessage = !empty($chargeId) && empty($redirectUrl) ? ", transaction id - {$chargeId}" : '';
    logTransaction($GATEWAY["name"], "Your payment was not completed. Response is invalid for trackId - {$invoiceId}{$transactionMessage}. Action - authorize. Try again or contact customer support.", "Unsuccessful");
    $_SESSION['checkout_error'] = true;
    $_SESSION['checkout_error_message'] = 'Please check you card details and try again. Thank you';
    header("Location:" . $returnUrl);
    exit;
}
if ($redirectUrl) {
    $_SESSION['checkout_payment_token']['invoice_id'] = $invoiceId;
    $_SESSION['checkout_payment_token']['token'] = $respondCharge->getId();
    header("Location:" . $redirectUrl);
    exit;
}
$cardId = $respondCharge->getCard()->getId();
$amount = $Api->decimalToValue($respondCharge->getValue(), $currency);
$invoiceId = checkCbInvoiceID($invoiceId, $GATEWAY["name"]);
# Checks invoice ID is a valid invoice number or ends processing
checkCbTransID($chargeId);
# Checks transaction number isn't already in the database and ends processing if it does
addInvoicePayment($invoiceId, $chargeId, $amount, '', $gatewaymodule);
$sql = "update `tblclients` set `gatewayid` ='" . $cardId . "' where `id`=" . $ClientID;
if ($ClientID != '' && $cardId != '') {
    mysql_query($sql);
}
$message = 'Your payment was completed. ChargeId: ' . $chargeId . ' Invoice Id : ' . $invoiceId;
if ($respondCharge->getResponseCode() == 10000) {
    logTransaction($GATEWAY["name"], $message, "Successful");
} elseif ($respondCharge->getResponseCode() == 10100) {
    logTransaction($GATEWAY["name"], $message, "Flagged");
}
header("Location:" . $returnUrl);
Exemplo n.º 13
0
        $url = "https://test.sagepay.com/gateway/service/direct3dcallback.vsp";
    } else {
        $url = "https://live.sagepay.com/gateway/service/direct3dcallback.vsp";
    }
}
$response = sagepaytokens_call($url, $_POST);
$baseStatus = $response['Status'];
$invoiceid = $_REQUEST['invoiceid'];
if (!$invoiceid && isset($_SESSION['sagepaytokensinvoiceid'])) {
    $invoiceid = $_SESSION['sagepaytokensinvoiceid'];
}
$invoiceid = checkCbInvoiceID($invoiceid, "SagePay Tokens 3DAuth");
$callbacksuccess = false;
switch ($response['Status']) {
    case "OK":
        checkCbTransID($response['VPSTxId']);
        addInvoicePayment($invoiceid, $response['VPSTxId'], "", "", "sagepaytokens", "on");
        logTransaction("SagePay Tokens 3DAuth", $response, "Successful");
        sendMessage("Credit Card Payment Confirmation", $invoiceid);
        $callbacksuccess = true;
        break;
    case "NOTAUTHED":
        logTransaction("SagePay Tokens 3DAuth", $response, "Not Authed");
        sendMessage("Credit Card Payment Failed", $invoiceid);
        update_query("tblclients", array("cardtype" => "", "cardlastfour" => "", "cardnum" => "", "expdate" => "", "issuenumber" => ""), array("id" => $userid));
        break;
    case "REJECTED":
        logTransaction("SagePay Tokens 3DAuth", $response, "Rejected");
        sendMessage("Credit Card Payment Failed", $invoiceid);
        update_query("tblclients", array("cardtype" => "", "cardlastfour" => "", "cardnum" => "", "expdate" => "", "issuenumber" => ""), array("id" => $userid));
        break;
Exemplo n.º 14
0
}
/**
 * Validate Callback Invoice ID.
 * Checks invoice ID is a valid invoice number. Note it will count an
 * invoice in any status as valid.
 * Performs a die upon encountering an invalid Invoice ID.
 * Returns a normalised invoice ID.
 */
$invoiceId = checkCbInvoiceID($responseData['invoice_id'], $gatewayParams['name']);
/**
 * Check Callback Transaction ID.
 * Performs a check for any existing transactions with the same given
 * transaction number.
 * Performs a die upon encountering a duplicate.
 */
checkCbTransID($responseData['ep_id']);
/**
 * Start the payment response logic process
 *
 * in two cases, payment may be approved directly,
 * but in one case, paymeny may be manually verified (yet not rejected)
 *
 */
if ($HashIsOK) {
    // if hash verification confirms data integrity
    if (0 == intval($responseData['action'])) {
        // if action is "0", meaning bank approved transaction
        switch ($responseData['sec_status']) {
            case "1":
                $message = "Valid transaction, pending state";
                break;
Exemplo n.º 15
0
include "../../../includes/invoicefunctions.php";
$gatewaymodule = "razorpay";
$GATEWAY = getGatewayVariables($gatewaymodule);
# Checks gateway module is active before accepting callback
if (!$GATEWAY["type"]) {
    die("Module Not Activated");
}
$key_id = $GATEWAY["KeyId"];
$key_secret = $GATEWAY["KeySecret"];
# Get Returned Variables
$merchant_order_id = $_POST["merchant_order_id"];
$razorpay_payment_id = $_POST["razorpay_payment_id"];
# Checks invoice ID is a valid invoice number or ends processing
$merchant_order_id = checkCbInvoiceID($merchant_order_id, $GATEWAY["name"]);
# Checks transaction number isn't already in the database and ends processing if it does
checkCbTransID($razorpay_payment_id);
# Fetch invoice to get the amount
$result = mysql_fetch_assoc(select_query('tblinvoices', 'total', array("id" => $merchant_order_id)));
$amount = $result['total'];
# Check if amount is INR, convert if not.
$currency = getCurrency();
if ($currency['code'] !== 'INR') {
    $result = mysql_fetch_array(select_query("tblcurrencies", "id", array("code" => 'INR')));
    $inr_id = $result['id'];
    $converted_amount = convertCurrency($amount, $currency['id'], $inr_id);
} else {
    $converted_amount = $amount;
}
# Amount in Paisa
$converted_amount = 100 * $converted_amount;
$success = true;
Exemplo n.º 16
0
<?php

/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
require "../../../init.php";
$whmcs->load_function("gateway");
$whmcs->load_function("invoice");
$GATEWAY = getGatewayVariables("egold");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$invoiceid = checkCbInvoiceID($invoiceid, "E-Gold");
checkCbTransID($_POST['PAYMENT_BATCH_NUM']);
addInvoicePayment($invoiceid, $_POST['PAYMENT_BATCH_NUM'], $_POST['PAYMENT_AMOUNT'], "", "egold");
logTransaction("E-Gold", $_REQUEST, "Successful");
header("HTTP/1.1 200 OK");
header("Status: 200 OK");
Exemplo n.º 17
0
# Checks gateway module is active before accepting callback
$transaction_hash = $_GET['transaction_hash'];
$input_transaction_hash = $_GET['input_transaction_hash'];
$input_address = $_GET['input_address'];
$value_in_influx = $_GET['value'];
$value_in_infx = $value_in_influx / 100000000;
$confirmations = $_GET['confirmations'];
$security_hash = $_GET['security_hash'];
$invoiceid = $_GET['invoiceid'];
$ninfx = $_GET['ninfx'];
$amount = $_GET['amount'];
$fee = 0.0;
$invdata = mysql_fetch_assoc(mysql_query("SELECT status,notes FROM `tblinvoices` WHERE `id`='" . $invoiceid . "'"));
$invoiceid = checkCbInvoiceID($invoiceid, $GATEWAY["name"]);
# Checks invoice ID is a valid invoice number or ends processing
checkCbTransID($transaction_hash);
# Checks transaction number isn't already in the database and ends processing if it does
// Verify the security hash
$salt_hash = $invdata['notes'];
// Get the salt_hash from DB
$my_hash = md5($salt_hash . "-" . $input_transaction_hash . "-" . $value_in_influx . "-" . $confirmations);
if ($my_hash != $security_hash) {
    die("Invalid Security Hash.");
}
if ($confirmations > 6 && $transaction_hash) {
    if ($ninfx = $value_in_infx) {
        # Successful
        addInvoicePayment($invoiceid, $transaction_hash, $amount, $fee, $gatewaymodule);
        # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
        logTransaction($GATEWAY["name"], $_POST, "Successful");
        # Save to Gateway Log: name, data array, status
Exemplo n.º 18
0
OrderID : ' . $cevap->Order->OrderID . '
Transaction Bilgileri :
Source : ' . $cevap->Transaction->Response->Source . '
Code : ' . $cevap->Transaction->Response->Code . '
ReasonCode : ' . $cevap->Transaction->Response->ReasonCode . '
Mesaj : ' . $cevap->Transaction->Response->Message . '
Sistem Hata Mesajı : ' . $cevap->Transaction->Response->SysErrMsg . '
RetrefNum : ' . $cevap->Transaction->RetrefNum . '
BatchNum : ' . $cevap->Transaction->BatchNum . '
SequenceNum : ' . $cevap->Transaction->SequenceNum . '
ProvDate : ' . $cevap->Transaction->ProvDate . '
CardNumberMasked : ' . $cevap->Transaction->CardNumberMasked . '
CardHolderName : ' . $cevap->Transaction->CardHolderName . '
CardType : ' . $cevap->Transaction->CardType . '
HashData : ' . $cevap->Transaction->HashData . '
XML : ' . $results;
    $ReasonCode = $cevap->Transaction->Response->ReasonCode;
    $invoiceid = checkCbInvoiceID($strOrderID, $GATEWAY["name"]);
    checkCbTransID($transid);
    if (00 == (int) $ReasonCode) {
        addInvoicePayment($strOrderID, $authcode, $StrAmount, "0", $gatewaymodule);
        logTransaction($GATEWAY["name"], $kayit, "Successful");
        echo "<script>alert('Ödeme Tamamlandı');</script>";
        callback3DSecureRedirect($strOrderID, true);
    } else {
        logTransaction($GATEWAY["name"], $kayit, "Unsuccessful");
        echo "Ödeme işlemi tamamlanamadı<br/>";
        echo 'Hata : ' . $cevap->Transaction->Response->ErrorMsg . ' - ' . $cevap->Transaction->Response->SysErrMsg;
        callback3DSecureRedirect($strOrderID, false);
    }
}
Exemplo n.º 19
0
    $token = $_GET['token'];
    $id_user = $_GET['id_user'];
    $amount = number_format($_GET['PRICE'] / 100, 2, '.', '');
    $paymentmethod = $_GET['paymentmethod'];
    $id_transaction_mpay24 = $_GET['MPAYTID'];
    $status = $_GET['STATUS'];
    $description = urldecode($_GET['description']);
    $hashKeyExtension = !empty($gateway['hashKeyExtension']) ? $gateway['hashKeyExtension'] : '';
    $tokenGenerated = sha1($hashKeyExtension . md5($_SERVER['HTTP_HOST'] . sha1($id_user * 100 / 23.5) . md5($amount) . $description . $_SERVER['SERVER_ADDR'] . 'CC'));
    try {
        if ($token == $tokenGenerated) {
            if (!$gateway["type"]) {
                throw new Exception("Module Not Activated");
            }
            $invoiceid = checkCbInvoiceID($id_invoice, $gateway["name"]);
            checkCbTransID($id_transaction_mpay24);
            addInvoicePayment($id_invoice, $id_transaction_mpay24, $amount, 0, $gatewayModule);
            logTransaction($gatewayModule, $_GET, "Successful");
            sendMessage("Credit Card Payment Confirmation", $id_invoice);
            echo "OK: STATUS received; Invoice marked as paid";
            if (isset($gateway['emailNotification']) && 'on' == $gateway['emailNotification'] && !empty($gateway['notificationRecipients'])) {
                $subject = empty($gateway['notificationSubject']) ? 'WHMCS order notification' : $gateway['notificationSubject'];
                $senderName = empty($gateway['notificationSenderName']) ? 'WHMCS order notification' : $gateway['notificationSenderName'];
                $senderEmail = empty($gateway['notificationSenderEmail']) ? '*****@*****.**' : $gateway['notificationSenderEmail'];
                $tempRecipients = explode(',', $gateway['notificationRecipients']);
                $header = 'From: ' . $senderName . '' . "\r\n" . 'Reply-To: ' . $senderEmail . '' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
                $content = 'Order notification from Module ' . $gateway['paymentmethod'] . '
					
Invoice ID: ' . $id_invoice . '

Amount: ' . $amount . '
$base = json_decode(base64_decode($qry['data']), true);
/**
 * Validate Callback Invoice ID.
 * Checks invoice ID is a valid invoice number. Note it will count an
 * invoice in any status as valid.
 * Performs a die upon encountering an invalid Invoice ID.
 * Returns a normalised invoice ID.
 */
$invoiceId = checkCbInvoiceID($base['invoice_id'], $gatewayParams['name']);
/**
 * Check Callback Transaction ID.
 * Performs a check for any existing transactions with the same given
 * transaction number.
 * Performs a die upon encountering a duplicate.
 */
checkCbTransID($transactionId);
switch ($sec_status) {
    case "1":
        $transactionStatus = "Valid transaction, pending state";
        break;
    case "2":
        $transactionStatus = "Failed transaction";
        break;
    case "3":
        $transactionStatus = "Manual verification";
        break;
    case "4":
        $transactionStatus = "Suspicious transaction, waiting client response";
        break;
    case "5":
        $transactionStatus = "Fraud";
Exemplo n.º 21
0
if (get_magic_quotes_gpc()) {
    $xml_response = stripslashes($xml_response);
}
$xmldata = XMLtoArray($xml_response);
if (is_array($xmldata['CHARGE-AMOUNT-NOTIFICATION'])) {
    $ordernumber = $xmldata['CHARGE-AMOUNT-NOTIFICATION']['GOOGLE-ORDER-NUMBER'];
    $amount = $xmldata['CHARGE-AMOUNT-NOTIFICATION']['LATEST-CHARGE-AMOUNT'];
    $fee = $xmldata['CHARGE-AMOUNT-NOTIFICATION']['LATEST-CHARGE-FEE']['TOTAL'];
    $query = "SELECT data FROM tblgatewaylog WHERE gateway='Google Checkout' AND data LIKE '%new-order-notification%" . db_escape_string($ordernumber) . "%'";
    $result = full_query($query);
    $data = mysql_fetch_array($result);
    $gatewaylogdata = $data['data'];
    $orderxml = XMLtoArray($gatewaylogdata);
    $invoiceid = $orderxml['NEW-ORDER-NOTIFICATION']['SHOPPING-CART']['ITEMS']['ITEM']['MERCHANT-ITEM-ID'];
    $invoiceid = checkCbInvoiceID($invoiceid, "Google Checkout");
    checkCbTransID($ordernumber);
    if ($GATEWAY['convertto']) {
        $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid));
        $data = mysql_fetch_array($result);
        $userid = $data['userid'];
        $total = $data['total'];
        $currency = getCurrency($userid);
        $amount = convertCurrency($amount, $GATEWAY['convertto'], $currency['id']);
        $fee = convertCurrency($fee, $GATEWAY['convertto'], $currency['id']);
        if ($total < $amount + 1 && $amount - 1 < $total) {
            $amount = $total;
        }
    }
    addInvoicePayment($invoiceid, $ordernumber, $amount, $fee, "googlecheckout");
    logTransaction("Google Checkout", $xml_response, "Successful");
    return 1;