Пример #1
0
function optimalpayments_3dsecure($params)
{
    $cardtype = optimalpayments_cardtype($params['cardtype']);
    $xml = "<ccEnrollmentLookupRequestV1\nxmlns=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://www.optimalpayments.com/creditcard/xmlschema/v1\">\n<merchantAccount>\n<accountNum>" . $params['accountnumber'] . "</accountNum>\n<storeID>" . $params['merchantid'] . "</storeID>\n<storePwd>" . $params['merchantpw'] . "</storePwd>\n</merchantAccount>\n<merchantRefNum>" . $params['invoiceid'] . "</merchantRefNum>\n<amount>" . $params['amount'] . "</amount>\n<card>\n<cardNum>" . $params['cardnum'] . "</cardNum>\n<cardExpiry>\n<month>" . substr($params['cardexp'], 0, 2) . "</month>\n<year>20" . substr($params['cardexp'], 2, 2) . "</year>\n</cardExpiry>\n<cardType>" . $cardtype . "</cardType>\n</card>\n</ccEnrollmentLookupRequestV1>";
    $url = "https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1";
    if ($params['testmode']) {
        $url = "https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1";
    }
    $query_str = "txnMode=ccTDSLookup&txnRequest=" . urlencode($xml);
    $data = curlCall($url, $query_str);
    $xmldata = XMLtoArray($data);
    $xmldata = $xmldata['CCTXNRESPONSEV1'];
    if ($xmldata['CODE'] == "0") {
        logTransaction("Optimal Payments 3D Auth", $data, "Lookup Successful");
        $_SESSION['optimalpaymentsconfirmationnumber'] = $xmldata['CONFIRMATIONNUMBER'];
        if ($xmldata['TDSRESPONSE']['ENROLLMENTSTATUS'] == "Y") {
            $code = "<form method=\"post\" action=\"" . $xmldata['TDSRESPONSE']['ACSURL'] . "\">\n<input type=hidden name=\"PaReq\" value=\"" . $xmldata['TDSRESPONSE']['PAYMENTREQUEST'] . "\">\n<input type=hidden name=\"TermUrl\" value=\"" . $params['systemurl'] . "/modules/gateways/callback/optimalpayments.php\">\n<input type=hidden name=\"MD\" value=\"" . $params['invoiceid'] . "\">\n<noscript>\n<div class=\"errorbox\"><b>JavaScript is currently disabled or is not supported by your browser.</b><br />Please click the continue button to proceed with the processing of your transaction.</div>\n<p align=\"center\"><input type=\"submit\" value=\"Continue >>\" /></p>\n</noscript>\n</form>";
            return $code;
        }
        $captureresult = optimalpayments_capture($params);
        if ($captureresult['status'] == "success") {
            addInvoicePayment($params['invoiceid'], $captureresult['transid'], "", "", "optimalpayments", "on");
            sendMessage("Credit Card Payment Confirmation", $invoiceid);
        }
        logTransaction("Optimal Payments Non 3d Processed", $captureresult['rawdata'], ucfirst($captureresult['status']));
        return $captureresult['status'];
    }
    logTransaction("Optimal Payments 3D Auth", $data, "Failed");
}
Пример #2
0
/**
 * @param $invoiceid
 * @param $pingback
 * @param $gateway
 * @param $userData
 * @param $orderData
 */
function processDeliverable($invoiceid, $pingback, $gateway, $userData, $orderData)
{
    addInvoicePayment($invoiceid, $pingback->getReferenceId(), null, null, 'paymentwall');
    $invoiceItems = select_query('tblinvoiceitems', '*', array("invoiceid" => $invoiceid));
    $hosting = false;
    if ($hostId = getHostId($invoiceItems)) {
        $hosting = mysql_fetch_assoc(select_query('tblhosting', 'tblhosting.id,tblhosting.username,tblproducts.autosetup,tblhosting.packageid', array("tblhosting.id" => $hostId), false, false, 1, "tblproducts ON tblhosting.packageid=tblproducts.id"));
    }
    // Update subscription id
    if ($hosting) {
        updateSubscriptionId($pingback->getReferenceId(), array('id' => $hosting['id']));
    }
    // Check enable delivery request
    if (isset($gateway['enableDeliveryApi']) && $gateway['enableDeliveryApi'] && $hosting) {
        sendDeliveryApiRequest($invoiceid, $hosting, $userData, $orderData, $pingback);
    }
    logTransaction($gateway['name'], $_GET, "Successful");
}
Пример #3
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;
}
Пример #4
0
/**
 ** WHMCS method to capture payments
 ** This method is triggered by WHMCS in an attempt to capture a PreAuth payment
 **
 ** @param array $params Array of paramaters parsed by WHMCS
 **/
