paystack 0.1.3 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rspec +2 -2
- data/.travis.yml +16 -0
- data/README.md +475 -20
- data/Rakefile +1 -2
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/paystack.rb +58 -84
- data/lib/paystack/error.rb +11 -12
- data/lib/paystack/modules/api.rb +14 -7
- data/lib/paystack/objects/balance.rb +12 -0
- data/lib/paystack/objects/banks.rb +12 -0
- data/lib/paystack/objects/base.rb +103 -102
- data/lib/paystack/objects/card.rb +105 -105
- data/lib/paystack/objects/customers.rb +37 -37
- data/lib/paystack/objects/plans.rb +39 -41
- data/lib/paystack/objects/recipients.rb +26 -0
- data/lib/paystack/objects/settlements.rb +12 -0
- data/lib/paystack/objects/subaccounts.rb +37 -0
- data/lib/paystack/objects/subscriptions.rb +40 -0
- data/lib/paystack/objects/transactions.rb +63 -70
- data/lib/paystack/objects/transfers.rb +75 -0
- data/lib/paystack/utils/utils.rb +104 -105
- data/lib/paystack/version.rb +2 -2
- data/paystack.gemspec +8 -6
- metadata +19 -15
- data/key.pem +0 -0
- data/lib/paystack/modules/crypto.rb +0 -11
- data/lib/paystack/modules/tokenmanager.rb +0 -60
@@ -1,37 +1,37 @@
|
|
1
|
-
require 'paystack/objects/base.rb'
|
2
|
-
|
3
|
-
class PaystackCustomers < PaystackBaseObject
|
4
|
-
def create(data={})
|
5
|
-
return PaystackCustomers.create(@paystack, data)
|
6
|
-
end
|
7
|
-
|
8
|
-
def get(customer_id)
|
9
|
-
return PaystackCustomers.get(@paystack, customer_id)
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
def update(customer_id, data={})
|
14
|
-
return PaystackCustomers.update(@paystack, customer_id, data)
|
15
|
-
end
|
16
|
-
|
17
|
-
def list(page=1)
|
18
|
-
return PaystackCustomers.list(@paystack, page)
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
def PaystackCustomers.create(paystackObj, data)
|
23
|
-
initPostRequest(paystackObj,"#{API::CUSTOMER_PATH}", data)
|
24
|
-
end
|
25
|
-
|
26
|
-
def PaystackCustomers.update(paystackObj, customer_id, data)
|
27
|
-
initPutRequest(paystackObj,"#{API::CUSTOMER_PATH}/#{customer_id}", data)
|
28
|
-
end
|
29
|
-
|
30
|
-
def PaystackCustomers.get(paystackObj, customer_id)
|
31
|
-
initGetRequest(paystackObj, "#{API::CUSTOMER_PATH}/#{customer_id}")
|
32
|
-
end
|
33
|
-
|
34
|
-
def PaystackCustomers.list(paystackObj, page=1)
|
35
|
-
initGetRequest(paystackObj, "#{API::CUSTOMER_PATH}?page=#{page}")
|
36
|
-
end
|
37
|
-
end
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
class PaystackCustomers < PaystackBaseObject
|
4
|
+
def create(data={})
|
5
|
+
return PaystackCustomers.create(@paystack, data)
|
6
|
+
end
|
7
|
+
|
8
|
+
def get(customer_id)
|
9
|
+
return PaystackCustomers.get(@paystack, customer_id)
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def update(customer_id, data={})
|
14
|
+
return PaystackCustomers.update(@paystack, customer_id, data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def list(page=1)
|
18
|
+
return PaystackCustomers.list(@paystack, page)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def PaystackCustomers.create(paystackObj, data)
|
23
|
+
initPostRequest(paystackObj,"#{API::CUSTOMER_PATH}", data)
|
24
|
+
end
|
25
|
+
|
26
|
+
def PaystackCustomers.update(paystackObj, customer_id, data)
|
27
|
+
initPutRequest(paystackObj,"#{API::CUSTOMER_PATH}/#{customer_id}", data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def PaystackCustomers.get(paystackObj, customer_id)
|
31
|
+
initGetRequest(paystackObj, "#{API::CUSTOMER_PATH}/#{customer_id}")
|
32
|
+
end
|
33
|
+
|
34
|
+
def PaystackCustomers.list(paystackObj, page=1)
|
35
|
+
initGetRequest(paystackObj, "#{API::CUSTOMER_PATH}?page=#{page}")
|
36
|
+
end
|
37
|
+
end
|
@@ -1,42 +1,40 @@
|
|
1
|
-
require 'paystack/objects/base.rb'
|
2
|
-
|
3
|
-
class PaystackPlans < PaystackBaseObject
|
4
|
-
|
5
|
-
def create(data={})
|
6
|
-
return PaystackPlans.create(@paystack, data)
|
7
|
-
end
|
8
|
-
|
9
|
-
def get(plan_id)
|
10
|
-
return PaystackPlans.get(@paystack, plan_id)
|
11
|
-
end
|
12
|
-
|
13
|
-
|
14
|
-
def update(plan_id, data={})
|
15
|
-
return PaystackPlans.update(@paystack, plan_id, data)
|
16
|
-
end
|
17
|
-
|
18
|
-
def list(page=1)
|
19
|
-
return PaystackPlans.list(@paystack, page)
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
def PaystackPlans.create(paystackObj, data)
|
24
|
-
initPostRequest(paystackObj,"#{API::PLAN_PATH}", data)
|
25
|
-
end
|
26
|
-
|
27
|
-
def PaystackPlans.update(paystackObj, plan_id, data)
|
28
|
-
initPutRequest(paystackObj,"#{API::PLAN_PATH}/#{plan_id}", data)
|
29
|
-
end
|
30
|
-
|
31
|
-
def PaystackPlans.get(paystackObj, plan_id)
|
32
|
-
initGetRequest(paystackObj, "#{API::PLAN_PATH}/#{plan_id}")
|
33
|
-
end
|
34
|
-
|
35
|
-
def PaystackPlans.list(paystackObj, page=1)
|
36
|
-
initGetRequest(paystackObj, "#{API::PLAN_PATH}?page=#{page}")
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
class PaystackPlans < PaystackBaseObject
|
4
|
+
|
5
|
+
def create(data={})
|
6
|
+
return PaystackPlans.create(@paystack, data)
|
7
|
+
end
|
8
|
+
|
9
|
+
def get(plan_id)
|
10
|
+
return PaystackPlans.get(@paystack, plan_id)
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
def update(plan_id, data={})
|
15
|
+
return PaystackPlans.update(@paystack, plan_id, data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def list(page=1)
|
19
|
+
return PaystackPlans.list(@paystack, page)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def PaystackPlans.create(paystackObj, data)
|
24
|
+
initPostRequest(paystackObj,"#{API::PLAN_PATH}", data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def PaystackPlans.update(paystackObj, plan_id, data)
|
28
|
+
initPutRequest(paystackObj,"#{API::PLAN_PATH}/#{plan_id}", data)
|
29
|
+
end
|
30
|
+
|
31
|
+
def PaystackPlans.get(paystackObj, plan_id)
|
32
|
+
initGetRequest(paystackObj, "#{API::PLAN_PATH}/#{plan_id}")
|
33
|
+
end
|
34
|
+
|
35
|
+
def PaystackPlans.list(paystackObj, page=1)
|
36
|
+
initGetRequest(paystackObj, "#{API::PLAN_PATH}?page=#{page}")
|
37
|
+
end
|
38
|
+
|
39
|
+
|
42
40
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
|
4
|
+
class PaystackRecipients < PaystackBaseObject
|
5
|
+
|
6
|
+
def create(data={})
|
7
|
+
return PaystackRecipients.create(@paystack, data)
|
8
|
+
end
|
9
|
+
|
10
|
+
def list(page=1)
|
11
|
+
return PaystackRecipients.list(@paystack, page)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def PaystackRecipients.create(paystackObj, data={})
|
16
|
+
initPostRequest(paystackObj, "#{API::RECIPIENT_PATH}", data, true)
|
17
|
+
end
|
18
|
+
|
19
|
+
def PaystackRecipients.list(paystackObj, page=1)
|
20
|
+
initGetRequest(paystackObj, "#{API::RECIPIENT_PATH}/?page=#{page}")
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
class PaystackSettlements < PaystackBaseObject
|
4
|
+
def list
|
5
|
+
return PaystackSettlements.list(@paystack)
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
def PaystackSettlements.list(paystackObj)
|
10
|
+
initGetRequest(paystackObj, "#{API::SETTLEMENT_PATH}")
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
class PaystackSubaccounts < PaystackBaseObject
|
4
|
+
def create(data={})
|
5
|
+
return PaystackSubaccounts.create(@paystack, data)
|
6
|
+
end
|
7
|
+
|
8
|
+
def get(subaccount_id)
|
9
|
+
return PaystackSubaccounts.get(@paystack, subaccount_id)
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def update(subaccount_id, data={})
|
14
|
+
return PaystackSubaccounts.update(@paystack, subaccount_id, data)
|
15
|
+
end
|
16
|
+
|
17
|
+
def list(page=1)
|
18
|
+
return PaystackSubaccounts.list(@paystack, page)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def PaystackSubaccounts.create(paystackObj, data)
|
23
|
+
initPostRequest(paystackObj,"#{API::SUBACCOUNT_PATH}", data)
|
24
|
+
end
|
25
|
+
|
26
|
+
def PaystackSubaccounts.update(paystackObj, subaccount_id, data)
|
27
|
+
initPutRequest(paystackObj,"#{API::SUBACCOUNT_PATH}/#{subaccount_id}", data)
|
28
|
+
end
|
29
|
+
|
30
|
+
def PaystackSubaccounts.get(paystackObj, subaccount_id)
|
31
|
+
initGetRequest(paystackObj, "#{API::SUBACCOUNT_PATH}/#{subaccount_id}")
|
32
|
+
end
|
33
|
+
|
34
|
+
def PaystackSubaccounts.list(paystackObj, page=1)
|
35
|
+
initGetRequest(paystackObj, "#{API::SUBACCOUNT_PATH}?page=#{page}")
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
|
4
|
+
class PaystackSubscriptions < PaystackBaseObject
|
5
|
+
|
6
|
+
def create(data={})
|
7
|
+
return PaystackSubscriptions.create(@paystack, data)
|
8
|
+
end
|
9
|
+
|
10
|
+
def get(subscription_id)
|
11
|
+
return PaystackSubscriptions.get(@paystack, subscription_id)
|
12
|
+
end
|
13
|
+
|
14
|
+
def disable(data={})
|
15
|
+
return PaystackSubscriptions.disable(@paystack, data)
|
16
|
+
end
|
17
|
+
|
18
|
+
def enable(data={})
|
19
|
+
return PaystackSubscriptions.enable(@paystack, data)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def PaystackSubscriptions.create(paystackObj, data)
|
24
|
+
initPostRequest(paystackObj, "#{API::SUBSCRIPTION_PATH}", data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def PaystackSubscriptions.get(paystackObj, subscription_id)
|
28
|
+
initGetRequest(paystackObj, "#{API::SUBSCRIPTION_PATH}/#{subscription_id}")
|
29
|
+
end
|
30
|
+
|
31
|
+
def PaystackSubscriptions.enable(paystackObj, data={})
|
32
|
+
initPostRequest(paystackObj, "#{API::SUBSCRIPTION_PATH}/enable", data)
|
33
|
+
end
|
34
|
+
|
35
|
+
def PaystackSubscriptions.disable(paystackObj, data)
|
36
|
+
initPostRequest(paystackObj, "#{API::SUBSCRIPTION_PATH}/disable", data)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|
@@ -1,70 +1,63 @@
|
|
1
|
-
require 'paystack/objects/base.rb'
|
2
|
-
|
3
|
-
class PaystackTransactions < PaystackBaseObject
|
4
|
-
|
5
|
-
def initializeTransaction(args={})
|
6
|
-
return PaystackTransactions.initializeTransaction(@paystack, args)
|
7
|
-
end
|
8
|
-
|
9
|
-
def list(page=1)
|
10
|
-
return PaystackTransactions.list(@paystack, page)
|
11
|
-
end
|
12
|
-
|
13
|
-
def get(transaction_id)
|
14
|
-
return PaystackTransactions.get(@paystack, transaction_id)
|
15
|
-
end
|
16
|
-
|
17
|
-
def verify transaction_reference
|
18
|
-
return PaystackTransactions.verify(@paystack, transaction_reference)
|
19
|
-
end
|
20
|
-
|
21
|
-
def totals page=1
|
22
|
-
return PaystackTransactions.totals(@paystack, page)
|
23
|
-
end
|
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
|
-
hash = {:authorization_code => authorization_code, :amount => amount, :email => email}.merge(args)
|
65
|
-
initPostRequest(paystackObj,"#{API::TRANSACTION_PATH}/charge_authorization", hash, true)
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
class PaystackTransactions < PaystackBaseObject
|
4
|
+
|
5
|
+
def initializeTransaction(args={})
|
6
|
+
return PaystackTransactions.initializeTransaction(@paystack, args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(page=1)
|
10
|
+
return PaystackTransactions.list(@paystack, page)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(transaction_id)
|
14
|
+
return PaystackTransactions.get(@paystack, transaction_id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def verify transaction_reference
|
18
|
+
return PaystackTransactions.verify(@paystack, transaction_reference)
|
19
|
+
end
|
20
|
+
|
21
|
+
def totals page=1
|
22
|
+
return PaystackTransactions.totals(@paystack, page)
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def chargeAuthorization(authorization_code, email, amount,args = {})
|
27
|
+
return PaystackTransactions.chargeAuthorization(@paystack,authorization_code,email, amount, args)
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
# => Public Static methods
|
32
|
+
|
33
|
+
|
34
|
+
def PaystackTransactions.initializeTransaction(paystackObj, args)
|
35
|
+
initPostRequest(paystackObj,"#{API::TRANSACTION_PATH}/initialize", args,true)
|
36
|
+
end
|
37
|
+
|
38
|
+
def PaystackTransactions.list(paystackObj, page=1)
|
39
|
+
|
40
|
+
initGetRequest(paystackObj, "#{API::TRANSACTION_PATH}?page=#{page}")
|
41
|
+
end
|
42
|
+
|
43
|
+
def PaystackTransactions.get(paystackObj, transaction_id)
|
44
|
+
initGetRequest(paystackObj, "#{API::TRANSACTION_PATH}/#{transaction_id}")
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
def PaystackTransactions.verify(paystackObj, transaction_reference)
|
49
|
+
initGetRequest(paystackObj, "#{API::TRANSACTION_PATH}/verify/#{transaction_reference}")
|
50
|
+
end
|
51
|
+
|
52
|
+
def PaystackTransactions.totals(paystackObj, page=1)
|
53
|
+
initGetRequest(paystackObj, "#{API::TRANSACTION_PATH}/totals?page=#{page}")
|
54
|
+
end
|
55
|
+
|
56
|
+
def PaystackTransactions.chargeAuthorization(paystackObj,authorization_code,email, amount,args = {})
|
57
|
+
hash = {:authorization_code => authorization_code, :amount => amount, :email => email}.merge(args)
|
58
|
+
initPostRequest(paystackObj,"#{API::TRANSACTION_PATH}/charge_authorization", hash, true)
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'paystack/objects/base.rb'
|
2
|
+
|
3
|
+
class PaystackTransfers < PaystackBaseObject
|
4
|
+
|
5
|
+
def initializeTransfer(args={})
|
6
|
+
return PaystackTransfers.initializeTransfer(@paystack, args)
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(page=1)
|
10
|
+
return PaystackTransfers.list(@paystack, page)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(transfer_code)
|
14
|
+
return PaystackTransfers.get(@paystack, transfer_code)
|
15
|
+
end
|
16
|
+
|
17
|
+
def authorize(data={})
|
18
|
+
return PaystackTransfers.authorize(@paystack,data)
|
19
|
+
end
|
20
|
+
|
21
|
+
def resendOtp(data={})
|
22
|
+
return PaystackTransfers.resendOtp(@paystack,data)
|
23
|
+
end
|
24
|
+
|
25
|
+
def disableOtp
|
26
|
+
return PaystackTransfers.disableOtp(@paystack)
|
27
|
+
end
|
28
|
+
|
29
|
+
def confirmDisableOtp(data={})
|
30
|
+
return PaystackTransfers.confirmDisableOTP(@paystack,otp)
|
31
|
+
end
|
32
|
+
|
33
|
+
def enableOtp
|
34
|
+
return PaystackTransfers.enableOtp(@paystack)
|
35
|
+
end
|
36
|
+
|
37
|
+
# => Public Static methods
|
38
|
+
|
39
|
+
def PaystackTransfers.initializeTransfer(paystackObj, args)
|
40
|
+
initPostRequest(paystackObj,"#{API::TRANSFER_PATH}", args,true)
|
41
|
+
end
|
42
|
+
|
43
|
+
def PaystackTransfers.list(paystackObj, page=1)
|
44
|
+
initGetRequest(paystackObj, "#{API::TRANSFER_PATH}?page=#{page}")
|
45
|
+
end
|
46
|
+
|
47
|
+
def PaystackTransfers.get(paystackObj, transfer_code)
|
48
|
+
initGetRequest(paystackObj, "#{API::TRANSFER_PATH}/#{transfer_code}")
|
49
|
+
end
|
50
|
+
|
51
|
+
def PaystackTransfers.authorize(paystackObj, data={})
|
52
|
+
initPostRequest(paystackObj, "#{API::TRANSFER_PATH}/finalize_transfer/",data)
|
53
|
+
end
|
54
|
+
|
55
|
+
def PaystackTransfers.resendOtp(paystackObj, data={})
|
56
|
+
initPostRequest(paystackObj, "#{API::TRANSFER_PATH}/resend_otp",data)
|
57
|
+
end
|
58
|
+
|
59
|
+
def PaystackTransfers.disableOtp(paystackObj)
|
60
|
+
initPostRequest(paystackObj, "#{API::TRANSFER_PATH}/disable_otp")
|
61
|
+
end
|
62
|
+
|
63
|
+
def PaystackTransfers.confirmDisableOtp(paystackObj, data={})
|
64
|
+
initPostRequest(paystackObj, "#{API::TRANSFER_PATH}/disable_otp_finalize",data)
|
65
|
+
end
|
66
|
+
|
67
|
+
def PaystackTransfers.enableOtp(paystackObj)
|
68
|
+
initPostRequest(paystackObj, "#{API::TRANSFER_PATH}/enable_otp")
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
end
|