function optimalpayments_capture($params) { global $remote_ip; $url = "https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1"; if ($params['testmode']) { $url = "https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1"; } $cardtype = optimalpayments_cardtype($params['cardtype']); if ($params['country'] == "US") { $state = "<state>" . $params['clientdetails']['state'] . "</state>"; } else { $state = "<region>" . $params['clientdetails']['state'] . "</region>"; } $xml = "<ccAuthRequestV1 xmlns=\"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"; if ($params['cccvv']) { $xml .= "<cvdIndicator>1</cvdIndicator>\n<cvd>" . $params['cccvv'] . "</cvd>\n"; } else { $xml .= "<cvdIndicator>0</cvdIndicator>\n"; } $xml .= "</card>\n<billingDetails>\n<cardPayMethod>WEB</cardPayMethod>\n<firstName>" . $params['clientdetails']['firstname'] . "</firstName>\n<lastName>" . $params['clientdetails']['lastname'] . "</lastName>\n<street>" . $params['clientdetails']['address1'] . "</street>\n<city>" . $params['clientdetails']['city'] . "</city>\n" . $state . "\n<country>" . $params['clientdetails']['country'] . "</country>\n<zip>" . $params['clientdetails']['postcode'] . "</zip>\n<phone>" . $params['clientdetails']['phonenumber'] . "</phone>\n<email>" . $params['clientdetails']['email'] . "</email>\n</billingDetails>\n<recurring>\n<recurringIndicator>R</recurringIndicator>\n</recurring>\n<customerIP>" . $remote_ip . "</customerIP>\n</ccAuthRequestV1>"; $query_str = "txnMode=ccPurchase&txnRequest=" . urlencode($xml); $data = curlCall($url, $query_str); $xmldata = XMLtoArray($data); $xmldata = $xmldata['CCTXNRESPONSEV1']; if ($xmldata['CODE'] == "0") { return array("status" => "success", "transid" => $xmldata['txnNumber'], "rawdata" => $xmldata); } return array("status" => "declined", "rawdata" => $xmldata); }
function securetrading_refund($params) { $gatewayusername = $params['username']; $gatewaypassword = $params['password']; $gatewaysiteref = $params['siteref']; $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><requestblock version=\"3.67\"><alias>" . $gatewayusername . "</alias><request type=\"REFUND\"> <merchant> <orderreference>" . $params['invoiceid'] . "</orderreference> </merchant> <operation> <sitereference>" . $gatewaysiteref . "</sitereference> <parenttransactionreference>" . $params['transid'] . "</parenttransactionreference> </operation> <billing> <amount currencycode=\"" . $params['currency'] . "\">" . $params['amount'] * 100 . "</amount> </billing> </request> </requestblock>"; $authstr = "Basic " . base64_encode($gatewayusername . ":" . $gatewaypassword); $headers = array("HTTP/1.1", "Host: webservices.securetrading.net", "Accept: text/xml", "Authorization: " . $authstr, "User-Agent: WHMCS Gateway Module", "Content-type: text/xml;charset=\"utf-8\"", "Content-length: " . strlen($xml), "Connection: close"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://webservices.securetrading.net:443/xml/"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_USERPWD, "" . $gatewayusername . ":" . $gatewaypassword); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); $data = curl_exec($ch); curl_close($ch); $xmldata = XMLtoArray($data); if ($xmldata['RESPONSEBLOCK']['RESPONSE']['ERROR']['CODE'] == "0") { $results['transid'] = $xmldata['RESPONSEBLOCK']['RESPONSE']['TRANSACTIONREFERENCE']; return array("status" => "success", "transid" => $results['transid'], "rawdata" => $data); } if ($xmldata['RESPONSEBLOCK']['RESPONSE']['ERROR']['CODE'] == "99999") { $results['status'] = "error"; return array("status" => "error", "rawdata" => $data); } return array("status" => "declined", "rawdata" => $data); }
function toArray($xml, $content = "response") { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $xml, $values, $tags); xml_parser_free($parser); $dbxml = XMLtoArray($values, $tags, $content); return $dbxml; }
function paymentexpress_link($params) { $url = "https://sec.paymentexpress.com/pxpay/pxaccess.aspx"; $xml = "<GenerateRequest>\n<PxPayUserId>" . $params['pxpayuserid'] . "</PxPayUserId>\n<PxPayKey>" . $params['pxpaykey'] . "</PxPayKey>\n<AmountInput>" . $params['amount'] . "</AmountInput>\n<CurrencyInput>" . $params['currency'] . "</CurrencyInput>\n<MerchantReference>" . $params['description'] . "</MerchantReference>\n<EmailAddress>" . $params['clientdetails']['email'] . "</EmailAddress>\n<TxnData1>" . $params['invoiceid'] . "</TxnData1>\n<TxnType>Purchase</TxnType>\n<TxnId>" . substr(time() . $params['invoiceid'], 0, 16) . "</TxnId>\n<BillingId></BillingId>\n<EnableAddBillCard>0</EnableAddBillCard>\n<UrlSuccess>" . $params['systemurl'] . "/modules/gateways/callback/paymentexpress.php</UrlSuccess>\n<UrlFail>" . $params['systemurl'] . "/clientarea.php</UrlFail>\n</GenerateRequest>"; $data = curlCall($url, $xml); $xmlresponse = XMLtoArray($data); $uri = $xmlresponse['REQUEST']['URI']; $code = "<form method=\"post\" action=\"" . $uri . "\"><input type=\"submit\" value=\"" . $params['langpaynow'] . "\"></form>"; return $code; }
function ippay_refund($params) { global $remote_ip; $url = $params['testmode'] ? "https://testgtwy.ippay.com/ippay" : "https://gtwy.ippay.com/ippay"; $transid = $params['invoiceid'] . date("YmdHis"); $transid = substr($transid, 0, 18); $transid = str_pad($transid, 18, "0", STR_PAD_LEFT); $xmldata = "<JetPay>\n <TransactionType>CREDIT</TransactionType>\n <TerminalID>" . $params['terminalid'] . "</TerminalID>\n <TransactionID>" . $transid . "</TransactionID>\n <CardNum>" . $params['cardnum'] . "</CardNum>\n <CardExpMonth>" . substr($params['cardexp'], 0, 2) . "</CardExpMonth>\n <CardExpYear>" . substr($params['cardexp'], 2, 2) . "</CardExpYear>\n <TotalAmount>" . $params['amount'] * 100 . "</TotalAmount>\n </JetPay>"; $response = curlCall($url, $xmldata); $response = XMLtoArray($response); $response = $response['JETPAYRESPONSE']; if ($response['ACTIONCODE'] == "000") { return array("status" => "success", "transid" => $response['TRANSACTIONID'], "rawdata" => $response); } return array("status" => "error", "rawdata" => $response); }
function quantumvault_refund($params) { if (!$params['gatewayid']) { return array("status" => "failed", "rawdata" => "No Card Stored for this Client in Vault"); } $url = "https://secure.quantumgateway.com/cgi/xml_requester.php"; $xml = "<QGWRequest>\n<Authentication>\n<GatewayLogin>" . $params['loginid'] . "</GatewayLogin>\n<GatewayKey>" . $params['transkey'] . "</GatewayKey>\n</Authentication>\n<Request>\n<RequestType>ShowTransactionDetails</RequestType>\n<TransactionID>" . $params['transid'] . "</TransactionID>\n</Request>\n</QGWRequest>"; $data = curlCall($url, "xml=" . $xml); $results = XMLtoArray($data); $cclastfour = $results['QGWREQUEST']['RESULT']['CREDITCARDNUMBER']; $xml = "<QGWRequest>\n<Authentication>\n<GatewayLogin>" . $params['loginid'] . "</GatewayLogin>\n<GatewayKey>" . $params['transkey'] . "</GatewayKey>\n</Authentication>\n<Request>\n<RequestType>ProcessSingleTransaction</RequestType>\n<ProcessType>RETURN</ProcessType>\n<TransactionType>CREDIT</TransactionType>\n<PaymentType>CC</PaymentType>\n<CustomerID>" . $params['gatewayid'] . "</CustomerID>\n<TransactionID>" . $params['transid'] . "</TransactionID>\n<CreditCardNumber>" . $cclastfour . "</CreditCardNumber>\n<Amount>" . $params['amount'] . "</Amount>\n</Request>\n</QGWRequest>"; $data = curlCall($url, "xml=" . $xml); $results = XMLtoArray($data); if ($results['QGWREQUEST']['RESULT']['STATUS'] == "APPROVED") { return array("status" => "success", "transid" => $results['QGWREQUEST']['RESULT']['TRANSACTIONID'], "rawdata" => $results['QGWREQUEST']['RESULT']); } return array("status" => "error", "rawdata" => $data); }
function cyberbit_capture($params) { if ($params['testmode']) { $url = "https://test.cyberbit.dk/author.php"; } else { $url = "https://merch.pmtngin.com/author.php"; } $postfields = array(); $postfields['Version'] = "2"; $postfields['Secret'] = $params['transsecret']; $postfields['MerchantId'] = $params['merchantid']; $postfields['RecurringRefId'] = $params['gatewayid']; $postfields['InternalOrderId'] = time() . "-" . $params['invoiceid']; $result = curlCall($url, $postfields); $xmldata = XMLtoArray($result); if ($xmldata['ECCPRO']['STATUSCODE'] == "000") { return array("status" => "success", "transid" => $xmldata['ECCPRO']['RESPONSE']['ORDERID'], "rawdata" => $xmldata['ECCPRO']['RESPONSE']); } return array("status" => "declined", "rawdata" => $xmldata['ECCPRO']['RESPONSE']); }
function quantumgateway_refund($params) { if (!$params['cardlastfour']) { $url = "https://secure.quantumgateway.com/cgi/xml_requester.php"; $prexml = "<QGWRequest>\n<Authentication>\n<GatewayLogin>" . $params['loginid'] . "</GatewayLogin>\n<GatewayKey>" . $params['transkey'] . "</GatewayKey>\n</Authentication>\n<Request>\n<RequestType>ShowTransactionDetails</RequestType>\n<TransactionID>" . $params['transid'] . "</TransactionID>\n</Request>\n</QGWRequest>"; $predata = curlCall($url, "xml=" . $prexml); $preresults = XMLtoArray($predata); if ($preresults['QGWREQUEST']['RESULT']['PAYMENTTYPE'] == "CC") { $params['cardlastfour'] = $preresults['QGWREQUEST']['RESULT']['CREDITCARDNUMBER']; } else { return array("status" => "error", "rawdata" => "Original Payment not made by CC " . $predata); } } $url = "https://secure.quantumgateway.com/cgi/xml_requester.php"; $xml = "<QGWRequest>\n<Authentication>\n<GatewayLogin>" . $params['loginid'] . "</GatewayLogin>\n<GatewayKey>" . $params['transkey'] . "</GatewayKey>\n</Authentication>\n<Request>\n<RequestType>ProcessSingleTransaction</RequestType>\n<ProcessType>RETURN</ProcessType>\n<PaymentType>CC</PaymentType>\n<Amount>" . $params['amount'] . "</Amount>\n<TransactionID>" . $params['transid'] . "</TransactionID>\n<CreditCardNumber>" . $params['cardlastfour'] . "</CreditCardNumber>\n</Request>\n</QGWRequest>"; $data = curlCall($url, "xml=" . $xml); $results = XMLtoArray($data); if ($results['QGWREQUEST']['RESULT']['STATUS'] == "APPROVED") { return array("status" => "success", "transid" => $results['QGWREQUEST']['RESULT']['TRANSACTIONID'], "rawdata" => $results['QGWREQUEST']['RESULT']); } return array("status" => "error", "rawdata" => $data); }
function heartinternet_curlcall($xml, $verbose = "off", $params) { if (!class_exists("HeartInternet_API")) { require ROOTDIR . "/modules/servers/heartinternet/heartinternet.class.php"; } $hi_api = new HeartInternet_API(); if ($params['configoption1'] == "on") { $hi_api->connect(true); } else { $hi_api->connect(); } $objects = array("http://www.heartinternet.co.uk/whapi/null-1.1", "http://www.heartinternet.co.uk/whapi/package-1.4"); $extensions = array("http://www.heartinternet.co.uk/whapi/ext-package-1.1", "http://www.heartinternet.co.uk/whapi/ext-whapi-1.0"); try { $hi_api->logIn($params['serverusername'], $params['serverpassword'], $objects, $extensions); } catch (Exception $e) { logModuleCall("heartinternet", $params['action'], $xml, $e->getMessage()); return "Caught exception: " . $e->getMessage(); } $data = $hi_api->sendMessage($xml, true); $retxml = $verbose == "on" ? heartinternet_xml2array($data) : XMLtoArray($data); logModuleCall("heartinternet", $params['action'], $xml, $data, $retxml); return $retxml; }
function call($xml) { $command = XMLtoArray($xml); $command = array_keys($command['COMMAND']); $command = $command[0]; $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><epp xmlns=\"urn:ietf:params:xml:ns:epp-1.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"urn:ietf:params:xml:ns:epp-1.0 epp-1.0.xsd\">" . $xml; fwrite($this->socket, pack("N", strlen($xml) + 4) . $xml); if (@feof($this->socket)) { $this->setError("Connection closed by remote server"); } else { $hdr = @fread($this->socket, 4); if (empty($hdr) && feof($this->socket)) { $this->setError("Connection closed by remote server"); } else { if (empty($hdr)) { $this->setError("Error: Reading from server: " . $php_errormsg); } else { $unpacked = unpack("N", $hdr); $length = $unpacked[1]; if ($length < 5) { $this->setError("Got a bad frame header length from server"); } else { $answer = fread($this->socket, $length - 4); $this->processResponse($answer); $this->logCall($command, $xml); return true; } } } } return false; }
function registereu_TransferDomain($params) { $username = $params['Username']; $password = $params['Password']; $domain = $params['sld']; $domext = $params['tld']; $nameserver1 = $params['ns1']; $nameserver2 = $params['ns2']; $transfersecret = $params['transfersecret']; $regperiod = $params['regperiod']; $RegistrantFirstName = $params['firstname']; $RegistrantLastName = $params['lastname']; $RegistrantAddress1 = $params['address1']; $RegistrantAddress2 = $params['address2']; $RegistrantCity = $params['city']; $RegistrantStateProvince = $params['state']; $RegistrantPostalCode = $params['postcode']; $RegistrantCountry = $params['country']; $RegistrantEmailAddress = $params['email']; $RegistrantPhone = $params['phonenumber']; $base_url = "http://www.register.eu/gateway/request.aspx?"; $head_query = "version=2&action=dom_transfer&logon=" . $username . "&password="******"&domain=" . $domain . "&extension=" . $domext; $body_query .= "&period=" . $regperiod . "&email=" . $RegistrantEmailAddress . "&firstname=" . $RegistrantFirstName . "&lastname=" . $RegistrantLastName . "&address=" . $RegistrantAddress1 . "&city=" . $RegistrantCity . "&zipcode=" . $RegistrantPostalCode . "&countrycode=" . strtoupper($RegistrantCountry) . "&phone=" . $RegistrantPhone . "&ns1=" . $nameserver1 . "&ns2=" . $nameserver2; if ($params['TestMode'] == "on") { $body_query .= "&exec=0"; } $query = $head_query . $body_query; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $query); curl_setopt($ch, CURLOPT_URL, $base_url); $data = curl_exec($ch); curl_close($ch); if ($xmldata = XMLtoArray($data)) { if ($xmldata['GATEWAY']['STATUS'] != "OK") { $values['error'] = $xmldata['GATEWAY']['ERROR']; } } else { $values['error'] = "Invalid data returned by server."; } return $values; }
function toArray($content = "response", $parsetype = 0) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); xml_parse_into_struct($parser, $this->responseXML, $values, $tags); xml_parser_free($parser); $showMess = XMLtoArray($values, $tags, $content, $parsetype); if (!$showMess) { $showMess[Error] = $this->responseXML; } return $showMess; }
function enom_GetDNS($params) { $Enom = new CEnomInterface(); $Enom->AddParam("uid", $params['Username']); $Enom->AddParam("pw", $params['Password']); $Enom->AddParam("tld", $params['tld']); $Enom->AddParam("sld", $params['sld']); $Enom->AddParam("command", "gethosts"); $Enom->AddParam("ResponseType", "XML"); $Enom->DoTransaction($params, true); $xmldata = new SimpleXMLElement($Enom); $arraydata = XMLtoArray($xmldata); foreach ($arraydata['INTERFACE-RESPONSE'] as $k => $values) { if (substr($k, 0, 4) == "HOST") { $hostrecords[] = array("hostname" => $values['NAME'], "type" => $values['TYPE'], "address" => $values['ADDRESS'], "priority" => $values['MXPREF']); continue; } } return $hostrecords; }
function heartinternetreg_curlcall($xml, $verbose = "off", $params) { if (!class_exists("HeartInternetReg_API")) { require ROOTDIR . "/modules/registrars/heartinternet/heartinternet.class.php"; } $hi_api = new HeartInternetReg_API(); if ($params['TestMode'] == "on") { $hi_api->connect(true); } else { $hi_api->connect(); } $objects = array("urn:ietf:params:xml:ns:contact-1.0", "urn:ietf:params:xml:ns:domain-1.0", "http://www.heartinternet.co.uk/whapi/null-1.1"); $extensions = array("http://www.heartinternet.co.uk/whapi/ext-domain-1.2", "http://www.heartinternet.co.uk/whapi/ext-contact-1.0", "http://www.heartinternet.co.uk/whapi/ext-host-1.0", "http://www.heartinternet.co.uk/whapi/ext-null-1.0", "http://www.heartinternet.co.uk/whapi/ext-whapi-1.0"); try { $hi_api->logIn($params['Username'], $params['Password'], $objects, $extensions); } catch (Exception $e) { return "Caught exception: " . $e->getMessage(); } $data = $hi_api->sendMessage($xml, true); logModuleCall("heartinternet", $action, $xml, $data, "", array($params['Username'], $params['Password'])); if ($verbose == "on") { return heartinternetreg_xml2array($data); } return XMLtoArray($data); }
function enkompass_req($params, $action, $postfields, $version = "1") { $url = $params['serversecure'] ? "https" : "http"; $url .= "://" . $params['serverip'] . ":"; $url .= $params['serversecure'] ? "2087" : "2086"; $url .= "/api/xml-api/xml-api.asmx/" . $action . "?"; $postfields["api.version"] = $version; $postfields["request.user"] = $params['serverusername']; $postfields["request.hash"] = $params['serveraccesshash']; foreach ($postfields as $k => $v) { $url .= $k . "=" . urlencode($v) . "&"; } $data = curlCall($url, ""); $xml = XMLtoArray($data); logModuleCall("enkompass", $action, $postfields, $data, $xml); if (is_array($xml['LISTIPS'])) { return $xml['LISTIPS']; } if (is_array($xml[strtoupper($action)]['RESULT'])) { return $xml[strtoupper($action)]['RESULT']; } if (is_array($xml[strtoupper($action)][strtoupper($action) . "1"])) { return $xml[strtoupper($action)][strtoupper($action) . "1"]; } if (is_array($xml['LISTACCTS'])) { return $xml['LISTACCTS']; } return array("STATUS" => "0", "STATUSMSG" => "Error: " . htmlentities($data)); }
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"; }
function eway_refund($params) { global $CONFIG; $url = "https://www.eway.com.au/gateway/xmlpaymentrefund.asp"; $xml = "<ewaygateway>\n<ewayCustomerID>" . $params['customerid'] . "</ewayCustomerID>\n<ewayTotalAmount>" . $params['amount'] * 100 . "</ewayTotalAmount>\n<ewayCardExpiryMonth>" . substr($params['expdate'], 0, 2) . "</ewayCardExpiryMonth>\n<ewayCardExpiryYear>" . substr($params['expdate'], 2, 2) . "</ewayCardExpiryYear>\n<ewayOriginalTrxnNumber>" . $params['transid'] . "</ewayOriginalTrxnNumber>\n<ewayOption1></ewayOption1>\n<ewayOption2></ewayOption2>\n<ewayOption3></ewayOption3>\n<ewayRefundPassword>" . $params['refundpw'] . "</ewayRefundPassword>\n</ewaygateway>"; $data = curlCall($url, $xml); $results = XMLtoArray($data); if ($results['EWAYRESPONSE']['EWAYTRXNSTATUS'] == "True") { return array("status" => "success", "transid" => $results['EWAYRESPONSE']['EWAYTRXNREFERENCE'], "rawdata" => $results['EWAYRESPONSE']); } return array("status" => "error", "rawdata" => $results['EWAYRESPONSE']); }
} $raw_xml = $xml_response; $Gresponse->SendAck(null, false); if (get_magic_quotes_gpc()) { $xml_response = stripslashes($xml_response); } $xmldata = XMLtoArray($xml_response); if (is_array($xmldata['CHARGE-AMOUNT-NOTIFICATION'])) { $ordernumber = $xmldata['CHARGE-AMOUNT-NOTIFICATION']['GOOGLE-ORDER-NUMBER']; $amount = $xmldata['CHARGE-AMOUNT-NOTIFICATION']['LATEST-CHARGE-AMOUNT']; $fee = $xmldata['CHARGE-AMOUNT-NOTIFICATION']['LATEST-CHARGE-FEE']['TOTAL']; $query = "SELECT data FROM tblgatewaylog WHERE gateway='Google Checkout' AND data LIKE '%new-order-notification%" . db_escape_string($ordernumber) . "%'"; $result = full_query($query); $data = mysql_fetch_array($result); $gatewaylogdata = $data['data']; $orderxml = XMLtoArray($gatewaylogdata); $invoiceid = $orderxml['NEW-ORDER-NOTIFICATION']['SHOPPING-CART']['ITEMS']['ITEM']['MERCHANT-ITEM-ID']; $invoiceid = checkCbInvoiceID($invoiceid, "Google Checkout"); checkCbTransID($ordernumber); 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']); $fee = convertCurrency($fee, $GATEWAY['convertto'], $currency['id']); if ($total < $amount + 1 && $amount - 1 < $total) { $amount = $total; } }
function onlinenic_sendCommand($fp, $command, $username = "", $password = "") { fputs($fp, $command); $i = 5; while (!feof($fp)) { ++$i; $line = fgets($fp, 2); $result .= $line; if (ereg("</epp>\$", $result)) { break; } if (5000 < $i) { break; } } $xmlinput = XMLtoArray($command); $xmlinput = array_keys($xmlinput['EPP']['COMMAND']); $xmlinput = $xmlinput[2]; logModuleCall("onlinenic", $xmlinput, $command, $result, "", array($username, $password)); return $result; }
$pagetitle = $_LANG['announcementstitle']; $breadcrumbnav = "<a href=\"index.php\">" . $_LANG['globalsystemname'] . "</a> > <a href=\"announcements.php\">" . $_LANG['announcementstitle'] . "</a>"; $pageicon = "images/announcements_big.gif"; initialiseClientArea($pagetitle, $pageicon, $breadcrumbnav); $id = (int) $whmcs->get_req_var("id"); $action = $whmcs->get_req_var("action"); $page = (int) $whmcs->get_req_var("page"); $twitterusername = $CONFIG['TwitterUsername']; $smartyvalues['twitterusername'] = $CONFIG['TwitterUsername']; $smartyvalues['twittertweet'] = $CONFIG['AnnouncementsTweet']; $smartyvalues['facebookrecommend'] = $CONFIG['AnnouncementsFBRecommend']; $smartyvalues['facebookcomments'] = $CONFIG['AnnouncementsFBComments']; $smartyvalues['googleplus1'] = $CONFIG['GooglePlus1']; if ($action == "twitterfeed") { $twitterposts = curlCall("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" . $twitterusername, ""); $twitterposts = XMLtoArray($twitterposts); $tweets = array(); foreach ($twitterposts['STATUSES'] as $values) { $twitterdate = strtotime($values['CREATED_AT']); $tweets[] = array("date" => fromMySQLDate(date("Y-m-d H:i", $twitterdate), true), "tweet" => ticketAutoHyperlinks($values['TEXT'])); } $smartyvalues['tweets'] = $tweets; $numtweets = $_POST['numtweets'] ? $_POST['numtweets'] : "3"; $smartyvalues['numtweets'] = $numtweets; echo processSingleTemplate("/templates/" . $whmcs->get_sys_tpl_name() . "/twitterfeed.tpl"); exit; } $smartyvalues['seofriendlyurls'] = $CONFIG['SEOFriendlyUrls']; $usingsupportmodule = false; if ($CONFIG['SupportModule']) { if (!isValidforPath($CONFIG['SupportModule'])) {
function registercom_curlCall($xml, $params) { if ($params['TestMode']) { $url = "https://staging-services.rxportalexpress.com/V1.0/"; } else { $url = "https://services.rxportalexpress.com/V1.0/"; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_HEADER, 0); $xml_data = curl_exec($ch); curl_close($ch); $tempxml = XMLtoArray($xml); $command = $tempxml['SERVICEREQUEST']['COMMAND']; logModuleCall("registercom", $command, $xml, $xml_data); return registercom_xml2array($xml_data); }
exit("Module Not Activated"); } logTransaction("Payment Express", $_REQUEST, "Received"); $url = "https://sec.paymentexpress.com/pxpay/pxaccess.aspx"; $xml = "<ProcessResponse>\n<PxPayUserId>" . $GATEWAY['pxpayuserid'] . "</PxPayUserId>\n<PxPayKey>" . $GATEWAY['pxpaykey'] . "</PxPayKey>\n<Response>" . html_entity_decode($_REQUEST['result']) . "</Response>\n</ProcessResponse>"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 60); $outputXml = curl_exec($ch); curl_close($ch); $xmlresponse = XMLtoArray($outputXml); $xmlresponse = $xmlresponse['RESPONSE']; $success = $xmlresponse['SUCCESS']; $invoiceid = (int) $xmlresponse['TXNDATA1']; $transid = $xmlresponse['TXNID']; if ($xmlresponse['SUCCESS'] == "1") { $result = select_query("tblinvoices", "id", array("id" => $invoiceid)); $data = mysql_fetch_array($result); $id = $data['id']; if (!$id) { logTransaction("Payment Express", array_merge($_REQUEST, $xmlresponse), "Invoice ID Not Found"); redirSystemURL("action=invoices", "clientarea.php"); } $result = select_query("tblaccounts", "invoiceid", array("transid" => $transid)); $data = mysql_fetch_array($result); $transinvoiceid = $data['invoiceid'];
$xml = "<ccAuthenticateRequestV1\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>" . $GATEWAY['accountnumber'] . "</accountNum>\n<storeID>" . $GATEWAY['merchantid'] . "</storeID>\n<storePwd>" . $GATEWAY['merchantpw'] . "</storePwd>\n</merchantAccount>\n<confirmationNumber>" . $_SESSION['optimalpaymentsconfirmationnumber'] . "</confirmationNumber>\n<paymentResponse>" . $pares . "</paymentResponse>\n</ccAuthenticateRequestV1>"; $url = "https://webservices.optimalpayments.com/creditcardWS/CreditCardServlet/v1"; if ($params['testmode']) { $url = "https://webservices.test.optimalpayments.com/creditcardWS/CreditCardServlet/v1"; } $query_str = "txnMode=ccTDSAuthenticate&txnRequest=" . urlencode($xml); $data = curlCall($url, $query_str); $xmldata = XMLtoArray($data); $xmldata = $xmldata['CCTXNRESPONSEV1']; $indicator = $xmldata['TDSAUTHENTICATERESPONSE']['STATUS']; $cavv = $xmldata['TDSAUTHENTICATERESPONSE']['CAVV']; $xid = $xmldata['TDSAUTHENTICATERESPONSE']['XID']; $eci = $xmldata['TDSAUTHENTICATERESPONSE']['ECI']; logTransaction("Optimal Payments 3D Callback", $data, "Authenticate Response"); $cardtype = optimalpayments_cardtype($params['cardtype']); $xml = "<ccAuthRequestV1 xmlns=\"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<authentication>\n<indicator>" . $indicator . "</indicator>\n<cavv>" . $cavv . "</cavv>\n<xid>" . $xid . "</xid>\n</authentication>\n<billingDetails>\n<cardPayMethod>WEB</cardPayMethod>\n<firstName>" . $params['clientdetails']['firstname'] . "</firstName>\n<lastName>" . $params['clientdetails']['lastname'] . "</lastName>\n<street>" . $params['clientdetails']['address1'] . "</street>\n<city>" . $params['clientdetails']['city'] . "</city>\n<region>" . $params['clientdetails']['state'] . "</region>\n<country>" . $params['clientdetails']['country'] . "</country>\n<zip>" . $params['clientdetails']['postcode'] . "</zip>\n<phone>" . $params['clientdetails']['phonenumber'] . "</phone>\n<email>" . $params['clientdetails']['email'] . "</email>\n</billingDetails>\n<recurringIndicator>R</recurringIndicator>\n<customerIP>" . $remote_ip . "</customerIP>\n<productType>M</productType>\n</ccAuthRequestV1>"; $query_str = "txnMode=ccPurchase&txnRequest=" . urlencode($xml); logTransaction("Optimal Payments 3D Callback", $query_str, "Payment Request"); $data = curlCall($url, $query_str); $xmldata = XMLtoArray($data); $xmldata = $xmldata['CCTXNRESPONSEV1']; if ($xmldata['CODE'] == "0") { addInvoicePayment($invoiceid, $transid, "", "", "optimalpayments", "on"); logTransaction("Optimal Payments 3D Callback", $data, "Approved"); sendMessage("Credit Card Payment Confirmation", $invoiceid); $callbacksuccess = true; } else { logTransaction("Optimal Payments 3D Callback", $data, "Declined"); sendMessage("Credit Card Payment Failed", $invoiceid); } callback3DSecureRedirect($invoiceid, $callbacksuccess);
function worldpayinvisiblexml_capture($params) { if ($params['cardtype'] == "Maestro" || $params['cardtype'] == "Solo") { $merchantCode = $params['merchantcode2']; } else { if ($params['cardtype'] == "American Express") { $merchantCode = $params['merchantcodeamex']; } else { $merchantCode = $params['merchantcode3']; } } $password = $params['merchantpw']; $instId = $params['instid']; $cookiestore = $params['cookiestore']; if ($params['cardtype'] == "Maestro" || $params['cardtype'] == "Solo") { $orderCode = "M-" . date("YmdHis") . "-" . $params['invoiceid']; } else { if ($params['cardtype'] == "American Express") { $orderCode = "A-" . date("YmdHis") . "-" . $params['invoiceid']; } else { $orderCode = "R-" . 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 .= "<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); $result_arr = XMLtoArray($result_tmp); $lastevent = $result_arr['PAYMENTSERVICE']['REPLY']['ORDERSTATUS']['PAYMENT']['LASTEVENT']; if ($lastevent == "AUTHORISED") { return array("status" => "success", "transid" => $orderCode, "rawdata" => $result_tmp); } return array("status" => "declined", "rawdata" => $result_tmp); }
$postfields['Version'] = "1.7"; $postfields['ProcessorId'] = $params['processorid']; $postfields['MerchantId'] = $params['merchantid']; $postfields['TransactionPwd'] = $params['transpw']; $postfields['TransactionType'] = "C"; $postfields['PAResPayload'] = $pares; $postfields['OrderId'] = $_SESSION['Centinel_OrderId']; $postfields['TransactionId'] = $_SESSION['Centinel_TransactionId']; $queryString = "<CardinalMPI>\r\n"; foreach ($postfields as $name => $value) { $queryString .= "<" . $name . ">" . $value . "</" . $name . ">\r\n"; } $queryString .= "</CardinalMPI>"; $data = "cmpi_msg=" . urlencode($queryString); $response = curlCall($mapurl, $data); $xmlarray = XMLtoArray($response); $xmlarray = $xmlarray['CARDINALMPI']; $errorno = $xmlarray['ERRORNO']; $paresstatus = $xmlarray['PARESSTATUS']; $sigverification = $xmlarray['SIGNATUREVERIFICATION']; $cavv = $xmlarray['CAVV']; $eciflag = $xmlarray['ECIFLAG']; $xid = $xmlarray['XID']; if ((strcasecmp("0", $errorno) == 0 || strcasecmp("1140", $errorno) == 0) && strcasecmp("Y", $sigverification) == 0 && (strcasecmp("Y", $paresstatus) == 0 || strcasecmp("A", $paresstatus) == 0)) { logTransaction("PayFlow Pro 3D Secure Callback", $_REQUEST, "Auth Passed"); $auth = array("paresstatus" => $paresstatus, "cavv" => $cavv, "eciflag" => $eciflag, "xid" => $xid); $params = getCCVariables($invoiceid); if (isset($_SESSION['Centinel_Details'])) { $params['cardtype'] = $_SESSION['Centinel_Details']['cardtype']; $params['cardnum'] = $_SESSION['Centinel_Details']['cardnum']; $params['cardexp'] = $_SESSION['Centinel_Details']['cardexp'];
function cpanel_req($usessl, $host, $user, $pass, $accesshash, $request, $notxml = "") { $cleanaccesshash = preg_replace("'(\n|\n)'", "", $accesshash); if ($cleanaccesshash) { $authstr = "WHM " . $user . ":" . $cleanaccesshash; } else { $authstr = "Basic " . base64_encode($user . ":" . $pass); } $results = array(); $ch = curl_init(); if ($usessl) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_URL, "https://" . $host . ":2087" . $request); } else { curl_setopt($ch, CURLOPT_URL, "http://" . $host . ":2086" . $request); } curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $curlheaders[0] = "Authorization: " . $authstr; curl_setopt($ch, CURLOPT_HTTPHEADER, $curlheaders); curl_setopt($ch, CURLOPT_TIMEOUT, 400); $data = curl_exec($ch); if (curl_errno($ch)) { $results = "(Curl Error) " . curl_error($ch) . " - code: " . curl_errno($ch) . ""; } else { if ($notxml) { $results = $data; } else { if (strpos($data, "Brute Force Protection") == true) { $results = "WHM has imposed a Brute Force Protection Block - Contact cPanel for assistance"; } else { if (strpos($data, "<form action=\"/login/\" method=\"POST\">") == true) { $results = "Login Failed"; } else { if (strpos($data, "SSL encryption is required") == true) { $results = "SSL Required for Login"; } else { if (substr($data, 0, 1) != "<") { $data = substr($data, strpos($data, "<")); } $results = XMLtoArray($data); if ($results['CPANELRESULT']['DATA']['REASON'] == "Access denied") { $results = "Login Failed"; } } } } } } curl_close($ch); $action = explode("?", $request); $action = $action[0]; $action = str_replace("/xml-api/", "", $action); logModuleCall("cpanel", $action, $request, $data, $results); unset($data); return $results; }
function enomtruste_call($params, $postfields) { $enomusr = $params['configoption1']; $enompwd = $params['configoption2']; $demomode = $params['configoption5']; $postfields['uid'] = $enomusr; $postfields['pw'] = $enompwd; $postfields['ResponseType'] = "XML"; $url = $demomode ? "test" : ""; $url = "http://reseller" . $url . ".enom.com/interface.asp"; $data = curlCall($url, $postfields); $xmldata = XMLtoArray($data); logModuleCall("enomtruste", $postfields['command'], $postfields, $data, $xmldata); return $xmldata; }
$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);
function authorizecim_refund($params) { global $CONFIG; 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']); $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<profileTransRefund>\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<transId>" . $params['transid'] . "</transId>\n</profileTransRefund>\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); }