class MaxipagoApi::TransactionRequest

Public Class Methods

create(transaction) click to toggle source
# File lib/maxipago_api/requests/transaction_request.rb, line 9
def create(transaction)
  xml = {
    'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key}, 
    version: '3.1.1.15',
    order: transaction.to_object
  }.to_xml(root: 'transaction-request', skip_types: true)
  response = post(MaxipagoApi.api_transaction_endpoint, body: xml, headers: {'Content-Type' => 'text/plain'})
  Hash.from_xml(response.parsed_response)
end
find(id) click to toggle source
# File lib/maxipago_api/requests/transaction_request.rb, line 19
def find(id)
  xml = {
    'verification' => {merchantId: MaxipagoApi.store_id, merchantKey: MaxipagoApi.store_key}, 
    command: 'transactionDetailReport',
    request: {
      filterOptions: {
        transactionId: id
      }
    }
  }.to_xml(root: 'rapi-request', skip_types: true)
  response = post(MaxipagoApi.api_reports_endpoint, body: xml, headers: {'Content-Type' => 'text/plain'})
  Hash.from_xml(response.parsed_response)
end