Skip to content

Commit 53788cf

Browse files
author
bmcmanus
committed
Merge branch 'master' of https://github.com/ramittal/sdk-dotnet into ramittal-master
2 parents d4fa6f4 + 89216a1 commit 53788cf

File tree

4 files changed

+107
-3
lines changed

4 files changed

+107
-3
lines changed

Authorize.NET/Utility/HttpXmlUtility.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,13 @@ string Serialize(object apiRequest) {
9292
}
9393
return result;
9494
}
95+
9596
void CheckForErrors(ANetApiResponse response) {
9697

9798
if (response.GetType() == typeof(createCustomerProfileTransactionResponse)) {
9899
//there's a directResponse we need to find...
99100
var thingy = (createCustomerProfileTransactionResponse)response;
100-
thingy.directResponse = null;
101+
//should not initialize directresponse
101102
for (var i = 0; i <= 1; i++)
102103
{
103104
if (null != _xmlDoc && null != _xmlDoc.ChildNodes[i])

AuthorizeNETtest/Api/Controllers/Test/ApiCoreTestBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ public void SetUp()
300300
interval = interval,
301301
startDate = _nowDate,
302302
totalOccurrences = 5,
303+
trialOccurrences = 0,
303304
};
304305

305306
ArbSubscriptionOne = new ARBSubscriptionType
@@ -312,6 +313,7 @@ public void SetUp()
312313
payment = PaymentOne,
313314
paymentSchedule = PaymentScheduleTypeOne,
314315
shipTo = NameAndAddressTypeOne,
316+
trialAmount= SetValidSubscriptionAmount(0),
315317
};
316318

317319
CustomerDataOne = new customerDataType

AuthorizeNETtest/CustomerGatewayTest.cs

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace AuthorizeNETtest
1010
{
11+
using System.Text;
12+
1113
/// <summary>
1214
/// This is a test class for CustomerGatewayTest and is intended to contain all CustomerGateway Unit Tests
1315
/// </summary>
@@ -995,5 +997,104 @@ public void TestCheckForErrorscreateCustomerProfileTransactionResponse()
995997
var response = gateway.AuthorizeAndCapture(order);
996998
Assert.IsNotNull(response);
997999
}
1000+
1001+
[Test]
1002+
public void TestSdkUpgradeCustomerOrder()
1003+
{
1004+
var random = new Random();
1005+
var counter = random.Next(1, (int)(Math.Pow(2, 24)));
1006+
const int maxAmount = 10000;// 214747;
1007+
var amount = new decimal(counter > maxAmount ? (counter % maxAmount) : counter);
1008+
var email = string.Format("user.{0}@authorize.net", counter);
1009+
var description = string.Format("Description for Customer: {0}", counter);
1010+
var merchantCustomerId = string.Format("CustomerId: {0}", counter);
1011+
const string cardNumber = "4111111111111111";
1012+
const string cvv = "";
1013+
var address = new Address
1014+
{
1015+
First = string.Format("FName:{0}", counter),
1016+
Last = string.Format("LName:{0}", counter),
1017+
Company = "Visa",
1018+
Street = "123 Elm Street",
1019+
City = "Bellevue",
1020+
State = "WA",
1021+
Country = "US",
1022+
Zip = "98006"
1023+
};
1024+
1025+
//Save the customer first
1026+
var gw = new CustomerGateway(ApiLogin, TransactionKey);
1027+
1028+
var customer = gw.CreateCustomer(email, description, merchantCustomerId);
1029+
var creditCardToken = gw.AddCreditCard(customer.ProfileID, cardNumber, DateTime.UtcNow.Month, DateTime.UtcNow.AddYears(1).Year, cvv, address);
1030+
1031+
//Create order
1032+
var order = new Order(customer.ProfileID, creditCardToken, "");
1033+
order.Amount = amount;
1034+
order.CardCode = cvv;
1035+
order.ExtraOptions = "x_duplicate_window=0";
1036+
1037+
var result = (GatewayResponse)gw.AuthorizeAndCapture(order);
1038+
Assert.IsNotNull(result, "GateWay response for Order AuthCapture is null");
1039+
1040+
var buffer = new StringBuilder();
1041+
1042+
buffer.Append( "IGateWayResponse->");
1043+
buffer.AppendFormat( " SplitTenderId:{0}", result.SplitTenderId);
1044+
buffer.AppendFormat( ", MD5Hash:{0}", result.MD5Hash);
1045+
buffer.AppendFormat( ", CCVResponse:{0}", result.CCVResponse);
1046+
buffer.AppendFormat( ", Code:{0}", result.Code);
1047+
buffer.AppendFormat( ", TransactionType:{0}", result.TransactionType);
1048+
buffer.AppendFormat( ", AuthorizationCode:{0}", result.AuthorizationCode);
1049+
buffer.AppendFormat( ", Method:{0}", result.Method);
1050+
buffer.AppendFormat( ", Amount:{0}", result.Amount);
1051+
buffer.AppendFormat( ", Tax:{0}", result.Tax);
1052+
buffer.AppendFormat( ", TransactionID:{0}", result.TransactionID);
1053+
buffer.AppendFormat( ", InvoiceNumber:{0}", result.InvoiceNumber);
1054+
buffer.AppendFormat( ", Description:{0}", result.Description);
1055+
buffer.AppendFormat( ", ResponseCode:{0}", result.ResponseCode);
1056+
buffer.AppendFormat( ", CardNumber:{0}", result.CardNumber);
1057+
buffer.AppendFormat( ", CardType:{0}", result.CardType);
1058+
buffer.AppendFormat( ", CAVResponse:{0}", result.CAVResponse);
1059+
buffer.AppendFormat( ", AVSResponse:{0}", result.AVSResponse);
1060+
buffer.AppendFormat( ", SubCode:{0}", result.SubCode);
1061+
buffer.AppendFormat( ", Message:{0}", result.Message);
1062+
buffer.AppendFormat( ", Approved:{0}", result.Approved);
1063+
buffer.AppendFormat( ", Declined:{0}", result.Declined);
1064+
buffer.AppendFormat( ", Error:{0}", result.Error);
1065+
buffer.AppendFormat( ", HeldForReview:{0}", result.HeldForReview);
1066+
buffer.AppendFormat( ", FirstName:{0}", result.FirstName);
1067+
buffer.AppendFormat( ", LastName:{0}", result.LastName);
1068+
buffer.AppendFormat( ", Email:{0}", result.Email);
1069+
buffer.AppendFormat( ", Company:{0}", result.Company);
1070+
buffer.AppendFormat( ", Address:{0}", result.Address);
1071+
buffer.AppendFormat( ", City:{0}", result.City);
1072+
buffer.AppendFormat( ", State:{0}", result.State);
1073+
buffer.AppendFormat( ", ZipCode:{0}", result.ZipCode);
1074+
buffer.AppendFormat( ", Country:{0}", result.Country);
1075+
buffer.AppendFormat( ", ShipFirstName:{0}", result.ShipFirstName);
1076+
buffer.AppendFormat( ", ShipLastName:{0}", result.ShipLastName);
1077+
buffer.AppendFormat( ", ShipCompany:{0}", result.ShipCompany);
1078+
buffer.AppendFormat( ", ShipAddress:{0}", result.ShipAddress);
1079+
buffer.AppendFormat( ", ShipCity:{0}", result.ShipCity);
1080+
buffer.AppendFormat( ", ShipState:{0}", result.ShipState);
1081+
buffer.AppendFormat( ", ShipZipCode:{0}", result.ShipZipCode);
1082+
buffer.AppendFormat( ", ShipCountry:{0}", result.ShipCountry);
1083+
1084+
Console.WriteLine(buffer);
1085+
1086+
Assert.IsNotNull(result.MD5Hash);
1087+
Assert.IsNotNullOrEmpty(result.TransactionType);
1088+
Assert.IsNotNullOrEmpty(result.AuthorizationCode);
1089+
Assert.IsNotNullOrEmpty(result.Method);
1090+
Assert.AreEqual("CC", result.Method);
1091+
Assert.IsNotNullOrEmpty(result.TransactionID);
1092+
Assert.AreEqual("1", result.ResponseCode);
1093+
Assert.AreEqual( "XXXX1111", result.CardNumber);
1094+
Assert.AreEqual( "Visa", result.CardType);
1095+
Assert.AreEqual("This transaction has been approved.", result.Message);
1096+
Assert.IsTrue(result.Approved);
1097+
Assert.IsFalse(result.Declined);
1098+
}
9981099
}
9991100
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Authorize.Net .Net SDK
22

3-
[![Build Status](https://travis-ci.org/AuthorizeNet/sdk-dotnet.png?branch=master)]
4-
(https://travis-ci.org/AuthorizeNet/sdk-dotnet)
3+
[![Build Status](https://travis-ci.org/ramittal/sdk-dotnet.png?branch=master)]
4+
(https://travis-ci.org/ramittal/sdk-dotnet)
55

66
`PM> Install-Package AuthorizeNet`
77

0 commit comments

Comments
 (0)