Example #1
0
function paypalexpress_orderformoutput($params)
{
    if ($_POST['paypalcheckout']) {
        $postfields = array();
        $postfields['PAYMENTREQUEST_0_PAYMENTACTION'] = "Sale";
        $postfields['PAYMENTREQUEST_0_AMT'] = $params['amount'];
        $postfields['PAYMENTREQUEST_0_CURRENCYCODE'] = $params['currency'];
        $postfields['RETURNURL'] = $params['systemurl'] . "/modules/gateways/callback/paypalexpress.php";
        $postfields['CANCELURL'] = $params['systemurl'] . "/cart.php?a=view";
        $results = paypalexpress_api_call($params, "SetExpressCheckout", $postfields);
        $ack = strtoupper($results['ACK']);
        if ($ack == "SUCCESS" || $ack == "SUCCESSWITHWARNING") {
            logTransaction("PayPal Express Token Gen", $results, "Successful");
            $token = $results['TOKEN'];
            $_SESSION['paypalexpress']['token'] = $token;
            $PAYPAL_URL = $params['sandbox'] ? "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=" : "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
            header("Location: " . $PAYPAL_URL . $token);
            exit;
        } else {
            logTransaction("PayPal Express Token Gen", $results, "Error");
            return "<p>PayPal Checkout Error. Please Contact Support.</p>";
        }
    }
    $code = "<form action=\"cart.php?a=view\" method=\"post\">\n<input type=\"hidden\" name=\"paypalcheckout\" value=\"1\" />\n<input type=\"image\" name=\"submit\" src=\"https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif\" border=\"0\" align=\"top\" alt=\"Check out with PayPal\" />\n</form>";
    return $code;
}
Example #2
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");
}
Example #3
0
 public function monerisvault_mpgHttpsPost($environment, $storeid, $apitoken, $monerisvault_mpgRequestOBJ)
 {
     $this->store_id = $storeid;
     $this->api_token = $apitoken;
     $this->monerisvault_mpgRequest = $monerisvault_mpgRequestOBJ;
     $dataToSend = $this->toXML();
     if ($environment == "live") {
         $globalarr = array("MONERIS_PROTOCOL" => "https", "MONERIS_HOST" => "www3.moneris.com", "MONERIS_PORT" => "443", "MONERIS_FILE" => "/gateway2/servlet/MpgRequest", "API_VERSION" => " CA PHP Api v.2.0.4 (Resolver)", "CLIENT_TIMEOUT" => "60");
     } else {
         $globalarr = array("MONERIS_PROTOCOL" => "https", "MONERIS_HOST" => "esqa.moneris.com", "MONERIS_PORT" => "443", "MONERIS_FILE" => "/gateway2/servlet/MpgRequest", "API_VERSION" => " CA PHP Api v.2.0.4 (Resolver)", "CLIENT_TIMEOUT" => "60");
     }
     $url = $globalarr['MONERIS_PROTOCOL'] . "://" . $globalarr['MONERIS_HOST'] . ":" . $globalarr['MONERIS_PORT'] . $globalarr['MONERIS_FILE'];
     logTransaction("Moneris Vault " . ucfirst($environment) . " Debug", $dataToSend, "Request to " . $url);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $dataToSend);
     curl_setopt($ch, CURLOPT_TIMEOUT, $globalarr['CLIENT_TIMEOUT']);
     curl_setopt($ch, CURLOPT_USERAGENT, $globalarr['API_VERSION']);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     $response = curl_exec($ch);
     logTransaction("Moneris Vault " . ucfirst($environment) . " Debug", $response, "Response");
     curl_close($ch);
     if (!$response) {
         $response = "<?xml version=\"1.0\"?><response><receipt>" . "<ReceiptId>Global Error Receipt</ReceiptId>" . "<ReferenceNum>null</ReferenceNum><ResponseCode>null</ResponseCode>" . "<AuthCode>null</AuthCode><TransTime>null</TransTime>" . "<TransDate>null</TransDate><TransType>null</TransType><Complete>false</Complete>" . "<Message>Global Error Receipt</Message><TransAmount>null</TransAmount>" . "<CardType>null</CardType>" . "<TransID>null</TransID><TimedOut>null</TimedOut>" . "<CorporateCard>false</CorporateCard><MessageId>null</MessageId>" . "</receipt></response>";
     }
     $this->monerisvault_mpgResponse = new monerisvault_mpgResponse($response);
 }
