Repository navigation
Expand file tree
/
Copy pathPayStackApi.cs
More file actions
132 lines (117 loc) · 3.43 KB
/
Copy pathPayStackApi.cs
File metadata and controls
132 lines (117 loc) · 3.43 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using System;
using System.Collections.Generic;
using System.Text;
using Paystack.Net.SDK.Transactions;
using Paystack.Net.SDK.Subscription;
using Paystack.Net.SDK.Charge;
using imprtCustomer = Paystack.Net.SDK.Customers;
using Paystack.Net.SDK.Plans;
using Paystack.Net.SDK.Transfers;
using Paystack.Net.SDK.Subaccounts;
using Paystack.Net.SDK.Verification;
namespace Paystack.Net.SDK
{
public interface IPayStackApi
{
ITransactions Transactions { get; }
ISubscriptions Subscriptions { get; }
ICharge Charge { get; }
ICustomers Customers { get; }
IPlans Plans { get; }
ISubAccounts SubAccounts { get; }
ITransfers Transfers { get; }
IVerification Verification { get; }
IChargeHelper CustomerCharge { get; }
}
public class PayStackApi : IPayStackApi
{
private ITransactions _transaction;
private ISubscriptions _subscriptions;
private ICharge _charge;
private ICustomers _customers;
private IPlans _plans;
private ISubAccounts _subAccounts;
private ITransfers _transfers;
private IVerification _verification;
private IChargeHelper _customerCharge;
private string _secretKey;
public PayStackApi(string secretKey)
{
_secretKey = secretKey;
}
public ITransactions Transactions
{
get
{
if (_transaction == null)
_transaction = new PaystackTransaction(_secretKey);
return _transaction;
}
}
public ISubscriptions Subscriptions
{
get
{
if (_subscriptions == null)
_subscriptions = new PaystackSubscription(_secretKey);
return _subscriptions;
}
}
public ICharge Charge
{
get
{
if (_charge == null) _charge = new PaystackCharge(_secretKey);
return _charge;
}
}
public ICustomers Customers
{
get
{
if (_customers == null) _customers= new imprtCustomer.PaystackCustomers(_secretKey);
return _customers;
}
}
public IPlans Plans
{
get
{
if (_plans == null) _plans = new PaystackPlans(_secretKey);
return _plans;
}
}
public ISubAccounts SubAccounts
{
get
{
if (_subAccounts == null) _subAccounts = new PaystackSubaccounts(_secretKey);
return _subAccounts;
}
}
public ITransfers Transfers
{
get
{
if (_transfers == null) _transfers = new PaystackTransfers(_secretKey);
return _transfers;
}
}
public IVerification Verification
{
get
{
if (_verification == null) _verification = new Paystack.Net.SDK.Verification.Verification(_secretKey);
return _verification;
}
}
public IChargeHelper CustomerCharge
{
get
{
if (_customerCharge == null) _customerCharge = new Paystack.Net.SDK.Fees.CustomerCharge();
return _customerCharge;
}
}
}
}