Beispiel #1
0
 /**
  * Render date input element
  *
  * @return string
  */
 public function getDateHtml()
 {
     if ($this->_profile->getStartDateIsEditable()) {
         $this->setDateHtmlId('recurring_start_date');
         $calendar = $this->getLayout()->createBlock('Mage_Core_Block_Html_Date')->setId('recurring_start_date')->setName(Mage_Payment_Model_Recurring_Profile::BUY_REQUEST_START_DATETIME)->setClass('datetime-picker input-text')->setImage($this->getSkinUrl('Mage_Core::calendar.gif'))->setDateFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT))->setTimeFormat(Mage::app()->getLocale()->getTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
         return $calendar->getHtml();
     }
 }
Beispiel #2
0
 /**
  * Automatically set "unknown" state if not defined
  *
  * @return Mage_Payment_Model_Recurring_Profile
  */
 protected function _filterValues()
 {
     $result = parent::_filterValues();
     if (!$this->getState()) {
         $this->setState(self::STATE_UNKNOWN);
     }
     return $result;
 }
 /**
  * Submit RP to the gateway
  *
  * @param Mage_Payment_Model_Recurring_Profile $profile
  * @param Mage_Payment_Model_Info $paymentInfo
  */
 public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
 {
     $token = $paymentInfo->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_TOKEN);
     $profile->setToken($token);
     $this->_pro->submitRecurringProfile($profile, $paymentInfo);
 }
Beispiel #4
0
 /**
  * Manage status
  *
  * @param Mage_Payment_Model_Recurring_Profile $profile
  */
 public function updateRecurringProfileStatus(Mage_Payment_Model_Recurring_Profile $profile)
 {
     $api = $this->getApi();
     $action = null;
     switch ($profile->getNewState()) {
         case Mage_Sales_Model_Recurring_Profile::STATE_CANCELED:
             $action = 'cancel';
             break;
         case Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED:
             $action = 'suspend';
             break;
         case Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE:
             $action = 'activate';
             break;
     }
     $state = $profile->getState();
     $api->setRecurringProfileId($profile->getReferenceId())->setIsAlreadyCanceled($state == Mage_Sales_Model_Recurring_Profile::STATE_CANCELED)->setIsAlreadySuspended($state == Mage_Sales_Model_Recurring_Profile::STATE_SUSPENDED)->setIsAlreadyActive($state == Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE)->setAction($action)->callManageRecurringPaymentsProfileStatus();
 }
Beispiel #5
0
 /**
  * Submit RP to the gateway
  *
  * @param Mage_Payment_Model_Recurring_Profile $profile
  * @param Mage_Payment_Model_Info $paymentInfo
  */
 public function submitRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile, Mage_Payment_Model_Info $paymentInfo)
 {
     $profile->setReferenceId(strtoupper(uniqid()));
     $profile->setState(Mage_Sales_Model_Recurring_Profile::STATE_ACTIVE);
 }