Skip to content

Commit bd87e3e

Browse files
committed
Merge pull request AuthorizeNet#85 from AuthorizeNet/future
Merge Future into Master for June 2015 SDK release
2 parents ac38c7d + bf203de commit bd87e3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4128
-2540
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language:
2-
c
2+
csharp
33

44
install:
5-
- sudo apt-get install mono-devel mono-gmcs nunit-console
5+
- sudo apt-get install nunit-console
66

77
script:
88
- xbuild ./Authorize.NET/AuthorizeNET.csproj

Authorize.NET/AIM/Requests/AuthorizationRequest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Text;
55
using System.Collections.Specialized;
6+
using System.Globalization;
67

78
namespace AuthorizeNet {
89

@@ -54,7 +55,7 @@ public AuthorizationRequest(NameValueCollection post) {
5455
protected virtual void SetQueue(string cardNumber, string expirationMonthAndYear, decimal amount, string description) {
5556
this.Queue(ApiFields.CreditCardNumber, cardNumber);
5657
this.Queue(ApiFields.CreditCardExpiration, expirationMonthAndYear);
57-
this.Queue(ApiFields.Amount, amount.ToString());
58+
this.Queue(ApiFields.Amount, amount.ToString(CultureInfo.InvariantCulture));
5859
this.Queue(ApiFields.Description, description);
5960
}
6061

Authorize.NET/AIM/Requests/CaptureRequest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
using System.Globalization;
56

67
namespace AuthorizeNet
78
{
@@ -24,7 +25,7 @@ public CaptureRequest(string authCode, string cardNumber, string expirationMonth
2425
this.Queue(ApiFields.AuthorizationCode, authCode);
2526
this.Queue(ApiFields.CreditCardNumber, cardNumber);
2627
this.Queue(ApiFields.CreditCardExpiration, expirationMonthAndYear);
27-
this.Queue(ApiFields.Amount, amount.ToString());
28+
this.Queue(ApiFields.Amount, amount.ToString(CultureInfo.InvariantCulture));
2829
}
2930
}
3031
}

Authorize.NET/AIM/Requests/CreditRequest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
using System.Globalization;
56

67
namespace AuthorizeNet {
78
/// <summary>
@@ -20,7 +21,7 @@ public CreditRequest(string transactionId, decimal amount, string cardNumber) {
2021
this.SetApiAction(RequestAction.Credit);
2122

2223
this.Queue(ApiFields.TransactionID, transactionId);
23-
this.Queue(ApiFields.Amount, amount.ToString());
24+
this.Queue(ApiFields.Amount, amount.ToString(CultureInfo.InvariantCulture));
2425
this.Queue(ApiFields.CreditCardNumber, cardNumber);
2526

2627
}

Authorize.NET/AIM/Requests/EcheckRequest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
using System.Globalization;
56

67
namespace AuthorizeNet {
78
public class EcheckRequest:GatewayRequest {
@@ -43,7 +44,7 @@ public EcheckRequest(EcheckType type, decimal amount, string bankABACode, string
4344
this.BankAccountNumber = bankAccountNumber;
4445
this.BankAccountType = acctType;
4546
this.BankCheckNumber = bankCheckNumber;
46-
this.Amount = amount.ToString();
47+
this.Amount = amount.ToString(CultureInfo.InvariantCulture);
4748

4849
}
4950

@@ -165,7 +166,7 @@ public EcheckPriorAuthCaptureRequest(string transactionId, decimal amount)
165166
{
166167
this.SetApiAction(RequestAction.PriorAuthCapture);
167168
this.Queue(ApiFields.Method, "ECHECK");
168-
this.Queue(ApiFields.Amount, amount.ToString());
169+
this.Queue(ApiFields.Amount, amount.ToString(CultureInfo.InvariantCulture));
169170
this.Queue(ApiFields.TransactionID, transactionId);
170171
}
171172
}
@@ -182,7 +183,7 @@ public EcheckCreditRequest(string transactionId, decimal amount, string bankAcco
182183
{
183184
this.SetApiAction(RequestAction.Credit);
184185
this.Queue(ApiFields.Method, "ECHECK");
185-
this.Queue(ApiFields.Amount, amount.ToString());
186+
this.Queue(ApiFields.Amount, amount.ToString(CultureInfo.InvariantCulture));
186187
this.Queue(ApiFields.TransactionID, transactionId);
187188
this.BankAccountNumber = bankAccountNumber;
188189
}

Authorize.NET/AIM/Requests/GatewayRequest.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Net;
88
using System.Text.RegularExpressions;
99
using System.Collections.Specialized;
10+
using System.Globalization;
1011

1112
namespace AuthorizeNet {
1213

@@ -264,14 +265,14 @@ public IGatewayRequest AddFraudCheck() {
264265
/// Adds a detailed tax value to the request
265266
/// </summary>
266267
public IGatewayRequest AddFreight(decimal amount, string name, string description) {
267-
this.Freight = string.Format("{0}<|>{1}<|>{2}", name, description, amount.ToString());
268+
this.Freight = string.Format("{0}<|>{1}<|>{2}", name, description, amount.ToString(CultureInfo.InvariantCulture));
268269
return this;
269270
}
270271
/// <summary>
271272
/// Adds a tax value to the request
272273
/// </summary>
273274
public IGatewayRequest AddFreight(decimal amount) {
274-
this.Freight = amount.ToString();
275+
this.Freight = amount.ToString(CultureInfo.InvariantCulture);
275276
return this;
276277
}
277278

@@ -281,29 +282,29 @@ public IGatewayRequest AddFreight(decimal amount) {
281282
/// Adds a detailed tax value to the request
282283
/// </summary>
283284
public IGatewayRequest AddDuty(decimal amount, string name, string description) {
284-
this.Duty = string.Format("{0}<|>{1}<|>{2}", name, description, amount.ToString());
285+
this.Duty = string.Format("{0}<|>{1}<|>{2}", name, description, amount.ToString(CultureInfo.InvariantCulture));
285286
return this;
286287
}
287288
/// <summary>
288289
/// Adds a tax value to the request
289290
/// </summary>
290291
public IGatewayRequest AddDuty(decimal amount) {
291-
this.Duty = amount.ToString();
292+
this.Duty = amount.ToString(CultureInfo.InvariantCulture);
292293
return this;
293294
}
294295

295296
/// <summary>
296297
/// Adds a detailed tax value to the request
297298
/// </summary>
298299
public IGatewayRequest AddTax(decimal amount, string name, string description) {
299-
this.Tax = string.Format("{0}<|>{1}<|>{2}", name, description, amount.ToString());
300+
this.Tax = string.Format("{0}<|>{1}<|>{2}", name, description, amount.ToString(CultureInfo.InvariantCulture));
300301
return this;
301302
}
302303
/// <summary>
303304
/// Adds a tax value to the request
304305
/// </summary>
305306
public IGatewayRequest AddTax(decimal amount) {
306-
this.Tax = amount.ToString();
307+
this.Tax = amount.ToString(CultureInfo.InvariantCulture);
307308
return this;
308309
}
309310
/// <summary>
@@ -350,7 +351,7 @@ public IGatewayRequest AddLineItem(string itemID, string name, string descriptio
350351
itemID,
351352
name,
352353
description,
353-
quantity.ToString(), price.ToString(), taxable.ToString());
354+
quantity.ToString(), price.ToString(CultureInfo.InvariantCulture), taxable.ToString());
354355
Post.Add(sFld, lineFormat);
355356
return this;
356357
}

Authorize.NET/AIM/Requests/PriorAuthCaptureRequest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
using System.Globalization;
56

67
namespace AuthorizeNet
78
{
@@ -19,7 +20,7 @@ public class PriorAuthCaptureRequest : GatewayRequest
1920
public PriorAuthCaptureRequest(decimal amount, string transactionId)
2021
{
2122
this.SetApiAction(RequestAction.PriorAuthCapture);
22-
this.Queue(ApiFields.Amount, amount.ToString());
23+
this.Queue(ApiFields.Amount, amount.ToString(CultureInfo.InvariantCulture));
2324
this.Queue(ApiFields.TransactionID, transactionId);
2425
}
2526

Authorize.NET/AIM/Requests/UnlinkedCredit.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
using System.Globalization;
56

67
namespace AuthorizeNet {
78
public class UnlinkedCredit:GatewayRequest {
89

910
public UnlinkedCredit(decimal amount, string cardNumber, string expirationMonthAndYear) {
1011
this.SetApiAction(RequestAction.UnlinkedCredit);
11-
this.Queue(ApiFields.Amount, amount.ToString());
12+
this.Queue(ApiFields.Amount, amount.ToString(CultureInfo.InvariantCulture));
1213
this.Queue(ApiFields.CreditCardNumber, cardNumber);
1314
this.Queue(ApiFields.CreditCardExpiration, expirationMonthAndYear);
1415
}

Authorize.NET/AIM/Responses/GatewayResponse.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ public string ResponseCode {
7878
return ParseResponse(0);
7979
}
8080
}
81+
public string ResponseReasonCode
82+
{
83+
get
84+
{
85+
return ParseResponse(2);
86+
}
87+
}
8188
public string CardNumber {
8289
get {
8390
return ParseResponse(50);

Authorize.NET/AIM/Responses/IGatewayResponse.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ public interface IGatewayResponse {
99
string ResponseCode { get; }
1010
string Message { get; }
1111
string TransactionID { get; }
12+
string ResponseReasonCode { get; }
13+
string GetValueByIndex(int position);
1214
}
1315
}

Authorize.NET/AIM/Responses/SIMResponse.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ public string ResponseCode {
3636
return FindKey("x_response_code");
3737
}
3838
}
39+
40+
public string ResponseReasonCode
41+
{
42+
get { throw new NotImplementedException(); }
43+
}
44+
3945
public string Message {
4046
get {
4147
return FindKey("x_response_reason_text");
@@ -101,6 +107,21 @@ string FindKey(string key) {
101107
return result;
102108
}
103109

110+
public string GetValueByIndex(int position)
111+
{
112+
return ParseResponse(position);
113+
}
114+
115+
internal string ParseResponse(int index)
116+
{
117+
var result = "";
118+
if (_post.AllKeys.Count() > index)
119+
{
120+
result = _post[index];
121+
}
122+
return result;
123+
}
124+
104125
public override string ToString() {
105126
var sb = new StringBuilder();
106127
sb.AppendFormat("<li>Code = {0}", this.ResponseCode);

0 commit comments

Comments
 (0)