function pagseguroapilite_link($params)
{
    $xml_checkout = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<checkout>
    <currency>BRL</currency>
    <items>
        <item>
            <id>1</id>
            <description>' . htmlspecialchars($params['description']) . '</description>
            <amount>' . $params['amount'] . '</amount>
            <quantity>1</quantity>
        </item>
    </items>
    <reference>' . $params['invoiceid'] . '</reference>
    <redirectURL>' . $params['systemurl'] . '/viewinvoice.php?id=' . $params['invoiceid'] . '</redirectURL>
    <notificationURL>' . $params['systemurl'] . '/modules/gateways/' . basename(__FILE__) . '</notificationURL>
</checkout>';
    $curl = curl_init('https://ws.pagseguro.uol.com.br/v2/checkout/?email=' . $params['email'] . '&token=' . $params['token']);
    curl_setopt_array($curl, array(CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $xml_checkout, CURLOPT_RETURNTRANSFER => 1, CURLOPT_HTTPHEADER => array('Content-Type: application/xml; charset=UTF-8')));
    $retorno_curl = curl_exec($curl);
    $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;
}
Example #5
0
function myideal_link($params)
{
    require_once dirname(__FILE__) . "/myideal/myideal_lib.php";
    require_once dirname(__FILE__) . "/myideal/ThinMPI.php";
    $data = new DirectoryRequest();
    $rule = new ThinMPI();
    $result = $rule->ProcessRequest($data);
    $gatewayusername = $params['username'];
    $gatewaytestmode = $params['testmode'];
    $invoiceid = $params['invoiceid'];
    $description = $params['description'];
    $amount = $params['amount'];
    $duedate = $params['duedate'];
    $firstname = $params['clientdetails']['firstname'];
    $lastname = $params['clientdetails']['lastname'];
    $email = $params['clientdetails']['email'];
    $address1 = $params['clientdetails']['address1'];
    $address2 = $params['clientdetails']['address2'];
    $city = $params['clientdetails']['city'];
    $state = $params['clientdetails']['state'];
    $postcode = $params['clientdetails']['postcode'];
    $country = $params['clientdetails']['country'];
    $phone = $params['clientdetails']['phone'];
    $companyname = $params['companyname'];
    $systemurl = $params['systemurl'];
    $currency = $params['currency'];
    if (!$result->isOK()) {
        $code = $result->getConsumerMessage();
        logTransaction("My iDEAL", $result->getErrorDetail(), "Link Error");
    } else {
        $issuerArray = $result->getIssuerList();
        if (count($issuerArray) == 0) {
            $code = "Lijst met banken niet beschikbaar, er is op dit moment geen betaling met iDEAL mogelijk.";
        } else {
            for ($i = 0; $i < count($issuerArray); $i++) {
                if ($issuerArray[$i]->issuerList == "Short") {
                    $issuerArrayShort[] = $issuerArray[$i];
                } else {
                    $issuerArrayLong[] = $issuerArray[$i];
                }
            }
            $code = "<form action=\"modules/gateways/myideal/TransReq.php\" method=\"post\" name=\"OrderForm\">" . "<select name=\"issuerID\">";
            $code .= "<option value=\"0\">Kies uw bank...</option>";
            for ($i = 0; $i < count($issuerArrayShort); $i++) {
                $code .= "<option value=\"" . $issuerArrayShort[$i]->issuerID . "\"> " . $issuerArrayShort[$i]->issuerName . " </option>";
            }
            if (0 < count($issuerArrayLong)) {
                $code .= "<option value=\"0\">---Overige banken---</option>";
            }
            for ($i = 0; $i < count($issuerArrayLong); $i++) {
                $code .= "<option value=\"" . $issuerArrayLong[$i]->issuerID . "\"> " . $issuerArrayLong[$i]->issuerName . " </option>";
            }
            $code .= "</select><br />" . "<input name=\"clicksubmit\" type=\"submit\" value=\"Betaal Nu\"><br />" . ("<input name=\"grandtotal\" type=\"hidden\" value=\"" . $amount . "\">") . "<input name=\"ordernumber\" type=\"hidden\" value=\"" . substr(myideal_RandomString($invoiceid), 0, 15) . "\">" . ("<input name=\"currency\" type=\"hidden\" value=\"" . $currency . "\">") . ("<input name=\"description\" type=\"hidden\" value=\"" . $invoiceid . "\">") . "</form>";
        }
    }
    return $code;
}
 /**
  * Get Payment Token from
  *
  * @param $params
  * @return mixed
  */
 public function getPaymentToken($params)
 {
     $Api = CheckoutApi_Api::getApi(array('mode' => $params['modetype']));
     $config = $this->createChargeConfig($params);
     /* Get payment Token */
     $paymentTokenCharge = $Api->getPaymentToken($config);
     $paymentTokenReturn = array('success' => false, 'token' => '', 'message' => '');
     if ($Api->getExceptionState()->hasError()) {
         logTransaction('checkoutjs', $Api->getExceptionState()->getErrorMessage(), "Unsuccessful");
     }
     if ($paymentTokenCharge->isValid()) {
         $paymentToken = $paymentTokenCharge->getId();
         $paymentTokenReturn['token'] = $paymentToken;
         $paymentTokenReturn['success'] = true;
     }
     return $paymentTokenReturn['token'];
 }
