forked from plexouy/Plexo.Client.SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaymentGatewayClientFactory.cs
29 lines (27 loc) · 1.18 KB
/
PaymentGatewayClientFactory.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
using System.Collections.Generic;
namespace Plexo.Client.SDK
{
public class PaymentGatewayClientFactory
{
private static readonly Dictionary<string, PaymentGatewayClient> Instances = new Dictionary<string, PaymentGatewayClient>();
private static readonly Dictionary<string, PaymentGatewayClient> InstancesIssuer = new Dictionary<string, PaymentGatewayClient>();
public static PaymentGatewayClient GetClient(string clientname)
{
lock (Instances)
{
if (!Instances.ContainsKey(clientname))
Instances[clientname] = PaymentGatewayClient.CreateClient(Properties.Settings.Default.PaymentServerUrl, clientname);
return Instances[clientname];
}
}
public static PaymentGatewayClient GetIssuer(string issuername)
{
lock (InstancesIssuer)
{
if (!InstancesIssuer.ContainsKey(issuername))
InstancesIssuer[issuername] = PaymentGatewayClient.CreateClientForIssuer(Properties.Settings.Default.PaymentServerUrl, issuername);
return InstancesIssuer[issuername];
}
}
}
}