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


PHP Am_HttpRequest类代码示例

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


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

示例1: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     $xml = new SimpleXMLElement('<ewaygateway></ewaygateway>');
     $xml->ewayCustomerID = $this->getConfig('customer_id');
     $xml->ewayTotalAmount = $doFirst ? $invoice->first_total * 100 : $invoice->second_total * 100;
     $xml->ewayCustomerFirstName = $cc->cc_name_f;
     $xml->ewayCustomerLastName = $cc->cc_name_l;
     $xml->ewayCustomerEmail = $invoice->getUser()->email;
     $xml->ewayCustomerAddress = $cc->cc_street;
     $xml->ewayCustomerPostcode = $cc->cc_zip;
     $xml->ewayCustomerInvoiceDescription = $invoice->getLineDescription();
     $xml->ewayCustomerInvoiceRef = $invoice->public_id;
     $xml->ewayCardHoldersName = sprintf('%s %s', $cc->cc_name_f, $cc->cc_name_l);
     $xml->ewayCardNumber = $cc->cc_number;
     $xml->ewayCardExpiryMonth = $cc->getExpire('%1$02d');
     $xml->ewayCardExpiryYear = $cc->getExpire('%2$02d');
     $xml->ewayTrxnNumber = $invoice->public_id;
     $xml->ewayOption1 = '';
     $xml->ewayOption2 = '';
     $xml->ewayOption3 = '';
     $xml->ewayCVN = $cc->getCvv();
     $request = new Am_HttpRequest($this->getGateway(), Am_HttpRequest::METHOD_POST);
     $request->setBody($xml->asXML());
     $request->setHeader('Content-type', 'text/xml');
     $tr = new Am_Paysystem_Transaction_CreditCard_Eway($this, $invoice, $request, $doFirst);
     $tr->run($result);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:27,代码来源:eway.php

示例2: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $req = new Am_HttpRequest(sprintf('https://gateway-japa.americanexpress.com/api/rest/version/23/merchant/%s/session', $this->getConfig('merchant')), Am_HttpRequest::METHOD_POST);
     $req->setAuth('merchant.' . $this->getConfig('merchant'), $this->getConfig('password'));
     $req->setBody(Am_Controller::getJson(array('apiOperation' => 'CREATE_PAYMENT_PAGE_SESSION', 'order' => array('id' => $invoice->public_id, 'amount' => $invoice->first_total, 'currency' => $invoice->currency), 'paymentPage' => array('cancelUrl' => $this->getCancelUrl(), 'returnUrl' => $this->getPluginUrl('thanks')))));
     $this->logRequest($req);
     $res = $req->send();
     $this->logResponse($res);
     if ($res->getStatus() != 201) {
         $result->setFailed(sprintf('Incorrect Responce Status From Paysystem [%s]', $res->getStatus()));
         return;
     }
     $msg = Am_Controller::decodeJson($res->getBody());
     if ($msg['result'] == 'ERROR') {
         $result->setFailed($msg['error']['explanation']);
         return;
     }
     $invoice->data()->set(self::DATA_KEY, $msg['successIndicator'])->update();
     $a = new Am_Paysystem_Action_Redirect(self::URL);
     $a->{'merchant'} = $this->getConfig('merchant');
     $a->{'order.description'} = $invoice->getLineDescription();
     $a->{'paymentPage.merchant.name'} = $this->getDi()->config->get('site_title');
     $a->{'session.id'} = $msg['session']['id'];
     $this->logRequest($a);
     $result->setAction($a);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:26,代码来源:amex-hpp.php

