Module: ObiWan::XmlClient::Instrument

Defined in:
lib/obi-wan/messages.rb

Class Method Summary collapse

Class Method Details

.obi_request(info, billing_address, instrument, name, phone) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/obi-wan/messages.rb', line 121

def self.obi_request(info, billing_address, instrument, name, phone)
  builder = Nokogiri::XML::Builder.new do 
    request('xmlns' => 'http://biz.aol.com/schema/2006-12-18') { 
      createInstrument {
        email {
          value info.email
        }
        instrument  {
          id_         info.id
          nickName    info.nick_name
          defaultFlag info.default_flag
          cardOnFileFlag info.card_on_file_flag

          userInformation {
            firstUserName {
              firstName  name.first_name
              lastName   name.last_name
              middleName name.middle_name
              honorific  name.honorific
            }

            billingAddress {
              street1 billing_address.street1
              street2 billing_address.street2
              city  billing_address.city
              state billing_address.state
              zip billing_address.zip
              country billing_address.country
            }

            eveningPhone {
              countryCode phone.country_code
              areaCode phone.area_code
              number phone.number
              type phone.type
            }
          }
          paymentInstrument {
            accountNumber  instrument.
            routingNumber  instrument.routing_number
            paymentType    instrument.payment_type
            expiryDate     instrument.expiry_date
            lastFourDigits instrument.last_four_digits
            pinNumber      instrument.pin_number
          }
        }
      }
    }
  end.doc.to_xml
end