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


PHP Invoice类代码示例

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


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

示例1: Action

 public function Action()
 {
     $return = '';
     if (!empty($_POST['invoices'])) {
         $notfound = array();
         $updated = array();
         $db = JFactory::getDBO();
         $list = explode("\n", $_POST['invoices']);
         foreach ($list as $li) {
             $invoice = new Invoice();
             $invoice->loadInvoiceNumber(trim($li));
             if (empty($invoice->id)) {
                 $notfound[] = trim($li);
                 continue;
             }
             if (!is_numeric($invoice->usage)) {
                 $notfound[] = trim($li);
                 continue;
             }
             $metaUser = new metaUser($invoice->userid);
             $cfid = $metaUser->focusSubscription->id;
             if ($cfid != $invoice->subscr_id) {
                 if (!$metaUser->moveFocus($invoice->subscr_id)) {
                     $notfound[] = trim($li);
                     continue;
                 }
             }
             if ($metaUser->focusSubscription->status == 'Active') {
                 $metaUser->focusSubscription->expiration = date('Y-m-d H:i:s', (int) gmdate('U') - 60);
                 $metaUser->focusSubscription->plan = $invoice->usage;
                 $metaUser->focusSubscription->type = $invoice->method;
                 $metaUser->focusSubscription->recurring = 1;
                 $metaUser->focusSubscription->check();
                 $metaUser->focusSubscription->store();
                 $updated[] = $invoice->invoice_number;
             } else {
                 $metaUser->focusSubscription->status = 'Active';
                 $metaUser->focusSubscription->expiration = date('Y-m-d H:i:s', (int) gmdate('U') - 60);
                 $metaUser->focusSubscription->plan = $invoice->usage;
                 $metaUser->focusSubscription->type = $invoice->method;
                 $metaUser->focusSubscription->recurring = 1;
                 $metaUser->focusSubscription->check();
                 $metaUser->focusSubscription->store();
                 $updated[] = $invoice->invoice_number;
             }
         }
         $return = '<p>Provided ' . count($list) . ' Invoice Numbers.</p>';
         if (count($updated)) {
             $return .= '<p>Updated ' . count($updated) . ' Invoices:</p>';
             $return .= '<p>' . implode(', ', $updated) . '</p>';
         }
         if (count($notfound)) {
             $return .= '<p>Failed to process the following ' . count($notfound) . ' Invoices:</p>';
             $return .= '<p>' . implode(', ', $notfound) . '</p>';
         }
     } elseif (isset($_POST['invoices'])) {
         $return = '<p>Please enter invoice numbers.</p>';
     }
     return $return;
 }
开发者ID:Ibrahim1,项目名称:aec,代码行数:60,代码来源:tool_invoicereactivate.php

