-
Notifications
You must be signed in to change notification settings - Fork 63
/
GpEcomReportingTest.cs
63 lines (57 loc) · 2.37 KB
/
GpEcomReportingTest.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
using System;
using GlobalPayments.Api.Entities;
using GlobalPayments.Api.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace GlobalPayments.Api.Tests.GpEcom {
[TestClass]
public class GpEcomReportingTest {
public GpEcomReportingTest() {
var config = new GpEcomConfig {
MerchantId = "heartlandgpsandbox",
AccountId = "api",
SharedSecret = "secret",
RebatePassword = "rebate",
RefundPassword = "refund",
ServiceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi",
};
ServicesContainer.ConfigureService(config);
}
[TestMethod]
public void GetTransactionDetail() {
const string orderId = "Dafl9Qi-mUaK7AGZrNlCkw";
var response = ReportingService.TransactionDetail(orderId)
.Execute();
Assert.IsNotNull(response);
Assert.AreEqual(orderId, response.OrderId);
Assert.AreEqual("gkJ8WR1YG2L31LSt", response.SchemeReferenceData);
Assert.AreEqual("17212082503361660", response.TransactionId);
Assert.AreEqual("U", response.AvsResponseCode);
Assert.AreEqual("M", response.CvnResponseCode);
Assert.AreEqual("00", response.GatewayResponseCode);
Assert.AreEqual("(00)[ test system ] Authorised", response.GatewayResponseMessage);
Assert.AreEqual("PASS", response.FraudRuleInfo);
}
[TestMethod]
public void GetTransactionDetail_WithRandomId() {
var orderId = Guid.NewGuid().ToString().Replace("-", "");
try {
ReportingService.TransactionDetail(orderId)
.Execute();
}
catch (GatewayException ex) {
Assert.AreEqual("508", ex.ResponseCode);
Assert.AreEqual("Original transaction not found.", ex.ResponseMessage);
}
}
[TestMethod]
public void GetTransactionDetail_WithNullId() {
try {
ReportingService.TransactionDetail(null)
.Execute();
}
catch (BuilderException ex) {
Assert.AreEqual("TransactionId cannot be null for this transaction type.", ex.Message);
}
}
}
}