Class: BreadMachine::SecureTrading::AuthReversalRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/breadmachine/secure_trading/auth_reversal_request.rb

Instance Method Summary collapse

Constructor Details

#initialize(transaction, order_info) ⇒ AuthReversalRequest

Returns a new instance of AuthReversalRequest.



6
7
8
9
# File 'lib/breadmachine/secure_trading/auth_reversal_request.rb', line 6

def initialize(transaction, order_info)
  @transaction = transaction
  @order_info = BreadMachine::SecureTrading::OrderInfoXml.new(order_info)
end

Instance Method Details

#response(xml) ⇒ Object



11
12
13
# File 'lib/breadmachine/secure_trading/auth_reversal_request.rb', line 11

def response(xml)
  AuthReversalResponse.new(xml)
end

#to_xmlObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/breadmachine/secure_trading/auth_reversal_request.rb', line 15

def to_xml
  xml = Builder::XmlMarkup.new(:indent => 2)
  xml.Request("Type" => "AUTHREVERSAL") {
    xml.Operation {
      xml.SiteReference BreadMachine::SecureTrading::configuration.site_reference
    }
    xml.PaymentMethod {
      xml.CreditCard {
        xml.ParentTransactionReference @transaction.transaction_reference
        xml.TransactionVerifier @transaction.transaction_verifier
      }
    }
    xml << @order_info.to_xml
  }
end