Beispiel #1
0
function paypalexpress_link($params)
{
    $paypalvars = getGatewayVariables("paypal");
    $params = array_merge($params, $paypalvars);
    $params['returnurl'] = $params['systemurl'] . "/viewinvoice.php?id=" . $params['invoiceid'];
    return paypal_link($params);
}
Beispiel #2
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function get_invoice_status($pars)
{
    $GATEWAY = getGatewayVariables("inpay");
    $calc_md5 = calc_inpay_invoice_status_md5key(array("invoice_ref" => $pars['invoice_reference'], "merchant_id" => $GATEWAY['username'], "secret_key" => $GATEWAY['secretkey']));
    $q = http_build_query(array("merchant_id" => $GATEWAY['username'], "invoice_ref" => $pars['invoice_reference'], "checksum" => $calc_md5), "", "&");
    $fsocket = false;
    $curl = false;
    $result = false;
    $fp = false;
    $server = "secure.inpay.com";
    if ($GATEWAY['testmode'] == "on") {
        $server = "test-secure.inpay.com";
    }
    if (4.3 <= PHP_VERSION && ($fp = @fsockopen("ssl://" . $server, 443, $errno, $errstr, 30))) {
        $fsocket = true;
    } else {
        if (function_exists("curl_exec")) {
            $curl = true;
        }
    }
    if ($fsocket == true) {
        $header = "POST /api/get_invoice_status HTTP/1.1" . "\r\n" . "Host: " . $server . "\r\n" . "Content-Type: application/x-www-form-urlencoded" . "\r\n" . "Content-Length: " . strlen($q) . "\r\n" . "Connection: close" . "\r\n\r\n";
        @fputs($fp, $header . $q);
        $str = "";
        while (!@feof($fp)) {
            $res = @fgets($fp, 1024);
            $str .= (bool) $res;
        }
        @fclose($fp);
        $result = $str;
        $result = preg_split('/^\\r?$/m', $result, 2);
        $result = trim($result[1]);
        $result = preg_split('/\\n/m', $result);
        if (1 < count($result)) {
            $result = trim($result[1]);
        } else {
            $result = trim($result[0]);
        }
    } else {
        if ($curl == true) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, "https://" . $server . "/api/get_invoice_status");
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $q);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HEADER, false);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            $result = curl_exec($ch);
            curl_close($ch);
        }
    }
    return (bool) $result;
}
Beispiel #3
0
function afterSetupProductEventListener($vars)
{
    $gateway = getGatewayVariables("paymentwall");
    if (!isset($gateway['enableDeliveryApi']) || $gateway['enableDeliveryApi'] == '') {
        return;
    }
    if ($vars['params']['packageid'] && ($product = mysql_fetch_assoc(select_query('tblproducts', '*', array('id' => $vars['params']['packageid']))))) {
        // Get hosting data
        $hosting = mysql_fetch_assoc(select_query('tblhosting', 'orderid, paymentmethod', array('username' => $vars['params']['username'])));
        if (!$hosting || $hosting['paymentmethod'] != 'paymentwall') {
            return;
        }
        handleProductAutoSetup($vars, $hosting, $gateway);
    }
}
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;
}
/**
 ** 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']));
    }
}
# Required File Includes
if (file_exists("../../../init.php")) {
    // For new version
    include "../../../init.php";
    $whmcs->load_function('gateway');
    $whmcs->load_function('invoice');
} else {
    include "../../../dbconnect.php";
    include "../../../includes/functions.php";
    include "../../../includes/gatewayfunctions.php";
    include "../../../includes/invoicefunctions.php";
}
$gatewaymodule = "allpaycredit";
# Enter your gateway module name here replacing template
$InvoicePrefix = "CRE";
$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) {
    die("Module Not Activated");
}
# Checks gateway module is active before accepting callback
# Get Returned Variables - Adjust for Post Variable Names from your Gateway's Documentation
$MerchantID = $_POST["MerchantID"];
$PaymentDate = $_POST["PaymentDate"];
$RtnCode = $_POST["RtnCode"];
$RtnMsg = $_POST["RtnMsg"];
$PaymentNo = $_POST["MerchantTradeNo"];
$status = $_POST["RtnCode"];
$transid = $_POST["TradeNo"];
$amount = $_POST["TradeAmt"];
$fee = $_POST["PaymentTypeChargeFee"];
$invoiceid = $_POST["MerchantTradeNo"];
Beispiel #7
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("payoffline");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
if (!$_REQUEST['code'] && !$_REQUEST['callbackvars']) {
    header("Status: 404 Not Found");
    exit;
} else {
    header("Status: 200 OK");
}
$amount = $_REQUEST['amt'];
$callbackvars2 = explode("&amp;", $callbackvars);
foreach ($callbackvars2 as $value) {
    $values[] = explode("=", $value);
}
if ($code == "5") {
Beispiel #8
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("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");
    $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');
    }
}
Beispiel #10
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");
Beispiel #11
0
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function paypal_email_trim($value)
{
    $value = trim($value);
}
require "../../../init.php";
$whmcs->load_function("gateway");
$whmcs->load_function("invoice");
$GATEWAY = getGatewayVariables("paypal");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$postipn = "cmd=_notify-validate";
$orgipn = "";
foreach ($_POST as $key => $value) {
    $orgipn .= "" . $key . " => " . $value . "\r\n";
    $postipn .= "&" . $key . "=" . urlencode(html_entity_decode($value, ENT_QUOTES));
}
$reply = curlCall("https://www.paypal.com/cgi-bin/webscr", $postipn);
if (!strcmp($reply, "VERIFIED")) {
} else {
    if (!strcmp($reply, "INVALID")) {
        logTransaction("PayPal", $orgipn, "IPN Handshake Invalid");
        header("HTTP/1.0 406 Not Acceptable");
Beispiel #12
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("payza");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
if ($GATEWAY['type'] == "on") {
    $ipnv2handlerurl = "https://sandbox.payza.com/sandbox/ipn2.ashx";
} else {
    $ipnv2handlerurl = "https://secure.payza.com/ipn2.ashx";
}
$token = "token=" . urlencode($_POST['token']);
$response = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $ipnv2handlerurl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Beispiel #13
0
        addInvoicePayment($invoiceid, $resultsarray["Transaction ID"], "", "", "authorizeecheck");
        logTransaction("Authorize.net Echeck", $debugreport, "Successful");
        echo "<p align=\"center\"><a href=\"#\" onclick=\"window.opener.refresh();window.close();\">Click here to close the window</a></p>\n<script language=\"javascript\">\nwindow.opener.refresh();\nwindow.close();\n</script>";
        return null;
    }
    $errormessage .= "<li>The echeck payment attempt was declined. Please check the supplied details";
    logTransaction("Authorize.net Echeck", $debugreport, "Failed");
}
$GATEWAYMODULE['authorizeecheckname'] = "authorizeecheck";
$GATEWAYMODULE['authorizeecheckvisiblename'] = "Authorize.net Echeck";
$GATEWAYMODULE['authorizeechecktype'] = "Invoices";
if (isset($_GET['invoiceid'])) {
    require "../../init.php";
    $whmcs->load_function("gateway");
    $whmcs->load_function("invoice");
    $GATEWAY = getGatewayVariables("authorizeecheck");
    if (!$GATEWAY['type']) {
        exit("Module Not Activated");
    }
    $where = array("id" => (int) $_GET['invoiceid'], "paymentmethod" => "authorizeecheck");
    if (!isset($_SESSION['adminid'])) {
        $where['userid'] = $_SESSION['uid'];
    }
    $invoiceid = get_query_val("tblinvoices", "id", $where);
    if (!$invoiceid) {
        exit("Access Denied");
    }
    echo "<html>\n<head>\n<title>Echeck Payment</title>\n";
    echo "<s";
    echo "tyle>\nbody,td,input {\n    font-family: Tahoma;\n    font-size: 11px;\n}\nh1 {\n    font-family: Tahoma;\n    font-weight: normal;\n    font-size: 18px;\n    color: #000066;\n}\n</style>\n</head>\n<body>\n\n<h1>Echeck Payment</h1>\n\n";
    if ($submit) {
Beispiel #14
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("paypalexpress");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$token = "";
if (isset($_REQUEST['token'])) {
    $token = $_REQUEST['token'];
}
if (!$token) {
    logTransaction("PayPal Express Callback", $_REQUEST, "Missing Token");
    exit;
}
$postfields = array();
$postfields['TOKEN'] = $token;
$results = paypalexpress_api_call($GATEWAY, "GetExpressCheckoutDetails", $postfields);
$ack = strtoupper($results['ACK']);
Beispiel #15
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("nochex");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
if (!isset($_POST)) {
    $_POST =& $HTTP_POST_VARS;
}
foreach ($_POST as $key => $value) {
    $values[] = $key . "=" . urlencode($value);
}
$work_string = @implode("&", $values);
$url = "https://www.nochex.com/nochex.dll/apc/apc";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDSIZE, 0);
Beispiel #16
0
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function define_var($params)
{
    $url_retorno = $params['url_retorno'];
    return $url_retorno;
}
require "../../../init.php";
$whmcs->load_function("gateway");
$whmcs->load_function("invoice");
$GATEWAY = getGatewayVariables("moipapi");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
if (!function_exists("log_var")) {
    function log_var($var, $name = "", $to_file = false)
    {
        if ($to_file == true) {
            $txt = @fopen("debug.txt", "a");
            if ($txt) {
                fwrite($txt, "-----------------------------------\r\n");
                fwrite($txt, $name . "\r\n");
                fwrite($txt, print_r($var, true) . "\r\n");
                fclose($txt);
                return null;
            }
/**
 * GoCardless WHMCS module
 *
 * @author WHMCS <*****@*****.**>
 * @version 1.0.4
 */
