コード例 #1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (RequestHeader == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RequestHeader");
     }
     if (Recipient == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Recipient");
     }
     if (Sender == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Sender");
     }
     if (TransferData == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TransferData");
     }
     if (TppTransactionId == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "TppTransactionId");
     }
     if (DeliveryMode == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "DeliveryMode");
     }
     if (RequestHeader != null)
     {
         RequestHeader.Validate();
     }
     if (Recipient != null)
     {
         Recipient.Validate();
     }
     if (Sender != null)
     {
         Sender.Validate();
     }
     if (TransferData != null)
     {
         TransferData.Validate();
     }
     if (UsInfo != null)
     {
         UsInfo.Validate();
     }
     if (TppTransactionId != null)
     {
         if (TppTransactionId.Length > 64)
         {
             throw new ValidationException(ValidationRules.MaxLength, "TppTransactionId", 64);
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (ResponseHeader == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "ResponseHeader");
     }
     if (BaseInfo == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "BaseInfo");
     }
     if (BaseInfo != null)
     {
         BaseInfo.Validate();
     }
     if (ZusInfo != null)
     {
         ZusInfo.Validate();
     }
     if (UsInfo != null)
     {
         UsInfo.Validate();
     }
     if (TransactionRate != null)
     {
         foreach (var element in TransactionRate)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
     if (BaseCurrency != null)
     {
         if (BaseCurrency.Length > 3)
         {
             throw new ValidationException(ValidationRules.MaxLength, "BaseCurrency", 3);
         }
     }
     if (AmountBaseCurrency != null)
     {
         if (!System.Text.RegularExpressions.Regex.IsMatch(AmountBaseCurrency, "^\\d*\\.\\d{2}$"))
         {
             throw new ValidationException(ValidationRules.Pattern, "AmountBaseCurrency", "^\\d*\\.\\d{2}$");
         }
     }
     if (UsedPaymentInstrumentId != null)
     {
         if (UsedPaymentInstrumentId.Length > 32)
         {
             throw new ValidationException(ValidationRules.MaxLength, "UsedPaymentInstrumentId", 32);
         }
     }
     if (TppTransactionId != null)
     {
         if (TppTransactionId.Length > 64)
         {
             throw new ValidationException(ValidationRules.MaxLength, "TppTransactionId", 64);
         }
     }
     if (TppName != null)
     {
         if (TppName.Length > 32)
         {
             throw new ValidationException(ValidationRules.MaxLength, "TppName", 32);
         }
     }
     if (RejectionReason != null)
     {
         if (RejectionReason.Length > 140)
         {
             throw new ValidationException(ValidationRules.MaxLength, "RejectionReason", 140);
         }
     }
 }