Sha256: 21e280b8a11500c432f7c79ded552fcf25044b7e7426089ae95354d07cbe92d5
Contents?: true
Size: 1.21 KB
Versions: 9
Compression:
Stored size: 1.21 KB
Contents
module Braintree class CreditCardVerificationGateway def initialize(gateway) @gateway = gateway @config = gateway.config @config.assert_has_access_token_or_keys end def find(id) raise ArgumentError if id.nil? || id.strip.to_s == "" response = @config.http.get("#{@config.base_merchant_path}/verifications/#{id}") CreditCardVerification._new(response[:verification]) rescue NotFoundError raise NotFoundError, "verification with id #{id.inspect} not found" end def search(&block) search = CreditCardVerificationSearch.new block.call(search) if block response = @config.http.post("#{@config.base_merchant_path}/verifications/advanced_search_ids", {:search => search.to_hash}) ResourceCollection.new(response) { |ids| _fetch_verifications(search, ids) } end def _fetch_verifications(search, ids) search.ids.in ids response = @config.http.post("#{@config.base_merchant_path}/verifications/advanced_search", {:search => search.to_hash}) attributes = response[:credit_card_verifications] Util.extract_attribute_as_array(attributes, :verification).map { |attrs| CreditCardVerification._new(attrs) } end end end
Version data entries
9 entries across 9 versions & 1 rubygems