-
Notifications
You must be signed in to change notification settings - Fork 3
[CLN-2122] Requests para Account Verifications #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pibahamondesw
merged 5 commits into
cln-2115-armar-sdk-de-transfers-en-ruby
from
cln-2122-requests-para-account-verifications
Sep 4, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3ce3c48
feature(account-verifications): Add AccountVerification resource
pibahamondesw 9e31458
feature(account-verifications): Add account verification methods
pibahamondesw ad477b6
feature(account-verifications): add refresh methods to account verifi…
pibahamondesw 90645fb
refactor(transfers): Remove unnecessary inclusions of Utils
pibahamondesw 4fa8d54
refactor(transfer/refresh-resources): Use ArgumentError for resfresh_…
pibahamondesw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
lib/fintoc/transfers/client/account_verifications_methods.rb
This file contains hidden or 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,39 @@ | ||
| require 'fintoc/transfers/resources/account_verification' | ||
|
|
||
| module Fintoc | ||
| module Transfers | ||
| module AccountVerificationsMethods | ||
| def create_account_verification(account_number:) | ||
| data = _create_account_verification(account_number:) | ||
| build_account_verification(data) | ||
| end | ||
|
|
||
| def get_account_verification(account_verification_id) | ||
| data = _get_account_verification(account_verification_id) | ||
| build_account_verification(data) | ||
| end | ||
|
|
||
| def list_account_verifications(**params) | ||
| _list_account_verifications(**params).map { |data| build_account_verification(data) } | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def _create_account_verification(account_number:) | ||
| post(version: :v2, use_jws: true).call('account_verifications', account_number:) | ||
| end | ||
|
|
||
| def _get_account_verification(account_verification_id) | ||
| get(version: :v2).call("account_verifications/#{account_verification_id}") | ||
| end | ||
|
|
||
| def _list_account_verifications(**params) | ||
| get(version: :v2).call('account_verifications', **params) | ||
| end | ||
|
|
||
| def build_account_verification(data) | ||
| Fintoc::Transfers::AccountVerification.new(**data, client: self) | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,73 @@ | ||
| module Fintoc | ||
| module Transfers | ||
| class AccountVerification | ||
| attr_reader :id, :object, :status, :reason, :transfer_id, :counterparty, :mode, :receipt_url, | ||
| :transaction_date | ||
|
|
||
| def initialize( | ||
| id:, | ||
| object:, | ||
| status:, | ||
| reason:, | ||
| transfer_id:, | ||
| counterparty:, | ||
| mode:, | ||
| receipt_url:, | ||
| transaction_date:, | ||
| client: nil, | ||
| ** | ||
| ) | ||
| @id = id | ||
| @object = object | ||
| @status = status | ||
| @reason = reason | ||
| @transfer_id = transfer_id | ||
| @counterparty = counterparty | ||
| @mode = mode | ||
| @receipt_url = receipt_url | ||
| @transaction_date = transaction_date | ||
| @client = client | ||
| end | ||
|
|
||
| def to_s | ||
| "🔍 Account Verification (#{@id}) - #{@status}" | ||
| end | ||
|
|
||
| def refresh | ||
| fresh_verification = @client.get_account_verification(@id) | ||
| refresh_from_verification(fresh_verification) | ||
| end | ||
|
|
||
| def pending? | ||
| @status == 'pending' | ||
pibahamondesw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
|
|
||
| def succeeded? | ||
| @status == 'succeeded' | ||
| end | ||
|
|
||
| def failed? | ||
pibahamondesw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| @status == 'failed' | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def refresh_from_verification(verification) | ||
| unless verification.id == @id | ||
| raise ArgumentError, 'Account verification must be the same instance' | ||
| end | ||
|
|
||
| @object = verification.object | ||
| @status = verification.status | ||
| @reason = verification.reason | ||
| @transfer_id = verification.transfer_id | ||
| @counterparty = verification.counterparty | ||
| @mode = verification.mode | ||
| @receipt_url = verification.receipt_url | ||
| @transaction_date = verification.transaction_date | ||
|
|
||
| self | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.