| 1 | using System;
|
|---|
| 2 | namespace Platnosci.Core.Linq
|
|---|
| 3 | {
|
|---|
| 4 | public class Merchant
|
|---|
| 5 | {
|
|---|
| 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 |
|
|---|
| 9 | public string Id { get; set; }
|
|---|
| 10 | 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 < 0) 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 | }
|
|---|
| 31 | if (String.IsNullOrEmpty(Error))
|
|---|
| 32 | {
|
|---|
| 33 | if (Hash == BAD_HASH || Hash == "" || Hash == HASH_ERROR_INFO) Error = "hash";
|
|---|
| 34 | else if (String.IsNullOrEmpty(Id)) Error = "id";
|
|---|
| 35 | else if (String.IsNullOrEmpty(Password)) Error = "password";
|
|---|
| 36 | else if (String.IsNullOrEmpty(Hash)) Error = "hash";
|
|---|
| 37 | else if (String.IsNullOrEmpty(LinkFail)) Error = "linkfail";
|
|---|
| 38 | else if (String.IsNullOrEmpty(LinkOk)) Error = "linkok";
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 | } |
|---|