paystackapi 0.2.0 → 0.3.0
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/{LICENSE.txt → LICENSE.md} +6 -6
- data/README.md +121 -20
- data/lib/paystackapi.rb +75 -136
- data/lib/paystackapi/core/bank.rb +7 -0
- data/lib/paystackapi/{base.rb → core/base.rb} +0 -0
- data/lib/paystackapi/core/customer.rb +18 -0
- data/lib/paystackapi/core/otp.rb +8 -0
- data/lib/paystackapi/core/plan.rb +24 -0
- data/lib/paystackapi/core/subscription.rb +30 -0
- data/lib/paystackapi/{transaction.rb → core/transaction.rb} +4 -4
- data/lib/paystackapi/core/transfer.rb +36 -0
- data/lib/paystackapi/{version.rb → core/version.rb} +1 -1
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18f3ee40677cc57e49748782109113f13f61343bb660d34797ae5535b8d53547
|
4
|
+
data.tar.gz: 93ed210d71f031a906391b5853fdb2838e625cbe1aaefe9cf4ef1dc5745e9e6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2eeca44758bb69e135af17453f1eeb487c8f1ba4002a70692bd640ca83b38c525faa6bc062b63852f7ece4faa752e8fe792b9b58fb55421bb1eb5f0d5e8ef2b
|
7
|
+
data.tar.gz: 5ce4697c0920529c83a029586ae7f3654db325da83644f9b407f7b48db53bebf010442e72d796155b1bc84a2c8727b0d89ccdec7bf46707bedf26826989fe1ed
|
data/{LICENSE.txt → LICENSE.md}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
1
|
+
MIT License
|
2
2
|
|
3
|
-
Copyright (c) 2019
|
3
|
+
Copyright (c) 2019 Samuel Joseph
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,43 +1,144 @@
|
|
1
|
-
# Paystackapi
|
1
|
+
# Paystackapi :moneybag:
|
2
|
+
[](https://circleci.com/gh/samuel52/PaystackRubyApi)
|
3
|
+
[](https://badge.fury.io/rb/paystackapi)
|
2
4
|
|
3
|
-
|
5
|
+
Paystack gem for Ruby api only application
|
6
|
+
### Installation
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
8
|
+
Simply add this line to your application's Gemfile:
|
10
9
|
|
11
10
|
```ruby
|
12
11
|
gem 'paystackapi'
|
13
12
|
```
|
14
13
|
|
15
14
|
And then execute:
|
16
|
-
|
17
|
-
|
15
|
+
```ruby
|
16
|
+
bundle install
|
17
|
+
```
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
|
+
```ruby
|
21
|
+
gem install paystackapi
|
22
|
+
```
|
23
|
+
|
24
|
+
### Usage
|
20
25
|
|
21
|
-
|
26
|
+
You may need to install [Dotenv](https://github.com/bkeepers/dotenv) to set you environmental variables. Set the requirements in your controller files where needed.
|
22
27
|
|
23
|
-
|
28
|
+
```ruby
|
29
|
+
require 'paystackapi'
|
30
|
+
require 'dotenv/load'
|
31
|
+
```
|
24
32
|
|
25
|
-
|
33
|
+
### Transactions :credit_card:
|
34
|
+
###### Verify Payment
|
26
35
|
|
27
|
-
|
36
|
+
```ruby
|
37
|
+
|
38
|
+
def validate_payment
|
39
|
+
paystack_ref = params[:reference_code] # get payment ref after initializing payment from the frontend
|
40
|
+
verify = Paystackapi::PaystackTransactions.verify(paystack_ref)
|
41
|
+
end
|
42
|
+
```
|
43
|
+
###### Other Transaction Methods :point_down:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
Paystackapi::PaystackTransactions.list # list all transactions
|
47
|
+
Paystackapi::PaystackTransactions.totals # show transaction totals
|
48
|
+
Paystackapi::PaystackTransactions.list_single(arg) # list single transaction
|
49
|
+
Paystackapi::PaystackTransactions.charge(arg) # charge authorization from card
|
50
|
+
```
|
51
|
+
### Customers :two_men_holding_hands:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
def customers
|
55
|
+
customerEmail = params[:customer_email]
|
56
|
+
customer = Paystackapi::PaystackCustomers.create(customerEmail)
|
57
|
+
end
|
58
|
+
```
|
59
|
+
###### Other Customer Methods
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
Paystackapi::PaystackCustomers.list #list all customers
|
63
|
+
Paystackapi::PaystackCustomers.list_single(arg) #get by id
|
64
|
+
```
|
65
|
+
### Plans :cyclone:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
def plans
|
69
|
+
createPlan = {
|
70
|
+
CustomerName = params[:name]
|
71
|
+
interval = params[:interval]
|
72
|
+
amount = params[:amount]
|
73
|
+
}
|
74
|
+
customer = Paystackapi::PaystackPlans.create(createPlan)
|
75
|
+
end
|
76
|
+
```
|
77
|
+
###### Other Plans Methods
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
Paystackapi::PaystackPlans.list #list all paystack plans
|
81
|
+
Paystackapi::PaystackPlans.list_single(arg) #get by id
|
82
|
+
Paystackapi::PaystackPlans.update(arg) #update plan by id
|
83
|
+
```
|
84
|
+
### Subscription :electric_plug:
|
85
|
+
```ruby
|
86
|
+
def subscription
|
87
|
+
createSub = {
|
88
|
+
CustomerToken = "CUS_xnxdt6s1zg1f4nx"
|
89
|
+
planCode = "PLN_gx2wn530m0i3w3m"
|
90
|
+
}
|
91
|
+
|
92
|
+
customer = Paystackapi::PaystackSubscription.create(createSub)
|
93
|
+
end
|
94
|
+
```
|
95
|
+
###### Other Subcription Methods
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
Paystackapi::PaystackSubscription.list #list all subs
|
99
|
+
Paystackapi::PaystackSubscription.list_single(arg) #get subs by id
|
100
|
+
Paystackapi::PaystackSubscription.disable #disable subs
|
101
|
+
Paystackapi::PaystackSubscription.enable #enable subs
|
102
|
+
```
|
103
|
+
### Paystack Transfer :boom:
|
104
|
+
```ruby
|
105
|
+
def transfer
|
106
|
+
createTrans = {
|
107
|
+
type = "nuban" #use params[:something] to get the parameters from your endpoint
|
108
|
+
name = "Raz"
|
109
|
+
description = "Razite"
|
110
|
+
account_number = "01000000419"
|
111
|
+
bank_code = "044"
|
112
|
+
currency = "NGN"
|
113
|
+
}
|
114
|
+
customer = Paystackapi::PaystackTransfer.generate(createTrans)
|
115
|
+
end
|
116
|
+
```
|
117
|
+
###### Other Transfer Methods
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
Paystackapi::PaystackTransfer.list_reciept #list all transfers Reciept
|
121
|
+
Paystackapi::PaystackTransfer.update_reciept(arg, arg) #update reciept
|
122
|
+
Paystackapi::PaystackTransfer.initailize(arg) #initalize a transfer (triggers an otp here)
|
123
|
+
Paystackapi::PaystackTransfer.list_transfer #list all transfers
|
124
|
+
Paystackapi::PaystackTransfer.finalize(arg) #finalize a transfer
|
125
|
+
|
126
|
+
```
|
127
|
+
### Bank List :bank:
|
128
|
+
```ruby
|
129
|
+
Paystackapi::PaystackSubscription.list_banks #list all Nigerian Banks
|
130
|
+
```
|
28
131
|
|
29
|
-
|
132
|
+
### Contributing
|
30
133
|
|
31
|
-
|
134
|
+
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.
|
32
135
|
|
33
|
-
|
136
|
+
### Who are you?
|
34
137
|
|
35
|
-
|
138
|
+
I'm Sam, find me on [twitter](https://twitter.com/sammyngn).
|
36
139
|
|
37
|
-
|
140
|
+
### License
|
38
141
|
|
39
142
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
143
|
|
41
|
-
## Code of Conduct
|
42
144
|
|
43
|
-
Everyone interacting in the Paystackapi project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/paystackapi/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/paystackapi.rb
CHANGED
@@ -1,164 +1,103 @@
|
|
1
|
-
require 'paystackapi/version'
|
2
|
-
require 'paystackapi/base.rb'
|
1
|
+
require 'paystackapi/core/version'
|
2
|
+
require 'paystackapi/core/base.rb'
|
3
|
+
require 'paystackapi/core/transaction.rb'
|
4
|
+
require 'paystackapi/core/bank.rb'
|
5
|
+
require 'paystackapi/core/customer.rb'
|
6
|
+
require 'paystackapi/core/otp.rb'
|
7
|
+
require 'paystackapi/core/plan.rb'
|
8
|
+
require 'paystackapi/core/transfer.rb'
|
9
|
+
require 'paystackapi/core/subscription.rb'
|
3
10
|
require 'httparty'
|
4
|
-
require 'openssl'
|
5
11
|
require 'dotenv'
|
6
12
|
|
7
13
|
module Paystackapi
|
8
14
|
class PaystackTransactions
|
9
|
-
def self.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
def self.fetch_transaction(body)
|
25
|
-
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "#{body}",
|
26
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
27
|
-
return api
|
28
|
-
end
|
29
|
-
def self.charge_authorization(body)
|
30
|
-
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "charge_authorization",
|
31
|
-
:body => body.to_json,
|
32
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
33
|
-
return api
|
15
|
+
def self.verify(body)
|
16
|
+
Transaction.verify_payment(body)
|
17
|
+
end
|
18
|
+
def self.list
|
19
|
+
Transaction.list_transactions
|
20
|
+
end
|
21
|
+
def self.totals
|
22
|
+
Transaction.list_transaction_totals
|
23
|
+
end
|
24
|
+
def self.list_single(body)
|
25
|
+
Transaction.fetch_transaction(body)
|
26
|
+
end
|
27
|
+
def self.charge(body)
|
28
|
+
Transaction.charge_authorization(body)
|
34
29
|
end
|
35
30
|
end
|
36
31
|
class PaystackCustomers
|
37
|
-
def self.
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
def self.
|
44
|
-
|
45
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
46
|
-
return api
|
47
|
-
end
|
48
|
-
def self.fetch_a_customer(body)
|
49
|
-
api = HTTParty.get("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}/" + "#{body}",
|
50
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
51
|
-
return api
|
32
|
+
def self.create(body)
|
33
|
+
Transaction.create_customer(body)
|
34
|
+
end
|
35
|
+
def self.list
|
36
|
+
Transaction.list_customer
|
37
|
+
end
|
38
|
+
def self.list_single(body)
|
39
|
+
Transaction.fetch_a_customer(body)
|
52
40
|
end
|
53
41
|
end
|
54
42
|
|
55
43
|
class PaystackPlans
|
56
|
-
def self.
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
def self.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
def self.list_single_plan(body)
|
68
|
-
api = HTTParty.get("#{API::BASE_URL}" + "#{API::PLAN_PATH}" + "#{body}",
|
69
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
70
|
-
return api
|
71
|
-
end
|
72
|
-
def self.update_plan(body)
|
73
|
-
api = HTTParty.put("#{API::BASE_URL}" + "#{API::PLAN_PATH}" + "#{body}",
|
74
|
-
:body => body.to_json,
|
75
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
76
|
-
return api
|
44
|
+
def self.create(body)
|
45
|
+
Transaction.create_plan(body)
|
46
|
+
end
|
47
|
+
def self.list
|
48
|
+
Transaction.list_plans
|
49
|
+
end
|
50
|
+
def self.list_single(body)
|
51
|
+
Transaction.list_single_plan(body)
|
52
|
+
end
|
53
|
+
def self.update(body)
|
54
|
+
Transaction.update_plan(body)
|
77
55
|
end
|
78
56
|
end
|
79
57
|
|
80
58
|
|
81
59
|
class PaystackSubscription
|
82
|
-
def self.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
88
|
-
def self.
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
return api
|
97
|
-
end
|
98
|
-
def self.disable_subscription()
|
99
|
-
api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "disable",
|
100
|
-
:body => body.to_json,
|
101
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
102
|
-
return api
|
103
|
-
end
|
104
|
-
def self.enable_subscription()
|
105
|
-
api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "enable",
|
106
|
-
:body => body.to_json,
|
107
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
108
|
-
return api
|
60
|
+
def self.create(body)
|
61
|
+
Transaction.create_subscription(body)
|
62
|
+
end
|
63
|
+
def self.list
|
64
|
+
Transaction.list_subscription
|
65
|
+
end
|
66
|
+
def self.list_single(body)
|
67
|
+
Transaction.list_single_subscription(body)
|
68
|
+
end
|
69
|
+
def self.disable
|
70
|
+
Transaction.disable_subscription
|
71
|
+
end
|
72
|
+
def self.enable
|
73
|
+
Transaction.enable_subscription
|
109
74
|
end
|
110
|
-
|
111
75
|
end
|
112
76
|
|
113
77
|
class PaystackTransfer
|
114
|
-
def self.
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
end
|
120
|
-
def self.
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
def self.init_transfer(body)
|
132
|
-
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
|
133
|
-
:body => body.to_json,
|
134
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
135
|
-
return api
|
136
|
-
end
|
137
|
-
def self.list_transfers(body)
|
138
|
-
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
|
139
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
140
|
-
return api
|
141
|
-
end
|
142
|
-
def self.finalize_transfers(body)
|
143
|
-
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/finalize_transfer",
|
144
|
-
:body => body.to_json,
|
145
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
146
|
-
return api
|
147
|
-
end
|
148
|
-
def self.resend_otp(body)
|
149
|
-
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/resend_otp",
|
150
|
-
:body => body.to_json,
|
151
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
152
|
-
return api
|
78
|
+
def self.generate(body)
|
79
|
+
Transaction.create_transfer_reciept(body)
|
80
|
+
end
|
81
|
+
def self.list_reciept
|
82
|
+
Transaction.list_transfer_reciept
|
83
|
+
end
|
84
|
+
def self.update_reciept(body, trf_code)
|
85
|
+
Transaction.update_transfer_reciept(body)
|
86
|
+
end
|
87
|
+
def self.initailize(body)
|
88
|
+
Transaction.init_transfer(body)
|
89
|
+
end
|
90
|
+
def self.list_transfer
|
91
|
+
Transaction.list_transfers
|
92
|
+
end
|
93
|
+
def self.finalize(body)
|
94
|
+
Transaction.finalize_transfers(body)
|
153
95
|
end
|
154
|
-
|
155
96
|
end
|
156
97
|
|
157
98
|
class PaystackBank
|
158
|
-
def self.
|
159
|
-
|
160
|
-
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
161
|
-
return api
|
99
|
+
def self.list_banks
|
100
|
+
Transaction.banks
|
162
101
|
end
|
163
102
|
end
|
164
103
|
end
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Customer
|
2
|
+
def self.create_customer(body)
|
3
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}",
|
4
|
+
:body => body.to_json,
|
5
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
6
|
+
return api
|
7
|
+
end
|
8
|
+
def self.list_customer
|
9
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}",
|
10
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
11
|
+
return api
|
12
|
+
end
|
13
|
+
def self.fetch_a_customer(body)
|
14
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::CUSTOMER_PATH}/" + "#{body}",
|
15
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
16
|
+
return api
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
module Otp
|
2
|
+
def self.resend_otp(body)
|
3
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/resend_otp",
|
4
|
+
:body => body.to_json,
|
5
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
6
|
+
return api
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Plan
|
2
|
+
def self.create_plan(body)
|
3
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::PLAN_PATH}",
|
4
|
+
:body => body.to_json,
|
5
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
6
|
+
return api
|
7
|
+
end
|
8
|
+
def self.list_plans
|
9
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::PLAN_PATH}",
|
10
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
11
|
+
return api
|
12
|
+
end
|
13
|
+
def self.list_single_plan(body)
|
14
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::PLAN_PATH}" + "#{body}",
|
15
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
16
|
+
return api
|
17
|
+
end
|
18
|
+
def self.update_plan(body)
|
19
|
+
api = HTTParty.put("#{API::BASE_URL}" + "#{API::PLAN_PATH}" + "#{body}",
|
20
|
+
:body => body.to_json,
|
21
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
22
|
+
return api
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Subscription
|
2
|
+
def self.create_subscription(body)
|
3
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
|
4
|
+
:body => body.to_json,
|
5
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
6
|
+
return api
|
7
|
+
end
|
8
|
+
def self.list_subscription
|
9
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
|
10
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
11
|
+
return api
|
12
|
+
end
|
13
|
+
def self.list_single_subscription(body)
|
14
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}" + "#{body}",
|
15
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
16
|
+
return api
|
17
|
+
end
|
18
|
+
def self.disable_subscription
|
19
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "disable",
|
20
|
+
:body => body.to_json,
|
21
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
22
|
+
return api
|
23
|
+
end
|
24
|
+
def self.enable_subscription
|
25
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "enable",
|
26
|
+
:body => body.to_json,
|
27
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
28
|
+
return api
|
29
|
+
end
|
30
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
|
1
|
+
module Transaction
|
2
2
|
def self.verify_payment(body)
|
3
3
|
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}" + "/verify/#{body}",
|
4
4
|
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
5
5
|
return api
|
6
6
|
end
|
7
|
-
def self.list_transactions
|
7
|
+
def self.list_transactions
|
8
8
|
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}",
|
9
9
|
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
10
10
|
return api
|
11
11
|
end
|
12
|
-
def self.list_transaction_totals
|
12
|
+
def self.list_transaction_totals
|
13
13
|
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "totals",
|
14
14
|
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
15
15
|
return api
|
@@ -24,5 +24,5 @@ class Transaction
|
|
24
24
|
:body => body.to_json,
|
25
25
|
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
26
26
|
return api
|
27
|
-
end
|
27
|
+
end
|
28
28
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Transfer
|
2
|
+
def self.create_transfer_reciept(body)
|
3
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}",
|
4
|
+
:body => body.to_json,
|
5
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
6
|
+
return api
|
7
|
+
end
|
8
|
+
def self.list_transfer_reciept
|
9
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}",
|
10
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
11
|
+
return api
|
12
|
+
end
|
13
|
+
def self.update_transfer_reciept(body, trf_code)
|
14
|
+
api = HTTParty.put("#{API::BASE_URL}" + "#{API::RECIPIENT_PATH}" + "#{trf_code}",
|
15
|
+
:body => body.to_json,
|
16
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
17
|
+
return api
|
18
|
+
end
|
19
|
+
def self.init_transfer(body)
|
20
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
|
21
|
+
:body => body.to_json,
|
22
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
23
|
+
return api
|
24
|
+
end
|
25
|
+
def self.list_transfers
|
26
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}",
|
27
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
28
|
+
return api
|
29
|
+
end
|
30
|
+
def self.finalize_transfers(body)
|
31
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSFER_PATH}" + "/finalize_transfer",
|
32
|
+
:body => body.to_json,
|
33
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
34
|
+
return api
|
35
|
+
end
|
36
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paystackapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Joseph
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,12 +94,18 @@ extensions: []
|
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
96
|
- CODE_OF_CONDUCT.md
|
97
|
-
- LICENSE.
|
97
|
+
- LICENSE.md
|
98
98
|
- README.md
|
99
99
|
- lib/paystackapi.rb
|
100
|
-
- lib/paystackapi/
|
101
|
-
- lib/paystackapi/
|
102
|
-
- lib/paystackapi/
|
100
|
+
- lib/paystackapi/core/bank.rb
|
101
|
+
- lib/paystackapi/core/base.rb
|
102
|
+
- lib/paystackapi/core/customer.rb
|
103
|
+
- lib/paystackapi/core/otp.rb
|
104
|
+
- lib/paystackapi/core/plan.rb
|
105
|
+
- lib/paystackapi/core/subscription.rb
|
106
|
+
- lib/paystackapi/core/transaction.rb
|
107
|
+
- lib/paystackapi/core/transfer.rb
|
108
|
+
- lib/paystackapi/core/version.rb
|
103
109
|
homepage: https://github.com/samuel52/PaystackRubyApi.git
|
104
110
|
licenses:
|
105
111
|
- MIT
|