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


PHP Invoice::pk方法代码示例

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


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

示例1: renderInvoiceCommissions

 function renderInvoiceCommissions(Invoice $invoice, Am_View $view)
 {
     $query = new Am_Query($this->getDi()->affCommissionTable);
     $query->leftJoin('?_invoice', 'i', 'i.invoice_id=t.invoice_id')->leftJoin('?_user', 'a', 't.aff_id=a.user_id')->leftJoin('?_product', 'p', 't.product_id=p.product_id')->addField('CONCAT(a.login, \' (\', a.name_f, \' \', a.name_l,\') #\', a.user_id)', 'aff_name')->addField('p.title', 'product_title')->addWhere('t.invoice_id=?', $invoice->pk())->leftJoin('?_aff_payout_detail', 'apd', 't.payout_detail_id=apd.payout_detail_id')->leftJoin('?_aff_payout', 'ap', 'ap.payout_id=apd.payout_id')->addField('ap.date', 'payout_date')->addField('ap.payout_id')->addField('apd.is_paid')->setOrder('commission_id', 'desc');
     $items = $query->selectAllRecords();
     $view->comm_items = $items;
     $view->invoice = $invoice;
     $view->has_tiers = $this->getDi()->affCommissionRuleTable->getMaxTier();
     return $view->render('blocks/admin-user-invoice-details.phtml');
 }
开发者ID:grlf,项目名称:eyedock,代码行数:10,代码来源:Bootstrap.php

示例2: getAdminCancelUrl

 /**
  * Return a link to stop recurring subscription
  * @param Invoice $invoice
  * @return string|null
  */
 public function getAdminCancelUrl(Invoice $invoice)
 {
     $m = new ReflectionMethod($this, 'cancelAction');
     if ($m->getDeclaringClass()->getName() == __CLASS__) {
         return;
     }
     return REL_ROOT_URL . '/admin-user-payments/stop-recurring/user_id/' . $invoice->user_id . '?invoice_id=' . $invoice->pk();
 }
开发者ID:grlf,项目名称:eyedock,代码行数:13,代码来源:Abstract.php

