当前位置: 首页>>代码示例>>PHP>>正文


PHP logTransaction函数代码示例

本文整理汇总了PHP中logTransaction函数的典型用法代码示例。如果您正苦于以下问题:PHP logTransaction函数的具体用法?PHP logTransaction怎么用?PHP logTransaction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logTransaction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: paypalexpress_orderformoutput

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;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:26,代码来源:paypalexpress.php

示例2: optimalpayments_3dsecure

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");
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:29,代码来源:optimalpayments.php

示例3: monerisvault_mpgHttpsPost

 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);
 }
开发者ID:billyprice1,项目名称:whmcs,代码行数:30,代码来源:monerisvault.php

示例4: pagseguroapilite_link

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;
}
开发者ID:andrebellafronte,项目名称:whmcs-pagseguro-api-lite,代码行数:32,代码来源:pagseguroapilite.php

示例5: myideal_link

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;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:57,代码来源:myideal.php

示例6: getPaymentToken

 /**
  * 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'];
 }
开发者ID:avish-bisbeehurry-cko,项目名称:checkout-whmcs-plugin,代码行数:23,代码来源:creditcard.php

示例7: processDeliverable

/**
 * @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");
}
开发者ID:fanytest,项目名称:module-whmcs,代码行数:25,代码来源:paymentwall.php

示例8: authorizecim_capture

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);
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:43,代码来源:authorizecim.php

示例9: completeOrderUser

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;
}
开发者ID:WebKutir,项目名称:bitshares-whmcs,代码行数:20,代码来源:userfunctions.php

示例10: tcoconvertcurrency

/**
 *
 * @ 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;
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:32,代码来源:tco.php

示例11: ewayuk_link

function ewayuk_link($params)
{
    $query = "";
    $gatewaytestmode = $params['testmode'];
    if ($gatewaytestmode == "on") {
        $query .= "CustomerID=87654321";
        $query .= "&UserName=TestAccount";
    } else {
        $query .= "CustomerID=" . $params['customerid'];
        $query .= "&UserName=" . $params['username'];
    }
    $query .= "&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.";
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:38,代码来源:ewayuk.php

示例12: netbilling_capture

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");
}
开发者ID:billyprice1,项目名称:whmcs,代码行数:69,代码来源:netbilling.php

示例13: gocardless_capture

/**
 ** 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']));
    }
}
开发者ID:stehardy,项目名称:gocardless-whmcs,代码行数:94,代码来源:gocardless.php

示例14: str_replace

$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";
    }
}
开发者ID:iHostUP,项目名称:WHMCS_AllPay_Mod,代码行数:31,代码来源:allpaycredit.php

示例15: localAPI

    # 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
}
开发者ID:carriercomm,项目名称:whmcs-coinbase-bitcoin,代码行数:31,代码来源:coinbase.php


注:本文中的logTransaction函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。