function gocardless_capture($params)
{
    # create GoCardless DB if it hasn't already been created
    gocardless_createdb();
    # grab the gateway information from WHMCS
    $gateway = getGatewayVariables('gocardless');
    # Send the relevant API information to the GoCardless class for future processing
    gocardless_set_account_details($params);
    # check against the database if the bill relevant to this invoice has already been created
    $existing_payment_query = select_query('mod_gocardless', 'resource_id', array('invoiceid' => $params['invoiceid']));
    $existing_payment = mysql_fetch_assoc($existing_payment_query);
    # check if any rows have been returned or if the returned result is empty.
    # If no rows were returned, the bill has not already been made for this invoice
    # If a row was returned but the resource ID is empty, the bill has not been completed
    # we have already raised a bill with GoCardless (in theory)
    if (!mysql_num_rows($existing_payment_query) || empty($existing_payment['resource_id'])) {
        #MOD-START
        #Use PreAuth table
        $userid_query = select_query('tblinvoices', 'userid', array('id' => $params['invoiceid']));
        $userid_result = mysql_fetch_array($userid_query);
        if (!empty($userid_result['userid'])) {
            $userid = $userid_result['userid'];
            $preauth_query = select_query('mod_gocardless_preauth', 'subscriptionid', array('userid' => $userid));
            $preauth_result = mysql_fetch_array($preauth_query);
            if (!empty($preauth_result['subscriptionid'])) {
                $preauthid = $preauth_result['subscriptionid'];
            }
        }
        #MOD-END
        # now we are out of the loop, check if we have been able to get the PreAuth ID
        if (isset($preauthid)) {
            # we have found the PreAuth ID, so get it from GoCardless and process a new bill
            $pre_auth = GoCardless_PreAuthorization::find($preauthid);
            # check the preauth returned something
            if ($pre_auth) {
                # Create a bill with the $pre_auth object
                try {
                    $bill = $pre_auth->create_bill(array('amount' => $params['amount'], 'name' => "Invoice #" . $params['invoiceid']));
                } catch (Exception $e) {
                    # we failed to create a new bill, lets update mod_gocardless to alert the admin why payment hasnt been received,
                    # log this in the transaction log and exit out
                    update_query('mod_gocardless', array('payment_failed' => 1), array('invoiceid' => $params['invoiceid']));
                    logTransaction($params['paymentmethod'], "Failed to create GoCardless bill against pre-authorization " . $preauthid . " for invoice " . $params['invoiceid'] . ": " . print_r($e, true) . print_r($bill, true), 'Failed');
                    return array('status' => 'error', 'rawdata' => $e);
                }
                # check that the bill has been created
                if ($bill->id) {
                    # check if the bill already exists in the database, if it does we will just update the record
                    # if not, we will create a new record and record the transaction
                    if (!mysql_num_rows($existing_payment_query)) {
                        # Add the bill ID to the table and mark the transaction as pending
                        insert_query('mod_gocardless', array('invoiceid' => $params['invoiceid'], 'billcreated' => 1, 'resource_id' => $bill->id, 'preauth_id' => $pre_auth->id));
                        if ($gateway['instantpaid'] == on) {
                            # The Instant Activation option is on, so add to the Gateway Log and log a transaction on the invoice
                            addInvoicePayment($params['invoiceid'], $bill->id, $bill->amount, $bill->gocardless_fees, $gateway['paymentmethod']);
                            logTransaction($gateway['paymentmethod'], 'Bill of ' . $bill->amount . ' raised and logged for invoice ' . $params['invoiceid'] . ' with GoCardless ID ' . $bill->id, 'Successful');
                            return array('status' => 'success', 'rawdata' => print_r($bill, true));
                        } else {
                            # Instant Activation is off, so just add to the gateway log and wait before marking as paid until web hook arrives
                            logTransaction($gateway['paymentmethod'], 'Bill of ' . $bill->amount . ' raised for invoice ' . $params['invoiceid'] . ' with GoCardless ID ' . $bill->id, 'Successful');
                            return array('status' => 'pending', 'rawdata' => print_r($bill, true));
                        }
                    } else {
                        # update the table with the bill ID
                        update_query('mod_gocardless', array('billcreated' => 1, 'resource_id' => $bill->id), array('invoiceid' => $params['invoiceid']));
                    }
                }
            } else {
                # PreAuth could not be verified
                logTransaction($gateway['paymentmethod'], 'The pre-authorization specified for invoice ' . $params['invoiceid'] . ' (' . $preauthid . ') does not seem to exist - something has gone wrong, or the customer needs to set up their Direct Debit again.', 'Incomplete');
                return array('status' => 'error', 'rawdata' => array('message' => 'The pre-authorization ID was found for invoice ' . $params['invoiceid'] . ' but it could not be fetched.'));
            }
        } else {
            # we couldn't find the PreAuthID meaning at this point all we can do is give up!
            # the client will have to setup a new preauth to begin recurring payments again
            # or pay using an alternative method
            logTransaction($gateway['paymentmethod'], 'No pre-authorization found when trying to raise payment for invoice ' . $params['invoiceid'] . ' - something has gone wrong, or the customer needs to set up their Direct Debit again.', 'Incomplete');
            return array('status' => 'error', 'rawdata' => array('message' => 'No pre-authorisation ID found in WHMCS for invoice ' . $params['invoiceid']));
        }
    } else {
        # WHMCS is trying to collect the bill but one has already been created - this happens because the bill is not mark as 'paid'
        # until a web hook is received by default, so WHMCS thinks it still needs to collect.
        # logTransaction('GoCardless', 'Bill already created - awaiting update via web hook...' . "\nBill ID: " . $existing_payment['resource_id'], 'Pending');
        # return array('status' => 'Bill already created - awaiting update via web hook...', 'rawdata' =>
        #    array('message' => 'Bill already created - awaiting update via web hook...'));
        return array('status' => 'pending', 'rawdata' => array('message' => 'The bill has already been created for invoice ' . $params['invoiceid']));
    }
}
Пример #5
0
$invoiceid = str_replace($InvoicePrefix, "", $invoiceid);
$invoiceidtoken = explode("T", $invoiceid);
$invoiceid = $invoiceidtoken[0];
checkCbInvoiceID($invoiceid, $GATEWAY["name"]);
# Checks invoice ID is a valid invoice number or ends processing
$sql = "SELECT * FROM mod_allpay where MerchantTradeNo = '" . $InvoicePrefix . "{$invoiceid}'";
$result = mysql_query($sql);
$row = @mysql_fetch_row($result);
if ($row[14] == 1) {
    #Allpay回傳第二次相同付款訊息就不理他,直接回傳1|OK告知收到
    echo "1|OK";
} else {
    if ($status == "1") {
        # Successful
        $sql = "insert into mod_allpay (MerchantID, MerchantTradeNo, RtnCode, RtnMsg, TradeAmt, TradeDate, TradeNo, PaymentNo, ExpireDate, PaymentType, CheckMacValue, Paid) values ('{$MerchantID}', '" . $InvoicePrefix . "{$invoiceid}', '{$RtnCode}', '{$RtnMsg}', '{$amount}', '{$PaymentDate}', '{$transid}', '{$PaymentNo}', '{$PaymentDate}', 'Credit', '{$CheckMacValue}', 1)";
        if (mysql_query($sql)) {
            addInvoicePayment($invoiceid, $transid, $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
            echo "1|OK";
        } else {
            echo "0|ErrorMessage";
        }
    } else {
        # Unsuccessful
        logTransaction($GATEWAY["name"], $_POST, "Unsuccessful");
        # Save to Gateway Log: name, data array, status
        echo "0|ErrorMessage";
    }
}
Пример #6
0
    $url = "https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, $merchantCode . ":" . $password);
curl_setopt($ch, CURLOPT_COOKIEFILE, "" . $cookiestore . $invoiceID . ".cookie");
curl_setopt($ch, CURLOPT_TIMEOUT, 240);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result_tmp = curl_exec($ch);
$xml .= "<echoData>" . $echoData . "</echoData>";
curl_close($ch);
$result_arr = XMLtoArray($result_tmp);
$lastevent = $result_arr['PAYMENTSERVICE']['REPLY']['ORDERSTATUS']['PAYMENT']['LASTEVENT'];
$callbacksuccess = false;
if ($lastevent == "AUTHORISED") {
    addInvoicePayment($invoiceID, $orderCode, $raworderAmount, "", "worldpayinvisiblexml", "on");
    logTransaction("WorldPay Invisible XML Callback", $result_tmp, "Successful");
    sendMessage("Credit Card Payment Confirmation", $invoiceid);
    $callbacksuccess = true;
} else {
    logTransaction("WorldPay Invisible XML Callback", $result_tmp, "Declined");
    sendMessage("Credit Card Payment Failed", $invoiceid);
}
unlink("" . $cookiestore . $invoiceID . ".cookie");
callback3DSecureRedirect($invoiceid, $callbacksuccess);
Пример #7
0
}
$amount = $_REQUEST['amt'];
$callbackvars2 = explode("&amp;", $callbackvars);
foreach ($callbackvars2 as $value) {
    $values[] = explode("=", $value);
}
if ($code == "5") {
    logTransaction("Pay Offline", $orgipn, "Pending");
    exit;
}
if ($transid) {
    checkCbTransID($transid);
}
if ($code == "0") {
    $invoiceid = $values[0][1];
    if ($invoiceid) {
        checkCbInvoiceID($invoiceid, "PayOffline");
        addInvoicePayment($invoiceid, $transid, $amount, "", "payoffline");
        logTransaction("Pay Offline", $_REQUEST, "Successful");
        return 1;
    }
    $userid = $values[2][1];
    $userid = get_query_val("tblclients", "id", array("id" => $userid));
    if (!$userid) {
        logTransaction("Pay Offline", $_REQUEST, "Invoice Not Found");
        return 1;
    }
    insert_query("tblcredit", array("clientid" => $userid, "date" => "now()", "description" => "Pay Offline Transaction ID " . $transid, "amount" => $amount));
    update_query("tblclients", array("credit" => "+=" . $amount), array("id" => $userid));
    logTransaction("Pay Offline", $_REQUEST, "Credit Added");
}
    $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');
    }
}
Пример #9
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");
Пример #10
0
     if (!preg_match('/(^|,)(' . $arrIP[0] . '|\\*{1})(\\.)' . '(' . $arrIP[1] . '|\\*{1})(\\.)' . '(' . $arrIP[2] . '|\\*{1})(\\.)' . '(' . $arrIP[3] . '|\\*{1})($|,)/', $sIP)) {
         $valid_ip = false;
     }
 }
 if (!$valid_ip) {
     $message .= " - IP-адрес сервера не является доверенным\n" . "   доверенные IP: " . $sIP . "\n" . "   IP текущего сервера: " . $_SERVER['REMOTE_ADDR'] . "\n";
     $err = true;
 }
 if ($_POST["m_sign"] != $sign_hash) {
     $message .= " - не совпадают цифровые подписи\n";
     $err = true;
 }
 if (!$err) {
     switch ($_POST['m_status']) {
         case 'success':
             addInvoicePayment($_POST['m_orderid'], $_POST["m_operation_id"], $payed, '', $gatewaymodule);
             logTransaction($GATEWAY['name'], $_POST, 'Successful');
             break;
         default:
             $message .= " - статус платежа не является success\n";
             logTransaction($GATEWAY["name"], $event, "Unsuccessful");
             $err = true;
             break;
     }
 }
 if ($err) {
     $to = $GATEWAY['payeer_email_error'];
     if (!empty($to)) {
         $message = "Не удалось провести платёж через систему Payeer по следующим причинам:\n\n" . $message . "\n" . $log_text;
         $headers = "From: no-reply@" . $_SERVER['HTTP_HOST'] . "\r\n" . "Content-type: text/plain; charset=utf-8 \r\n";
         mail($to, 'Ошибка оплаты', $message, $headers);
Пример #11
0
$aInt = new WHMCS_Admin($reqperm);
$aInt->inClientsProfile = true;
$aInt->requiredFiles(array("gatewayfunctions", "invoicefunctions"));
$aInt->valUserID($userid);
if ($sub == "add") {
    check_token("WHMCS.admin.default");
    if ($invoiceid) {
        $transuserid = get_query_val("tblinvoices", "userid", array("id" => $invoiceid));
        if (!$transuserid) {
            redir("error=invalidinvid");
        } else {
            if ($transuserid != $userid) {
                redir("error=wronguser");
            }
        }
        addInvoicePayment($invoiceid, $transid, $amountin, $fees, $paymentmethod, "", $date);
    } else {
        addTransaction($userid, 0, $description, $amountin, $fees, $amountout, $paymentmethod, $transid, $invoiceid, $date);
    }
    if ($addcredit) {
        if ($transid) {
            $description .= " (Trans ID: " . $transid . ")";
        }
        insert_query("tblcredit", array("clientid" => $userid, "date" => toMySQLDate($date), "description" => $description, "amount" => $amountin));
        update_query("tblclients", array("credit" => "+=" . $amountin), array("id" => (int) $userid));
    }
    redir("userid=" . $userid);
    exit;
}
if ($sub == "save") {
    check_token("WHMCS.admin.default");
Пример #12
0
$amount = $_REQUEST['amount'];
$md5_hash = $_REQUEST['md5_hash'];
$vaultid = $_REQUEST['cust_id'];
checkCbTransID($transid);
$ourhash = md5($GATEWAY['md5hash'] . $GATEWAY['loginid'] . $transid . $amount);
if ($ourhash != $md5_hash) {
    logTransaction("Quantum Vault", $_REQUEST, "MD5 Hash Failure");
    echo "Hash Failure. Please Contact Support.";
    exit;
}
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']);
    if ($total < $amount + 1 && $amount - 1 < $total) {
        $amount = $total;
    }
}
if ($transresult == "APPROVED") {
    update_query("tblclients", array("gatewayid" => $vaultid), array("id" => $vaultid));
    addInvoicePayment($invoiceid, $transid, $amount, "", "quantumvault", "on");
    logTransaction("Quantum Vault", $_REQUEST, "Approved");
    sendMessage("Credit Card Payment Confirmation", $invoiceid);
    callback3DSecureRedirect($invoiceid, true);
}
logTransaction("Quantum Vault", $_REQUEST, "Declined");
sendMessage("Credit Card Payment Failed", $invoiceid);
callback3DSecureRedirect($invoiceid, false);
Пример #13
0
$invoiceid = $data['id'];
$userid = $data['userid'];
if ($invoiceid) {
    logTransaction("PayPal", $orgipn, "Successful");
    $currency = getCurrency($userid);
    if ($paypalcurrencyid != $currency['id']) {
        $mc_gross = convertCurrency($mc_gross, $paypalcurrencyid, $currency['id']);
        $mc_fee = convertCurrency($mc_fee, $paypalcurrencyid, $currency['id']);
        $result = select_query("tblinvoices", "total", array("id" => $invoiceid));
        $data = mysql_fetch_array($result);
        $total = $data['total'];
        if ($total < $mc_gross + 1 && $mc_gross - 1 < $total) {
            $mc_gross = $total;
        }
    }
    addInvoicePayment($invoiceid, $txn_id, $mc_gross, $mc_fee, "paypal");
    $result = select_query("tblinvoiceitems", "", array("invoiceid" => $invoiceid, "type" => "Hosting"));
    $data = mysql_fetch_array($result);
    $relid = $data['relid'];
    update_query("tblhosting", array("subscriptionid" => $subscr_id), array("id" => $relid));
    exit;
}
if ($txn_type == "subscr_payment") {
    $result = select_query("tblhosting", "userid", array("subscriptionid" => $subscr_id));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    if ($userid) {
        $orgipn .= "User ID Found from Subscription ID Match: User ID => " . $userid . "\r\n";
        insert_query("tblaccounts", array("userid" => $userid, "currency" => $paypalcurrencyid, "gateway" => "paypal", "date" => "now()", "description" => "PayPal Subscription Payment", "amountin" => $mc_gross, "fees" => $mc_fee, "rate" => $currencyconvrate, "transid" => $txn_id));
        insert_query("tblcredit", array("clientid" => $userid, "date" => "now()", "description" => "PayPal Subscription Transaction ID " . $txn_id, "amount" => $mc_gross));
        update_query("tblclients", array("credit" => "+=" . $mc_gross), array("id" => (int) $userid));
Пример #14
0
        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");
        logTransaction("Payza", $response, "Successful");
        exit;
        return 1;
    }
    logTransaction("Payza", $response, "Unsuccessful");
    exit;
    return 1;
}
logTransaction("Payza", $response, "No response received from Payza");
exit;
Пример #15
0
$aInt->requiredFiles(array("gatewayfunctions", "invoicefunctions", "processinvoices"));
$aInt->inClientsProfile = true;
if ($delete || $massdelete) {
    checkPermission("Delete Invoice");
}
if ($markpaid || $markunpaid || $markcancelled) {
    checkPermission("Manage Invoice");
}
$aInt->valUserID($userid);
if ($markpaid) {
    check_token("WHMCS.admin.default");
    foreach ($selectedinvoices as $invid) {
        $result2 = select_query("tblinvoices", "paymentmethod", array("id" => $invid));
        $data = mysql_fetch_array($result2);
        $paymentmethod = $data['paymentmethod'];
        addInvoicePayment($invid, "", "", "", $paymentmethod);
        run_hook("InvoicePaid", array("invoiceid" => $invoiceid));
    }
    if ($page) {
        $userid .= "&page=" . $page;
    }
    redir("userid=" . $userid . "&filter=1");
}
if ($markunpaid) {
    check_token("WHMCS.admin.default");
    foreach ($selectedinvoices as $invid) {
        update_query("tblinvoices", array("status" => "Unpaid", "datepaid" => "0000-00-00 00:00:00"), array("id" => $invid));
        logActivity("Reactivated Invoice - Invoice ID: " . $invid, $userid);
        run_hook("InvoiceUnpaid", array("invoiceid" => $invid));
    }
    if ($page) {
Пример #16
0
 function paypalpaymentsproref_3dsecure($params)
 {
     if ($params['sandbox']) {
         $mapurl = "https://centineltest.cardinalcommerce.com/maps/txns.asp";
     } else {
         $mapurl = "https://paypal.cardinalcommerce.com/maps/txns.asp";
     }
     $currency = "";
     if ($params['currency'] == "USD") {
         $currency = "840";
     }
     if ($params['currency'] == "GBP") {
         $currency = "826";
     }
     if ($params['currency'] == "EUR") {
         $currency = "978";
     }
     if ($params['currency'] == "CAD") {
         $currency = "124";
     }
     $postfields = array();
     $postfields['MsgType'] = "cmpi_lookup";
     $postfields['Version'] = "1.7";
     $postfields['ProcessorId'] = $params['processorid'];
     $postfields['MerchantId'] = $params['merchantid'];
     $postfields['TransactionPwd'] = $params['transpw'];
     $postfields['UserAgent'] = $_SERVER['HTTP_USER_AGENT'];
     $postfields['BrowserHeader'] = $_SERVER['HTTP_ACCEPT'];
     $postfields['TransactionType'] = "C";
     $postfields['Amount'] = $params['amount'] * 100;
     $postfields['ShippingAmount'] = "0";
     $postfields['TaxAmount'] = "0";
     $postfields['CurrencyCode'] = $currency;
     $postfields['OrderNumber'] = $params['invoiceid'];
     $postfields['OrderDescription'] = $params['description'];
     $postfields['EMail'] = $params['clientdetails']['email'];
     $postfields['BillingFirstName'] = $params['clientdetails']['firstname'];
     $postfields['BillingLastName'] = $params['clientdetails']['lastname'];
     $postfields['BillingAddress1'] = $params['clientdetails']['address1'];
     $postfields['BillingAddress2'] = $params['clientdetails']['address2'];
     $postfields['BillingCity'] = $params['clientdetails']['city'];
     $postfields['BillingState'] = $params['clientdetails']['state'];
     $postfields['BillingPostalCode'] = $params['clientdetails']['postcode'];
     $postfields['BillingCountryCode'] = $params['clientdetails']['country'];
     $postfields['BillingPhone'] = $params['clientdetails']['phonenumber'];
     $postfields['ShippingFirstName'] = $params['clientdetails']['firstname'];
     $postfields['ShippingLastName'] = $params['clientdetails']['lastname'];
     $postfields['ShippingAddress1'] = $params['clientdetails']['address1'];
     $postfields['ShippingAddress2'] = $params['clientdetails']['address2'];
     $postfields['ShippingCity'] = $params['clientdetails']['city'];
     $postfields['ShippingState'] = $params['clientdetails']['state'];
     $postfields['ShippingPostalCode'] = $params['clientdetails']['postcode'];
     $postfields['ShippingCountryCode'] = $params['clientdetails']['country'];
     $postfields['ShippingPhone'] = $params['clientdetails']['phonenumber'];
     $postfields['CardNumber'] = $params['cardnum'];
     $postfields['CardExpMonth'] = substr($params['cardexp'], 0, 2);
     $postfields['CardExpYear'] = "20" . substr($params['cardexp'], 2, 2);
     $queryString = "<CardinalMPI>\n";
     foreach ($postfields as $name => $value) {
         $queryString .= "<" . $name . ">" . $value . "</" . $name . ">\n";
     }
     $queryString .= "</CardinalMPI>";
     $data = "cmpi_msg=" . urlencode($queryString);
     $response = curlCall($mapurl, $data);
     $xmlarray = XMLtoArray($response);
     $xmlarray = $xmlarray['CARDINALMPI'];
     $errorno = $xmlarray['ERRORNO'];
     $enrolled = $xmlarray['ENROLLED'];
     $eciflag = $xmlarray['ECIFLAG'];
     $transid = $xmlarray['TRANSACTIONID'];
     $acsurl = $xmlarray['ACSURL'];
     $pareq = $xmlarray['PAYLOAD'];
     $orderid = $xmlarray['ORDERID'];
     $_SESSION['Centinel_OrderId'] = $orderid;
     $_SESSION['Centinel_TransactionId'] = $transid;
     if ($errorno == 0) {
         if ($enrolled == "Y") {
             logTransaction("PayPal Pro Reference", $xmlarray, "3D Auth");
             $_SESSION['Centinel_Details'] = array("cardtype" => $params['cardtype'], "cardnum" => $params['cardnum'], "cardexp" => $params['cardexp'], "cccvv" => $params['cccvv'], "cardstart" => $params['cardstart'], "cardissuenum" => $params['cardissuenum']);
             $code = "<form method=\"POST\" action=\"" . $acsurl . "\">\n                <input type=hidden name=\"PaReq\" value=\"" . $pareq . "\">\n                <input type=hidden name=\"TermUrl\" value=\"" . $params['systemurl'] . "/modules/gateways/callback/paypalpaymentsproref.php\">\n                <input type=hidden name=\"MD\" value=\"" . $params['invoiceid'] . "\">\n                <noscript>\n                <center>\n                    <font color=\"red\">\n                        <h2>Processing your Payer Authentication Transaction</h2>\n                        <h3>JavaScript is currently disabled or is not supported by your browser.<br></h3>\n                        <h4>Please click Submit to continue the processing of your transaction.</h4>\n                    </font>\n                <input type=\"submit\" value=\"Submit\">\n                </center>\n                </noscript>\n            </form>";
             return $code;
         }
         $result = paypalpaymentsproref_capture($params);
         if ($result['status'] == "success") {
             logTransaction("PayPal Pro References 3D Capture", $result['rawdata'], "Successful");
             addInvoicePayment($params['invoiceid'], $result['transid'], "", "", "paypalpaymentsproref", "on");
             sendMessage("Credit Card Payment Confirmation", $params['invoiceid']);
             redirSystemURL("id=" . $params['invoiceid'] . "&paymentsuccess=true", "viewinvoice.php");
         } else {
             logTransaction("PayPal Pro References 3D Capture", $result['rawdata'], "Failed");
         }
     } else {
         logTransaction("PayPal Pro References 3D Secure", $xmlarray, "No 3D Auth");
     }
     return "declined";
 }
Пример #17
0
             $userID = mysql_result(select_query('tblinvoices', 'userid', array('id' => $invoiceID)), 0, 0);
             # verify the invoice ID (to ensure it exists) and transaction ID to ensure it is unique
             checkCBInvoiceID($invoiceID, $gateway['paymentmethod']);
             checkCBTransID($aBill['id']);
             # calculate GoCardless fees
             $aBill['fees'] = $aBill['amount'] - $aBill['amount_minus_fees'];
             # convert the currency where necessary
             $aCurrency = getCurrency($userID);
             if ($gateway['convertto'] && $aCurrency['id'] != $gateway['convertto']) {
                 # the users currency is not the same as the GoCardless currency, convert to the users currency
                 $aBill['amount'] = convertCurrency($aBill['amount'], $gateway['convertto'], $aCurrency['id']);
                 $aBill['fees'] = convertCurrency($aBill['fees'], $gateway['convertto'], $aCurrency['id']);
             }
             # if we get to this point, we have verified the callback and performed sanity checks
             # add a payment to the invoice and create a transaction log
             addInvoicePayment($invoiceID, $aBill['id'], $aBill['amount'], $aBill['fees'], $gateway['paymentmethod']);
             logTransaction($gateway['paymentmethod'], 'Bill payment completed (' . $aBill['id'] . '). Invoice #' . $invoiceID, 'Successful');
             # clean up for next loop
             unset($invoiceID, $userID);
         } else {
             header('HTTP/1.1 400 Bad Request');
             logTransaction($gateway['paymentmethod'], 'Could not find invoice with ID. callback.php ' . __LINE__ . $invoiceID, 'Failed');
             exit(__LINE__ . ': Could not get invoice ID for ' . htmlentities($aBill['id']));
         }
     }
     break;
 case 'failed':
 case 'refunded':
     # loop through each bill that has failed or been refunded
     foreach ($val['bills'] as $aBill) {
         # attempt to obtain the mod_gocardless record
Пример #18
0
 $referrer = $_SERVER['HTTP_REFERER'];
 $pos = strpos($referrer, "?");
 if ($pos) {
     $referrer = substr($referrer, 0, $pos);
 }
 $adminfolder = $whmcs->get_admin_folder_name();
 if ($CONFIG['SystemURL'] . ("/" . $adminfolder . "/offlineccprocessing.php") != $referrer && $CONFIG['SystemSSLURL'] . ("/" . $adminfolder . "/offlineccprocessing.php") != $referrer) {
     echo "<p>" . $aInt->lang("global", "invalidaccessattempt") . "</p>";
     exit;
 }
 if ($cchash != $cc_encryption_hash) {
     echo $aInt->lang("offlineccp", "entercchashdie");
 } else {
     logActivity("Viewed Decrypted Credit Card Number for User ID " . $userid);
     if ($successful == "true") {
         addInvoicePayment($id, $transid, "", "", "offlinecc");
         echo "<p align=center><a href=\"#\" onClick=\"window.opener.location.reload();window.close()\">" . $aInt->lang("addons", "closewindow") . "</a></p>";
         exit;
     }
     if ($failed == "true") {
         sendMessage("Credit Card Payment Failed", $id);
         echo "<p align=center><a href=\"#\" onClick=\"window.opener.location.reload();window.close()\">" . $aInt->lang("addons", "closewindow") . "</a></p>";
         exit;
     }
     $data = getCCDetails($userid);
     $cardtype = $data['cardtype'];
     $cardnum = $data['fullcardnum'];
     $cardexp = $data['expdate'];
     $cardissuenum = $data['issuenumber'];
     $cardstart = $data['startdate'];
     echo $aInt->lang("fields", "cardtype") . ": " . $cardtype . "<br>" . $aInt->lang("fields", "cardnum") . ": " . $cardnum . "<br>" . $aInt->lang("fields", "expdate") . ": " . $cardexp . " (MMYY)";
Пример #19
0
$md5_hash = $_REQUEST['md5_hash'];
checkCbTransID($transid);
$ourhash = md5($GATEWAY['md5hash'] . $GATEWAY['loginid'] . $transid . $amount);
if ($ourhash != $md5_hash) {
    logTransaction("Quantum Gateway", $_REQUEST, "MD5 Hash Failure");
    echo "Hash Failure. Please Contact Support.";
    exit;
}
$callbacksuccess = false;
$invoiceid = checkCbInvoiceID($invoiceid, "Quantum Gateway");
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']);
    if ($total < $amount + 1 && $amount - 1 < $total) {
        $amount = $total;
    }
}
if ($transresult == "APPROVED") {
    addInvoicePayment($invoiceid, $transid, $amount, "", "quantumgateway", "on");
    logTransaction("Quantum Gateway", $_REQUEST, "Approved");
    sendMessage("Credit Card Payment Confirmation", $invoiceid);
    $callbacksuccess = true;
} else {
    logTransaction("Quantum Gateway", $_REQUEST, "Declined");
    sendMessage("Credit Card Payment Failed", $invoiceid);
}
callback3DSecureRedirect($invoiceid, $callbacksuccess);
Пример #20
0
 * @ Website  : http://www.mtimer.cn
 *
 **/
require "../../../init.php";
$whmcs->load_function("gateway");
$whmcs->load_function("invoice");
$whmcs->load_function("clientarea");
$GATEWAY = getGatewayVariables("worldpayfuturepay");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$invoiceid = mysql_real_escape_string($_POST['cartId']);
$futurepayid = mysql_real_escape_string($_POST['futurePayId']);
$transid = mysql_real_escape_string($_POST['transId']);
$invoiceid = checkCbInvoiceID($invoiceid, "WorldPay FuturePay");
initialiseClientArea($_LANG['ordercheckout'], "", $_LANG['ordercheckout']);
echo processSingleTemplate("/templates/" . $whmcs->get_sys_tpl_name() . "/header.tpl", $smarty->_tpl_vars);
echo "<WPDISPLAY ITEM=\"banner\">";
$result = select_query("tblinvoices", "", array("id" => $invoiceid));
$data = mysql_fetch_array($result);
$userid = $data['userid'];
if ($_POST['transStatus'] == "Y") {
    logTransaction("WorldPay FuturePay", $_POST, "Successful");
    update_query("tblclients", array("gatewayid" => $futurepayid), array("id" => $userid));
    addInvoicePayment($invoiceid, $transid, "", "", "worldpayfuturepay");
    echo "<p align=\"center\"><a href=\"" . $CONFIG['SystemURL'] . "/viewinvoice.php?id=" . $invoiceid . "&paymentsuccess=true\">Click here to return to " . $CONFIG['CompanyName'] . "</a></p>";
} else {
    logTransaction("WorldPay FuturePay", $_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>";
}
echo processSingleTemplate("/templates/" . $whmcs->get_sys_tpl_name() . "/footer.tpl", $smarty->_tpl_vars);
Пример #21
0
 * @ 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("paymex");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$invoiceid = checkCbInvoiceID($_GET['xinv'], "Paymex");
if ($_GET['xresp'] == "1") {
    $result = select_query("tblinvoices", "total", array("id" => $invoiceid));
    $data = mysql_fetch_array($result);
    $total = $data['total'];
    $fee = $total * 0.0295 + 0.55;
    $pos = strpos($fee, ".");
    $pos = $pos + 3;
    $fee = substr($fee, 0, $pos);
    addInvoicePayment($invoiceid, $invoiceid, "", $fee, "paymex");
    logTransaction("Paymex", $_REQUEST, "Successful");
    redirSystemURL("id=" . $invoiceid . "&paymentsuccess=true", "viewinvoice.php");
    return 1;
}
logTransaction("Paymex", $_REQUEST, "Unsuccessful");
redirSystemURL("id=" . $invoiceid . "&paymentfailed=true", "viewinvoice.php");
Пример #22
0
    }
}
$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));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $total = $data['total'];
    $currency = getCurrency($userid);
    $amount = convertCurrency($amount, $currencyid, $currency['id']);
    if ($total < $amount + 1 && $amount - 1 < $total) {
        $amount = $total;
    }
}
if ($_POST['status'] == "2") {
    $invoiceid = checkCbInvoiceID($invoiceid, "Moneybookers");
    if ($invoiceid) {
        addInvoicePayment($invoiceid, $transid, $amount, "", "moneybookers");
        logTransaction("Moneybookers", $_REQUEST, "Successful");
        return 1;
    }
    logTransaction("Moneybookers", $_REQUEST, "Error");
    return 1;
}
logTransaction("Moneybookers", $_REQUEST, "Unsuccessful");
Пример #23
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);
    }
}
Пример #24
0
     $invoiceData = $invoice->getOutput();
     // Prepare form data
     $smartyvalues["client"] = $invoiceData['clientsdetails'];
     $smartyvalues['months'] = $gateways->getCCDateMonths();
     $smartyvalues['years'] = $gateways->getCCExpiryDateYears();
     $smartyvalues['invoice'] = $invoiceData;
     $smartyvalues['invoiceItems'] = $invoice->getLineItems();
     if ($_POST['fromCCForm'] == 'true') {
         # Check form submit & capture payment
         $cardInfo = array('email' => $invoiceData['clientsdetails']['email'], 'amount' => $post['amount'], 'currency' => $post["currency"], 'token' => $_POST['brick_token'], 'fingerprint' => $_POST['brick_fingerprint'], 'description' => $invoiceData['pagetitle']);
         $charge = new Paymentwall_Charge();
         $charge->create(array_merge($cardInfo, brick_get_user_profile_data($invoiceData)));
         $response = $charge->getPublicData();
         if ($charge->isSuccessful()) {
             if ($charge->isCaptured()) {
                 addInvoicePayment($_POST["invoiceid"], $charge->getId(), null, null, 'brick');
             } elseif ($charge->isUnderReview()) {
                 // decide on risk charge
             }
             logTransaction($gateway['name'], $cardInfo, "Successful");
             $smartyvalues["success"] = true;
         } else {
             $error = json_decode($response, true);
             $smartyvalues["processingerror"] = '<li>' . $error['error']['message'] . '</li>';
             logTransaction($gateway['name'], $cardInfo, "Unsuccessful");
         }
     }
 } else {
     // User is logged in but they shouldn't be here (i.e. they weren't here from an invoice)
     header("Location: " . $CONFIG['SystemURL'] . "/clientarea.php?action=details");
 }
}
# Checks gateway module is active before accepting callback
# Gateway Specific Variables
$u = $GATEWAY['username'];
$p = $GATEWAY['password'];
$h = $GATEWAY['host'] . ':' . $GATEWAY['port'];
$rpc = 'http://' . $u . ':' . $p . '@' . $h;
# Build Litecoin Information Here
require_once '../litcoin/jsonRPCClient.php';
$litecoin = new jsonRPCClient($rpc);
if (!$litecoin->getinfo()) {
    die('could not connect to litcoind');
}
$sql = 'SELECT * FROM tblinvoices WHERE paymentmethod="' . $gatewaymodule . '" AND status = "Unpaid"';
$results = mysql_query($sql);
while ($result = mysql_fetch_array($results)) {
    $amount = $result['total'];
    $btcaccount = $result['userid'] . '-' . $result['id'];
    $received = $litecoin->getbalance($btcaccount);
    //print($received);
    if ($amount <= $received) {
        //echo 'PAID';
        $fee = 0;
        $transid = $litecoin->getaccountaddress($btcaccount . '-' . $result['id']);
        //checkCbTransID($transid);
        addInvoicePayment($result['id'], $transid, $received, $fee, $gatewaymodule);
        logTransaction($GATEWAY["name"], array('address' => $transid, 'amount' => $received), "Successful");
    } else {
        //echo 'Still Owes: '.$amount;
    }
}
 * @param string $gatewayName        Display label
 * @param string|array $debugData    Data to log
 * @param string $transactionStatus  Status
 */