示例2: process

 /**
  * This function is likely never returns
  * but anyway handle result and exceptions
  * @return Am_Paysystem_Result
  */
 function process()
 {
     $err = $this->invoice->validate();
     if ($err) {
         throw new Am_Exception_InputError($err[0]);
     }
     $this->invoice->save();
     $plugin = Am_Di::getInstance()->plugins_payment->loadGet($this->invoice->paysys_id);
     $this->result = new Am_Paysystem_Result();
     $plugin->processInvoice($this->invoice, $this->controller->getRequest(), $this->result);
     if ($this->result->isSuccess() || $this->result->isFailure()) {
         if ($transaction = $this->result->getTransaction()) {
             $transaction->setInvoice($this->invoice);
             $transaction->process();
         }
     }
     if ($this->result->isSuccess()) {
         $url = REL_ROOT_URL . "/thanks?id=" . $this->invoice->getSecureId('THANKS');
         $this->callback($this->onSuccess);
         $this->controller->redirectLocation($url, ___("Invoice processed"), ___("Invoice processed successfully"));
         // no return Am_Exception_Redirect
     } elseif ($this->result->isAction()) {
         $this->callback($this->onAction);
         $this->result->getAction()->process($this->controller);
         // no return Am_Exception_Redirect
     } else {
         //  ($result->isFailure()) {
         $this->callback($this->onFailure);
     }
     return $this->result;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:36,代码来源:PayProcessMediator.php

示例3: indexAction

 function indexAction()
 {
     $this->getDi()->plugins_payment->loadEnabled()->getAllEnabled();
     $id = $this->_request->getFiltered('id');
     if (empty($id)) {
         $id = filterId(@$_GET['id']);
     }
     $this->invoice = null;
     if ($id) {
         $this->invoice = $this->getDi()->invoiceTable->findBySecureId($id, 'THANKS');
         if (!$this->invoice) {
             throw new Am_Exception_InputError("Invoice #{$id} not found");
         }
         $tm = max($this->invoice->tm_started, $this->invoice->tm_added);
         if ($this->getDi()->time - strtotime($tm) > 48 * 3600) {
             throw new Am_Exception_InputError("Link expired");
         }
         // Clean signup_member_login and signup_member_id to avoid duplicate signups with the same email address.
         $this->getSession()->signup_member_id = null;
         $this->getSession()->signup_member_login = null;
         $this->view->invoice = $this->invoice;
         foreach ($this->invoice->getPaymentRecords() as $p) {
             $this->view->payment = $p;
         }
         if (!$this->invoice->tm_started) {
             $this->view->show_waiting = true;
             $this->view->refreshTime = "<span id='am-countdown'>00:10</span> " . ___("seconds");
         }
         $this->view->script = $this->getJs(10);
     }
     $this->getDi()->hook->call(Am_Event::THANKS_PAGE, array('controller' => $this, 'invoice' => $this->invoice));
     $this->view->layoutNoMenu = true;
     $this->view->display('thanks.phtml');
 }
开发者ID:grlf,项目名称:eyedock,代码行数:34,代码来源:ThanksController.php

示例4: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     $a = new Am_Paysystem_Action_Redirect(self::LIVE_URL);
     $a->sitereference = $this->getConfig('sitereference');
     $a->currencyiso3a = $invoice->currency;
     $a->mainamount = $invoice->first_total;
     $a->version = 1;
     $a->billingstreet = $user->street;
     $a->billingtown = $user->city;
     $a->billingcounty = $user->country;
     $a->billingpostcode = $user->zip;
     $a->billingfirstname = $user->name_f;
     $a->billinglastname = $user->name_l;
     $a->billingemail = $user->email;
     $a->billingtelephone = $user->phone;
     $a->customerstreet = $user->street;
     $a->customertown = $user->city;
     $a->customercounty = $user->country;
     $a->customerpostcode = $user->zip;
     $a->customerfirstname = $user->name_f;
     $a->customerlastname = $user->name_l;
     $a->customeremail = $user->email;
     $a->customertelephone = $user->phone;
     $a->orderreference = $invoice->public_id;
     $a->filterEmpty();
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:28,代码来源:securetrading.php

示例5: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $req = $this->createHttpRequest();
     $req->setUrl(self::POST_URL);
     $req->addPostParameter('Key', $this->getConfig('app_key'));
     $req->addPostParameter('Secret', $this->getConfig('app_secret'));
     $req->addPostParameter('DestinationId', $this->getConfig('destination_id'));
     $req->addPostParameter('OrderId', $invoice->public_id);
     $req->addPostParameter('Amount', $invoice->first_total);
     $req->addPostParameter('Test', $this->getConfig('testing') ? 'true' : 'false');
     $req->addPostParameter('Redirect', $this->getPluginUrl('thanks') . '?id=' . $invoice->getSecureId('THANKS'));
     $req->addPostParameter('Name', $this->getDi()->config->get('site_title'));
     $req->addPostParameter('Description', $invoice->getLineDescription());
     $req->addPostParameter('Callback', $this->getPluginUrl('ipn'));
     $this->logRequest($req);
     $req->setMethod(Am_HttpRequest::METHOD_POST);
     $response = $req->send();
     $this->logResponse($response);
     $resp = $response->getBody();
     if (strstr($resp, "Invalid+application+credentials")) {
         $result->setFailed("Invalid Application Credentials.");
         return;
     } elseif (strstr($resp, "error")) {
         $result->setFailed("Invalid Response From Dwolla's server.");
         return;
     }
     $i = strpos($resp, "checkout/");
     $checkout_id = substr($resp, $i + 9, 36);
     $a = new Am_Paysystem_Action_Redirect(self::REDIRECT_URL . $checkout_id);
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:31,代码来源:dwolla.php

示例6: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Redirect($this->getConfig('testing') ? self::SANDBOX_URL : self::LIVE_URL);
     $result->setAction($a);
     $u = $invoice->getUser();
     $vars = array();
     $vars['PSPID'] = $this->config['pspid'];
     $vars['ORDERID'] = $invoice->public_id;
     $vars['AMOUNT'] = $invoice->first_total * 100;
     $vars['CURRENCY'] = $invoice->currency;
     $vars['LANGUAGE'] = 'en_US';
     $vars['CN'] = $u->getName();
     $vars['EMAIL'] = $u->email;
     $vars['OWNERZIP'] = $u->zip;
     $vars['OWNERADDRESS'] = $u->street;
     $vars['OWNERCTY'] = $u->city;
     $vars['COM'] = $invoice->getLineDescription();
     $vars['HOMEURL'] = $this->getReturnUrl();
     $vars['ACCEPTURL'] = $this->getPluginUrl('thanks');
     $vars['DECLINEURL'] = $this->getCancelUrl();
     $vars['CANCELURL'] = $this->getCancelUrl();
     $vars = array_filter($vars);
     ksort($vars);
     foreach ($vars as $k => $v) {
         $sha .= "{$k}={$v}" . $this->config['sha_in'];
         $a->addParam($k, $v);
     }
     $a->SHASIGN = sha1($sha);
     $result->setAction($a);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:30,代码来源:postfinance.php

示例7: store

 /**
  * Store a newly created resource in storage.
  * POST /invoice
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make(Input::all(), Invoice::$rules);
     if ($validator->fails()) {
         return Redirect::to('invoice')->withErrors($validator)->withInput(Input::all());
     } else {
         $invoice = new Invoice();
         $invoice->no_inv = Input::get('no_inv');
         $invoice->tgl_inv = Input::get('tgl_inv');
         $invoice->no_PO = Input::get('no_PO');
         $invoice->ship_by = Input::get('ship_by');
         $invoice->pay_method = Input::get('pay_method');
         $invoice->no_rek = Input::get('no_rek');
         $invoice->pelabuhan = Input::get('pelabuhan');
         $invoice->carrier = Input::get('carrier');
         $invoice->save();
         $SPPB = Barang::join('detil_SPPB', 'barang.kode_barang', '=', 'detil_SPPB.kode_barang')->join('SPPB', 'detil_SPPB.no_SPPB', '=', 'SPPB.no_SPPB')->join('PO', 'SPPB.no_SPPB', '=', 'PO.no_SPPB')->where('no_PO', Input::get('no_PO'))->selectRaw('barang.kode_barang as barang, jml_pesan as pesan')->get();
         foreach ($SPPB as $key => $value) {
             $barang = Barang::find($value->barang);
             $barang->jml_barang = $barang->jml_barang - $value->pesan;
             $barang->save();
         }
         Session::flash('message', 'Successfully created invoice!');
         return Redirect::to('invoice');
     }
 }
开发者ID:shimohira,项目名称:supplier,代码行数:32,代码来源:InvoiceController.php

示例8: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $a = new Am_Paysystem_Action_Form(self::LIVE_URL);
     $u = $invoice->getUser();
     $a->intInstID = $this->config['installation_id'];
     $a->strCartID = $invoice->public_id;
     $a->strCurrency = $invoice->currency;
     $a->strDesc = $invoice->getLineDescription();
     $a->strEmail = $u->email;
     $a->strCardHolder = $u->getName();
     $a->strAddress = $u->street;
     $a->strCity = $u->city;
     $a->strState = $u->state;
     $a->strCountry = $u->country;
     $a->strPostcode = $u->zip;
     $a->intTestMode = $this->getConfig('testing') ? '1' : '';
     $a->fltAmount = sprintf('%.3f', $invoice->first_total);
     //recurring
     if (!is_null($invoice->second_period)) {
         $a->intRecurs = '1';
         $a->intCancelAfter = substr($invoice->rebill_times, 3);
         $a->fltSchAmount1 = sprintf('%.3f', $invoice->second_total);
         $a->strSchPeriod1 = $this->metacharge_get_period($invoice->first_period);
         $a->fltSchAmount = sprintf('%.3f', $invoice->first_total);
         $a->strSchPeriod = $this->metacharge_get_period($invoice->second_period);
     }
     $a->filterEmpty();
     $result->setAction($a);
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:29,代码来源:metacharge.php

示例9: process

 /**
  * This function is likely never returns
  * but anyway handle result and exceptions
  * @return Am_Paysystem_Result
  */
 function process()
 {
     Am_Di::getInstance()->hook->call(Am_Event::INVOICE_BEFORE_PAYMENT, array('invoice' => $this->invoice, 'controller' => $this->controller));
     $plugin = Am_Di::getInstance()->plugins_payment->loadGet($this->invoice->paysys_id);
     $this->result = new Am_Paysystem_Result();
     $plugin->processInvoice($this->invoice, $this->controller->getRequest(), $this->result);
     if ($this->result->isSuccess() || $this->result->isFailure()) {
         if ($transaction = $this->result->getTransaction()) {
             $transaction->setInvoice($this->invoice);
             $transaction->process();
         }
     }
     if ($this->result->isSuccess()) {
         if (method_exists($this->controller, 'getForm')) {
             $this->controller->getForm()->getSessionContainer()->destroy();
         }
         $url = REL_ROOT_URL . "/thanks?id=" . $this->invoice->getSecureId('THANKS');
         $this->callback($this->onSuccess);
         $this->controller->redirectLocation($url);
         // no return
         // Am_Exception_Redirect only for APPLICATION_ENV = 'testing'
     } elseif ($this->result->isAction()) {
         if (method_exists($this->controller, 'getForm')) {
             $this->controller->getForm()->getSessionContainer()->destroy();
         }
         $this->callback($this->onAction);
         $this->result->getAction()->process($this->controller);
         // no return
         // Am_Exception_Redirect only for APPLICATION_ENV = 'testing'
     } else {
         //  ($result->isFailure()) {
         $this->callback($this->onFailure);
     }
     return $this->result;
 }
开发者ID:irovast,项目名称:eyedock,代码行数:40,代码来源:PayProcessMediator.php

示例10: __construct

 /**
  * Constructor
  */
 public function __construct(Invoice $invoice, array $wallets)
 {
     $this->invoice = $invoice;
     $this->wallets = $wallets;
     $defaults = array('LMI_SIM_MODE' => sfConfig::get('app_webmoney_sim_mode'), 'LMI_PAYMENT_NO' => $invoice->getId(), 'LMI_PAYMENT_DESC_BASE64' => base64_encode($invoice->getDescription()));
     parent::__construct($defaults);
 }
开发者ID:pycmam,项目名称:myPaymentPlugin,代码行数:10,代码来源:WebmoneyRequestForm.class.php

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

示例12: _process

 public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
 {
     $items = $invoice->getItems();
     if (count($items) > 1) {
         $exc = new Am_Exception_InternalError("It's impossible purchase " . count($items) . " products at one invoice with Selz-plugin");
         $this->getDi()->errorLogTable->logException($exc);
         throw $exc;
     }
     $item = $items[0];
     $bp = $this->getDi()->billingPlanTable->load($item->billing_plan_id);
     $sharedLink = $bp->data()->get(self::SHARED_LINK_FIELD);
     if (!$sharedLink) {
         $exc = new Am_Exception_InternalError("Product #{$item->item_id} has no shared link");
         $this->getDi()->errorLogTable->logException($exc);
         throw $exc;
     }
     if ($this->getConfig('payment_way', 'redirect') == 'redirect') {
         $a = new Am_Paysystem_Action_Redirect($sharedLink);
     } else {
         $a = new Am_Paysystem_Action_HtmlTemplate_Selz($this->getDir(), 'selz.phtml');
         $a->link = $sharedLink;
         $a->inv = $invoice->public_id;
         $a->thanks = $this->getReturnUrl();
         $a->ipn = $this->getPluginUrl('ipn');
         $a->way = $this->getConfig('payment_way');
     }
     $result->setAction($a);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:28,代码来源:selz.php

示例13: __construct

 /**
  * Constructor
  */
 public function __construct(Invoice $invoice)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'Date'));
     $resultUrl = 'https://' . sfContext::getInstance()->getRequest()->getHost() . url_for('payment_liqpay_result');
     $defaults = array('version' => '1.1', 'merchant_id' => sfConfig::get('app_liqpay_merchant'), 'amount' => $invoice->getAmount(), 'currency' => 'UAH', 'order_id' => $invoice->getId(), 'description' => $invoice->getDescription(), 'result_url' => $resultUrl, 'server_url' => $resultUrl);
     parent::__construct($defaults);
 }
