-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for checking balance and settlement history
- Loading branch information
Showing
7 changed files
with
92 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
require 'paystack/objects/base.rb' | ||
|
||
class PaystackSettlements < PaystackBaseObject | ||
def list(data={}) | ||
return PaystackBanks.list(@paystack, data) | ||
def list | ||
return PaystackSettlements.list(@paystack) | ||
end | ||
|
||
|
||
def PaystackSettlements.list(paystackObj, data={}) | ||
initGetRequest(paystackObj, "#{API::SETTLEMENT_PATH}",data) | ||
def PaystackSettlements.list(paystackObj) | ||
initGetRequest(paystackObj, "#{API::SETTLEMENT_PATH}") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Paystack | ||
class Paystack | ||
VERSION = "0.1.6" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require 'spec_helper' | ||
require 'paystack/objects/balance.rb' | ||
require 'paystack.rb' | ||
|
||
public_test_key = "pk_test_ea7c71f838c766922873f1dd3cc529afe13da1c0" | ||
private_test_key = "sk_test_40e9340686e6187697f8309dbae57c002bb16dd0" | ||
|
||
describe PaystackBalance do | ||
|
||
it "should return paystack account balance" do | ||
paystack = Paystack.new(public_test_key, private_test_key) | ||
balance = PaystackBalance.new(paystack) | ||
expect(balance.nil?).to eq false | ||
hash = balance.get | ||
expect(hash.nil?).to eq false | ||
expect(hash['message']).to eq "Balances retrieved" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require 'spec_helper' | ||
require 'paystack/objects/recipients.rb' | ||
require 'paystack.rb' | ||
|
||
public_test_key = "pk_test_ea7c71f838c766922873f1dd3cc529afe13da1c0" | ||
private_test_key = "sk_test_40e9340686e6187697f8309dbae57c002bb16dd0" | ||
|
||
describe PaystackRecipients do | ||
it "should return a valid recipients object" do | ||
paystack = Paystack.new(public_test_key, private_test_key) | ||
plans = PaystackRecipients.new(paystack) | ||
expect(plans.nil?).to eq false | ||
end | ||
|
||
it "should return a list of recipients" do | ||
paystack = Paystack.new(public_test_key, private_test_key) | ||
plans = PaystackRecipients.new(paystack) | ||
expect(plans.nil?).to eq false | ||
list = plans.list(1) | ||
puts list | ||
expect(list.nil?).to eq false | ||
end | ||
|
||
it "should successfuly create a recipient" do | ||
paystack = Paystack.new(public_test_key, private_test_key) | ||
recipients = PaystackRecipients.new(paystack) | ||
expect(recipients.nil?).to eq false | ||
temp = Random.new_seed.to_s | ||
hash=recipients.create( | ||
:type => "nuban", #Must be nuban | ||
:name => "#{temp[0..2]} Test Plan", | ||
:description => "Dev Test Plan Updated", | ||
:account_number => temp[0..9], #10 digit account number | ||
:bank_code => "044", #monthly, yearly, quarterly, weekly etc | ||
:currency => "NGN", | ||
|
||
) | ||
puts hash | ||
expect(hash.nil?).to eq false | ||
expect(hash['data']['id'].nil?).to eq false | ||
#expect(hash['message']).to eq "Recipient created" | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'spec_helper' | ||
require 'paystack/objects/settlements.rb' | ||
require 'paystack.rb' | ||
|
||
public_test_key = "pk_test_ea7c71f838c766922873f1dd3cc529afe13da1c0" | ||
private_test_key = "sk_test_40e9340686e6187697f8309dbae57c002bb16dd0" | ||
|
||
describe PaystackSettlements do | ||
|
||
it "should return a list of settlements made" do | ||
paystack = Paystack.new(public_test_key, private_test_key) | ||
settlements = PaystackSettlements.new(paystack) | ||
expect(settlements.nil?).to eq false | ||
list = settlements.list | ||
#puts list | ||
expect(settlements.nil?).to eq false | ||
end | ||
|
||
|
||
|
||
end |