paystackapi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE.md +21 -0
- data/README.md +144 -0
- data/lib/paystackapi/core/bank.rb +7 -0
- data/lib/paystackapi/core/base.rb +14 -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/core/transaction.rb +28 -0
- data/lib/paystackapi/core/transfer.rb +36 -0
- data/lib/paystackapi/core/version.rb +3 -0
- data/lib/paystackapi.rb +104 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5ba82afef2fefb1237161ae822651db461aa466b149d1fbfe5a4378b84624e50
|
4
|
+
data.tar.gz: be1d8f666f537b7c3ea39a9a1a8771f3be74487170fa66bf9d803f50bd06d14d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 95f205513c08322e8f46d4a615497e16a9bd4d093c04a314840234b5e952c2f83d1a2225f1a2878299d53f59e4722136901b731a036032b94fe9e1b45d538ab6
|
7
|
+
data.tar.gz: 15004a3e696cf757007d41ed1f556e3976d1af1ddc339e07ac4941bf6f18f10a363300e20562bb0133e5352068386cff67feb4f63d7eba2ccdc8c42bb29a9c7a
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at samuelsadiq52@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Samuel Joseph
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
# Paystackapi :moneybag:
|
2
|
+
[![CircleCI](https://circleci.com/gh/samuel52/PaystackRubyApi.svg?style=shield)](https://circleci.com/gh/samuel52/PaystackRubyApi)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/paystackapi.svg)](https://badge.fury.io/rb/paystackapi)
|
4
|
+
|
5
|
+
Paystack gem for Ruby api only application
|
6
|
+
### Installation
|
7
|
+
|
8
|
+
Simply add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'paystackapi'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```ruby
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```ruby
|
21
|
+
gem install paystackapi
|
22
|
+
```
|
23
|
+
|
24
|
+
### Usage
|
25
|
+
|
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.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'paystackapi'
|
30
|
+
require 'dotenv/load'
|
31
|
+
```
|
32
|
+
|
33
|
+
### Transactions :credit_card:
|
34
|
+
###### Verify Payment
|
35
|
+
|
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
|
+
```
|
131
|
+
|
132
|
+
### Contributing
|
133
|
+
|
134
|
+
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.
|
135
|
+
|
136
|
+
### Who are you?
|
137
|
+
|
138
|
+
I'm Sam, find me on [twitter](https://twitter.com/sammyngn).
|
139
|
+
|
140
|
+
### License
|
141
|
+
|
142
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
143
|
+
|
144
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module API
|
2
|
+
BASE_URL = "https://api.paystack.co"
|
3
|
+
TOKEN_URL ='https://standard.paystack.co/bosco/createmobiletoken'
|
4
|
+
TRANSACTION_PATH = "/transaction"
|
5
|
+
PLAN_PATH = "/plan"
|
6
|
+
CUSTOMER_PATH = "/customer"
|
7
|
+
SUBSCRIPTION_PATH = "/subscription"
|
8
|
+
BANK_PATH = "/bank"
|
9
|
+
SUBACCOUNT_PATH = "/subaccount"
|
10
|
+
BALANCE_PATH = "/balance"
|
11
|
+
RECIPIENT_PATH = "/transferrecipient"
|
12
|
+
TRANSFER_PATH = "/transfer"
|
13
|
+
SETTLEMENT_PATH = "/settlement"
|
14
|
+
end
|
@@ -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, plan)
|
19
|
+
api = HTTParty.put("#{API::BASE_URL}" + "#{API::PLAN_PATH}/" + "#{plan}",
|
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(body)
|
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
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Transaction
|
2
|
+
def self.verify_payment(body)
|
3
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}" + "/verify/#{body}",
|
4
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
5
|
+
return api
|
6
|
+
end
|
7
|
+
def self.list_transactions
|
8
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}",
|
9
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
10
|
+
return api
|
11
|
+
end
|
12
|
+
def self.list_transaction_totals
|
13
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "totals",
|
14
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
15
|
+
return api
|
16
|
+
end
|
17
|
+
def self.fetch_transaction(body)
|
18
|
+
api = HTTParty.get("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "#{body}",
|
19
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
20
|
+
return api
|
21
|
+
end
|
22
|
+
def self.charge_authorization(body)
|
23
|
+
api = HTTParty.post("#{API::BASE_URL}" + "#{API::TRANSACTION_PATH}/" + "charge_authorization",
|
24
|
+
:body => body.to_json,
|
25
|
+
:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
|
26
|
+
return api
|
27
|
+
end
|
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
|
data/lib/paystackapi.rb
ADDED
@@ -0,0 +1,104 @@
|
|
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'
|
10
|
+
require 'httparty'
|
11
|
+
require 'dotenv'
|
12
|
+
|
13
|
+
module Paystackapi
|
14
|
+
class PaystackTransactions
|
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)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
class PaystackCustomers
|
32
|
+
def self.create(body)
|
33
|
+
Customer.create_customer(body)
|
34
|
+
end
|
35
|
+
def self.list
|
36
|
+
Customer.list_customer
|
37
|
+
end
|
38
|
+
def self.list_single(body)
|
39
|
+
Customer.fetch_a_customer(body)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class PaystackPlans
|
44
|
+
def self.create(body)
|
45
|
+
Plan.create_plan(body)
|
46
|
+
end
|
47
|
+
def self.list
|
48
|
+
Plan.list_plans
|
49
|
+
end
|
50
|
+
def self.list_single(body)
|
51
|
+
Plan.list_single_plan(body)
|
52
|
+
end
|
53
|
+
def self.update(body, plan)
|
54
|
+
Plan.update_plan(body, plan)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
class PaystackSubscription
|
60
|
+
def self.create(body)
|
61
|
+
Subscription.create_subscription(body)
|
62
|
+
end
|
63
|
+
def self.list
|
64
|
+
Subscription.list_subscription
|
65
|
+
end
|
66
|
+
def self.list_single(body)
|
67
|
+
Subscription.list_single_subscription(body)
|
68
|
+
end
|
69
|
+
def self.disable(body)
|
70
|
+
Subscription.disable_subscription(body)
|
71
|
+
end
|
72
|
+
def self.enable(body)
|
73
|
+
Subscription.enable_subscription(body)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class PaystackTransfer
|
78
|
+
def self.generate(body)
|
79
|
+
Transfer.create_transfer_reciept(body)
|
80
|
+
end
|
81
|
+
def self.list_reciept
|
82
|
+
Transfer.list_transfer_reciept
|
83
|
+
end
|
84
|
+
def self.update_reciept(body, trf_code)
|
85
|
+
Transfer.update_transfer_reciept(body, trf_code)
|
86
|
+
end
|
87
|
+
def self.initailize(body)
|
88
|
+
Transfer.init_transfer(body)
|
89
|
+
end
|
90
|
+
def self.list_transfer
|
91
|
+
Transfer.list_transfers
|
92
|
+
end
|
93
|
+
def self.finalize(body)
|
94
|
+
Transfer.finalize_transfers(body)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class PaystackBank
|
99
|
+
def self.list_banks
|
100
|
+
Bank.banks
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: paystackapi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Joseph
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.16.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.16.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dotenv
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.6'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: openssl
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.1'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 2.1.2
|
93
|
+
type: :runtime
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '2.1'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 2.1.2
|
103
|
+
description: This gem will be used mostly for ruby api only apps
|
104
|
+
email:
|
105
|
+
- samuelsadiq52@gmail.com
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- CODE_OF_CONDUCT.md
|
111
|
+
- LICENSE.md
|
112
|
+
- README.md
|
113
|
+
- lib/paystackapi.rb
|
114
|
+
- lib/paystackapi/core/bank.rb
|
115
|
+
- lib/paystackapi/core/base.rb
|
116
|
+
- lib/paystackapi/core/customer.rb
|
117
|
+
- lib/paystackapi/core/otp.rb
|
118
|
+
- lib/paystackapi/core/plan.rb
|
119
|
+
- lib/paystackapi/core/subscription.rb
|
120
|
+
- lib/paystackapi/core/transaction.rb
|
121
|
+
- lib/paystackapi/core/transfer.rb
|
122
|
+
- lib/paystackapi/core/version.rb
|
123
|
+
homepage: https://github.com/samuel52/PaystackRubyApi.git
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 2.0.0
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project:
|
143
|
+
rubygems_version: 2.7.7
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: PayStack Gem for Ruby Api applications
|
147
|
+
test_files: []
|