-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCardPresentResponse.cs
286 lines (270 loc) · 5.42 KB
/
CardPresentResponse.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
using System;
namespace AuthorizeNet
{
/// <summary>
/// Parses the response from the transaction (a piped string) into a represenational class
/// </summary>
public class CardPresentResponse : ResponseBase, IGatewayResponse
{
/// <summary>
/// Gets the amount.
/// </summary>
/// <value>The amount.</value>
public decimal Amount
{
get
{
return base.ParseDecimal(24);
}
}
/// <summary>
/// Gets a value indicating whether this <see cref="T:AuthorizeNet.CardPresentResponse" /> is approved.
/// </summary>
/// <value><c>true</c> if approved; otherwise, <c>false</c>.</value>
public bool Approved
{
get
{
return base.ParseInt(1) == 1;
}
}
/// <summary>
/// Gets the authorization code.
/// </summary>
/// <value>The authorization code.</value>
public string AuthorizationCode
{
get
{
return base.ParseResponse(4);
}
}
/// <summary>
/// Gets the AVS response.
/// </summary>
/// <value>The AVS response.</value>
public string AVSResponse
{
get
{
string str = base.ParseResponse(5);
string str1 = str;
if (str != null)
{
switch (str1)
{
case "A":
{
return "Address (Street): matches, ZIP does not";
}
case "B":
{
return "Address information not provided for AVS check";
}
case "E":
{
return "AVS error ";
}
case "G":
{
return "Non-U.S. Card Issuing Bank ";
}
case "N":
{
return "No Match on Address (Street) or ZIP ";
}
case "P":
{
return "AVS not applicable for this transaction ";
}
case "R":
{
return "Retry — System unavailable or timed out ";
}
case "S":
{
return "Service not supported by issuer ";
}
case "U":
{
return "Address information is unavailable ";
}
case "W":
{
return "Nine digit ZIP matches, Address (Street): does not ";
}
case "X":
{
return "Address (Street) and nine digit ZIP match ";
}
case "Y":
{
return "Address (Street) and five digit ZIP match ";
}
case "Z":
{
return "Five digit ZIP matches, Address (Street) does not";
}
}
}
return "";
}
}
/// <summary>
/// Gets the card code response.
/// </summary>
/// <value>The card code response.</value>
public string CardCodeResponse
{
get
{
string code = base.ParseResponse(6);
string result = "No result";
string str = code;
string str1 = str;
if (str != null)
{
if (str1 == "M")
{
return "Match";
}
if (str1 == "N")
{
return "No Match";
}
if (str1 == "P")
{
return "Not Processed";
}
if (str1 == "S")
{
return "Should have been present";
}
if (str1 == "U")
{
return "Issuer unable to process request";
}
}
return result;
}
}
/// <summary>
/// Gets the card number.
/// </summary>
/// <value>The card number.</value>
public string CardNumber
{
get
{
return base.ParseResponse(20);
}
}
/// <summary>
/// Gets the invoice number.
/// </summary>
/// <value>The invoice number.</value>
public string InvoiceNumber
{
get
{
return base.ParseResponse(9);
}
}
/// <summary>
/// Gets the MD5 hash.
/// </summary>
/// <value>The MD5 hash.</value>
public string MD5Hash
{
get
{
return base.ParseResponse(8);
}
}
/// <summary>
/// Gets the message.
/// </summary>
/// <value>The message.</value>
public string Message
{
get
{
return base.ParseResponse(3);
}
}
/// <summary>
/// Gets the remaining balance on card.
/// </summary>
/// <value>The remaining balance on card.</value>
public decimal RemainingBalanceOnCard
{
get
{
return base.ParseDecimal(25);
}
}
/// <summary>
/// Gets the requested amount.
/// </summary>
/// <value>The requested amount.</value>
public decimal RequestedAmount
{
get
{
return base.ParseDecimal(23);
}
}
/// <summary>
/// Gets the response code.
/// </summary>
/// <value>The response code.</value>
public string ResponseCode
{
get
{
return base.ParseResponse(1);
}
}
/// <summary>
/// Gets the split tender ID.
/// </summary>
/// <value>The split tender ID.</value>
public string SplitTenderID
{
get
{
return base.ParseResponse(22);
}
}
/// <summary>
/// Gets the transaction ID.
/// </summary>
/// <value>The transaction ID.</value>
public string TransactionID
{
get
{
return base.ParseResponse(7);
}
}
/// <summary>
/// Gets the user reference.
/// </summary>
/// <value>The user reference.</value>
public string UserReference
{
get
{
return base.ParseResponse(9);
}
}
/// <summary>
/// Initializes a new instance of the <see cref="T:AuthorizeNet.CardPresentResponse" /> class.
/// </summary>
/// <param name="RawResponse">The raw response.</param>
public CardPresentResponse(string[] RawResponse)
{
this.RawResponse = RawResponse;
}
}
}