logTransaction($gatewayParams['name'], $_POST, $transactionStatus);
$paymentSuccess = false;
if ($success) {
    /**
     * Add Invoice Payment.
     *
     * Applies a payment transaction entry to the given invoice ID.
     *
     * @param int $invoiceId         Invoice ID
     * @param string $transactionId  Transaction ID
     * @param float $paymentAmount   Amount paid (defaults to full balance)
     * @param float $paymentFee      Payment fee (optional)
     * @param string $gatewayModule  Gateway module name
     */
    addInvoicePayment($invoiceId, $transactionId, $paymentAmount, $paymentFee, $gatewayModuleName);
    $paymentSuccess = true;
}
/**
 * Redirect to invoice.
 *
 * Performs redirect back to the invoice upon completion of the 3D Secure
 * process displaying the transaction result along with the invoice.
 *
 * @param int $invoiceId        Invoice ID
 * @param bool $paymentSuccess  Payment status
 */
callback3DSecureRedirect($invoiceId, $paymentSuccess);
    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";
        break;
    case "6":
        $transactionStatus = "Suspicious transaction, cancel shipping";
        break;
    case "7":
        $transactionStatus = "Insecure transaction";
        break;
    case "8":
        $transactionStatus = "Authenticated transaction";
        addInvoicePayment($invoiceId, $transactionId, $base['paid'], $base['fee'], $gatewayModuleName);
        break;
    case "9":
        $transactionStatus = "Verified transaction";
        addInvoicePayment($invoiceId, $responseData['ep_id'], $base['paid'], $base['fee'], $gatewayModuleName);
        break;
    default:
        $transactionStatus = "Failed";
        break;
}
logTransaction($gatewayParams['name'], $_POST, $transactionStatus);
Пример #28
0
        $response_array = json_decode($result, true);
        //Check success response
        if ($http_status === 200 and isset($response_array['error']) === false) {
            $success = true;
        } else {
            $success = false;
            if (!empty($response_array['error']['code'])) {
                $error = $response_array['error']['code'] . ":" . $response_array['error']['description'];
            } else {
                $error = "RAZORPAY_ERROR:Invalid Response <br/>" . $result;
            }
        }
    }
    //close connection
    curl_close($ch);
} catch (Exception $e) {
    $success = false;
    $error = "WHMCS_ERROR:Request to Razorpay Failed";
}
if ($success === true) {
    # Successful
    # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
    addInvoicePayment($merchant_order_id, $razorpay_payment_id, $amount, 0, $GATEWAY["name"]);
    logTransaction($GATEWAY["name"], $_POST, "Successful");
    # Save to Gateway Log: name, data array, status
} else {
    # Unsuccessful
    # Save to Gateway Log: name, data array, status
    logTransaction($GATEWAY["name"], $_POST, "Unsuccessful-" . $error . ". Please check razorpay dashboard for Payment id: " . $_POST['razorpay_payment_id']);
}
header("Location: " . $GATEWAY['systemurl'] . "/viewinvoice.php?id=" . $merchant_order_id);
Пример #29
0
$rule = new ThinMPI();
$result = $rule->ProcessRequest($data);
if (!$result->isOK()) {
    $error_message = $result->getErrorMessage();
} else {
    if (!$result->isAuthenticated()) {
        $error_message = "Uw bestelling is helaas niet betaald, probeer het nog eens";
    } else {
        $transactionID = $result->getTransactionID();
        $invoiceid = get_query_val("mod_myideal", "invoiceid", array("transid" => $transactionID));
        $logdata = array("TransactionID" => $transactionID, "InvoiceID" => $invoiceid);
        if (!$invoiceid) {
            logTransaction("iDEAL", $logdata, "Invoice ID Not Found");
        }
        logTransaction("iDEAL", $logdata, "Successful");
        addInvoicePayment($invoiceid, $transactionID, "", "", "myideal");
        header("Location: " . $urltowhmcs . "viewinvoice.php?id=" . (int) $invoiceid . "&paymentsuccess=true");
        exit;
    }
}
if ($error_message) {
    echo "<html>\n<head>\n  <title> iDeal Payment Failed </title>\n  <meta http-equiv=\"refresh\" content=\"10; url=";
    echo $urltowhmcs;
    echo "clientarea.php?action=invoices\">\n</head>\n<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" vlink=\"#800080\" alink=\"#FF0000\">\n\n<center>\n\n<img src=\"";
    echo $whmcslogo;
    echo "\"><br/><br/>\n\n<p>De betaling is niet voldaan. U kunt het wellicht nogmaals proberen of een andere betaalwijze kiezen. <br />U wordt nu teruggestuurd naar het overzicht van uw facturen.<br />\n<a href=\"";
    echo $urltowhmcs;
    echo "clientarea.php?action=invoices\">Klik hier om verder te gaan</a></p>\n\nThe payment was not made. Please try again or choose a different way to pay. <br />You will now be send back to the invoice overview.«<br/>\n<a href=\"";
    echo $urltowhmcs;
    echo "clientarea.php?action=invoices\">Please click here to continue</a><br/><br/>\n\n<p>";
    echo $error_message;
Пример #30
0
function worldpayinvisiblexml_3dsecure($params)
{
    if ($params['cardtype'] == "American Express") {
        $merchantCode = $params['merchantcodeamex'];
    } else {
        $merchantCode = $params['merchantcode1'];
    }
    $password = $params['merchantpw'];
    $instId = $params['instid'];
    $cookiestore = $params['cookiestore'];
    if ($params['cardtype'] == "American Express") {
        $orderCode = "A-" . date("YmdHis") . "-" . $params['invoiceid'];
    } else {
        $orderCode = "E-" . date("YmdHis") . "-" . $params['invoiceid'];
    }
    $orderDescription = "Invoice #" . $params['invoiceid'];
    $orderAmount = $params['amount'] * 100;
    $raworderAmount = $params['amount'];
    $invoiceID = $params['invoiceid'];
    $orderShopperEmail = $params['clientdetails']['email'];
    $orderShopperID = $params['clientdetails']['userid'];
    $orderShopperFirstName = $params['clientdetails']['firstname'];
    $orderShopperSurname = $params['clientdetails']['lastname'];
    $orderShopperStreet = $params['clientdetails']['address1'];
    $orderShopperPostcode = $params['clientdetails']['postcode'];
    $orderShopperCity = $params['clientdetails']['city'];
    $orderShopperCountryCode = $params['clientdetails']['country'];
    $orderShopperTel = $params['clientdetails']['phonenumber'];
    $cvv = $params['cccvv'];
    $acceptHeader = $_SERVER['HTTP_ACCEPT'];
    $userAgentHeader = $_SERVER['HTTP_USER_AGENT'];
    $shopperIPAddress = is_null($_SERVER['REMOTE_ADDR']) ? "127.0.0.1" : $_SERVER['REMOTE_ADDR'];
    if ($params['cardtype'] == "American Express") {
        $cardType = "AMEX-SSL";
    } else {
        if ($params['cardtype'] == "Diners Club") {
            $cardType = "DINERS-SSL";
        } else {
            if ($params['cardtype'] == "JCB") {
                $cardType = "JCB-SSL";
            } else {
                if ($params['cardtype'] == "MasterCard") {
                    $cardType = "ECMC-SSL";
                } else {
                    if ($params['cardtype'] == "Solo") {
                        $cardType = "SOLO_GB-SSL";
                    } else {
                        if ($params['cardtype'] == "Maestro") {
                            $cardType = "MAESTRO-SSL";
                        } else {
                            $cardType = "VISA-SSL";
                        }
                    }
                }
            }
        }
    }
    $id = time();
    $xml = "<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE paymentService PUBLIC '-//WorldPay/DTD WorldPay PaymentService v1//EN' 'http://dtd.worldpay.com/paymentService_v1.dtd'>";
    $xml .= "<paymentService version='1.4' merchantCode='" . $merchantCode . "'>";
    $xml .= "<submit>";
    $xml .= "<order orderCode='" . $orderCode . "' installationId='" . $instId . "'>";
    $xml .= "<description>" . $orderDescription . "</description>";
    $xml .= "<amount value='" . $orderAmount . "' currencyCode='" . $params['currency'] . "' exponent='2'/>";
    $xml .= "<orderContent><![CDATA[]]></orderContent>";
    $xml .= "<paymentDetails>";
    $xml .= "<" . $cardType . ">";
    $xml .= "<cardNumber>" . $params['cardnum'] . "</cardNumber>";
    $xml .= "<expiryDate><date month='" . substr($params['cardexp'], 0, 2) . "' year='20" . substr($params['cardexp'], 2, 2) . "'/></expiryDate>";
    $xml .= "<cardHolderName>" . $orderShopperFirstName . " " . $orderShopperSurname . "</cardHolderName>";
    if ($params['cardtype'] == "Maestro" || $params['cardtype'] == "Solo") {
        if ($params['cardstart']) {
            $xml .= "<startDate><date month='" . substr($params['cardstart'], 0, 2) . "' year='20" . substr($params['cardstart'], 2, 2) . "'/></startDate>";
        }
        if ($params['cardissuenum']) {
            $xml .= "<issueNumber>" . $params['cardissuenum'] . "</issueNumber>";
        }
    }
    $xml .= "<cvc>" . $cvv . "</cvc>";
    $xml .= "<cardAddress>";
    $xml .= "<address>";
    $xml .= "<firstName>" . $orderShopperFirstName . "</firstName>";
    $xml .= "<lastName>" . $orderShopperSurname . "</lastName>";
    $xml .= "<street>" . $orderShopperStreet . "</street>";
    $xml .= "<postalCode>" . $orderShopperPostcode . "</postalCode>";
    $xml .= "<city>" . $orderShopperCity . "</city>";
    $xml .= "<countryCode>" . $orderShopperCountryCode . "</countryCode>";
    $xml .= "<telephoneNumber>" . $orderShopperTel . "</telephoneNumber>";
    $xml .= "</address>";
    $xml .= "</cardAddress>";
    $xml .= "</" . $cardType . ">";
    $xml .= "<session shopperIPAddress='" . $shopperIPAddress . "' id='" . $invoiceID . "'/>";
    $xml .= "</paymentDetails>";
    $xml .= "<shopper>";
    $xml .= "<shopperEmailAddress>" . $orderShopperEmail . "</shopperEmailAddress>";
    $xml .= "<browser>";
    $xml .= "<acceptHeader>" . $acceptHeader . "</acceptHeader>";
    $xml .= "<userAgentHeader>" . $userAgentHeader . "</userAgentHeader>";
    $xml .= "</browser>";
    $xml .= "</shopper>";
    $xml .= "</order></submit></paymentService>";
    if ($params['testmode']) {
        $url = "https://secure-test.wp3.rbsworldpay.com/jsp/merchant/xml/paymentService.jsp";
    } else {
        $url = "https://secure.worldpay.com/jsp/merchant/xml/paymentService.jsp";
    }
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
    curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($ch, CURLOPT_USERPWD, $merchantCode . ":" . $password);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "" . $cookiestore . $invoiceID . ".cookie");
    curl_setopt($ch, CURLOPT_TIMEOUT, 240);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $result_tmp = curl_exec($ch);
    if (curl_error($ch)) {
        $result_tmp = "Curl Error: " . curl_errno($ch) . " - " . curl_error($ch);
    }
    curl_close($ch);
    logTransaction("WorldPay Invisible XML", $result_tmp, "Received");
    $result_arr = XMLtoArray($result_tmp);
    $PostUrl = $result_arr['PAYMENTSERVICE']['REPLY']['ORDERSTATUS']['REQUESTINFO']['REQUEST3DSECURE']['ISSUERURL'];
    $PaReq = $result_arr['PAYMENTSERVICE']['REPLY']['ORDERSTATUS']['REQUESTINFO']['REQUEST3DSECURE']['PAREQUEST'];
    $echoData = $result_arr['PAYMENTSERVICE']['REPLY']['ORDERSTATUS']['ECHODATA'];
    $lastevent = $result_arr['PAYMENTSERVICE']['REPLY']['ORDERSTATUS']['PAYMENT']['LASTEVENT'];
    if (!$PaReq) {
        if ($lastevent == "AUTHORISED") {
            addInvoicePayment($invoiceID, $orderCode, $raworderAmount, "", "worldpayinvisiblexml", "on");
            logTransaction("WorldPay Invisible XML Callback", $result_tmp, "Successful");
            sendMessage("Credit Card Payment Confirmation", $params['invoiceid']);
            $result = "success";
        } else {
            logTransaction("WorldPay Invisible XML Callback", $result_tmp, "Declined");
            sendMessage("Credit Card Payment Failed", $params['invoiceid']);
            $result = "declined";
        }
        return $result;
    }
    delete_query("tblgatewaylog", array("gateway" => "WorldPay Invisible XML Callback", "result" => "echoData Not Found"));
    delete_query("tblgatewaylog", "gateway LIKE '%WPI%' AND date<='" . date("Y-m-d H:i:s", strtotime("-10 minutes") . "'"));
    delete_query("tblgatewaylog", array("gateway" => "WPIORDERCODE" . $params['invoiceid']));
    delete_query("tblgatewaylog", array("gateway" => "WPIECHODATA" . $params['invoiceid']));
    delete_query("tblgatewaylog", array("gateway" => "WPICPDATA" . $params['invoiceid']));
    insert_query("tblgatewaylog", array("date" => "now()", "gateway" => "WPIORDERCODE" . $params['invoiceid'], "data" => $orderCode));
    insert_query("tblgatewaylog", array("date" => "now()", "gateway" => "WPIECHODATA" . $params['invoiceid'], "data" => $echoData));
    if ($params['cvvpass']) {
        insert_query("tblgatewaylog", array("date" => "now()", "gateway" => "WPICPDATA" . $params['invoiceid'], "data" => $cvv));
    }
    $code = "<form action=\"" . $PostUrl . "\" method=\"post\">\n<input type=\"hidden\" name=\"PaReq\" value=\"" . $PaReq . "\" />\n<input type=\"hidden\" name=\"TermUrl\" value=\"" . $params['systemurl'] . "/modules/gateways/callback/worldpayinvisiblexml.php\" />\n<input type=\"hidden\" name=\"MD\" value=\"" . $params['invoiceid'] . "\" />\n<!-- <input type=\"submit\" name=\"Click to Authenticate Card\"> -->\n</form>";
    return $code;
}