public function validateParams( $p_aParams, &$p_strError ) {

    if( isset($p_aParams['shoppingCartType']) ) {
      $strShoppingCartType = trim($p_aParams['shoppingCartType']);
    }
    if (empty($strShoppingCartType)) {
      $strShoppingCartType = "MIXED";  // Default value
    }

    if( isset($p_aParams['shippingAddresseFirstName']) ) {
      $strFirstName = trim( $p_aParams['shippingAddresseFirstName'] );
    }
    else {
      $strFirstName = "";
    }
    if( isset($p_aParams['shippingAddresseLastName']) ) {
      $strLastName = trim( $p_aParams['shippingAddresseLastName'] );
    }
    else {
      $strLastName = "";
    }
    if( isset($p_aParams['shippingEmail']) ) {
      $strEmail = trim( $p_aParams['shippingEmail'] );
    }
    else {
      $strEmail = "";
    }
    if( isset($p_aParams['shippingZipCode']) ) {
      $strZipCode = trim($p_aParams['shippingZipCode']);
    }
    else {
      $strZipCode = "";
    }
    if( isset($p_aParams['shippingCity']) ) {
      $strCity = trim( $p_aParams['shippingCity'] );
    }
    else {
      $strCity = "";
    }
    if( isset($p_aParams['shippingCountry']) ) {
      $strCountry = trim( $p_aParams['shippingCountry'] );
    }
    else {
      $strCountry = "";
    }

    // Validate shopping cart type
    if ( !in_array($strShoppingCartType, array(
      'PHYSICAL',
      'DIGITAL',
      'MIXED',
      'ANONYMOUS_DONATION',
      'AUTHORITIES_PAYMENT',
    ))) {
      $p_strError = "Shopping cart type";
      return FALSE;
    }

    // Validate other address fields depending on shoppingCartType
    // First and last name are mandatory for mixed, physical and digital shopping carts
    if( in_array( $strShoppingCartType, array('MIXED', 'PHYSICAL', 'DIGITAL') ) ) {
      if (empty($strFirstName)) {
        $p_strError = "First Name";
        return FALSE;
      }
      if (empty($strLastName)) {
        $p_strError = "Last Name";
        return FALSE;
      }
    }

    if( $strShoppingCartType == 'DIGITAL' ) {
      if( empty($strEmail) ) {
        $p_strError = "Shipping Email";
        return FALSE;
      }
    }
    elseif( in_array( $strShoppingCartType, array('MIXED', 'PHYSICAL') ) ) {
      if( empty($strZipCode) ) {
        $p_strError = "Shipping Address Zip code";
        return FALSE;
      }
      if( empty($strCity) ) {
        $p_strError = "Shipping Address City";
        return FALSE;
      }
      if( empty($strCountry) ) {
        $p_strError = "Shipping Address Country";
        return FALSE;
      }
    }

    return TRUE;
  }
public function validateParams( $p_aParams, &$p_strError ) {

    if( isset($p_aParams['shoppingCartType']) ) {
      $strShoppingCartType = trim($p_aParams['shoppingCartType']);
    }
    if (empty($strShoppingCartType)) {
      $strShoppingCartType = "MIXED";  // Default value
    }

    if( isset($p_aParams['shippingAddresseFirstName']) ) {
      $strFirstName = trim( $p_aParams['shippingAddresseFirstName'] );
    }
    else {
      $strFirstName = "";
    }
    if( isset($p_aParams['shippingAddresseLastName']) ) {
      $strLastName = trim( $p_aParams['shippingAddresseLastName'] );
    }
    else {
      $strLastName = "";
    }
    if( isset($p_aParams['shippingEmail']) ) {
      $strEmail = trim( $p_aParams['shippingEmail'] );
    }
    else {
      $strEmail = "";
    }
    if( isset($p_aParams['shippingZipCode']) ) {
      $strZipCode = trim($p_aParams['shippingZipCode']);
    }
    else {
      $strZipCode = "";
    }
    if( isset($p_aParams['shippingCity']) ) {
      $strCity = trim( $p_aParams['shippingCity'] );
    }
    else {
      $strCity = "";
    }
    if( isset($p_aParams['shippingCountry']) ) {
      $strCountry = trim( $p_aParams['shippingCountry'] );
    }
    else {
      $strCountry = "";
    }

    // Validate shopping cart type
    if ( !in_array($strShoppingCartType, array(
      'PHYSICAL',
      'DIGITAL',
      'MIXED',
      'ANONYMOUS_DONATION',
      'AUTHORITIES_PAYMENT',
    ))) {
      $p_strError = "Shopping cart type";
      return FALSE;
    }

    // Validate other address fields depending on shoppingCartType
    // First and last name are mandatory for mixed, physical and digital shopping carts
    if( in_array( $strShoppingCartType, array('MIXED', 'PHYSICAL', 'DIGITAL') ) ) {
      if (empty($strFirstName)) {
        $p_strError = "First Name";
        return FALSE;
      }
      if (empty($strLastName)) {
        $p_strError = "Last Name";
        return FALSE;
      }
    }

    if( $strShoppingCartType == 'DIGITAL' ) {
      if( empty($strEmail) ) {
        $p_strError = "Shipping Email";
        return FALSE;
      }
    }
    elseif( in_array( $strShoppingCartType, array('MIXED', 'PHYSICAL') ) ) {
      if( empty($strZipCode) ) {
        $p_strError = "Shipping Address Zip code";
        return FALSE;
      }
      if( empty($strCity) ) {
        $p_strError = "Shipping Address City";
        return FALSE;
      }
      if( empty($strCountry) ) {
        $p_strError = "Shipping Address Country";
        return FALSE;
      }
    }

    return TRUE;
  }
