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


PHP Payment::setStatus方法代码示例

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


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

示例1: execute

 /**
  * Implements PaymentMethodController::execute().
  */
 function execute(\Payment $payment)
 {
     $data =& $payment->context_data['method_data'];
     $redirect = NULL;
     if (!empty($data['redirect'])) {
         $payment->setStatus(new \PaymentStatusItem(PAYMENT_STATUS_PENDING));
         $path = WPS_TEST_PAYMENT_REDIRECT_URL . (int) $payment->pid;
         $redirect = array($path, array());
     } else {
         $payment->setStatus(new \PaymentStatusItem($data['status']));
     }
     if ($redirect) {
         $payment->contextObj->redirect($redirect[0], $redirect[1]);
     }
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:18,代码来源:DummyController.php

示例2: executeBuy

 public function executeBuy($request)
 {
     $this->user = $this->getUser()->getSubscriber();
     $this->step = 1;
     $this->form = new BuyStep1Form();
     if ($request->isMethod('post') || $request->getParameter('jotag')) {
         // if direct access, stop on step 1
         if (!$request->isMethod('post')) {
             $request->setParameter('step', 1);
         }
         $this->form->bind(array('jotag' => strtolower($request->getParameter('jotag'))));
         if ($this->form->isValid()) {
             // step 1 OK
             $this->jotag_object = $this->form->getValue('jotag_object');
             $this->step = 2;
             if ($this->user->getCredits() || $this->isWebserviceCall()) {
                 if (!$this->user->getCredits()) {
                     // ok, webservice call, but we don't have credits
                     $this->form = null;
                     return sfView::ERROR;
                 }
                 // REDEEM FORK
                 $this->setTemplate('redeem');
                 $this->form = new RedeemStep2Form(array('jotag' => strtolower($this->form->getValue('jotag'))));
                 if ($request->getParameter('step') > 1) {
                     $this->form->bind(array('jotag' => strtolower($request->getParameter('jotag')), 'confirm_jotag' => strtolower($request->getParameter('confirm_jotag'))));
                     if ($this->form->isValid()) {
                         // step 2 OK, here we create new jotag
                         $this->step = 3;
                         if ($this->jotag_object) {
                             $jotag = $this->jotag_object;
                             $ptype = PaymentPeer::PT_RENEW;
                         } else {
                             $jotag = new Tag();
                             $jotag->setJotag(strtolower($this->form->getValue('jotag')));
                             $jotag->setStatus(TagPeer::ST_NEW);
                             $jotag->setUser($this->getUser()->getSubscriber());
                             $jotag->setIsPrimary(false);
                             $ptype = PaymentPeer::PT_NEW;
                         }
                         // mark this jotag as FREE, so we can automatically give credits
                         $jotag->setIsCredit(true);
                         // calculate new expiration date
                         $jotag->setValidUntil($jotag->calcNewDate($this->user->getCredits() * OptionPeer::retrieveOption('BONUS_DAYS_PER_CREDIT'), true));
                         $jotag->setStatus(TagPeer::ST_ACTIVE);
                         // create payment
                         $payment = new Payment();
                         $payment->setTag($jotag);
                         $payment->setMethod(PaymentPeer::PT_CREDITS);
                         $payment->setAmount(0);
                         $payment->setDuration($this->user->getCredits() * OptionPeer::retrieveOption('BONUS_DAYS_PER_CREDIT'));
                         $payment->setCredits($this->user->getCredits());
                         $payment->setUser($this->getUser()->getSubscriber());
                         $payment->setStatus(PaymentPeer::ST_PAID);
                         $payment->setType($ptype);
                         // save
                         $jotag->save();
                         $payment->save();
                         // remove credits from user account
                         $this->user->setCredits(0);
                         $this->user->save();
                         // remove from interest list
                         $this->user->delInterest($jotag->getJotag());
                         $this->payment = $payment;
                         $this->jotag = $jotag;
                         // send receipt to the user
                         Mailer::sendEmail($payment->getUser()->getPrimaryEmail(), 'paymentConfirmation', array('payment' => $payment), $this->getUser()->getSubscriber()->getPreferedLanguage());
                     }
                 }
             } else {
                 // BUY FORK
                 $this->form = new BuyStep2Form(array('jotag' => strtolower($this->form->getValue('jotag'))));
                 if ($request->getParameter('step') > 1) {
                     $this->form->bind(array('jotag' => strtolower($request->getParameter('jotag')), 'confirm_jotag' => strtolower($request->getParameter('confirm_jotag')), 'duration' => $request->getParameter('duration')));
                     if ($this->form->isValid()) {
                         // step 2 OK, create payment
                         $payment = new Payment();
                         if ($this->jotag_object) {
                             $payment->setTag($this->jotag_object);
                             $payment->setType(PaymentPeer::PT_RENEW);
                         } else {
                             $payment->setJotag(strtolower($this->form->getValue('jotag')));
                             $payment->setType(PaymentPeer::PT_NEW);
                         }
                         $payment->setMethod(PaymentPeer::PT_PAYPAL);
                         $payment->setAmount((double) sprintf("%0.2f", $this->form->getValue('duration') * OptionPeer::retrieveOption('BUY_PRICE')));
                         $payment->setDuration($this->form->getValue('duration'));
                         $payment->setUser($this->getUser()->getSubscriber());
                         $payment->setCredits(0);
                         $payment->setStatus(PaymentPeer::ST_NEW);
                         $payment->save();
                         $this->payment = $payment;
                         $this->getUser()->setPaymentId($payment->getId());
                         $this->step = 3;
                         $this->form = new BuyStep3Form(array('jotag' => strtolower($this->form->getValue('jotag')), 'confirm_jotag' => strtolower($this->form->getValue('confirm_jotag')), 'duration' => $this->form->getValue('duration')));
                     }
                 }
             }
         } else {
             if (get_class($this->form["jotag"]->getError()->getValidator()) == "buyJotagValidator") {
//.........这里部分代码省略.........
开发者ID:psskhal,项目名称:symfony-sample,代码行数:101,代码来源:actions.class.php

示例3: cancelReceiptList

 function cancelReceiptList($receiptIDArray = "")
 {
     if (is_array($receiptIDArray)) {
         $collectionRecords = new CollectionRecords();
         $collection = new Collection();
         $receipt = new Receipt();
         $payment = new Payment();
         foreach ($receiptIDArray as $receiptID) {
             // find other receipts associated to payment
             $collectionRecords->selectRecords("WHERE receiptID='" . $receiptID . "'");
             $paymentID = $collectionRecords->arrayList[0]->getPaymentID();
             $collectionRecords->selectRecords("WHERE paymentID='" . $paymentID . "'");
             if (is_array($collectionRecords->getArrayList())) {
                 foreach ($collectionRecords->getArrayList() as $collection) {
                     $cancelReceiptIDArray[] = $collection->getReceiptID();
                     $cancelPaymentIDArray[] = $collection->getPaymentID();
                     $cancelCollectionIDArray[] = $collection->getCollectionID();
                 }
             }
         }
         $cancelCollectionIDArray = array_unique($cancelCollectionIDArray);
         $cancelReceiptIDArray = array_unique($cancelReceiptIDArray);
         $cancelPaymentIDArray = array_unique($cancelPaymentIDArray);
         foreach ($cancelCollectionIDArray as $collectionID) {
             $collection->selectRecord($collectionID);
             $collection->setStatus("cancelled");
             $collection->updateRecord();
         }
         $condition = " WHERE ";
         foreach ($cancelReceiptIDArray as $receiptID) {
             if ($condition != " WHERE ") {
                 $condition .= " OR ";
             }
             $condition .= " receiptID = '" . $receiptID . "' ";
             $receipt->selectRecord($receiptID);
             $receipt->setStatus("cancelled");
             $receipt->updateRecord();
         }
         foreach ($cancelPaymentIDArray as $paymentID) {
             $payment->selectRecord($paymentID);
             $payment->setStatus("cancelled");
             $payment->updateRecord();
         }
         // cancel associated mergedReceipts
         $receiptRecords = new ReceiptRecords();
         if ($receiptRecords->selectRecords($condition)) {
             if (!($domDoc = $receiptRecords->getDomDocument())) {
                 return false;
             } else {
                 $xmlStr = $domDoc->dump_mem(true);
                 return $xmlStr;
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:armic,项目名称:erpts,代码行数:59,代码来源:ReceiptList.php


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