示例3: findInitialTransactionNumber

 function findInitialTransactionNumber(Invoice $invoice)
 {
     return $this->getDi()->db->selectCell("SELECT receipt_id \n                FROM ?_invoice_payment\n                WHERE invoice_id=?d \n                ORDER BY dattm \n                LIMIT 1", $invoice->pk());
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:4,代码来源:charge2000.php

示例4: yesOto

 function yesOto(Am_Controller $controller, Invoice $invoice, Oto $oto)
 {
     $inv = $this->getDi()->invoiceTable->createRecord();
     /* @var $inv Invoice */
     $inv->data()->set('oto_parent', $invoice->pk());
     $inv->user_id = $invoice->user_id;
     $inv->add($oto->getProduct());
     $coupon = $oto->getCoupon();
     if ($coupon) {
         $inv->setCoupon($coupon);
     }
     $inv->calculate();
     if ($inv->isZero()) {
         // free invoice
         $inv->paysys_id = 'free';
     } elseif ($oto->getPaysysId()) {
         // configured
         $inv->paysys_id = $oto->getPaysysId();
     } elseif ($invoice->paysys_id != 'free') {
         // not free? take from invoice
         $inv->paysys_id = $invoice->paysys_id;
     } else {
         // was free, now paid, take first public
         $paysystems = Am_Di::getInstance()->paysystemList->getAllPublic();
         $inv->paysys_id = $paysystems[0]->paysys_id;
     }
     $inv->insert();
     $payProcess = new Am_Paysystem_PayProcessMediator($controller, $inv);
     $result = $payProcess->process();
     // we decided to ignore failures here...
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:31,代码来源:oto.php

示例5: processPayment

 /**
  * Process invoice and insert necessary commissions for it
  *
  * External code should guarantee that this method with $payment = null will be called
  * only once for each user for First user invoice
  */
 public function processPayment(Invoice $invoice, InvoicePayment $payment = null)
 {
     $aff_id = $invoice->aff_id;
     /* @var $coupon Coupon */
     try {
         if (!$aff_id && ($coupon = $invoice->getCoupon())) {
             // try to find affiliate by coupon
             $aff_id = $coupon->aff_id ? $coupon->aff_id : $coupon->getBatch()->aff_id;
         }
     } catch (Am_Exception_Db_NotFound $e) {
         //coupon not found
     }
     if (empty($aff_id)) {
         $aff_id = $invoice->getUser()->aff_id;
     }
     if ($aff_id && empty($invoice->aff_id)) {
         // set aff_id to invoice for quick access next time
         $invoice->updateQuick('aff_id', $aff_id);
     }
     // run event to get plugins chance choose another affiliate
     $event = new Am_Event(Bootstrap_Aff::AFF_FIND_AFFILIATE, array('invoice' => $invoice, 'payment' => $payment));
     $event->setReturn($aff_id);
     $this->getDi()->hook->call($event);
     $aff_id = $event->getReturn();
     if (empty($aff_id)) {
         return;
     }
     // no affiliate id registered
     if ($aff_id == $invoice->getUser()->pk()) {
         return;
     }
     //strange situation
     // load affiliate and continue
     $aff = $this->getDi()->userTable->load($aff_id, false);
     if (!$aff || !$aff->is_affiliate) {
         return;
     }
     // affiliate not found
     $user = $invoice->getUser();
     if (!$user->aff_id) {
         $user->aff_id = $aff->pk();
         $user->aff_added = sqlTime('now');
         $user->data()->set('aff-source', 'invoice-' . $invoice->pk());
         $user->save();
     }
     // try to load other tier affiliate
     $aff_tier = $aff;
     $aff_tiers = array();
     $aff_tiers_exists = array($aff->pk());
     for ($tier = 1; $tier <= $this->getMaxTier(); $tier++) {
         if (!$aff_tier->aff_id || $aff_tier->pk() == $invoice->getUser()->pk()) {
             break;
         }
         $aff_tier = $this->getDi()->userTable->load($aff_tier->aff_id, false);
         if (!$aff_tier || !$aff_tier->is_affiliate || $aff_tier->pk() == $invoice->getUser()->pk() || in_array($aff_tier->pk(), $aff_tiers_exists)) {
             //already in chain
             break;
         }
         $aff_tiers[$tier] = $aff_tier;
         $aff_tiers_exists[] = $aff_tier->pk();
     }
     $isFirst = !$payment || $payment->isFirst();
     //to define price field
     $paymentNumber = is_null($payment) ? 0 : $invoice->getPaymentsCount();
     if (!$payment) {
         $tax = 0;
     } else {
         $tax = $this->getDi()->config->get('aff.commission_include_tax', false) ? 0 : doubleval($payment->tax);
     }
     $amount = $payment ? $payment->amount - $tax : 0;
     $date = $payment ? $payment->dattm : 'now';
     // now calculate commissions
     $items = is_null($payment) ? array_slice($invoice->getItems(), 0, 1) : $invoice->getItems();
     foreach ($items as $item) {
         //we do not calculate commission for free items in invoice
         $prefix = $isFirst ? 'first' : 'second';
         if (!is_null($payment) && !(double) $item->get("{$prefix}_total")) {
             continue;
         }
         $comm = $this->getDi()->affCommissionRecord;
         $comm->date = sqlDate($date);
         $comm->record_type = AffCommission::COMMISSION;
         $comm->invoice_id = $invoice->invoice_id;
         $comm->invoice_item_id = $item->invoice_item_id;
         $comm->invoice_payment_id = $payment ? $payment->pk() : null;
         $comm->receipt_id = $payment ? $payment->receipt_id : null;
         $comm->product_id = $item->item_id;
         $comm->is_first = $paymentNumber <= 1;
         $comm->_setPayment($payment);
         $comm->_setInvoice($invoice);
         $comm_tier = clone $comm;
         $rules = array();
         $topay_this = $topay = $this->calculate($invoice, $item, $aff, $paymentNumber, 0, $amount, $date, $rules);
         if ($topay > 0) {
//.........这里部分代码省略.........
开发者ID:alexanderTsig,项目名称:arabic,代码行数:101,代码来源:AffCommissionRule.php

示例6: getAdminCancelUrl

 function getAdminCancelUrl(Invoice $invoice)
 {
     return REL_ROOT_URL . '/admin-user-payments/stop-recurring/user_id/' . $invoice->user_id . '?invoice_id=' . $invoice->pk();
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:4,代码来源:CreditCard.php

示例7: getInvoiceRecordTitle

 public function getInvoiceRecordTitle(Invoice $invoice = null)
 {
     return $invoice ? sprintf('%s (%s/%s, %s: %s)', ___('Invoice'), $invoice->pk(), $invoice->public_id, ___('Billing Terms'), new Am_TermsText($invoice)) : ___('Invoice');
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:4,代码来源:AdminPaymentsController.php

示例8: 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

示例9: getUnusedAmount

 /**
  * Return unused amount for $item subscription
  * null will be returned if:
  *   - subscription is lifetime
  *   - subscription is for free product
  *   - subscription is expired
  * @param Invoice $invoice
  * @param InvoiceItem $item
  * @return float|null
  */
 function getUnusedAmount(Invoice $invoice, InvoiceItem $item)
 {
     $row = $this->getDi()->db->selectRow("\n            SELECT begin_date, expire_date \n            FROM ?_access\n            WHERE invoice_id=?d AND product_id=?\n            ORDER by expire_date desc LIMIT 1 \n            ", $invoice->pk(), $item->item_id);
     if (!$row) {
         return;
     }
     $maxExpire = $row['expire_date'];
     $maxBegin = $row['begin_date'];
     if ($maxExpire < $this->getDi()->sqlDate) {
         return null;
     }
     if ($maxExpire == Am_Period::MAX_SQL_DATE) {
         return null;
     }
     $daysTotal = $this->diffDays($maxBegin, $maxExpire);
     $daysUnused = $this->diffDays($this->getDi()->sqlDate, $maxExpire) - 1;
     // -1 as today date can be fully used
     $pc = $invoice->getPaymentsCount();
     $field = $pc == 1 && (double) $invoice->first_total || $pc == 0 ? 'first_total' : 'second_total';
     $paid = $item->get($field);
     return moneyRound($daysUnused * $paid / $daysTotal);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:32,代码来源:ProductUpgrade.php

示例10: cancelAction

 public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
 {
     $request = $this->createHttpRequest();
     $ps = new stdclass();
     $ps->type = 'cncl';
     $ps->reason = 'ticket.type.cancel.7';
     $ps->comment = 'cancellation request from aMember user (' . $invoice->getLogin() . ')';
     $get_params = http_build_query((array) $ps, '', '&');
     $payment = current($invoice->getPaymentRecords());
     $request->setUrl($s = 'https://api.clickbank.com/rest/1.3/tickets/' . Am_Di::getInstance()->invoicePaymentTable->getLastReceiptId($invoice->pk()) . "?{$get_params}");
     $request->setHeader(array('Content-Length' => '0', 'Accept' => 'application/xml', 'Authorization' => $this->getConfig('dev_key') . ':' . $this->getConfig('clerk_key')));
     $request->setMethod(Am_HttpRequest::METHOD_POST);
     $this->logRequest($request);
     $request->setMethod('POST');
     $response = $request->send();
     $this->logResponse($response);
     if ($response->getStatus() != 200 && $response->getBody() != 'Subscription already canceled') {
         throw new Am_Exception_InputError("An error occurred while cancellation request");
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:20,代码来源:clickbank.php

示例11: getAdminCancelUrl

 public function getAdminCancelUrl(Invoice $invoice)
 {
     return REL_ROOT_URL . '/payment/twocheckout/admin-cancel?invoice_id=' . $invoice->pk();
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:4,代码来源:twocheckout.php


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