Class: Braintree::UsBankAccountVerificationGateway
- Inherits:
-
Object
- Object
- Braintree::UsBankAccountVerificationGateway
- Defined in:
- lib/braintree/us_bank_account_verification_gateway.rb
Instance Method Summary collapse
- #_fetch_verifications(search, ids) ⇒ Object
- #confirm_micro_transfer_amounts(id, deposit_amounts) ⇒ Object
- #find(id) ⇒ Object
-
#initialize(gateway) ⇒ UsBankAccountVerificationGateway
constructor
A new instance of UsBankAccountVerificationGateway.
- #search(&block) ⇒ Object
Constructor Details
#initialize(gateway) ⇒ UsBankAccountVerificationGateway
Returns a new instance of UsBankAccountVerificationGateway.
3 4 5 6 7 |
# File 'lib/braintree/us_bank_account_verification_gateway.rb', line 3 def initialize(gateway) @gateway = gateway @config = gateway.config @config.assert_has_access_token_or_keys end |
Instance Method Details
#_fetch_verifications(search, ids) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/braintree/us_bank_account_verification_gateway.rb', line 44 def _fetch_verifications(search, ids) search.ids.in ids response = @config.http.post("#{@config.base_merchant_path}/us_bank_account_verifications/advanced_search", {:search => search.to_hash}) attributes = response[:us_bank_account_verifications] Util.extract_attribute_as_array(attributes, :us_bank_account_verification).map { |attrs| UsBankAccountVerification._new(attrs) } end |
#confirm_micro_transfer_amounts(id, deposit_amounts) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/braintree/us_bank_account_verification_gateway.rb', line 9 def confirm_micro_transfer_amounts(id, deposit_amounts) raise ArgumentError if id.nil? || id.to_s.strip == "" || !deposit_amounts.kind_of?(Array) response = @config.http.put( "#{@config.base_merchant_path}/us_bank_account_verifications/#{id}/confirm_micro_transfer_amounts", :us_bank_account_verification => { :deposit_amounts => deposit_amounts, }, ) if response[:api_error_response] ErrorResult.new(@gateway, response[:api_error_response]) else SuccessfulResult.new( :us_bank_account_verification => UsBankAccountVerification._new(response[:us_bank_account_verification]), ) end rescue NotFoundError raise NotFoundError, "verification with id #{id.inspect} not found" end |
#find(id) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/braintree/us_bank_account_verification_gateway.rb', line 28 def find(id) raise ArgumentError if id.nil? || id.to_s.strip == "" response = @config.http.get("#{@config.base_merchant_path}/us_bank_account_verifications/#{id}") UsBankAccountVerification._new(response[:us_bank_account_verification]) rescue NotFoundError raise NotFoundError, "verification with id #{id.inspect} not found" end |
#search(&block) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/braintree/us_bank_account_verification_gateway.rb', line 36 def search(&block) search = UsBankAccountVerificationSearch.new block.call(search) if block response = @config.http.post("#{@config.base_merchant_path}/us_bank_account_verifications/advanced_search_ids", {:search => search.to_hash}) ResourceCollection.new(response) { |ids| _fetch_verifications(search, ids) } end |