Class: HostConnect::RecordBookingPaymentBuilder

Inherits:
AbstractBuilder show all
Defined in:
lib/hostconnect/builders/record_booking_payment_builder.rb

Instance Method Summary collapse

Methods inherited from AbstractBuilder

#submit, #to_s

Constructor Details

#initialize(options = {}) ⇒ RecordBookingPaymentBuilder

Returns a new instance of RecordBookingPaymentBuilder.



3
4
5
6
7
# File 'lib/hostconnect/builders/record_booking_payment_builder.rb', line 3

def initialize(options = {})
  @valid_options = [ :agent_id, :password, :booking_id, :currency,
                     :amount, :receipt_type ].freeze
  super(options)
end

Instance Method Details

#to_xmlObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hostconnect/builders/record_booking_payment_builder.rb', line 9

def to_xml
  x = bare
  amount = (@amount.to_f * 100).to_i # Format amount for HostConnect
  x.Request {
    x.RecordBookingPaymentRequest {
      x.AgentID @agent_id
      x.Password @password
      x.BookingId @booking_id
      x.Currency @currency
      x.Amount amount
      x.ReceiptType @receipt_type
    }
  }
  x
end