开发者ID:pycmam,项目名称:myPaymentPlugin,代码行数:10,代码来源:LiqpayRequestForm.class.php

示例14: calculate

 public function calculate(Invoice $invoiceBill)
 {
     $this->invoiceBill = $invoiceBill;
     foreach ($invoiceBill->getItems() as $item) {
         $this->item = $item;
         foreach (self::$_prefixes as $prefix) {
             $this->currentPrefix = $prefix;
             $fields = new stdClass();
             foreach (self::$_noPrefixFields as $k) {
                 $fields->{$k} = @$item->{$k};
             }
             foreach (self::$_prefixFields as $k) {
                 $kk = $prefix ? $prefix . $k : $k;
                 if (isset($fields->{$kk})) {
                     throw new Am_Exception_InternalError("Field is already defined [{$k}]");
                 }
                 $fields->{$k} = @$item->{$kk};
             }
             $this->calculatePiece($fields);
             foreach (self::$_noPrefixFields as $k) {
                 $item->{$k} = $fields->{$k};
             }
             foreach (self::$_prefixFields as $k) {
                 $kk = $prefix ? $prefix . $k : $k;
                 $item->{$kk} = $fields->{$k};
             }
         }
         unset($this->item);
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:30,代码来源:Calc.php

示例15: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     $user = $invoice->getUser();
     if ($cc->user_id != $user->pk()) {
         throw new Am_Exception_Paysystem("Assertion failed: cc.user_id != user.user_id");
     }
     // will be stored only if cc# or expiration changed
     $this->storeCreditCard($cc, $result);
     if (!$result->isSuccess()) {
         return;
     }
     $user->refresh();
     // we have both profile id and payment id, run the necessary transaction now if amount > 0
     $result->reset();
     if ($doFirst && !$invoice->first_total) {
         // free trial
         $tr = new Am_Paysystem_Transaction_Free($this);
         $tr->setInvoice($invoice);
         $tr->process();
         $result->setSuccess($tr);
     } else {
         $tr = new Am_Paysystem_Transaction_Securepaycomau_Payment($this, $invoice, $doFirst);
         $tr->run($result);
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:25,代码来源:securepaycomau.php


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