Class: Cayan::Merchantware::Reports::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cayan/merchantware/reports/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ Client

Returns a new instance of Client.



10
11
12
13
14
15
16
# File 'lib/cayan/merchantware/reports/client.rb', line 10

def initialize(credentials)
  @credentials = credentials
  @client = Savon.client(
    wsdl: 'https://ps1.merchantware.net/Merchantware/ws/TransactionHistory/v4/Reporting.asmx?WSDL',
    convert_request_keys_to: :lower_camelcase
  )
end

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



8
9
10
# File 'lib/cayan/merchantware/reports/client.rb', line 8

def credentials
  @credentials
end

Instance Method Details

#current_batch_summary(filters) ⇒ Object



18
19
20
21
22
# File 'lib/cayan/merchantware/reports/client.rb', line 18

def current_batch_summary(filters)
  response = @client.call(:current_batch_summary, message: credentials.merge(filters))

  response.body[:current_batch_summary_response][:current_batch_summary_result]
end

#current_batch_transactionsObject



24
25
26
27
28
# File 'lib/cayan/merchantware/reports/client.rb', line 24

def current_batch_transactions
  response = @client.call(:current_batch_transactions, message: credentials)
  
  response.body[:current_batch_transactions_response][:current_batch_transactions_result]
end

#detailed_transaction_by_reference(filters) ⇒ Object



56
57
58
59
60
# File 'lib/cayan/merchantware/reports/client.rb', line 56

def detailed_transaction_by_reference(filters)
  response = @client.call(:detailed_transaction_by_reference, message: credentials.merge(filters))

  response.body[:detailed_transaction_by_reference_response][:detailed_transaction_by_reference_result]
end

#detailed_transaction_by_transaction_id(transaction_id) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/cayan/merchantware/reports/client.rb', line 62

def detailed_transaction_by_transaction_id(transaction_id)
  response = @client.call(:detailed_transaction_by_transaction_id, message: credentials.merge({
    merchant_transaction_id: transaction_id
  }))

  response.body[:detailed_transaction_by_transaction_id_response][:detailed_transaction_by_transaction_id_result]
end

#summary_by_date(filters) ⇒ Object



30
31
32
33
34
# File 'lib/cayan/merchantware/reports/client.rb', line 30

def summary_by_date(filters)
  response = @client.call(:summary_by_date, message: credentials.merge(filters))

  response.body[:summary_by_date_response][:summary_by_date_result]
end

#transactions_by_date(filters) ⇒ Object



36
37
38
39
40
# File 'lib/cayan/merchantware/reports/client.rb', line 36

def transactions_by_date(filters)
  response = @client.call(:transactions_by_date, message: credentials.merge(filters))

  response.body[:transactions_by_date_response][:transactions_by_date_result]
end

#transactions_by_reference(filters) ⇒ Object



42
43
44
45
46
# File 'lib/cayan/merchantware/reports/client.rb', line 42

def transactions_by_reference(filters)
  response = @client.call(:transactions_by_date, message: credentials.merge(filters))

  response.body[:transactions_by_reference_response][:transactions_by_reference_result]
end

#transactions_by_transaction_id(transaction_id) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/cayan/merchantware/reports/client.rb', line 48

def transactions_by_transaction_id(transaction_id)
  response = @client.call(:detailed_transaction_by_transaction_id, message: credentials.merge({
    merchant_transaction_id: transaction_id
  }))
  
  response.body[:transactions_by_transaction_id_response][:transactions_by_transaction_id_result]
end