Pokaż
Ignoruj:
Data:
2009-12-14 16:03:54 (16 years ago)
Autor:
alina
Opis:

re #215 dodanie testów, mała przebudowa akcji Merchant (wydzielenie funkcji)

Pliki:
1 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/eCard/eCardMVC/Platnosci.Core/Linq/Merchant.cs

    r949 r951  
    1 namespace Platnosci.Core.Linq 
     1using System; 
     2namespace Platnosci.Core.Linq 
    23{ 
    34    public class Merchant 
    45    { 
     6        public const string BAD_HASH = "zlyHash";                  //błędne hasło - odpowiedź z eCard 
     7        public const string HASH_ERROR_INFO = "payment not exist"; 
     8 
    59        public string Id { get; set; } 
    610        public string Password { get; set; } 
     11        public PlatnosciEcard Payment { get; set; } 
     12        public string SystemKsiegowy { get; set; } 
     13        public string Hash { get; set; } 
     14        public string LinkFail { get; set; } 
     15        public string LinkOk { get; set; } 
     16        public string Error {get; set;} 
     17         
     18        public void IsValid() 
     19        { 
     20            if (Payment == null) Error = "payment"; 
     21            else if (Payment != null) 
     22            { 
     23                if (Payment.AMOUNT == null) Error = "amount"; 
     24                else if (Payment.AUTODEPOSIT != true) Error = "autodeposit"; 
     25                else if (String.IsNullOrEmpty(Payment.ORDERDESCRIPTION)) Error = "orderdescription"; 
     26                else if (String.IsNullOrEmpty(Payment.CURRENCY)) Error = "currency"; 
     27                else if (String.IsNullOrEmpty(Payment.NAME)) Error = "name"; 
     28                else if (String.IsNullOrEmpty(Payment.SURNAME)) Error = "surname"; 
     29                else if (String.IsNullOrEmpty(Payment.LANGUAGE)) Error = "language"; 
     30                else if (Payment.ORDERNUMBER < 1) Error = "ordernumber"; 
     31            } 
     32            else if (Hash == BAD_HASH || Hash == "" || Hash == HASH_ERROR_INFO) Error = "hash"; 
     33            else if (String.IsNullOrEmpty(Id)) Error = "id"; 
     34            else if (String.IsNullOrEmpty(Password)) Error = "password"; 
     35            else if (String.IsNullOrEmpty(Hash)) Error = "hash"; 
     36            else if (String.IsNullOrEmpty(LinkFail)) Error = "linkfail"; 
     37            else if (String.IsNullOrEmpty(LinkOk)) Error = "linkok"; 
     38        } 
    739    } 
    840}