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


PHP Am_Paysystem_Abstract::getId方法代码示例

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


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

示例1: createInvoices

 /**
  *
  * @param User 
  * @param Am_Paysystem_Abstract $payplugin
  * @param array $product_ids array of product_id to use for generation
  * @param int $invCnt count of invoices per user
  * @param int $invVar variation of count of invoices per user
  * @param int $prdCnt count of products per invoice
  * @param int $prdVar variation of products per invoice 
  */
 public function createInvoices($user, $payplugin, $product_ids, $invCnt, $invVar, $prdCnt, $prdVar)
 {
     $invoiceLimit = $this->getLimit($invCnt, $invVar);
     for ($j = 1; $j <= $invoiceLimit; $j++) {
         //subscribe user for some subscriptions
         $invoice = $this->getDi()->invoiceTable->createRecord();
         $productLimit = $this->getLimit($prdCnt, $prdVar);
         for ($k = 1; $k <= $productLimit; $k++) {
             $invoice->add(Am_Di::getInstance()->productTable->load(array_rand($product_ids)), 1);
         }
         $invoice->setUser($user);
         $invoice->setPaysystem($payplugin->getId());
         $invoice->calculate();
         $invoice->save();
         $transaction = new Am_Paysystem_Transaction_Manual($payplugin);
         $transaction->setAmount($invoice->first_total)->setInvoice($invoice)->setTime(new DateTime('-' . rand(0, 200) . ' days'))->setReceiptId('demo-' . uniqid() . microtime(true));
         $invoice->addPayment($transaction);
         //            $cc = $this->createCcRecord($user);
         //
         //            Am_Paysystem_Transaction_CcDemo::_setTime(new DateTime('-'.rand(0,200).' days'));
         //            $payplugin->doBill($invoice, true, $cc);
         $transaction = null;
         unset($transaction);
         $invoice = null;
         unset($invoice);
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:37,代码来源:AdminBuildDemoController.php

示例2: sendRequest

 /**
  * Send response handle failure, return parsed array
  * @return array 
  */
 public function sendRequest(InvoiceLog $log)
 {
     $log->paysys_id = $this->plugin->getId();
     $log->add($this);
     $response = $this->send();
     $log->add($response);
     if ($response->getStatus() != 200) {
         throw new Am_Exception_InputError("Error communicating to PayPal, unable to finish transaction. Your account was not billed, please try again");
     }
     parse_str($response->getBody(), $vars);
     if (!count($vars)) {
         throw new Am_Exception_InputError("Error communicating to PayPay, unable to parse response ");
     }
     return $vars;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:19,代码来源:PaypalApiRequest.php

示例3: createInvoices

 /**
  *
  * @param User
  * @param Am_Paysystem_Abstract $payplugin
  * @param array $product_ids array of product_id to use for generation
  * @param int $invCnt count of invoices per user
  * @param int $invVar variation of count of invoices per user
  * @param int $prdCnt count of products per invoice
  * @param int $prdVar variation of products per invoice
  * @param int $start timestamp period begin
  * @param int $end timestamp period end
  */
 public function createInvoices($user, $payplugin, $product_ids, $invCnt, $invVar, $prdCnt, $prdVar, $start, $end, $coupons = array())
 {
     $invoiceLimit = $this->getLimit($invCnt, $invVar);
     for ($j = 1; $j <= $invoiceLimit; $j++) {
         $tm = mt_rand($start, $end);
         /* @var $invoice Invoice */
         $invoice = $this->getDi()->invoiceTable->createRecord();
         $productLimit = max(1, $this->getLimit($prdCnt, $prdVar));
         for ($k = 1; $k <= $productLimit; $k++) {
             try {
                 $product = Am_Di::getInstance()->productTable->load(array_rand($product_ids));
                 if (!($err = $invoice->isProductCompatible($product))) {
                     $invoice->add($product, 1);
                 }
             } catch (Am_Exception_InputError $e) {
             }
         }
         if (!count($invoice->getItems())) {
             continue;
         }
         if (count($coupons) && rand(1, 5) == 5) {
             $invoice->setCouponCode($coupons[array_rand($coupons)]);
             $invoice->validateCoupon();
         }
         $invoice->tm_added = sqlTime($tm);
         $invoice->setUser($user);
         $invoice->calculate();
         $invoice->setPaysystem($payplugin->getId());
         $invoice->save();
         $this->getDi()->setService('dateTime', new DateTime('@' . $tm));
         if ($invoice->isZero()) {
             $tr = new Am_Paysystem_Transaction_Free($this->getDi()->plugins_payment->loadGet('free'));
             $tr->setInvoice($invoice)->setTime(new DateTime('@' . $tm))->process();
         } else {
             $tr = new Am_Paysystem_Transaction_Manual($payplugin);
             $tr->setAmount($invoice->first_total)->setInvoice($invoice)->setTime(new DateTime('@' . $tm))->setReceiptId('demo-' . substr(sprintf('%.4f', microtime(true)), -7))->process();
             //recurring payments
             $i = 1;
             while ((double) $invoice->second_total && $invoice->rebill_date < sqlDate($end) && $invoice->rebill_times >= $i && !$invoice->isCancelled()) {
                 $this->getDi()->setService('dateTime', new DateTime('@' . amstrtotime($invoice->rebill_date)));
                 $tr = new Am_Paysystem_Transaction_Manual($payplugin);
                 $tr->setAmount($invoice->second_total)->setInvoice($invoice)->setTime(new DateTime('@' . amstrtotime($invoice->rebill_date)))->setReceiptId('demo-rebill-' . $i++ . '-' . substr(sprintf('%.4f', microtime(true)), -7))->process();
                 if (rand(1, 5) == 5) {
                     //20% probability
                     $invoice->setCancelled(true);
                 }
             }
             //            $cc = $this->createCcRecord($user);
             //
             //            Am_Paysystem_Transaction_CcDemo::_setTime(new DateTime('-'.rand(0,200).' days'));
             //            $payplugin->doBill($invoice, true, $cc);
         }
         $tr = null;
         unset($tr);
         $invoice = null;
         unset($invoice);
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:70,代码来源:DemoBuilder.php


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