-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBatch.cs
107 lines (99 loc) · 2.25 KB
/
Batch.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using AuthorizeNet.APICore;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace AuthorizeNet
{
/// <summary>
/// A class representing a batch-settlement
/// </summary>
public class Batch
{
/// <summary>
/// Gets or sets the charges.
/// </summary>
/// <value>The charges.</value>
public List<Charge> Charges
{
get;
set;
}
/// <summary>
/// Gets or sets the ID.
/// </summary>
/// <value>The ID.</value>
public string ID
{
get;
set;
}
/// <summary>
/// Gets or sets the payment method.
/// </summary>
/// <value>The payment method.</value>
public string PaymentMethod
{
get;
set;
}
/// <summary>
/// Gets or sets the settled on.
/// </summary>
/// <value>The settled on.</value>
public DateTime SettledOn
{
get;
set;
}
/// <summary>
/// Gets or sets the state.
/// </summary>
/// <value>The state.</value>
public string State
{
get;
set;
}
public Batch()
{
}
/// <summary>
/// Creates a new batch from a stats response
/// </summary>
public static Batch NewFromResponse(getBatchStatisticsResponse batch)
{
Batch batch1 = new Batch()
{
ID = batch.batchDetails.batchId,
PaymentMethod = batch.batchDetails.paymentMethod,
SettledOn = batch.batchDetails.settlementTimeUTC,
State = batch.batchDetails.settlementState,
Charges = Charge.NewFromStat(batch.batchDetails.statistics)
};
return batch1;
}
/// <summary>
/// Creates a list of batches directly from the API Response
/// </summary>
/// <param name="batches">The batches.</param>
/// <returns></returns>
public static List<Batch> NewFromResponse(getSettledBatchListResponse batches)
{
List<Batch> result = new List<Batch>();
for (int i = 0; i < (int)batches.batchList.Length; i++)
{
batchDetailsType item = batches.batchList[i];
Batch batch = new Batch()
{
Charges = Charge.NewFromStat(item.statistics),
ID = item.batchId,
PaymentMethod = item.paymentMethod,
SettledOn = item.settlementTimeUTC,
State = item.settlementState
};
result.Add(batch);
}
return result;
}
}
}