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