Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/currency_cloud/account_verification.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module CurrencyCloud
class AccountVerification
include CurrencyCloud::Resource
end
end
4 changes: 4 additions & 0 deletions lib/currency_cloud/beneficiary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ class Beneficiary
def self.validate(params)
new(client.post('validate', params))
end

def self.account_verification(params)
result = AccountVerification::new(client.post('account_verification', params))
end
end
end
24 changes: 24 additions & 0 deletions spec/integration/actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,30 @@
expect(beneficiary.payment_types).to include('regular')
end

it 'can #account_verify beneficiaries' do
params = {
bank_country: 'GB',
account_number: '12345678',
routing_code_type_1: 'sort_code',
routing_code_value_1: '123456',
payment_type: 'regular',
beneficiary_entity_type: 'individual',
beneficiary_first_name: 'test',
beneficiary_last_name: 'last',
}

puts "test1"
account_verifaction = CurrencyCloud::Beneficiary.account_verification(params)
puts "test3"

expect(account_verifaction).to be_a_kind_of(CurrencyCloud::AccountVerification)

expect(account_verifaction.actual_name).to include('test last')
expect(account_verifaction.reason_code).to include('AV100')
expect(account_verifaction.answer).to include('full_match')
expect(account_verifaction.reason_type).to include('okay')
end

it 'can use #currency to retrieve balance' do
balance = CurrencyCloud::Balance.currency('GBP')

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
http_interactions:
- request:
method: post
uri: https://devapi.currencycloud.com/v2/beneficiaries/account_verification
body:
encoding: UTF-8
string: bank_country=GB&account_number=12345678&routing_code_type_1=sort_code&routing_code_value_1=123456&payment_type=regular&beneficiary_entity_type=individual&beneficiary_first_name=test&beneficiary_last_name=last
headers:
X-Auth-Token:
- bbdd421bdda373ea69670c9101fa9197
response:
status:
code: 200
message: OK
headers:
Server:
- nginx
Date:
- Sun, 03 May 2015 16:55:03 GMT
Content-Type:
- application/json;charset=utf-8
Content-Length:
- '126'
Connection:
- keep-alive
X-Request-Id:
- '2777975414238700878'
X-Content-Type-Options:
- nosniff
body:
encoding: UTF-8
string: '{ "answer": "full_match", "actual_name": "test last", "reason_code": "AV100", "reason": "Full match.", "reason_type": "okay" }'
http_version:
recorded_at: Sun, 03 May 2015 16:55:03 GMT
recorded_with: VCR 2.9.3
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ http_interactions:
Wimbledon Hill Rd","Wimbledon","London"]}'
http_version:
recorded_at: Sun, 03 May 2015 16:55:03 GMT
recorded_with: VCR 2.9.3
recorded_with: VCR 2.9.3