Example #7
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");
}
Example #8
0
function authorizecim_capture($params)
{
    if ($params['testmode']) {
        $url = "https://apitest.authorize.net/xml/v1/request.api";
    } else {
        $url = "https://api.authorize.net/xml/v1/request.api";
    }
    $gatewayids = explode(",", $params['gatewayid']);
    if (!$gatewayids[0]) {
        return array("status" => "error", "rawdata" => "No Client Profile ID Found");
    }
    if (!$gatewayids[1]) {
        return array("status" => "error", "rawdata" => "No Client Payment Profile ID Found");
    }
    $storednameaddresshash = $gatewayids[2];
    $nameaddresshash = md5($params['clientdetails']['firstname'] . $params['clientdetails']['lastname'] . $params['clientdetails']['address1'] . $params['clientdetails']['city'] . $params['clientdetails']['state'] . $params['clientdetails']['postcode'] . $params['clientdetails']['country']);
    if ($nameaddresshash != $storednameaddresshash) {
        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<getCustomerPaymentProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n<merchantAuthentication>\n<name>" . $params['loginid'] . "</name>\n<transactionKey>" . $params['transkey'] . "</transactionKey>\n</merchantAuthentication>\n<customerProfileId>" . $gatewayids[0] . "</customerProfileId>\n<customerPaymentProfileId>" . $gatewayids[1] . "</customerPaymentProfileId>\n</getCustomerPaymentProfileRequest>";
        $data = curlCall($url, $xml, array("HEADER" => array("Content-Type: text/xml")));
        $xmldata = XMLtoArray($data);
        $cardnum = $xmldata['GETCUSTOMERPAYMENTPROFILERESPONSE']['PAYMENTPROFILE']['PAYMENT']['CREDITCARD']['CARDNUMBER'];
        $expdate = $xmldata['GETCUSTOMERPAYMENTPROFILERESPONSE']['PAYMENTPROFILE']['PAYMENT']['CREDITCARD']['EXPIRATIONDATE'];
        $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<updateCustomerPaymentProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n<merchantAuthentication>\n<name>" . $params['loginid'] . "</name>\n<transactionKey>" . $params['transkey'] . "</transactionKey>\n</merchantAuthentication>\n<customerProfileId>" . $gatewayids[0] . "</customerProfileId>\n<paymentProfile>\n<billTo>\n<firstName><![CDATA[" . $params['clientdetails']['firstname'] . "]]></firstName>\n<lastName><![CDATA[" . $params['clientdetails']['lastname'] . "]]></lastName>\n<company><![CDATA[" . $params['clientdetails']['companyname'] . "]]></company>\n<address><![CDATA[" . $params['clientdetails']['address1'] . "]]></address>\n<city><![CDATA[" . $params['clientdetails']['city'] . "]]></city>\n<state><![CDATA[" . $params['clientdetails']['state'] . "]]></state>\n<zip><![CDATA[" . $params['clientdetails']['postcode'] . "]]></zip>\n<country><![CDATA[" . $params['clientdetails']['country'] . "]]></country>\n<phoneNumber>" . $params['clientdetails']['phonenumber'] . "</phoneNumber>\n<faxNumber></faxNumber>\n</billTo>\n<payment>\n<creditCard>\n<cardNumber>" . $cardnum . "</cardNumber>\n<expirationDate>" . $expdate . "</expirationDate>\n</creditCard>\n</payment>\n<customerPaymentProfileId>" . $gatewayids[1] . "</customerPaymentProfileId>\n</paymentProfile>\n</updateCustomerPaymentProfileRequest>";
        $data = curlCall($url, $xml, array("HEADER" => array("Content-Type: text/xml")));
        logTransaction("Authorize.net CIM Remote Storage", $data, "Address Update");
        $gatewayids[2] = $nameaddresshash;
        update_query("tblclients", array("gatewayid" => implode(",", $gatewayids)), array("id" => $params['clientdetails']['userid']));
    }
    $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<createCustomerProfileTransactionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">\n<merchantAuthentication>\n<name>" . $params['loginid'] . "</name>\n<transactionKey>" . $params['transkey'] . "</transactionKey>\n</merchantAuthentication>\n<transaction>\n<profileTransAuthCapture>\n<amount>" . $params['amount'] . "</amount>\n<customerProfileId>" . $gatewayids[0] . "</customerProfileId>\n<customerPaymentProfileId>" . $gatewayids[1] . "</customerPaymentProfileId>\n<order>\n<invoiceNumber>" . $params['invoiceid'] . "</invoiceNumber>\n</order>\n<recurringBilling>false</recurringBilling>\n";
    if ($params['cccvv']) {
        $xml .= "<cardCode>" . $params['cccvv'] . "</cardCode>\n";
    }
    $xml .= "</profileTransAuthCapture>\n</transaction>\n<extraOptions><![CDATA[x_customer_ip=" . $remote_ip . "]]></extraOptions>\n</createCustomerProfileTransactionRequest>";
    $data = curlCall($url, $xml, array("HEADER" => array("Content-Type: text/xml")));
    $xmldata = XMLtoArray($data);
    if ($xmldata['CREATECUSTOMERPROFILETRANSACTIONRESPONSE']['MESSAGES']['RESULTCODE'] == "Ok") {
        $transid = $xmldata['CREATECUSTOMERPROFILETRANSACTIONRESPONSE']['DIRECTRESPONSE'];
        $transid = explode(",", $transid);
        $transid = $transid[6];
        return array("status" => "success", "transid" => $transid, "rawdata" => $data);
    }
    return array("status" => "error", "rawdata" => $data);
}
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;
}
Example #10
0
/**
 *
 * @ WHMCS FULL DECODED & NULLED
 *
 * @ Version  : 5.2.15
 * @ Author   : MTIMER
 * @ Release on : 2013-12-24
 * @ Website  : http://www.mtimer.cn
 *
 **/