# load all required files
$whmcsdir = dirname(__FILE__) . '/../../../';
require_once $whmcsdir . 'dbconnect.php';
require_once $whmcsdir . '/includes/functions.php';
require_once $whmcsdir . '/includes/gatewayfunctions.php';
require_once $whmcsdir . '/includes/invoicefunctions.php';
require_once $whmcsdir . '/modules/gateways/gocardless.php';
# get gateway params using WHMCS getGatewayVariables method
$gateway = getGatewayVariables('gocardless');
# sanity check to ensure module is active
if (!$gateway['type']) {
    die("Module Not Activated");
}
# set relevant API information for GoCardless module
gocardless_set_account_details($gateway);
# get the raw contents of the callback and decode JSON
$webhook = file_get_contents('php://input');
$webhook_array = json_decode($webhook, true);
# validate the webhook by verifying the integrity of the payload with GoCardless
if (GoCardless::validate_webhook($webhook_array['payload']) !== true) {
    # we could not validate the web hook
    header('HTTP/1.1 400 Bad Request');
    exit(__LINE__ . ': Payload could not be verified');
}
Beispiel #18
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("quantumvault");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$invoiceid = checkCbInvoiceID($_REQUEST['ID'], "Quantum Vault");
$transid = $_REQUEST['transID'];
$transresult = $_REQUEST['trans_result'];
$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;
<?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("quantumgateway");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$invoiceid = $_REQUEST['ID'];
$transid = $_REQUEST['transID'];
$transresult = $_REQUEST['trans_result'];
$amount = $_REQUEST['amount'];
$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;
}
Beispiel #20
0
<?php

