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


PHP Invoice::data方法代码示例

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


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

示例1: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::URL);
     $params = array('jp_item_type' => 'cart', 'jp_item_name' => $invoice->getLineDescription(), 'order_id' => $invoice->public_id, 'jp_business' => $this->getConfig('business'), 'jp_payee' => $invoice->getEmail(), 'jp_shipping' => '', 'jp_amount_1' => $invoice->currency == 'KES' ? $invoice->first_total : $this->exchange($invoice->first_total), 'jp_amount_2' => 0, 'jp_amount_5' => $invoice->currency == 'USD' ? $invoice->first_total : 0, 'jp_rurl' => $this->getPluginUrl('thanks'), 'jp_furl' => $this->getCancelUrl(), 'jp_curl' => $this->getCancelUrl());
     $invoice->data()->set('jambopay-terms-KES', $params['jp_amount_1']);
     $invoice->data()->set('jambopay-terms-USD', $params['jp_amount_5']);
     $invoice->save();
     foreach ($params as $k => $v) {
         $a->addParam($k, $v);
     }
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:12,代码来源:jambopay.php

示例2: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $u = $invoice->getUser();
     $request = $this->createHttpRequest();
     $vars = array('VPSProtocol' => '2.23', 'TxType' => 'PAYMENT', 'Vendor' => $this->getConfig('login'), 'VendorTxCode' => $invoice->public_id . '-AMEMBER', 'Amount' => number_format($invoice->first_total, 2, '.', ''), 'Currency' => $invoice->currency ? $invoice->currency : 'USD', 'Description' => $invoice->getLineDescription(), 'NotificationURL' => $this->getPluginUrl('ipn'), 'SuccessURL' => $this->getReturnUrl(), 'RedirectionURL' => $this->getReturnUrl(), 'BillingFirstnames' => $u->name_f, 'BillingSurname' => $u->name_l, 'BillingAddress1' => $u->street, 'BillingCity' => $u->city, 'BillingPostCode' => $u->zip, 'BillingCountry' => $u->country, 'DeliveryFirstnames' => $u->name_f, 'DeliverySurname' => $u->name_l, 'DeliveryAddress1' => $u->street, 'DeliveryCity' => $u->city, 'DeliveryPostCode' => $u->zip, 'DeliveryCountry' => $u->country, 'CustomerEMail' => $u->email, 'Profile' => 'NORMAL');
     if ($u->country == 'US') {
         $vars['BillingState'] = $u->state;
         $vars['DeliveryState'] = $u->state;
     }
     $request->addPostParameter($vars);
     $request->setUrl($this->getConfig('testing') ? self::TEST_URL : self::LIVE_URL);
     $request->setMethod(Am_HttpRequest::METHOD_POST);
     $this->logRequest($request);
     $response = $request->send();
     $this->logResponse($response);
     if (!$response->getBody()) {
         throw new Am_Exception_InputError("An error occurred while payment request");
     }
     $res = array();
     foreach (split(PHP_EOL, $response->getBody()) as $line) {
         list($l, $r) = explode('=', $line, 2);
         $res[trim($l)] = trim($r);
     }
     if ($res['Status'] == 'OK') {
         $invoice->data()->set('sagepay_securitykey', $res['SecurityKey']);
         $invoice->update();
         $a = new Am_Paysystem_Action_Form($res['NextURL']);
         $result->setAction($a);
     } else {
         throw new Am_Exception_InputError($res['StatusDetail']);
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:32,代码来源:sagepay.php

示例3: _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

示例4: cancelAction

 public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
 {
     $id = $invoice->data()->get(self::PROFILE_ID);
     if (!$id) {
         throw new Am_Exception_InputError("No external id recorded for invoice [" . $invoice->public_id . "]");
     }
     $resp = $this->apiRequest('suspendSubscription', array('profileid' => $id));
     if ($resp->recurring->status == 'suspended') {
         echo "Order Cancelled";
     } else {
         throw new Am_Exception_InputError("PWC: Unknown response from API");
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:13,代码来源:premiumwebcart.php

示例5: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $prSpeeds = array();
     foreach ($invoice->getProducts() as $product) {
         $prSpeeds[] = ($o = $product->data()->get('bitpay_speed_risk')) ? $o : $this->getConfig('bitpay_speed_risk');
     }
     $user = $invoice->getUser();
     $post = array('price' => $invoice->first_total, 'currency' => $invoice->currency, 'posData' => array(), 'notificationURL' => $this->getPluginUrl('ipn'), 'transactionSpeed' => $this->transactionSpeed[min($prSpeeds)], 'redirectURL' => $this->getConfig('use_http', false) ? str_replace('https://', 'http://', $this->getReturnUrl()) : $this->getReturnUrl(), 'orderID' => $invoice->public_id, 'itemDesc' => $invoice->getLineDescription(), 'buyerName' => $user->getName(), 'buyerAddress1' => $user->street, 'buyerAddress2' => $user->street2, 'buyerState' => Am_Di::getInstance()->stateTable->getTitleByCode($user->country, $user->state), 'buyerZip' => $user->zip, 'buyerCountry' => Am_Di::getInstance()->countryTable->getTitleByCode($user->country), 'buyerEmail' => $user->email, 'buyerPhone' => $user->phone);
     $post = array_filter($post);
     $req = new Am_Request_Bitpay($this, Am_HttpRequest::METHOD_POST, json_encode($post), 'createInvoice');
     $res = $req->getResult();
     if (!isset($res['status']) || $res['status'] != 'new') {
         Am_Di::getInstance()->errorLogTable->log("BitPay API Error. Invoice status is not NEW: " . @$res['status'] . ".");
         throw new Am_Exception_InternalError();
     }
     $invoice->data()->set(self::BITPAY_INVOICE_ID, $res['id'])->update();
     $action = new Am_Paysystem_Action_Redirect($res['url']);
     $result->setAction($action);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:19,代码来源:bitpay.php

示例6: _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

示例7: _addPendingInvoiceAndSend

 protected function _addPendingInvoiceAndSend(Invoice $invoice, Am_Form $form, $vars)
 {
     if ($vars['paysys_id']) {
         try {
             $invoice->setPaysystem($vars['paysys_id'], false);
         } catch (Am_Exception_InputError $e) {
             $form->setError($e->getMessage());
             return false;
         }
     }
     $errors = $invoice->validate();
     if ($errors) {
         $form->setError(current($errors));
         return false;
     }
     $invoice->data()->set('added-by-admin', $this->getDi()->authAdmin->getUserId());
     $invoice->due_date = $vars['tm_due'];
     $invoice->save();
     $et = Am_Mail_Template::load('invoice_pay_link', $invoice->getUser()->lang ? $invoice->getUser()->lang : null);
     $et->setUser($invoice->getUser());
     $et->setUrl(ROOT_SURL . sprintf('/pay/%s', $invoice->getSecureId('payment-link')));
     $et->setMessage($vars['message']);
     $et->setInvoice($invoice);
     $et->setInvoice_text($invoice->render());
     $et->send($invoice->getUser());
     return true;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:27,代码来源:AdminUserPaymentsController.php

示例8: cancelInvoice

 function cancelInvoice(Invoice $invoice)
 {
     $r = new Am_HttpRequest(self::URL, Am_HttpRequest::METHOD_POST);
     $r->addPostParameter('userkey', $this->getConfig('api_key'));
     $r->addPostParameter('type', self::CANCEL);
     $r->addPostParameter('version', '2.6');
     $r->addPostParameter('transid', $invoice->data()->get(self::INITIAL_TRANSACTION_ID));
     $r->addPostParameter('merchantMID', $this->getPlugin()->getConfig('mid', 1));
     $tr = new Am_Paysystem_Transaction_Altcharge($this, $payment->getInvoice(), $r, $doFirst);
     $tr->run(new Am_Paysystem_Result());
 }
开发者ID:grlf,项目名称:eyedock,代码行数:11,代码来源:altcharge.php

示例9: processRecurring

 function processRecurring(Invoice $invoice, $doFirst = true)
 {
     $request = new Am_HttpRequest(self::API_URL, Am_HttpRequest::METHOD_POST);
     $post_params = new stdclass();
     $post_params->protocol = '6';
     $post_params->msgtype = 'recurring';
     $post_params->merchant = $this->getConfig('merchant');
     $post_params->ordernumber = $invoice->public_id . "-" . sprintf("%03d", $invoice->getPaymentsCount()) . "-R";
     $post_params->amount = ($doFirst ? $invoice->first_total : $invoice->second_total) * 100;
     $post_params->currency = $invoice->currency;
     $post_params->autocapture = '1';
     $post_params->transaction = $invoice->data()->get(self::SUBSCRIBE);
     foreach ((array) $post_params as $k => $v) {
         $cstr .= $v;
     }
     $cstr .= $this->getConfig('secret');
     $post_params->md5check = md5($cstr);
     $request->addPostParameter((array) $post_params);
     return $request;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:20,代码来源:quickpay.php

示例10: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $encoded = file_get_contents(dirname(__FILE__) . '/resource.cgn');
     $decoded = $this->zapakiraj($this->simpleXOR($this->odpakiraj($encoded)));
     $temp = tempnam(DATA_DIR, 'bnk');
     file_put_contents($temp, $decoded);
     $zipFile = zip_open($temp);
     while ($zipEntry = zip_read($zipFile)) {
         if (zip_entry_name($zipEntry) == $this->getConfig('terminal_id') . '.xml') {
             $zip_entry_exist = true;
             if (zip_entry_open($zipFile, $zipEntry)) {
                 $readStream = zip_entry_read($zipEntry);
                 $data = unpack("N*", $readStream);
                 for ($i = 1; $i < count($data) + 1; $i++) {
                     $data1[$i - 1] = $data[$i];
                 }
                 $xorData = $this->simpleXOR($data1);
                 $bin = null;
                 for ($i = 0; $i < count($xorData); $i++) {
                     $bin .= pack("N", $xorData[$i]);
                 }
                 $decoded = unpack("C*", $bin);
                 $xmlString = "";
                 for ($i = 1; $i < count($decoded) + 1; $i++) {
                     $xmlString .= chr($decoded[$i]);
                 }
                 $strData = $xmlString;
                 zip_entry_close($zipEntry);
             }
         }
     }
     zip_close($zipFile);
     if (!$zip_entry_exist) {
         $this->getDi()->errorLogTable->log("BANKART API ERROR : terminal xml file is not found in cgn file");
         throw new Am_Exception_InputError(___('Error happened during payment process. '));
     }
     //for some reasone xml is broken in bankart cgn file
     $strData = preg_replace("/\\<\\/term[a-z]+\$/", '</terminal>', $strData);
     $terminal = new SimpleXMLElement($strData);
     $port = (string) $terminal->port[0];
     $context = (string) $terminal->context[0];
     if ($port == "443") {
         $url = "https://";
     } else {
         $url = "http://";
     }
     $url .= (string) $terminal->webaddress[0];
     if (strlen($port) > 0) {
         $url .= ":" . $port;
     }
     if (strlen($context) > 0) {
         if ($context[0] != "/") {
             $url .= "/";
         }
         $url .= $context;
         if (!$context[strlen($context) - 1] != "/") {
             $url .= "/";
         }
     } else {
         $url .= "/";
     }
     $url .= "servlet/PaymentInitHTTPServlet";
     $vars = array('id' => (string) $terminal->id[0], 'password' => (string) $terminal->password[0], 'passwordhash' => (string) $terminal->passwordhash[0], 'action' => 4, 'amt' => $invoice->first_total, 'currency' => $this->currency_codes[$invoice->currency], 'responseURL' => $this->getPluginUrl('ipn'), 'errorURL' => $this->getRootUrl() . "/cancel", 'trackId' => $invoice->public_id, 'udf1' => $invoice->public_id);
     $req = new Am_HttpRequest($url, Am_HttpRequest::METHOD_POST);
     $req->addPostParameter($vars);
     $res = $req->send();
     $body = $res->getBody();
     if (strpos($body, 'ERROR') > 0) {
         $this->getDi()->errorLogTable->log("BANKART API ERROR : {$body}");
         throw new Am_Exception_InputError(___('Error happened during payment process. '));
     }
     list($payment_id, $url) = explode(':', $body, 2);
     $invoice->data()->set('bankart_payment_id', $payment_id)->update();
     $a = new Am_Paysystem_Action_Redirect($url . '?PaymentID=' . $payment_id);
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:76,代码来源:bankart.php

示例11: cancelInvoice

 public function cancelInvoice(Invoice $invoice)
 {
     if (!($rbAccId = $invoice->data()->get(self::RB_ACCOUNT_ID_KEY))) {
         throw new Am_Exception_InputError("Subscription can not be cancelled");
     }
     $request = new Am_HttpRequest(self::URL_RB, Am_HttpRequest::METHOD_POST);
     $request->addPostParameter(array('serviceVersion' => '1.0', 'operationType' => 'C', 'merchantId' => $this->getConfig('merchant_id'), 'passCode' => $this->getConfig('passcode'), 'rbAccountId' => $rbAccId));
     $response = $request->send()->getBody();
     $xml = simplexml_load_string($response);
     if ((string) $xml->code != 1) {
         throw new Am_Exception_InternalError("Cancel subscription[{$invoice->pk()}/{$invoice->public_id}] ERROR: " . (string) $xml->message);
     }
     $invoice->data()->set(self::RB_ACCOUNT_ID_KEY, null)->update();
     return true;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:15,代码来源:beanstream-remote.php

示例12: cancelInvoice

 public function cancelInvoice(Invoice $invoice)
 {
     $subscriptionid = $invoice->data()->get(self::SUBSCRIPTIONID);
     if (!$subscriptionid) {
         throw new Am_Exception_InternalError('Subscriptionid is empty in invoice! Nothing to cancel. ');
     }
     $result = $this->APIRequest("subscription", "deletesubscription", array('merchantnumber' => $this->getConfig('id'), 'subscriptionid' => $subscriptionid));
     $xml = $this->getResponseXML($result);
     if ($xml->deletesubscriptionResponse->deletesubscriptionResult != 'true') {
         throw new Am_Exception_InternalError("Subscription was not cancelled! Got: " . $result);
     }
     // Cancelled;
     return;
 }
开发者ID:irovast,项目名称:eyedock,代码行数:14,代码来源:epay.php

示例13: getUserCancelUrl

 function getUserCancelUrl(Invoice $invoice)
 {
     $customerUrl = '';
     $SubscriptionURL = $invoice->data()->get('SubscriptionURL');
     $OrderReference = $invoice->data()->get('OrderReference2');
     if ($SubscriptionURL != '') {
         $customerUrl = $SubscriptionURL;
     } elseif ($OrderReference != '') {
         $url = sprintf("https://api.fastspring.com/company/%s/subscription/%s?user=%s&pass=%s", $this->getConfig('company'), $OrderReference, $this->getConfig('api_user'), $this->getConfig('api_pass'));
         $request = new Am_HttpRequest($url);
         $response = $request->send();
         $body = $response->getBody();
         if (strpos($body, "<?xml") !== false) {
             $xml = simplexml_load_string();
             $customerUrl = $xml->customerUrl;
         } else {
             $this->logResponse($body);
         }
     }
     return $customerUrl;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:21,代码来源:fastspring.php

示例14: cancelAction

 public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
 {
     // Cancelling subscription
     $subscriptionId = $invoice->data()->get('subscription_id');
     $response = $this->_sendRequest('/subscriptions/' . $subscriptionId . '/actions/cancel');
     if ($response->getStatus() !== 200) {
         throw new Am_Exception_InputError("An error occurred while cancellation request");
     }
     // Cancelling mandate
     $mandateId = $invoice->data()->get('mandate_id');
     $response = $this->_sendRequest('/mandates/' . $mandateId . '/actions/cancel');
     if ($response->getStatus() !== 200) {
         throw new Am_Exception_InputError("An error occurred while cancellation request");
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:15,代码来源:gocardlesspro.php

示例15: getAdminCancelUrl

 public function getAdminCancelUrl(Invoice $invoice)
 {
     if ($invoice->data()->get(self::PAYPAL_PROFILE_ID) && $this->getConfig('api_username') && $this->getConfig('api_password') && $this->getConfig('api_signature')) {
         return parent::getAdminCancelUrl($invoice);
     }
     return 'https://' . $this->domain . '?' . http_build_query(array('cmd' => '_subscr-find', 'alias' => $this->getConfig('merchant_id')), '', '&');
 }
开发者ID:grlf,项目名称:eyedock,代码行数:7,代码来源:paypal.php


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