function tcoconvertcurrency($amount, $currency, $invoiceid)
{
    $result = select_query("tblcurrencies", "id", array("code" => $currency));
    $data = mysql_fetch_array($result);
    $currencyid = $data['id'];
    if (!$currencyid) {
        logTransaction($GATEWAY['name'], $_POST, "Unrecognised Currency");
        exit;
    }
    $result = select_query("tblinvoices", "userid,total", array("id" => $invoiceid));
    $data = mysql_fetch_array($result);
    $userid = $data['userid'];
    $total = $data['total'];
    $currency = getCurrency($userid);
    if ($currencyid != $currency['id']) {
        $amount = convertCurrency($amount, $currencyid, $currency['id']);
        if ($total < $amount + 1 && $amount - 1 < $total) {
            $amount = $total;
        }
    }
    return $amount;
}
Example #11
0
function ewayuk_link($params)
{
    $query = "";
    $gatewaytestmode = $params['testmode'];
    if ($gatewaytestmode == "on") {
        $query .= "CustomerID=87654321";
        $query .= "&UserName=TestAccount";
    } else {
        $query .= "CustomerID=" . $params['customerid'];
        $query .= "&UserName="******"&MerchantInvoice=" . $params['invoiceid'];
    $query .= "&MerchantReference=" . $params['invoiceid'];
    $query .= "&Amount=" . urlencode($params['amount']);
    $query .= "&Currency=" . $params['currency'];
    $query .= "&CustomerFirstName=" . $params['clientdetails']['firstname'];
    $query .= "&CustomerLastName=" . $params['clientdetails']['lastname'];
    $query .= "&CustomerAddress=" . $params['clientdetails']['address1'] . " " . $params['clientdetails']['address2'];
    $query .= "&CustomerCity=" . $params['clientdetails']['city'];
    $query .= "&CustomerState=" . $params['clientdetails']['state'];
    $query .= "&CustomerPostCode=" . $params['clientdetails']['postcode'];
    $query .= "&CustomerCountry=" . $params['clientdetails']['country'];
    $query .= "&CustomerEmail=" . $params['clientdetails']['email'];
    $query .= "&CustomerPhone=" . $params['clientdetails']['phonenumber'];
    $query .= "&CancelUrl=" . urlencode($params['systemurl'] . "/viewinvoice.php?id=" . $params['invoiceid']);
    $query .= "&ReturnUrl=" . urlencode($params['systemurl'] . "/modules/gateways/callback/ewayuk.php");
    $query = str_replace(" ", "%20", $query);
    $posturl = "https://payment.ewaygateway.com/Request/?" . $query;
    $response = curlCall($posturl, "");
    $responsemode = strtolower(ewayuk_fetch_data($response, "<Result>", "</Result>"));
    if ($responsemode == "true") {
        $redirecturl = ewayuk_fetch_data($response, "<Uri>", "</Uri>");
        $code = "<input type=\"button\" value=\"" . $params['langpaynow'] . "\" onclick=\"window.location='" . $redirecturl . "'\" />\n</form>";
        return $code;
    }
    logTransaction("eWay UK", $response, "Error");
    return "An Error Occurred. Please try again later or submit a ticket if the error persists.";
}
Example #12
0
function netbilling_capture($params)
{
    $payment['account_id'] = $params['accountid'];
    $payment['site_tag'] = $params['sitetag'];
    $payment['tran_type'] = "S";
    $payment['amount'] = $params['amount'];
    $payment['description'] = "Invoice ID " . $params['invoiceid'];
    $payment['bill_name1'] = $params['clientdetails']['firstname'];
    $payment['bill_name2'] = $params['clientdetails']['lastname'];
    $payment['bill_street'] = $params['clientdetails']['address1'];
    $payment['bill_city'] = $params['clientdetails']['city'];
    $payment['bill_state'] = $params['clientdetails']['state'];
    $payment['bill_zip'] = $params['clientdetails']['postcode'];
    $payment['bill_country'] = $params['clientdetails']['country'];
    $payment['cust_email'] = $params['email'];
    $payment['pay_type'] = "C";
    $payment['card_number'] = $params['cardnum'];
    $payment['card_expire'] = $params['cardexp'];
    if ($params['cccvv']) {
        $payment['card_cvv2'] = $params['cccvv'];
    } else {
        $payment['disable_cvv2'] = 1;
    }
    $post_str = "";
    foreach ($payment as $k => $v) {
        if (!empty($post_str)) {
            $post_str .= "&";
        }
        $post_str .= $k . "=" . urlencode($v);
    }
    $gateway_url = "https://secure.netbilling.com:1402/gw/sas/direct3.1";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $gateway_url);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 90);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    $res = curl_exec($ch);
    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if (curl_errno($ch)) {
        $curlerror = curl_errno($ch) . " - " . curl_error($ch);
    }
    curl_close($ch);
    $resp = explode("\n\n", $res);
    $header = explode("\n", $resp[0]);
    parse_str($resp[1], $result);
    $approved = 5;
    $retry = 5;
    $failed = 5;
    $response_msg = "";
    $desc = "Action => Auth_Capture\nClient => " . $params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname'] . ("\n" . $res);
    if ($curlerror) {
        $desc .= "\nCURL Error => " . $curlerror;
    }
    if ($http_code == "200") {
        $status_code = $result['status_code'];
        if ($status_code == "0" || $status_code == "F") {
            return array("status" => "error", "rawdata" => $desc);
        }
        if ($status_code == "D") {
            return array("status" => "declined", "rawdata" => $desc);
        }
        return array("status" => "success", "transid" => $result['auth_code'], "rawdata" => $desc);
    }
    logTransaction("NetBilling", $desc, "Connection Failed");
}
Example #13
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']));
    }
}
Example #14
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";
    }
}
    # http://docs.whmcs.com/API:Update_Invoice - add BTC currency conversion in invoice notes
    $command = "updateinvoice";
    $values["invoiceid"] = $invoice_id;
    #changeme
    $values["notes"] = "BTC:{$total_btc_cents};USD:{$total_native_cents};";
    #changeme
    $results = localAPI($command, $values, $adminuser);
    //addInvoicePayment($invoice_id,$trans_id,$amount,$fee,$gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
    $command = "addinvoicepayment";
    $values["invoiceid"] = $invoice_id;
    $values["transid"] = $trans_id;
    $values["amount"] = $amount;
    $values["fee"] = $fee;
    $values["gateway"] = $GATEWAY['name'];
    $results = localAPI($command, $values, $adminuser);
    logTransaction($GATEWAY["name"], $json, "Successful");
    # Save to Gateway Log: name, data array, status
} elseif ($status == "canceled") {
    # Canceled
    $command = "updateinvoice";
    $values["invoiceid"] = $invoice_id;
    #changeme
    $values["status"] = "Unpaid";
    $results = localAPI($command, $values, $adminuser);
    logTransaction($GATEWAY["name"], $json, "Canceled");
    # Save to Gateway Log: name, data array, status
} else {
    # Unsuccessful
    logTransaction($GATEWAY["name"], $json, "Unsuccessful");
    # Save to Gateway Log: name, data array, status
}
    $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);
