-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathGeniusConfig.cs
61 lines (47 loc) · 2.02 KB
/
GeniusConfig.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
using System;
using GlobalPayments.Api.Entities;
using GlobalPayments.Api.Gateways;
namespace GlobalPayments.Api {
public class GeniusConfig : GatewayConfig {
public string ClerkId { get; set; }
public string MerchantName { get; set; }
public string MerchantSiteId { get; set; }
public string MerchantKey { get; set; }
public string RegisterNumber { get; set; }
public string DBA { get; set; }
public string TerminalId { get; set; }
public GeniusConfig() : base(GatewayProvider.Genius) { }
internal override void ConfigureContainer(ConfiguredServices services) {
base.ConfigureContainer(services);
if (string.IsNullOrEmpty(ServiceUrl)) {
if (Environment.Equals(Entities.Environment.TEST)) {
ServiceUrl = ServiceEndpoints.GENIUS_API_TEST;
}
else ServiceUrl = ServiceEndpoints.GENIUS_API_PRODUCTION;
}
var gateway = new GeniusConnector() {
MerchantName = MerchantName,
MerchantSiteId = MerchantSiteId,
MerchantKey = MerchantKey,
RegisterNumber = RegisterNumber,
TerminalId = TerminalId,
Timeout = Timeout,
ServiceUrl = ServiceUrl,
WebProxy = WebProxy
};
services.GatewayConnector = gateway;
}
internal override void Validate() {
base.Validate();
if (string.IsNullOrEmpty(MerchantSiteId)) {
throw new ConfigurationException("MerchantSiteId is required for this configuration.");
}
else if (string.IsNullOrEmpty(MerchantName)) {
throw new ConfigurationException("MerchantName is required for this configuration.");
}
else if (string.IsNullOrEmpty(MerchantKey)) {
throw new ConfigurationException("MerchantKey is required for this configuration.");
}
}
}
}