Class: BreadMachine::SecureTrading::AuthRequest
- Inherits:
-
Object
- Object
- BreadMachine::SecureTrading::AuthRequest
- Defined in:
- lib/breadmachine/secure_trading/auth_request.rb
Instance Method Summary collapse
-
#initialize(amount, card, customer_info, order_info, settlement_day) ⇒ AuthRequest
constructor
A new instance of AuthRequest.
- #response(xml) ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(amount, card, customer_info, order_info, settlement_day) ⇒ AuthRequest
Returns a new instance of AuthRequest.
6 7 8 9 10 11 12 13 14 |
# File 'lib/breadmachine/secure_trading/auth_request.rb', line 6 def initialize(amount, card, customer_info, order_info, settlement_day) raise ArgumentError, 'Currency mismatch' unless amount.currency == BreadMachine::SecureTrading::configuration.currency @amount = amount @card = BreadMachine::SecureTrading::CardXml.new(card) @customer_info = BreadMachine::SecureTrading::CustomerInfoAuthXml.new(customer_info) @order_info = BreadMachine::SecureTrading::OrderInfoXml.new(order_info) @settlement_day = settlement_day end |
Instance Method Details
#response(xml) ⇒ Object
16 17 18 |
# File 'lib/breadmachine/secure_trading/auth_request.rb', line 16 def response(xml) St3dAuthResponse.new(xml) end |
#to_xml ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/breadmachine/secure_trading/auth_request.rb', line 20 def to_xml xml = Builder::XmlMarkup.new(:indent => 2) xml.Request("Type" => "AUTH") { xml.Operation { xml.Amount @amount.cents xml.Currency BreadMachine::SecureTrading::configuration.currency xml.SiteReference BreadMachine::SecureTrading::configuration.site_reference xml.SettlementDay @settlement_day } xml << @customer_info.to_xml xml.PaymentMethod { xml << @card.to_xml } xml << @order_info.to_xml } end |