Example #17
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");
}
Example #18
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");
Example #19
0
            $description = $event->data->object->description;
        }
        // Get the invoice ID from the transaction
        $start = strpos($description, "#") + strlen("#");
        $end = strpos($description, " ", $start);
        $invoiceid = substr($description, $start, $end - $start);
        $transid = $event->data->object->id;
        $amount_cents = $event->data->object->amount;
        $amount = $amount_cents / 100;
        $fee_cents = floatval($event->data->object->fee);
        $fee = $fee_cents / 100;
        $paid = $event->data->object->paid;
    }
} catch (Exception $e) {
    mail($gateway["problememail"], "Stripe Failed Callback", "A problem prevented Stripe from properly processing an incoming payment webhook:" . $e);
}
$invoiceid = checkCbInvoiceID($invoiceid, $GATEWAY["name"]);
# Checks invoice ID is a valid invoice number or ends processing
checkCbTransID($transid);
# Checks transaction number isn't already in the database and ends processing if it does
if ($paid == true) {
    # Successful
    addInvoicePayment($invoiceid, $transid, $amount, $fee, $gatewaymodule);
    # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
    logTransaction($GATEWAY["name"], $event, "Successful");
    # Save to Gateway Log: name, data array, status
} else {
    # Unsuccessful
    logTransaction($GATEWAY["name"], $event, "Unsuccessful");
    # Save to Gateway Log: name, data array, status
}
Example #20
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);
Example #21
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);
    }
}
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;
}
}
# 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;
    }
}
 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";
 }
