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


PHP Invoice::getPaymentsCount方法代码示例

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


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

示例1: setFromTransaction

 public function setFromTransaction(Invoice $invoice, Am_Paysystem_Transaction_Abstract $transaction)
 {
     $this->dattm = $transaction->getTime()->format('Y-m-d H:i:s');
     $this->invoice_id = $invoice->invoice_id;
     $this->user_id = $invoice->user_id;
     $this->currency = $invoice->currency;
     $this->paysys_id = $transaction->getPlugin()->getId();
     $this->receipt_id = $transaction->getReceiptId();
     $this->transaction_id = $transaction->getUniqId();
     /// get from invoice
     $isFirst = !$invoice->getPaymentsCount();
     $amount = $transaction->getAmount();
     if ($amount <= 0) {
         $amount = $isFirst && $invoice->first_total ? $invoice->first_total : $invoice->second_total;
     }
     $this->amount = (double) $amount;
     $this->discount = $isFirst ? $invoice->first_discount : $invoice->second_discount;
     $this->tax = $isFirst ? $invoice->first_tax : $invoice->second_tax;
     $this->shipping = $isFirst ? $invoice->first_shipping : $invoice->second_shipping;
     return $this;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:21,代码来源:InvoicePayment.php

示例2: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc = null, Am_Paysystem_Result $result)
 {
     $request = new Am_HttpRequest(self::TICKET_AUTH_URL, Am_HttpRequest::METHOD_POST);
     $order_id = $invoice->public_id . "-" . sprintf("%03d", $invoice->getPaymentsCount() + 1);
     $currency = $this->getCurrencyCode($invoice);
     $amount = ($doFirst ? $invoice->first_total : $invoice->second_total) * 100;
     $post_params = new stdclass();
     $post_params->merchant = $this->getConfig('merchant');
     $post_params->amount = $amount;
     $post_params->orderId = $order_id;
     $post_params->ticket = $invoice->data()->get(self::TICKET);
     $post_params->textreply = 'true';
     $post_params->currency = $currency;
     $post_params->capturenow = 'true';
     $post_params->md5key = md5($s2 = $this->getConfig('key2') . md5($s1 = $this->getConfig('key1') . "merchant=" . $this->getConfig('merchant') . "&orderid=" . $order_id . "&ticket=" . $invoice->data()->get(self::TICKET) . "&currency=" . $currency . "&amount=" . $amount));
     if ($this->getConfig('testing')) {
         $post_params->test = 'yes';
     }
     $request->addPostParameter((array) $post_params);
     $transaction = new Am_Paysystem_Transaction_DibsRecurringSale($this, $invoice, $request, $doFirst);
     $transaction->run($result);
 }
开发者ID:irovast,项目名称:eyedock,代码行数:22,代码来源:dibs-recurring.php

示例3: _doBill

 public function _doBill(Invoice $invoice, $doFirst, CcRecord $cc, Am_Paysystem_Result $result)
 {
     $r = new Am_HttpRequest(self::REBILL_URL, Am_HttpRequest::METHOD_POST);
     $vars = array('MerchantId' => $this->getConfig('merchant_id'), 'RebillAnchor' => $invoice->data()->get(self::REBILL_ANCHOR), 'OrderId' => $invoice->public_id . '-' . $invoice->getPaymentsCount(), 'Amount' => $invoice->second_total, 'Currency' => $invoice->currency, 'ContentType' => 'text');
     $vars['SecurityKey'] = $this->getRebillSecurityKey($vars);
     foreach ($vars as $k => $v) {
         $r->addPostParameter($k, $v);
     }
     $transaction = new Am_Paysystem_Transaction_PayonlineSystemRebill($this, $invoice, $r, $doFirst);
     $transaction->run($result);
 }
开发者ID:grlf,项目名称:eyedock,代码行数:11,代码来源:payonlinesystem.php

示例4: createXml

    protected function createXml(Invoice $invoice, $doFirst)
    {
        $request = <<<CUT
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
  </soap:Header>
  <soap:Body>
  </soap:Body>
</soap:Envelope>        
CUT;
        $x = new SimpleXMLElement($request);
        $ns = $x->getNamespaces();
        $b = $x->children($ns['soap'])->Body;
        $bb = $b->addChild('ProcessPayment', "", 'https://www.eway.com.au/gateway/managedpayment');
        $h = $x->children($ns['soap'])->Header;
        $hh = $h->addChild('eWAYHeader', "", 'https://www.eway.com.au/gateway/managedpayment');
        $hh->addChild('eWAYCustomerID', $this->plugin->getConfig('customer_id'));
        $hh->addChild('Username', $this->plugin->getConfig('customer_username'));
        $hh->addChild('Password', $this->plugin->getConfig('customer_password'));
        $bb->addChild('managedCustomerID', $invoice->getUser()->data()->get(Am_Paysystem_EwayRapid3::TOKEN));
        $bb->addChild('amount', $invoice->second_total * 100);
        $bb->addChild('invoiceReference', $invoice->public_id . "-" . sprintf("%03d", $invoice->getPaymentsCount()));
        $bb->addChild('invoiceDescription', $invoice->getLineDescription());
        $xml = $x->asXML();
        return $xml;
    }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:27,代码来源:eway-rapid3.php

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

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

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


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