Sha256: 97fbd5bfe9bc05f6ee0cbd99a5eff77cbd1c24ecb88e1c3256b289ac0b031057

Contents?: true

Size: 915 Bytes

Versions: 8

Compression:

Stored size: 915 Bytes

Contents

module Braintree
  class SettlementBatchSummaryGateway
    include BaseModule

    def initialize(gateway)
      @gateway = gateway
      @config = gateway.config
      @config.assert_has_access_token_or_keys
    end

    def generate(criteria)
      Util.verify_keys(_signature, criteria)
      response = @config.http.post("#{@config.base_merchant_path}/settlement_batch_summary", :settlement_batch_summary => criteria)
      if response[:settlement_batch_summary]
        SuccessfulResult.new(:settlement_batch_summary => SettlementBatchSummary._new(@gateway, response[:settlement_batch_summary]))
      elsif response[:api_error_response]
        ErrorResult.new(@gateway, response[:api_error_response])
      else
        raise UnexpectedError, "expected :settlement_batch_summary or :api_error_response"
      end
    end

    def _signature
      [:settlement_date, :group_by_custom_field]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
braintree-4.23.0 lib/braintree/settlement_batch_summary_gateway.rb
braintree-4.22.0 lib/braintree/settlement_batch_summary_gateway.rb
braintree-4.21.0 lib/braintree/settlement_batch_summary_gateway.rb
braintree-4.20.0 lib/braintree/settlement_batch_summary_gateway.rb
braintree-4.19.0 lib/braintree/settlement_batch_summary_gateway.rb
braintree-4.18.0 lib/braintree/settlement_batch_summary_gateway.rb
braintree-4.17.0 lib/braintree/settlement_batch_summary_gateway.rb
braintree-4.16.0 lib/braintree/settlement_batch_summary_gateway.rb