Beispiel #1
0
                 $array = array("userid" => $_SESSION['uid'], "firstname" => $firstname, "lastname" => $lastname, "email" => $email, "address1" => $address1, "address2" => $address2, "city" => $city, "state" => $state, "postcode" => $postcode, "country" => $country, "phonenumber" => $phonenumber);
                 $billingcid = insert_query($table, $array);
                 update_query("tblclients", array("billingcid" => $billingcid), array("id" => $_SESSION['uid']));
             }
         }
         if ($ccinfo == "new") {
             $errormessage .= updateCCDetails($_SESSION['uid'], $cctype, $ccnumber, $cccvv, $ccexpirymonth . $ccexpiryyear, $ccstartmonth . $ccstartyear, $ccissuenum, $nostore);
         }
     }
 }
 if (!$errormessage) {
     if ($ccinfo == "new") {
         $params['cardtype'] = $cctype;
         $params['cardnum'] = ccFormatNumbers($ccnumber);
         $params['cardexp'] = ccFormatDate(ccFormatNumbers($ccexpirymonth . $ccexpiryyear));
         $params['cardstart'] = ccFormatDate(ccFormatNumbers($ccstartmonth . $ccstartyear));
         $params['cardissuenum'] = ccFormatNumbers($ccissuenum);
         $params['gatewayid'] = get_query_val("tblclients", "gatewayid", array("id" => $_SESSION['uid']));
     }
     if (function_exists($params['paymentmethod'] . "_3dsecure")) {
         $params['cccvv'] = $cccvv;
         $buttoncode = call_user_func($params['paymentmethod'] . "_3dsecure", $params);
         $buttoncode = str_replace("<form", "<form target=\"3dauth\"", $buttoncode);
         $smartyvalues['code'] = $buttoncode;
         $smartyvalues['width'] = "400";
         $smartyvalues['height'] = "500";
         if ($buttoncode == "success" || $buttoncode == "declined") {
             $result = $buttoncode;
         } else {
             $templatefile = "3dsecure";
             outputClientArea($templatefile);
Beispiel #2
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function updateCCDetails($userid, $cardtype, $cardnum, $cardcvv, $cardexp, $cardstart, $cardissue, $noremotestore = "", $fullclear = "")
{
    global $CONFIG;
    global $_LANG;
    global $cc_encryption_hash;
    $gatewayid = get_query_val("tblclients", "gatewayid", array("id" => $userid));
    if ($fullclear) {
        update_query("tblclients", array("cardtype" => "", "cardlastfour" => "", "cardnum" => "", "expdate" => "", "startdate" => "", "issuenumber" => "", "gatewayid" => ""), array("id" => $userid));
    }
    $cardnum = ccFormatNumbers($cardnum);
    $cardexp = ccFormatNumbers($cardexp);
    $cardstart = ccFormatNumbers($cardstart);
    $cardissue = ccFormatNumbers($cardissue);
    $cardexp = ccFormatDate($cardexp);
    ccFormatDate($cardstart);
    $cardcvv = ccFormatNumbers($cardcvv);
    if ($cardtype) {
        $errormessage = checkCreditCard($cardnum, $cardtype);
        if (!$cardexp || strlen($cardexp) != 4) {
            $errormessage .= "<li>" . $_LANG['creditcardenterexpirydate'];
        } else {
            if (substr($cardexp, 0, 2) < date("m") && "20" . substr($cardexp, 2) <= date("Y")) {
                $errormessage .= "<li>" . $_LANG['creditcardexpirydateinvalid'];
            }
        }
    }
    if ($errormessage) {
        return $errormessage;
    }
    if (!$userid) {
        return "";
    }
    if ($noremotestore) {
        return "";
    }
    if ($CONFIG['CCNeverStore']) {
        return "";
    }
    $remotestored = false;
    $result = select_query("tblpaymentgateways", "gateway,(SELECT id FROM tblinvoices WHERE paymentmethod=gateway AND userid='" . (int) $userid . "' ORDER BY id DESC LIMIT 0,1) AS invoiceid", "setting='type' AND (value='CC' OR value='OfflineCC')");
    while ($data = mysql_fetch_array($result)) {
        $gateway = $data['gateway'];
        $invoiceid = $data['invoiceid'];
        if ($invoiceid) {
            if (!isValidforPath($gateway)) {
                exit("Invalid Gateway Module Name");
            }
            require_once ROOTDIR . ("/modules/gateways/" . $gateway . ".php");
            if (function_exists($gateway . "_storeremote")) {
                $rparams = getCCVariables($invoiceid);
                $rparams['cardtype'] = $cardtype;
                $rparams['cardnum'] = $cardnum;
                $rparams['cardcvv'] = $cardcvv;
                $rparams['cardexp'] = $cardexp;
                $rparams['cardstart'] = $cardstart;
                $rparams['cardissuenum'] = $cardissue;
                $rparams['gatewayid'] = $gatewayid;
                $action = "create";
                if ($rparams['gatewayid']) {
                    if ($rparams['cardnum']) {
                        $action = "update";
                    } else {
                        $action = "delete";
                    }
                }
                $rparams['action'] = $action;
                $captureresult = call_user_func($gateway . "_storeremote", $rparams);
                $result = select_query("tblpaymentgateways", "value", array("gateway" => $rparams['paymentmethod'], "setting" => "name"));
                $data = mysql_fetch_array($result);
                $gatewayname = $data['value'] . " Remote Storage";
                $debugdata = is_array($captureresult['rawdata']) ? array_merge(array("UserID" => $rparams['clientdetails']['userid']), $captureresult['rawdata']) : "UserID => " . $rparams['clientdetails']['userid'] . "\r\n" . $captureresult['rawdata'];
                if ($captureresult['status'] == "success") {
                    if (isset($captureresult['gatewayid'])) {
                        update_query("tblclients", array("gatewayid" => $captureresult['gatewayid']), array("id" => $userid));
                    }
                    if ($action == "delete") {
                        update_query("tblclients", array("cardtype" => "", "cardlastfour" => "", "cardnum" => "", "expdate" => "", "startdate" => "", "issuenumber" => "", "gatewayid" => ""), array("id" => $userid));
                    }
                    logTransaction($gatewayname, $debugdata, "Success");
                } else {
                    logTransaction($gatewayname, $debugdata, ucfirst($captureresult['status']));
                    return "<li>Remote Transaction Failure. Please Contact Support.";
                }
                $remotestored = true;
            }
        }
    }
    $cchash = md5($cc_encryption_hash . $userid);
    $cardstart = "";
    $cardlastfour = substr($cardnum, 0 - 4);
    if ($remotestored) {
        $cardnum = "";
    }
    update_query("tblclients", array("cardtype" => $cardtype, "cardlastfour" => $cardlastfour, "cardnum" => array("type" => "AES_ENCRYPT", "text" => $cardnum, "hashkey" => $cchash), "expdate" => array("type" => "AES_ENCRYPT", "text" => $cardexp, "hashkey" => $cchash), "startdate" => array("type" => "AES_ENCRYPT", "text" => $cardstart, "hashkey" => $cchash), "issuenumber" => array("type" => "AES_ENCRYPT", "text" => $cardissue, "hashkey" => $cchash)), array("id" => $userid));
    logActivity("Updated Stored Credit Card Details - User ID: " . $userid, $userid);
    run_hook("CCUpdate", array("userid" => $userid, "cardtype" => $cardtype, "cardnum" => $cardnum, "cardcvv" => $cardcvv, "expdate" => $cardexp, "cardstart" => $cardstart, "issuenumber" => $cardissue));
}