paystack 0.1.4 → 0.1.5
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 +4 -4
- data/.rspec +2 -2
- data/.travis.yml +16 -0
- data/README.md +58 -22
- data/Rakefile +1 -2
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/paystack.rb +55 -54
- data/lib/paystack/error.rb +11 -12
- data/lib/paystack/modules/api.rb +8 -7
- 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/subscriptions.rb +40 -0
- data/lib/paystack/objects/transactions.rb +63 -63
- data/lib/paystack/utils/utils.rb +104 -105
- data/lib/paystack/version.rb +1 -1
- data/paystack.gemspec +7 -5
- metadata +11 -10
- data/key.pem +0 -0
@@ -1,106 +1,106 @@
|
|
1
|
-
require 'paystack/utils/utils.rb'
|
2
|
-
|
3
|
-
class PaystackCard
|
4
|
-
attr_reader :name, :number,:cvc,:expiryMonth,:expiryYear, :addressLine1,:addressLine2, :addressLine3, :addressLine4, :addressCountry, :addressPostalCode, :email, :cardCountry, :cardIssuer
|
5
|
-
|
6
|
-
MAX_DINERS_CARD_LENGTH = 14
|
7
|
-
MAX_AMERICAN_EXPRESS_CARD_LENGTH = 15
|
8
|
-
MAX_NORMAL_CARD_LENGTH = 16
|
9
|
-
|
10
|
-
PATTERN_VISA = /^4[0-9]{6,}$/
|
11
|
-
PATTERN_MASTERCARD = /^5[1-5][0-9]{5,}$/
|
12
|
-
PATTERN_AMERICAN_EXPRESS = /^3[47][0-9]{5,}$/
|
13
|
-
PATTERN_DINERS_CLUB = /^3(?:0[0-5]|[68][0-9])[0-9]{4,}$/
|
14
|
-
PATTERN_DISCOVER = /^6(?:011|5[0-9]{2})[0-9]{3,}$/
|
15
|
-
PATTERN_JCB = /^(?:2131|1800|35[0-9]{3})[0-9]{3,}/
|
16
|
-
|
17
|
-
def initialize(args = {})
|
18
|
-
@name = Utils.nullifyString(args[:name])
|
19
|
-
@number = Utils.nullifyString(args[:number])
|
20
|
-
@cvc = Utils.nullifyString(args[:cvc])
|
21
|
-
@expiryMonth = Utils.nullifyString(args[:expiryMonth])
|
22
|
-
@expiryYear = Utils.nullifyString(args[:expiryYear])
|
23
|
-
@cardIssuer = PaystackCard.getCardType(@number)
|
24
|
-
end
|
25
|
-
|
26
|
-
def isValidCard()
|
27
|
-
if (@cvc != nil)
|
28
|
-
return isValidNumber() && isValidExpiryDate() && isValidCVC()
|
29
|
-
else
|
30
|
-
return isValidNumber() && isValidExpiryDate()
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def PaystackCard.getCardType(number)
|
36
|
-
if(number == nil)
|
37
|
-
return 'invalid'
|
38
|
-
end
|
39
|
-
if(number =~ PATTERN_VISA) != nil
|
40
|
-
return 'visa'
|
41
|
-
end
|
42
|
-
|
43
|
-
if(number =~ PATTERN_MASTERCARD) != nil
|
44
|
-
return 'mastercard'
|
45
|
-
end
|
46
|
-
|
47
|
-
if(number =~ PATTERN_AMERICAN_EXPRESS) != nil
|
48
|
-
return 'american_express'
|
49
|
-
end
|
50
|
-
|
51
|
-
if(number =~ PATTERN_DINERS_CLUB)
|
52
|
-
return 'diners'
|
53
|
-
end
|
54
|
-
if(number =~ PATTERN_DISCOVER)
|
55
|
-
return 'discover'
|
56
|
-
end
|
57
|
-
if(number =~ PATTERN_JCB)
|
58
|
-
return 'jcb'
|
59
|
-
end
|
60
|
-
return 'unknown'
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
def isValidNumber
|
69
|
-
if(Utils.isEmpty(@number))
|
70
|
-
return false
|
71
|
-
end
|
72
|
-
formatted_number = @number.gsub(/\s+|-/) {|s| '' }.strip
|
73
|
-
|
74
|
-
if(Utils.isEmpty(formatted_number) || !Utils.isWholePositiveNumber(formatted_number) || !Utils.isLuhnValidNumber(formatted_number))
|
75
|
-
|
76
|
-
return false
|
77
|
-
end
|
78
|
-
if PaystackCard.getCardType(formatted_number).eql?('diners')
|
79
|
-
return (formatted_number.length == MAX_DINERS_CARD_LENGTH)
|
80
|
-
end
|
81
|
-
|
82
|
-
if PaystackCard.getCardType(formatted_number).eql?('american_express')
|
83
|
-
return (formatted_number.length == MAX_AMERICAN_EXPRESS_CARD_LENGTH)
|
84
|
-
end
|
85
|
-
|
86
|
-
return (formatted_number.length == MAX_NORMAL_CARD_LENGTH)
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
def isValidCVC
|
91
|
-
if(@cvc.eql?(""))
|
92
|
-
return false
|
93
|
-
end
|
94
|
-
cvc = @cvc.strip
|
95
|
-
cvc_len = cvc.length
|
96
|
-
|
97
|
-
validLength = ((cvc_len >= 3 && cvc_len <= 4) || (@cardIssuer.eql?('american_express') && cvc_len == 4) ||(!@cardIssuer.eql?('american_express') && cvc_len == 3))
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
def isValidExpiryDate()
|
102
|
-
return !(@expiryMonth == nil || @expiryYear == nil) && Utils.hasCardExpired(@expiryYear, @expiryMonth);
|
103
|
-
end
|
104
|
-
|
105
|
-
|
1
|
+
require 'paystack/utils/utils.rb'
|
2
|
+
|
3
|
+
class PaystackCard
|
4
|
+
attr_reader :name, :number,:cvc,:expiryMonth,:expiryYear, :addressLine1,:addressLine2, :addressLine3, :addressLine4, :addressCountry, :addressPostalCode, :email, :cardCountry, :cardIssuer
|
5
|
+
|
6
|
+
MAX_DINERS_CARD_LENGTH = 14
|
7
|
+
MAX_AMERICAN_EXPRESS_CARD_LENGTH = 15
|
8
|
+
MAX_NORMAL_CARD_LENGTH = 16
|
9
|
+
|
10
|
+
PATTERN_VISA = /^4[0-9]{6,}$/
|
11
|
+
PATTERN_MASTERCARD = /^5[1-5][0-9]{5,}$/
|
12
|
+
PATTERN_AMERICAN_EXPRESS = /^3[47][0-9]{5,}$/
|
13
|
+
PATTERN_DINERS_CLUB = /^3(?:0[0-5]|[68][0-9])[0-9]{4,}$/
|
14
|
+
PATTERN_DISCOVER = /^6(?:011|5[0-9]{2})[0-9]{3,}$/
|
15
|
+
PATTERN_JCB = /^(?:2131|1800|35[0-9]{3})[0-9]{3,}/
|
16
|
+
|
17
|
+
def initialize(args = {})
|
18
|
+
@name = Utils.nullifyString(args[:name])
|
19
|
+
@number = Utils.nullifyString(args[:number])
|
20
|
+
@cvc = Utils.nullifyString(args[:cvc])
|
21
|
+
@expiryMonth = Utils.nullifyString(args[:expiryMonth])
|
22
|
+
@expiryYear = Utils.nullifyString(args[:expiryYear])
|
23
|
+
@cardIssuer = PaystackCard.getCardType(@number)
|
24
|
+
end
|
25
|
+
|
26
|
+
def isValidCard()
|
27
|
+
if (@cvc != nil)
|
28
|
+
return isValidNumber() && isValidExpiryDate() && isValidCVC()
|
29
|
+
else
|
30
|
+
return isValidNumber() && isValidExpiryDate()
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def PaystackCard.getCardType(number)
|
36
|
+
if(number == nil)
|
37
|
+
return 'invalid'
|
38
|
+
end
|
39
|
+
if(number =~ PATTERN_VISA) != nil
|
40
|
+
return 'visa'
|
41
|
+
end
|
42
|
+
|
43
|
+
if(number =~ PATTERN_MASTERCARD) != nil
|
44
|
+
return 'mastercard'
|
45
|
+
end
|
46
|
+
|
47
|
+
if(number =~ PATTERN_AMERICAN_EXPRESS) != nil
|
48
|
+
return 'american_express'
|
49
|
+
end
|
50
|
+
|
51
|
+
if(number =~ PATTERN_DINERS_CLUB)
|
52
|
+
return 'diners'
|
53
|
+
end
|
54
|
+
if(number =~ PATTERN_DISCOVER)
|
55
|
+
return 'discover'
|
56
|
+
end
|
57
|
+
if(number =~ PATTERN_JCB)
|
58
|
+
return 'jcb'
|
59
|
+
end
|
60
|
+
return 'unknown'
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
def isValidNumber
|
69
|
+
if(Utils.isEmpty(@number))
|
70
|
+
return false
|
71
|
+
end
|
72
|
+
formatted_number = @number.gsub(/\s+|-/) {|s| '' }.strip
|
73
|
+
|
74
|
+
if(Utils.isEmpty(formatted_number) || !Utils.isWholePositiveNumber(formatted_number) || !Utils.isLuhnValidNumber(formatted_number))
|
75
|
+
|
76
|
+
return false
|
77
|
+
end
|
78
|
+
if PaystackCard.getCardType(formatted_number).eql?('diners')
|
79
|
+
return (formatted_number.length == MAX_DINERS_CARD_LENGTH)
|
80
|
+
end
|
81
|
+
|
82
|
+
if PaystackCard.getCardType(formatted_number).eql?('american_express')
|
83
|
+
return (formatted_number.length == MAX_AMERICAN_EXPRESS_CARD_LENGTH)
|
84
|
+
end
|
85
|
+
|
86
|
+
return (formatted_number.length == MAX_NORMAL_CARD_LENGTH)
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
def isValidCVC
|
91
|
+
if(@cvc.eql?(""))
|
92
|
+
return false
|
93
|
+
end
|
94
|
+
cvc = @cvc.strip
|
95
|
+
cvc_len = cvc.length
|
96
|
+
|
97
|
+
validLength = ((cvc_len >= 3 && cvc_len <= 4) || (@cardIssuer.eql?('american_express') && cvc_len == 4) ||(!@cardIssuer.eql?('american_express') && cvc_len == 3))
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
def isValidExpiryDate()
|
102
|
+
return !(@expiryMonth == nil || @expiryYear == nil) && Utils.hasCardExpired(@expiryYear, @expiryMonth);
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
106
|
end
|
@@ -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,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,63 +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
|
-
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
|
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
|