public function validateParams ( $ p_aParams , & $ p_strError ) { if ( isset ( $ p_aParams [ 'shoppingCartType' ] ) ) { $ strShoppingCartType = trim ( $ p_aParams [ 'shoppingCartType' ] ) ; } if ( empty ( $ strShoppingCartType ) ) { $ strShoppingCartType = "MIXED" ; // Default value } if ( isset ( $ p_aParams [ 'shippingAddresseFirstName' ] ) ) { $ strFirstName = trim ( $ p_aParams [ 'shippingAddresseFirstName' ] ) ; } else { $ strFirstName = "" ; } if ( isset ( $ p_aParams [ 'shippingAddresseLastName' ] ) ) { $ strLastName = trim ( $ p_aParams [ 'shippingAddresseLastName' ] ) ; } else { $ strLastName = "" ; } if ( isset ( $ p_aParams [ 'shippingEmail' ] ) ) { $ strEmail = trim ( $ p_aParams [ 'shippingEmail' ] ) ; } else { $ strEmail = "" ; } if ( isset ( $ p_aParams [ 'shippingZipCode' ] ) ) { $ strZipCode = trim ( $ p_aParams [ 'shippingZipCode' ] ) ; } else { $ strZipCode = "" ; } if ( isset ( $ p_aParams [ 'shippingCity' ] ) ) { $ strCity = trim ( $ p_aParams [ 'shippingCity' ] ) ; } else { $ strCity = "" ; } if ( isset ( $ p_aParams [ 'shippingCountry' ] ) ) { $ strCountry = trim ( $ p_aParams [ 'shippingCountry' ] ) ; } else { $ strCountry = "" ; } // Validate shopping cart type if ( ! in_array ( $ strShoppingCartType , array ( 'PHYSICAL' , 'DIGITAL' , 'MIXED' , 'ANONYMOUS_DONATION' , 'AUTHORITIES_PAYMENT' , ) ) ) { $ p_strError = "Shopping cart type" ; return FALSE ; } // Validate other address fields depending on shoppingCartType // First and last name are mandatory for mixed, physical and digital shopping carts if ( in_array ( $ strShoppingCartType , array ( 'MIXED' , 'PHYSICAL' , 'DIGITAL' ) ) ) { if ( empty ( $ strFirstName ) ) { $ p_strError = "First Name" ; return FALSE ; } if ( empty ( $ strLastName ) ) { $ p_strError = "Last Name" ; return FALSE ; } } if ( $ strShoppingCartType == 'DIGITAL' ) { if ( empty ( $ strEmail ) ) { $ p_strError = "Shipping Email" ; return FALSE ; } } elseif ( in_array ( $ strShoppingCartType , array ( 'MIXED' , 'PHYSICAL' ) ) ) { if ( empty ( $ strZipCode ) ) { $ p_strError = "Shipping Address Zip code" ; return FALSE ; } if ( empty ( $ strCity ) ) { $ p_strError = "Shipping Address City" ; return FALSE ; } if ( empty ( $ strCountry ) ) { $ p_strError = "Shipping Address Country" ; return FALSE ; } } return TRUE ; }
Do some special validations for this payment method.
Used only in a few, simply returns true for most.

@param $p_aParams Array of parameters from shop
@param $p_strError string [OUT] Field name in case of error
@return bool TRUE if ok, FALSE if validation error.
Do some special validations for this payment method . Used only in a few simply returns true for most .