Class: BreadMachine::SecureTrading::CardXml

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

Instance Method Summary collapse

Constructor Details

#initialize(card) ⇒ CardXml

Returns a new instance of CardXml.



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

def initialize(card)
  @card = card
end

Instance Method Details

#to_xmlObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/breadmachine/secure_trading/card_xml.rb', line 10

def to_xml
  xml = Builder::XmlMarkup.new(:indent => 2)
  xml.CreditCard {
    xml.Type @card.issuer unless @card.issuer.blank?
    xml.Number @card.number unless @card.number.blank?
    xml.ExpiryDate @card.expiry_date unless @card.expiry_date.blank?
    xml.StartDate @card.start_date unless @card.start_date.blank?
    xml.Issue @card.issue unless @card.issue.blank?
    xml.SecurityCode @card.security_code unless @card.security_code.blank?
    xml.TransactionVerifier @card.transaction_verifier unless @card.transaction_verifier.blank?
    xml.ParentTransactionReference @card.transaction_reference unless @card.transaction_reference.blank?
  }
end