Example #25
0
function sagepaytokens_3dsecure($params)
{
    $subdomain = $params['testmode'] ? "test" : "live";
    $url = "https://" . $subdomain . ".sagepay.com/gateway/service/vspdirect-register.vsp";
    $fields = array();
    $fields['VPSProtocol'] = "2.23";
    $fields['TxType'] = "PAYMENT";
    $fields['Vendor'] = $params['vendorid'];
    $fields['VendorTxCode'] = $params['invoiceid'] . "-" . date("YmdHis");
    $fields['Amount'] = $params['amount'];
    $fields['Currency'] = $params['currency'];
    $fields['Description'] = $params['companyname'] . " - Invoice #" . $params['invoiceid'];
    $fields['Token'] = $params['gatewayid'];
    $fields['StoreToken'] = "1";
    if ($params['cccvv']) {
        $fields['CV2'] = $params['cccvv'];
    }
    $fields['BillingSurname'] = $params['clientdetails']['lastname'];
    $fields['BillingFirstnames'] = $params['clientdetails']['firstname'];
    $fields['BillingAddress1'] = $params['clientdetails']['address1'];
    $fields['BillingAddress2'] = $params['clientdetails']['address2'];
    $fields['BillingCity'] = $params['clientdetails']['city'];
    if ($params['clientdetails']['country'] == "US") {
        $fields['BillingState'] = $params['clientdetails']['state'];
    }
    $fields['BillingPostCode'] = $params['clientdetails']['postcode'];
    $fields['BillingCountry'] = $params['clientdetails']['country'];
    $fields['BillingPhone'] = $params['clientdetails']['phonenumber'];
    $fields['ClientIPAddress'] = $remote_ip;
    $fields['CardType'] = sagepaytokens_getcardtype($params['cardtype']);
    $results = sagepaytokens_call($url, $fields);
    $baseStatus = $results['Status'];
    switch ($baseStatus) {
        case "3DAUTH":
            logTransaction("SagePay Tokens 3DAuth", $results, "Ok");
            $_SESSION['sagepayrepeatsinvoiceid'] = $params['invoiceid'];
            $code = "<form method=\"post\" action=\"" . $results['ACSURL'] . "\">\n    \t\t<input type=\"hidden\" name=\"PaReq\" value=\"" . $results['PAReq'] . "\">\n    \t\t<input type=\"hidden\" name=\"TermUrl\" value=\"" . $params['systemurl'] . "/modules/gateways/callback/sagepaytokens.php?invoiceid=" . $params['invoiceid'] . "\">\n    \t\t<input type=\"hidden\" name=\"MD\" value=\"" . $results['MD'] . "\">\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    \t\t</form>";
            $code;
    }
    return;
}
Example #26
0
                            update_query('tblinvoices', array('status' => 'Unpaid'), array('id' => $invoiceID));
                        }
                        # update the corresponding transaction to mark as FAIL and mark the invoice as unpaid
                        update_query('tblaccounts', array('amountin' => "0", 'fees' => "0", 'transid' => ($val['action'] == 'failed' ? 'FAIL_' : 'REFUND_') . $aBill['id']), array('invoiceid' => $invoiceID, 'transid' => $aBill['id']));
                        # log the failed/refunded transaction in the gateway log as status 'Payment Failed/Refunded'
                        logTransaction($gateway['paymentmethod'], "GoCardless Payment {$val['action']}.\r\nPreauth ID: {$aBill['source_id']}\nBill ID: {$aBill['id']}: " . print_r($aBill, true), 'Bill ' . ucfirst($val['action']));
                        # 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;
                    }
                }
                break;
            case 'created':
                # we dont want to handle created bills
                foreach ($val['bills'] as $aBill) {
                    logTransaction($gateway['paymentmethod'], 'GoCardless Bill Created (' . $aBill['id'] . ')', 'Bill Created');
                }
                break;
        }
        break;
    default:
        header('HTTP/1.1 400 Bad Request');
        logTransaction($gateway['paymentmethod'], 'Could not determine given resource type. callback.php ' . __LINE__ . $invoiceID, 'Failed');
        exit(__LINE__ . ': Could not determine given resource type');
        break;
}
# if we get to this point we are done
header('HTTP/1.1 200 OK');
        $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);
Example #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("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");
Example #29
0
$data->setTransactionID($transID);
$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>";
Example #30
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);