Class: Killbill::Cybersource::CyberSourceOnDemand
- Inherits:
-
Object
- Object
- Killbill::Cybersource::CyberSourceOnDemand
- Includes:
- ActiveMerchant::PostsData
- Defined in:
- lib/cybersource/cyber_source_on_demand.rb
Overview
Defined Under Namespace
Classes: CyberSourceOnDemandTransactionReport
Instance Method Summary collapse
- #check_for_duplicates? ⇒ Boolean
-
#initialize(config, logger) ⇒ CyberSourceOnDemand
constructor
A new instance of CyberSourceOnDemand.
- #single_transaction_report(merchant_reference_code, target_date) ⇒ Object
Constructor Details
#initialize(config, logger) ⇒ CyberSourceOnDemand
Returns a new instance of CyberSourceOnDemand.
10 11 12 13 14 15 |
# File 'lib/cybersource/cyber_source_on_demand.rb', line 10 def initialize(config, logger) @config = config @logger = logger configure_connection end |
Instance Method Details
#check_for_duplicates? ⇒ Boolean
42 43 44 |
# File 'lib/cybersource/cyber_source_on_demand.rb', line 42 def check_for_duplicates? @config[:check_for_duplicates] == true end |
#single_transaction_report(merchant_reference_code, target_date) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cybersource/cyber_source_on_demand.rb', line 17 def single_transaction_report(merchant_reference_code, target_date) params = { :merchantID => @config[:merchantID], :merchantReferenceNumber => merchant_reference_code, :targetDate => target_date, :type => 'transaction', :subtype => 'transactionDetail', :versionNumber => '1.7', } headers = { # Don't use symbols or it will confuse Net/HTTP 'Authorization' => 'Basic ' + Base64.encode64("#{@config[:username]}:#{@config[:password]}").chomp, 'User-Agent' => ActiveMerchant::Billing::CyberSourceGateway.user_agent } headers['X-Request-Id'] = ActiveMerchant::Billing::CyberSourceGateway.x_request_id unless ActiveMerchant::Billing::CyberSourceGateway.x_request_id.blank? data = URI.encode_www_form(params) @logger.info "Retrieving report for merchant_reference_code='#{merchant_reference_code}', target_date='#{target_date}', merchant_id='#{@config[:merchantID]}'" # Will raise ResponseError if the response code is > 300 CyberSourceOnDemandTransactionReport.new(ssl_post(endpoint, data, headers), @logger) end |