コード例 #1
0
ファイル: paypal.php プロジェクト: phpsource/CrowdFunding
 /**
  * Remove an intention record or create a payment session record.
  *
  * @param CrowdFundingIntention|CrowdFundingPaymentSession $intention
  * @param string                                           $txnStatus
  */
 protected function removeIntention($intention, $txnStatus)
 {
     // If status is NOT completed create a payment session.
     if (strcmp("completed", $txnStatus) != 0) {
         // If intention object is instance of CrowdFundingIntention,
         // create a payment session record and remove intention record.
         // If it is NOT instance of CrowdFundingIntention, do NOT remove the recrod,
         // because it will be used again when PayPal sends a response with status "completed".
         if ($intention instanceof CrowdFundingIntention) {
             jimport("crowdfunding.payment.session");
             $paymentSession = new CrowdFundingPaymentSession(JFactory::getDbo());
             $paymentSession->setUserId($intention->getUserId())->setAnonymousUserId($intention->getAnonymousUserId())->setProjectId($intention->getProjectId())->setRewardId($intention->getRewardId())->setRecordDate($intention->getRecordDate())->setTransactionId($intention->getTransactionId())->setGateway($intention->getGateway())->setIntentionId($intention->getId())->setToken($intention->getToken());
             $paymentSession->store();
             // DEBUG DATA
             JDEBUG ? $this->log->add(JText::_($this->textPrefix . "_DEBUG_PAYMENT_SESSION"), $this->debugType, $paymentSession->getProperties()) : null;
             // Remove intention object.
             $intention->delete();
         }
         // If transaction status is completed, remove intention record.
     } elseif (strcmp("completed", $txnStatus) == 0) {
         $intention->delete();
     }
 }