# Required File Includes
include "../../../init.php";
$whmcs->load_function('gateway');
$whmcs->load_function('invoice');
define('PW_WHMCS_ITEM_TYPE_HOSTING', 'Hosting');
require_once ROOTDIR . "/includes/api/paymentwall_api/lib/paymentwall.php";
$gateway = getGatewayVariables("paymentwall");
if (!$gateway["type"]) {
    die("Module Not Activated");
}
Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $gateway['appKey'], 'private_key' => $gateway['secretKey']));
$pingback = new Paymentwall_Pingback($_GET, $_SERVER['REMOTE_ADDR']);
$invoiceid = checkCbInvoiceID($pingback->getProductId(), $gateway["name"]);
if ($invoiceid && $pingback->validate()) {
    $orderData = mysql_fetch_assoc(select_query('tblorders', 'userid,id', array("invoiceid" => $invoiceid)));
    $userData = mysql_fetch_assoc(select_query('tblclients', 'email, firstname, lastname, country, address1, state, phonenumber, postcode, city, id', array("id" => $orderData['userid'])));
    if ($pingback->isDeliverable()) {
        processDeliverable($invoiceid, $pingback, $gateway, $userData, $orderData);
    } elseif ($pingback->isCancelable()) {
        // WHMCS not supported
        logTransaction($gateway["name"], $_GET, "Not Supported");
        die("Not Supported");
    } else {
        switch ($pingback->getType()) {
            /*
            case Paymentwall_Pingback::PINGBACK_TYPE_SUBSCRIPTION_EXPIRED:
            case Paymentwall_Pingback::PINGBACK_TYPE_SUBSCRIPTION_PAYMENT_FAILED:
                // Do not process transaction
                break;
Beispiel #21
0
    $authcode = $resultsarray['auth_code'];
    if ($code == "A") {
        return array("status" => "success", "transid" => $authcode, "rawdata" => $resultsarray);
    }
    return array("status" => "declined", "rawdata" => $debugreport);
}
if (!defined("WHMCS")) {
    exit("This file cannot be accessed directly");
}
$GATEWAYMODULE['secpayname'] = "secpay";
$GATEWAYMODULE['secpayvisiblename'] = "SecPay";
$GATEWAYMODULE['secpaytype'] = "CC";
if (isset($_REQUEST['runcharge'])) {
    require "../../init.php";
    $whmcs->load_function("gateway");
    $GATEWAY = getGatewayVariables("secpay");
    if (!$GATEWAY['type']) {
        exit("Module Not Activated");
    }
    require "../../includes/xmlrpc.php";
    $testmode = $_REQUEST['testmode'];
    if (!$testmode) {
        $testmode = "live";
    }
    $repeattrans = "";
    if (!$_REQUEST['cardcvv']) {
        $repeattrans = "usage_type=R,repeat=true,";
    }
    $f = new xmlrpcmsg("SECVPN.validateCardFull");
    $f->addParam(new xmlrpcval($_REQUEST['merchantid'], "string"));
    $f->addParam(new xmlrpcval($_REQUEST['vpnpassword'], "string"));
Beispiel #22
0
 public function getPaymentLink()
 {
     if (!function_exists("getGatewayVariables")) {
         require ROOTDIR . "/includes/gatewayfunctions.php";
     }
     $params = getGatewayVariables($this->getData("paymentmodule"), $this->getData("invoiceid"), $this->getData("balance"));
     $paymentbutton = function_exists($this->getData("paymentmodule") . "_link") ? call_user_func($this->getData("paymentmodule") . "_link", $params) : "";
     return $paymentbutton;
 }
Beispiel #23
0
<?php

# Required File Includes
include "../../../dbconnect.php";
include "../../../includes/functions.php";
include "../../../includes/gatewayfunctions.php";
include "../../../includes/invoicefunctions.php";
require_once "../stripe/Stripe.php";
$gatewaymodule = "stripe";
$gateway = getGatewayVariables($gatewaymodule);
if (!$gateway["type"]) {
    die("Module Not Activated");
}
# Checks gateway module is active before accepting callback
$gatewaytestmode = $gateway['testmode'];
if ($gatewaytestmode == "on") {
    Stripe::setApiKey($gateway['private_test_key']);
} else {
    Stripe::setApiKey($gateway['private_live_key']);
}
$body = @file_get_contents('php://input');
$event_json = json_decode($body);
$event_id = $event_json->id;
try {
    $event = Stripe_Event::retrieve($event_id);
    if ($event->type == 'charge.succeeded') {
        // Pull invoice ID from Stripe description
        if ($event->data->object->invoice != "") {
            // This is an invoice/subscription payment, get the WHMCS invoice ID
            $invoice_id = $event->data->object->invoice;
            $retrieved_invoice = Stripe_Invoice::retrieve($invoice_id)->lines->all(array('count' => 1, 'offset' => 0));
Beispiel #24
0
 function tco_reoccuring_request()
 {
     global $whmcs;
     $whmcs->load_function("gateway");
     $whmcs->load_function("client");
     $whmcs->load_function("invoice");
     $GATEWAY = getGatewayVariables("tco");
     $invoiceid = $description = (int) $_POST['invoiceid'];
     $vendorid = $GATEWAY['vendornumber'];
     $apiusername = $GATEWAY['apiusername'];
     $apipassword = $GATEWAY['apipassword'];
     $demomode = $GATEWAY['demomode'];
     $recurrings = getRecurringBillingValues($invoiceid);
     if (!$recurrings) {
         $url = "../../viewinvoice.php?id=" . $invoiceid;
         header("Location:" . $url);
         exit;
     }
     $primaryserviceid = $recurrings['primaryserviceid'];
     $first_payment_amount = $recurrings['firstpaymentamount'] ? $recurrings['firstpaymentamount'] : $recurrings['recurringamount'];
     $recurring_amount = $recurrings['recurringamount'];
     if ($recurrings['recurringcycleunits'] == "Months") {
         $billing_cycle = $recurrings['recurringcycleperiod'] . " Month";
     } else {
         if ($recurrings['recurringcycleunits'] == "Years") {
             $billing_cycle = $recurrings['recurringcycleperiod'] . " Year";
         }
     }
     $billing_duration = "Forever";
     $startup_fee = $first_payment_amount - $recurring_amount;
     $url = "https://www.2checkout.com/api/products/create_product";
     $name = "Recurring Subscription for Invoice #" . $invoiceid;
     if ($demomode = "on") {
         $query_string = "name=" . $name . "&price=" . $recurring_amount . "&startup_fee=" . $startup_fee . "&demo=Y&recurring=1&recurrence=" . $billing_cycle . "&duration=" . $billing_duration . "&description=" . $description;
     } else {
         $query_string = "name=" . $name . "&price=" . $recurring_amount . "&startup_fee=" . $startup_fee . "&recurring=1&recurrence=" . $billing_cycle . "&duration=" . $billing_duration . "&description=" . $description;
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_USERPWD, $apiusername . ":" . $apipassword);
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array("Accept: application/json"));
     $response = curl_exec($ch);
     curl_close($ch);
     if (!function_exists("json_decode")) {
         exit("JSON Module Required in PHP Build for 2CheckOut Gateway");
     }
     $response = json_decode($response, true);
     if (!count($response['errors']) && $response['response_code'] == "OK") {
         logTransaction("2Checkout Recurring", print_r($response, true), "Ok");
         $product_id = $response['product_id'];
         $assigned_product_id = $response['assigned_product_id'];
         $purchaseroutine = !$GATEWAY['purchaseroutine'] ? "s" : "";
         $result = select_query("tblinvoices", "userid", array("id" => $invoiceid));
         $data = mysql_fetch_array($result);
         $userid = $data[0];
         $clientsdetails = getClientsDetails($userid);
         $currency = getCurrency($userid);
         global $CONFIG;
         $lang = $clientsdetails['language'];
         if (!$lang) {
             $lang = $CONFIG['Language'];
         }
         $lang = strtolower($lang);
         if ($lang == "chinese") {
             $lang = "zh";
         } else {
             if ($lang == "danish") {
                 $lang = "da";
             } else {
                 if ($lang == "dutch") {
                     $lang = "nl";
                 } else {
                     if ($lang == "french") {
                         $lang = "fr";
                     } else {
                         if ($lang == "german") {
                             $lang = "gr";
                         } else {
                             if ($lang == "greek") {
                                 $lang = "el";
                             } else {
                                 if ($lang == "italian") {
                                     $lang = "it";
                                 } else {
                                     if ($lang == "japanese") {
                                         $lang = "jp";
                                     } else {
                                         if ($lang == "norwegian") {
                                             $lang = "no";
                                         } else {
                                             if ($lang == "portuguese") {
                                                 $lang = "pt";
                                             } else {
                                                 if ($lang == "slovenian") {
                                                     $lang = "sl";
                                                 } else {
                                                     if ($lang == "spanish") {
                                                         $lang = "es_la";
                                                     } else {
                                                         if ($lang == "swedish") {
                                                             $lang = "sv";
                                                         } else {
                                                             if ($lang == "english") {
                                                                 $lang = "en";
                                                             } else {
                                                                 $lang = "";
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if ($lang) {
             $lang = "&lang=" . $lang;
         }
         if ($clientsdetails['country'] != "US" || $clientsdetails['country'] != "CA") {
             $clientsdetails['state'] = "XX";
         }
         $url = "https://www.2checkout.com/checkout/" . $purchaseroutine . "purchase?sid=" . $vendorid . "&quantity=1&product_id=" . $assigned_product_id . "&tco_currency=" . $currency['code'] . "&merchant_order_id=" . $primaryserviceid . "&card_holder_name=" . $clientsdetails['firstname'] . " " . $clientsdetails['lastname'] . "&street_address=" . $clientsdetails['address1'] . "&city=" . $clientsdetails['city'] . "&state=" . $clientsdetails['state'] . "&zip=" . $clientsdetails['postcode'] . "&country=" . $clientsdetails['country'] . "&email=" . $clientsdetails['email'] . "&phone=" . $clientsdetails['phonenumber'] . $lang;
         header("Location:" . $url);
         exit;
         return null;
     }
     $apierror = "Errors => " . print_r($response, true);
     logTransaction("2Checkout Recurring", $apierror, "Error");
     $url = "../../viewinvoice.php?id=" . $invoiceid . "&paymentfailed=true";
     header("Location:" . $url);
     exit;
 }
/**
 *
 * @ 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");
$whmcs->load_function("client");
$whmcs->load_function("cc");
$GATEWAY = getGatewayVariables("worldpayinvisiblexml");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$invoiceid = (int) $_REQUEST['MD'];
$result = select_query("tblgatewaylog", "data", array("gateway" => "WPIORDERCODE" . $invoiceid));
$data = mysql_fetch_array($result);
$orderCode = $data['data'];
$result = select_query("tblgatewaylog", "data", array("gateway" => "WPIECHODATA" . $invoiceid));
$data = mysql_fetch_array($result);
$echoData = $data['data'];
$result = select_query("tblgatewaylog", "data", array("gateway" => "WPICPDATA" . $invoiceid));
$data = mysql_fetch_array($result);
$cvv = $data['data'];
if (!$echoData) {
    logTransaction("WorldPay Invisible XML Callback", $_REQUEST, "echoData Not Found");
Beispiel #26
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");
$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");
 */
// the directive below is available only for WHMCS 6.*
require_once __DIR__ . '/../../../init.php';
// the directive below is available only for WHMCS 5.*
// include("../../../dbconnect.php");
require_once __DIR__ . '/../../../includes/gatewayfunctions.php';
require_once __DIR__ . '/../../../includes/invoicefunctions.php';
require_once __DIR__ . '/../euplatesc/functions.php';
/**
 * Build the module name
 * usualy is taken from filename.
 * in this particular case is hardcoded
 */
$gatewayModuleName = 'euplatesc';
// Fetch gateway configuration parameters.
$gatewayParams = getGatewayVariables($gatewayModuleName);
// Die if module is not active.
if (!$gatewayParams['type']) {
    die("Module Not Activated");
}
// Fetch the allowed callback IP list from the  parameters
$allowedIPs = $gatewayParams['allowedIPs'];
$ipArray = explode(PHP_EOL, $allowedIPs);
// Die if callback is not from the allowed IP range
if (!in_array($_SERVER['REMOTE_ADDR'], $ipArray)) {
    die("We do not allow callbacks from this IP address");
}
// Retrieve the special key
$secretKey = htmlspecialchars_decode($gatewayParams['secretKey']);
/**
 * read the data sent by POST
Beispiel #28
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("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']);
Beispiel #29
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");
require_once dirname(__FILE__) . "/myideal_lib.php";
require_once dirname(__FILE__) . "/ThinMPI.php";
$GATEWAY = getGatewayVariables("myideal");
if (!$GATEWAY['type']) {
    exit("Module Not Activated");
}
$urltowhmcs = $CONFIG['SystemURL'] . "/";
$whmcslogo = $CONFIG['LogoURL'];
$data = new AcquirerStatusRequest();
$transID = $_GET['trxid'];
$transID = str_pad($transID, 16, "0");
$data->setTransactionID($transID);
$rule = new ThinMPI();
$result = $rule->ProcessRequest($data);
if (!$result->isOK()) {
    $error_message = $result->getErrorMessage();
} else {
    if (!$result->isAuthenticated()) {
Beispiel #30
0
<?php

define("CLIENTAREA", true);
define("FORCESSL", true);
include "init.php";
require_once ROOTDIR . '/includes/api/paymentwall_api/lib/paymentwall.php';
$whmcs->load_function('gateway');
$whmcs->load_function('clientarea');
$whmcs->load_function('invoice');
$gateway = getGatewayVariables("brick");
$whmcsVer = substr($CONFIG['Version'], 0, 1);
if ($whmcsVer <= 5) {
    $gateways = new WHMCS_Gateways();
} else {
    $gateways = new WHMCS\Gateways();
}
$publicKey = $gateway['isTest'] ? $gateway['publicTestKey'] : $gateway['publicKey'];
Paymentwall_Config::getInstance()->set(array('api_type' => Paymentwall_Config::API_GOODS, 'public_key' => $publicKey, 'private_key' => $gateway['isTest'] ? $gateway['privateTestKey'] : $gateway['privateKey']));
$pagetitle = $_LANG['clientareatitle'] . " - Pay via Brick (Powered by Paymentwall)";
initialiseClientArea($pagetitle, '', 'Pay via Brick');
# Check login status
if ($_SESSION['uid'] && isset($_POST['data']) && ($post = json_decode(decrypt($_POST['data']), true))) {
    $smartyvalues = array_merge($smartyvalues, $post);
    $smartyvalues["data"] = $_POST['data'];
    $smartyvalues["whmcsVer"] = $whmcsVer;
    $smartyvalues["publicKey"] = $publicKey;
    $smartyvalues["processingerror"] = '';
    $smartyvalues["success"] = false;
    if ($_POST['frominvoice'] == "true" || $_POST['fromCCForm'] == 'true') {
        if ($whmcsVer <= 5) {
            $invoice = new WHMCS_Invoice();