示例3: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     if (!$user->data()->get(self::DATA_KEY)) {
         //create user
         $req = new Am_HttpRequest($this->url(), Am_HttpRequest::METHOD_POST);
         $req->addPostParameter(array('fn' => 'eWallet_RegisterUser', 'MerchantGUID' => $this->getConfig('MerchantGUID'), 'MerchantPassword' => $this->getConfig('MerchantPassword'), 'UserName' => $user->login, 'FirstName' => $user->name_f, 'LastName' => $user->name_l, 'EmailAddress' => $user->email, 'DateOfBirth' => '1/1/1900'));
         $this->logRequest($req);
         $resp = $req->send();
         $this->logResponse($resp);
         if ($resp->getStatus() != 200) {
             $result->setFailed('Incorrect HTTP response status: ' . $resp->getStatus());
             return;
         }
         parse_str($resp->getBody(), $tmp);
         parse_str($tmp['response'], $params);
         if ($params['m_Code'] != 'NO_ERROR') {
             $result->setFailed($params['m_Text']);
             return;
         }
         $user->data()->set(self::DATA_KEY, $params['TransactionRefID'])->update();
     }
     //create invoice
     $req = new Am_HttpRequest($this->url(), Am_HttpRequest::METHOD_POST);
     $arrItems = array('Amount' => $invoice->first_total, 'CurrencyCode' => $invoice->currency, 'ItemDescription' => $invoice->getLineDescription(), 'MerchantReferenceID' => $invoice->public_id, 'UserReturnURL' => $this->getReturnUrl(), 'MustComplete' => 'false', 'IsSubscription' => 'false');
     $req->addPostParameter(array('fn' => 'eWallet_AddCheckoutItems', 'MerchantGUID' => $this->getConfig('MerchantGUID'), 'MerchantPassword' => $this->getConfig('MerchantPassword'), 'UserName' => $user->login, 'arrItems' => sprintf('[%s]', http_build_query($arrItems)), 'AutoChargeAccount' => 'false'));
     $this->logRequest($req);
     $resp = $req->send();
     $this->logResponse($resp);
     if ($resp->getStatus() != 200) {
         $result->setFailed('Incorrect HTTP response status: ' . $resp->getStatus());
         return;
     }
     parse_str($resp->getBody(), $tmp);
     parse_str($tmp['response'], $params);
     if ($params['m_Code'] != 'NO_ERROR') {
         $result->setFailed($params['m_Text']);
         return;
     }
     //login and redirect
     $req = new Am_HttpRequest($this->url(), Am_HttpRequest::METHOD_POST);
     $req->addPostParameter(array('fn' => 'eWallet_RequestUserAutoLogin', 'MerchantGUID' => $this->getConfig('MerchantGUID'), 'MerchantPassword' => $this->getConfig('MerchantPassword'), 'UserName' => $user->login));
     $this->logRequest($req);
     $resp = $req->send();
     $this->logResponse($resp);
     if ($resp->getStatus() != 200) {
         $result->setFailed('Incorrect HTTP response status: ' . $resp->getStatus());
         return;
     }
     parse_str($resp->getBody(), $tmp);
     parse_str($tmp['responset'], $params);
     if ($params['m_Code'] != 'NO_ERROR') {
         $result->setFailed($params['m_Text']);
         return;
     }
     $a = new Am_Paysystem_Action_Redirect($this->urlLogin());
     $a->secKey = $params['m_ProcessorTransactionRefNumber'];
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:59,代码来源:i-payout.php

