Esempio n. 1
0
 /**
  * Validate RP data
  *
  * @param Mage_Payment_Model_Recurring_Profile $profile
  * @throws Mage_Core_Exception
  */
 public function validateRecurringProfile(Mage_Payment_Model_Recurring_Profile $profile)
 {
     $errors = array();
     if (strlen($profile->getSubscriberName()) > 32) {
         // up to 32 single-byte chars
         $errors[] = Mage::helper('Mage_Paypal_Helper_Data')->__('Subscriber name is too long.');
     }
     $refId = $profile->getInternalReferenceId();
     // up to 127 single-byte alphanumeric
     if (strlen($refId) > 127) {
         //  || !preg_match('/^[a-z\d\s]+$/i', $refId)
         $errors[] = Mage::helper('Mage_Paypal_Helper_Data')->__('Merchant reference ID format is not supported.');
     }
     $scheduleDescr = $profile->getScheduleDescription();
     // up to 127 single-byte alphanumeric
     if (strlen($refId) > 127) {
         //  || !preg_match('/^[a-z\d\s]+$/i', $scheduleDescr)
         $errors[] = Mage::helper('Mage_Paypal_Helper_Data')->__('Schedule description is too long.');
     }
     if ($errors) {
         Mage::throwException(implode(' ', $errors));
     }
 }