Esempio n. 1
0
 /**
  * validate the Payment Method parameters. Only one payment methos is permitted
  * @param $parameters
  * @param $existParamBankAccount
  * @param $existParamCreditCard
  * @throws PayUException
  */
 public static function validatePaymentMethod($parameters, $existParamBankAccount, $existParamCreditCard, $edit = FALSE)
 {
     if ($existParamBankAccount == TRUE && $existParamCreditCard == TRUE) {
         throw new PayUException(PayUErrorCodes::INVALID_PARAMETERS, "The subscription must have only one payment method");
     } else {
         if ($existParamBankAccount == TRUE) {
             PayUSubscriptionsRequestUtil::validateBankAccount($parameters);
             if ($edit == FALSE) {
                 //The TERMS_AND_CONDITIONS_ACEPTED Parameter is required for Bank Account
                 $required = array(PayUParameters::TERMS_AND_CONDITIONS_ACEPTED);
                 CommonRequestUtil::validateParameters($parameters, $required);
             }
         } else {
             if ($existParamCreditCard == TRUE) {
                 PayUSubscriptionsRequestUtil::validateCreditCard($parameters);
             } else {
                 throw new PayUException(PayUErrorCodes::INVALID_PARAMETERS, "The subscription must have one payment method");
             }
         }
     }
 }