From aa1ab5355c01c5fd0e01d330e6cc97b54ca19a2e Mon Sep 17 00:00:00 2001 From: Ricardo Filipe Sousa Gomes Date: Tue, 30 Jul 2024 11:57:53 +0000 Subject: [PATCH 1/4] PAYB-1151: Add COP SDK --- lib/currency_cloud/beneficiary.rb | 4 +++ spec/integration/actions_spec.rb | 21 ++++++++++++ .../Actions/can_validate_beneficiaries.yml | 34 +++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/lib/currency_cloud/beneficiary.rb b/lib/currency_cloud/beneficiary.rb index 8ab3b8e..17361f1 100644 --- a/lib/currency_cloud/beneficiary.rb +++ b/lib/currency_cloud/beneficiary.rb @@ -9,5 +9,9 @@ class Beneficiary def self.validate(params) new(client.post('validate', params)) end + + def account_verification(params) + AccountVerification:new(client.post('account_verification', params)) + end end end diff --git a/spec/integration/actions_spec.rb b/spec/integration/actions_spec.rb index 89dba59..07d6c45 100644 --- a/spec/integration/actions_spec.rb +++ b/spec/integration/actions_spec.rb @@ -128,6 +128,27 @@ expect(beneficiary.payment_types).to include('regular') end + it 'can #account_verification 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', + } + + account_verifaction = CurrencyCloud::Beneficiary.account_verification(params) + 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') diff --git a/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml b/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml index b69c8df..6b44877 100644 --- a/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml +++ b/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml @@ -36,3 +36,37 @@ http_interactions: http_version: recorded_at: Sun, 03 May 2015 16:55:03 GMT recorded_with: VCR 2.9.3 +- 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: + - '732' + 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 From 479f7f2a3c1288fab416cc81523ffcb1aa4833d3 Mon Sep 17 00:00:00 2001 From: Ricardo Filipe Sousa Gomes Date: Tue, 30 Jul 2024 12:09:25 +0000 Subject: [PATCH 2/4] PAYB-1151: Add COP SDK --- lib/currency_cloud/beneficiary.rb | 4 +-- spec/integration/actions_spec.rb | 12 +++---- .../Actions/can_validate_beneficiaries.yml | 36 +------------------ 3 files changed, 9 insertions(+), 43 deletions(-) diff --git a/lib/currency_cloud/beneficiary.rb b/lib/currency_cloud/beneficiary.rb index 17361f1..b19e510 100644 --- a/lib/currency_cloud/beneficiary.rb +++ b/lib/currency_cloud/beneficiary.rb @@ -10,8 +10,8 @@ def self.validate(params) new(client.post('validate', params)) end - def account_verification(params) - AccountVerification:new(client.post('account_verification', params)) + def self.account_verification(params) + AccountVerification::new(client.post('account_verification', params)) end end end diff --git a/spec/integration/actions_spec.rb b/spec/integration/actions_spec.rb index 07d6c45..f5bbe80 100644 --- a/spec/integration/actions_spec.rb +++ b/spec/integration/actions_spec.rb @@ -140,13 +140,13 @@ beneficiary_last_name: 'last', } - account_verifaction = CurrencyCloud::Beneficiary.account_verification(params) - expect(account_verifaction).to be_a_kind_of(CurrencyCloud::AccountVerification) + # account_verifaction = CurrencyCloud::Beneficiary.account_verification(params) + # 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') + # 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 diff --git a/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml b/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml index 6b44877..ac054f3 100644 --- a/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml +++ b/spec/support/vcr_cassettes/Actions/can_validate_beneficiaries.yml @@ -35,38 +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 -- 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: - - '732' - 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 +recorded_with: VCR 2.9.3 \ No newline at end of file From 56266308d3f3a53beb1b8897bfc6aa7138489a26 Mon Sep 17 00:00:00 2001 From: Ricardo Filipe Sousa Gomes Date: Tue, 30 Jul 2024 12:57:58 +0000 Subject: [PATCH 3/4] Fixes tests --- lib/currency_cloud/beneficiary.rb | 2 +- spec/integration/actions_spec.rb | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/currency_cloud/beneficiary.rb b/lib/currency_cloud/beneficiary.rb index b19e510..8c7f95b 100644 --- a/lib/currency_cloud/beneficiary.rb +++ b/lib/currency_cloud/beneficiary.rb @@ -11,7 +11,7 @@ def self.validate(params) end def self.account_verification(params) - AccountVerification::new(client.post('account_verification', params)) + result = AccountVerification::new(client.post('account_verification', params)) end end end diff --git a/spec/integration/actions_spec.rb b/spec/integration/actions_spec.rb index f5bbe80..b1b3153 100644 --- a/spec/integration/actions_spec.rb +++ b/spec/integration/actions_spec.rb @@ -128,7 +128,7 @@ expect(beneficiary.payment_types).to include('regular') end - it 'can #account_verification beneficiaries' do + it 'can #account_verify beneficiaries' do params = { bank_country: 'GB', account_number: '12345678', @@ -140,13 +140,16 @@ beneficiary_last_name: 'last', } - # account_verifaction = CurrencyCloud::Beneficiary.account_verification(params) - # expect(account_verifaction).to be_a_kind_of(CurrencyCloud::AccountVerification) + puts "test1" + account_verifaction = CurrencyCloud::Beneficiary.account_verification(params) + puts "test3" - # 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') + 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 From 8f90d36c5980e0b78738eca7b22f2701e0fe5367 Mon Sep 17 00:00:00 2001 From: Ricardo Filipe Sousa Gomes Date: Tue, 30 Jul 2024 12:58:58 +0000 Subject: [PATCH 4/4] Fixes tests --- lib/currency_cloud/account_verification.rb | 5 +++ .../can_account_verify_beneficiaries.yml | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 lib/currency_cloud/account_verification.rb create mode 100644 spec/support/vcr_cassettes/Actions/can_account_verify_beneficiaries.yml diff --git a/lib/currency_cloud/account_verification.rb b/lib/currency_cloud/account_verification.rb new file mode 100644 index 0000000..11d882f --- /dev/null +++ b/lib/currency_cloud/account_verification.rb @@ -0,0 +1,5 @@ +module CurrencyCloud + class AccountVerification + include CurrencyCloud::Resource + end +end \ No newline at end of file diff --git a/spec/support/vcr_cassettes/Actions/can_account_verify_beneficiaries.yml b/spec/support/vcr_cassettes/Actions/can_account_verify_beneficiaries.yml new file mode 100644 index 0000000..ea880e5 --- /dev/null +++ b/spec/support/vcr_cassettes/Actions/can_account_verify_beneficiaries.yml @@ -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 \ No newline at end of file