示例4: validateSource

 public function validateSource()
 {
     $request = new Am_HttpRequest($this->getPlugin()->getConfig('testing') ? Am_Paysystem_Cashenvoy::SANDBOX_STATUS_URL : Am_Paysystem_Cashenvoy::LIVE_STATUS_URL, Am_HttpRequest::METHOD_POST);
     $request->addPostParameter(array('mertid' => $this->getPlugin()->getConfig('merchant_id'), 'transref' => $this->request->getFiltered("ce_transref"), 'respformat' => 'json'));
     $response = $request->send();
     $this->vars = json_decode($response->getBody(), true);
     $this->log->add($this->vars);
     return true;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:9,代码来源:cashenvoy.php

示例5: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     if (!($trxid = $invoice->getUser()->data()->get(self::INVOICE_TRANSACTION_ID))) {
         throw new Am_Exception_Paysystem("Stored targetpay-wap trxid not found");
     }
     $request = new Am_HttpRequest(self::LIVE_URL_FOLLOWUP, Am_HttpRequest::METHOD_POST);
     $request->addPostParameter(array('trxid' => $trxid, 'service' => $this->getConfig('service'), 'amount' => $invoice->second_total * 100, 'rtlo' => $this->getConfig('rtlo'), 'description' => $invoice->getLineDescription()));
     $tr = new Am_paysystem_Transaction_TargetpayWap_Charge($this, $invoice, $request, $doFirst);
     $tr->run($result);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:10,代码来源:targetpay-wap.php

示例6: sendRequest

 function sendRequest($data, $method)
 {
     $request = new Am_HttpRequest('http://api.moon-ray.com/cdata.php', Am_HttpRequest::METHOD_POST);
     $request->addPostParameter(array('appid' => $this->getConfig('app_id'), 'key' => $this->getConfig('app_key'), 'return_id' => 1, 'reqType' => $method, 'data' => $data));
     $ret = $request->send();
     if ($ret->getStatus() != '200') {
         throw new Am_Exception_InternalError("Officeautopilot API Error");
     }
     $res = $ret->getBody();
     if (preg_match("|<error>(.*)</error>|", $res, $r)) {
         throw new Am_Exception_InternalError("Officeautopilot API Error - unknown response [" . $r[1] . "]");
     }
     return $res;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:14,代码来源:officeautopilot.php

示例7: loadPaymentData

 /**
  * 
  * @param type $xmlURL
  * @return Am_Fortumo_Service_Details $details;     
  * @throws Am_Exception_InternalError
  */
 public function loadPaymentData($xmlURL)
 {
     $req = new Am_HttpRequest($xmlURL, Am_HttpRequest::METHOD_GET);
     $resp = $req->send();
     $body = $resp->getBody();
     if (empty($body)) {
         throw new Am_Exception_InternalError('Fortumo plugin: Empty response from service XML url');
     }
     $xml = simplexml_load_string($body);
     if ($xml === false) {
         throw new Am_Exception_InternalError("Fortumo plugin: Can't parse incoming xml");
     }
     if ((int) $xml->status->code !== 0) {
         throw new Am_Exception_InternalError("Fortumo plugin: Request status is not OK GOT: " . (int) $xml->status->code);
     }
     return Am_Fortumo_Service_Details::create($xml);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:23,代码来源:fortumo.php

示例8: changeSubscription

 public function changeSubscription(\User $user, array $addLists, array $deleteLists)
 {
     if (!empty($addLists)) {
         $req = new Am_HttpRequest($this->getConfig('install_url') . '/subscriber/optIn.php', Am_HttpRequest::METHOD_POST);
         foreach (array('api_action' => 'add', 'api_key' => $this->getConfig('api_key'), 'api_send_email' => $this->getConfig('api_send_email') ? 'yes' : 'no', 'email' => $user->email, 'double_optin' => $this->getConfig('double_optin', 0), 'lists' => implode(',', $addLists)) as $k => $v) {
             $req->addPostParameter($k, $v);
         }
         $req->send();
     }
     if (!empty($deleteLists)) {
         $req = new Am_HttpRequest($this->getConfig('install_url') . '/subscriber/optOut.php', Am_HttpRequest::METHOD_POST);
         foreach (array('api_action' => 'remove', 'api_key' => $this->getConfig('api_key'), 'api_send_email' => $this->getConfig('api_send_email') ? 'yes' : 'no', 'email' => $user->email, 'opt_out_type' => 1, 'lists' => implode(',', $addLists)) as $k => $v) {
             $req->addPostParameter($k, $v);
         }
         $req->send();
     }
     return true;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:18,代码来源:nuevomailer.php

示例9: _getCountry

 public function _getCountry($ip)
 {
     $req = new Am_HttpRequest(sprintf(self::URL, $ip), Am_HttpRequest::METHOD_GET);
     $req->setAuth($this->getAccountId(), $this->getAccountLicense());
     try {
         $response = $req->send();
     } catch (Exception $e) {
         throw new Am_Exception_InternalError("MaxMind GeoLocation service: Unable to contact server (got: " . $e->getMessage() . " )");
     }
     $resp = json_decode($response->getBody());
     if ($response->getStatus() !== 200) {
         throw new Am_Exception_InternalError("MaxMind GeoLocation service: Got an error from API server (got: " . $resp->error . " )");
     }
     if (!empty($resp->error)) {
         return null;
     }
     return (string) $resp->country->iso_code;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:18,代码来源:CountryLookup.php

示例10: validateSource

 public function validateSource()
 {
     $vars = $this->request->getPost();
     $vars['tipo'] = 'CP';
     $vars['Comando'] = 'validar';
     $vars['Token'] = $this->getPlugin()->getConfig('token');
     $vars['email_cobranca'] = $this->getPlugin()->getConfig('merchant');
     try {
         $r = new Am_HttpRequest("https://pagseguro.uol.com.br/Security/NPI/Default.aspx?" . http_build_query($vars, '', '&'));
         $response = $r->send();
     } catch (Exception $e) {
         $this->getPlugin()->getDi()->errorLogTable->logException($e);
     }
     if ($response && $response->getBody() == 'VERIFICADO') {
         return true;
     }
     throw new Am_Exception_Paysystem_TransactionSource('Incorrect transaction received. Please contact webmaster for details');
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:18,代码来源:pagseguro.php

示例11: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $req = new Am_HttpRequest('https://' . $this->getWsHost() . '/v2/checkout', Am_HttpRequest::METHOD_POST);
     $p = array();
     $p['email'] = $this->getConfig('merchant');
     $p['token'] = $this->getConfig('token');
     $p['currency'] = strtoupper($invoice->currency);
     $p['reference'] = $invoice->public_id;
     $p['receiverEmail'] = $this->getConfig('merchant');
     $i = 1;
     foreach ($invoice->getItems() as $item) {
         $p['itemId' . $i] = $item->item_id;
         $p['itemDescription' . $i] = $item->item_title;
         $p['itemAmount' . $i] = $item->first_total;
         $p['itemQuantity' . $i] = $item->qty;
         $i++;
     }
     $p['senderEmail'] = $invoice->getUser()->email;
     $p['senderName'] = $invoice->getUser()->getName();
     $p['redirectURL'] = $this->getReturnUrl();
     $p['notificationURL'] = $this->getPluginUrl('ipn');
     $p['maxUses'] = 1;
     $p['maxAge'] = 180;
     $req->addPostParameter($p);
     $this->logRequest($req);
     $res = $req->send();
     $this->logResponse($res);
     if (!($xml = simplexml_load_string($res->getBody()))) {
         throw new Am_Exception('Incorrect XML recieved');
     }
     if ($xml->getName() == 'errors') {
         throw new Am_Exception(sprintf('%s: %s', $xml->errors[0]->code, $xml->errors[0]->message));
     }
     if ($res->getStatus() != 200) {
         throw new Am_Exception_FatalError(sprintf('Incorrect Responce Status From Paysystem [%s]', $res->getStatus()));
     }
     $code = (string) $xml->code;
     $a = new Am_Paysystem_Action_Redirect('https://' . $this->getHost() . '/v2/checkout/payment.html?code=' . $code);
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:40,代码来源:pagseguro-v2.php

示例12: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $req = new Am_HttpRequest(self::LIVE_URL, Am_HttpRequest::METHOD_POST);
     $req->addPostParameter(array('method' => 'create', 'address' => $this->getConfig('address'), 'callback' => $this->getPluginUrl('ipn') . "?secret=" . $invoice->getSecureId('THANKS') . '&invoice_id=' . $invoice->public_id));
     $res = $req->send();
     $arr = (array) json_decode($res->getBody(), true);
     if (empty($arr['input_address'])) {
         throw new Am_Exception_InternalError($res->getBody());
     }
     $req = new Am_HttpRequest(self::CURRENCY_URL . "?currency={$invoice->currency}&value={$invoice->first_total}", Am_HttpRequest::METHOD_GET);
     $res = $req->send();
     $amount = $res->getBody();
     if (doubleval($amount) <= 0) {
         throw new Am_Exception_InternalError($amount);
     }
     $invoice->data()->set(self::BLOCKHAIN_AMOUNT, doubleval($amount))->update();
     $a = new Am_Paysystem_Action_HtmlTemplate_Blockchain($this->getDir(), 'confirm.phtml');
     $a->amount = doubleval($amount);
     $a->input_address = $arr['input_address'];
     $a->invoice = $invoice;
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:22,代码来源:blockchain.php

示例13: _process

 function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     $data = array('VERSION' => "0001", 'STAMP' => $invoice->public_id . '-' . $this->getDi()->time, 'AMOUNT' => $invoice->first_total * 100, 'REFERENCE' => $invoice->public_id, 'MESSAGE' => $invoice->getLineDescription(), 'LANGUAGE' => "FI", 'MERCHANT' => $this->getConfig('merchant_id'), 'RETURN' => $this->getPluginUrl('thanks'), 'CANCEL' => $this->getCancelUrl(), 'REJECT' => "", 'DELAYED' => "", 'COUNTRY' => "FIN", 'CURRENCY' => "EUR", 'DEVICE' => "10", 'CONTENT' => "1", 'TYPE' => "0", 'ALGORITHM' => "1", 'DELIVERY_DATE' => date("Ymd"), 'FIRSTNAME' => $user->name_f, 'FAMILYNAME' => $user->name_l, 'ADDRESS' => $user->street . ($user->street2 ? '; ' . $user->street2 : ''), 'POSTCODE' => $user->zip, 'POSTOFFICE' => "");
     $data['MAC'] = $this->getMac(self::$coMapOut, $data);
     $req = new Am_HttpRequest(self::URL, Am_HttpRequest::METHOD_POST);
     $req->addPostParameter($data);
     $this->logRequest($data);
     $res = $req->send();
     if ($res->getStatus() != '200') {
         throw new Am_Exception_InternalError(self::LOG_PREFIX_ERROR . "[_process()] - bad status of server response [{$res->getStatus()}]");
     }
     if (!($body = $res->getBody())) {
         throw new Am_Exception_InternalError(self::LOG_PREFIX_ERROR . "[_process()] - server return null");
     }
     $this->logResponse($body);
     if (!($xml = simplexml_load_string($body))) {
         throw new Am_Exception_InternalError(self::LOG_PREFIX_ERROR . "[_process()] - server return bad xml");
     }
     $a = new Am_Paysystem_Action_HtmlTemplate_Checkout($this->getDir(), 'payment-checkout-redirect.phtml');
     $a->xml = $xml;
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:23,代码来源:checkout.php

示例14: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $xml = new SimpleXMLElement('<request/>');
     $transactiondetails = $xml->addChild('transactiondetails');
     $transactiondetails->addChild('merchantcode', $this->getConfig('merchantid'));
     $transactiondetails->addChild('merchantpwd', $this->getConfig('merchantpwd'));
     $transactiondetails->addChild('trackid', $invoice->public_id);
     $transactiondetails->addChild('customerip', $request->getClientIp());
     $transactiondetails->addChild('udf1', $invoice->public_id);
     $transactiondetails->addChild('customerid', $invoice->getLogin());
     $paymentdetails = $xml->addChild('paymentdetails');
     $paymentdetails->addChild('paysource', 'enets');
     $paymentdetails->addChild('amount', $invoice->first_total);
     $paymentdetails->addChild('currency', $invoice->currency);
     $paymentdetails->addChild('actioncode', 1);
     $notificationurls = $xml->addChild('notificationurls');
     $notificationurls->addChild('successurl', $this->getReturnUrl());
     $notificationurls->addChild('failurl', $this->getCancelUrl());
     $shippingdetails = $xml->addChild('shippingdetails');
     foreach (array('ship_address' => $invoice->getStreet(), 'ship_email' => $invoice->getEmail(), 'ship_postal' => $invoice->getZip(), 'ship_address2' => $invoice->getStreet1(), 'ship_city' => $invoice->getCity(), 'ship_state' => $invoice->getState(), 'ship_phone' => $invoice->getPhone(), 'ship_country' => $invoice->getCountry()) as $k => $v) {
         $shippingdetails->addChild($k, $v);
     }
     $req = new Am_HttpRequest($this->getConfig('gatewayurl'), Am_HttpRequest::METHOD_POST);
     $req->setHeader('Content-type: text/xml; charset=utf-8')->setHeader('Connection:close')->setBody($xml->asXML());
     $response = $req->send();
     $resxml = @simplexml_load_string($response->getBody());
     if (!$resxml instanceof SimpleXMLElement) {
         throw new Am_Exception_InputError('Incorrect Gateway response received!');
     }
     if ($paymenturl = (string) $resxml->transactionresponse->paymenturl) {
         $a = new Am_Paysystem_Action_Redirect($paymenturl);
         $result->setAction($a);
     } else {
         throw new Am_Exception_InputError('Incorrect Gateway response received! Got: ' . (string) $resxml->responsedesc);
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:36,代码来源:checkout-enets.php

示例15: _sendRequest

 /** @return  HTTP_Request2_Response */
 public function _sendRequest(Am_HttpRequest $request)
 {
     $request->addPostParameter('x_login', $this->getConfig('login'));
     $request->addPostParameter('x_tran_key', $this->getConfig('tkey'));
     $request->addPostParameter('x_Delim_Data', "True");
     $request->addPostParameter('x_Delim_Char', "|");
     $request->addPostParameter('x_Version', "3.1");
     if ($this->getConfig('testing')) {
         $request->addPostParameter("x_test_request", "TRUE");
         $request->setUrl(self::SANDBOX_URL);
     } else {
         $request->setUrl(self::LIVE_URL);
     }
     $request->setMethod(Am_HttpRequest::METHOD_POST);
     return $request;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:17,代码来源:authorize-aim.php


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