Class: GoogleCheckout::ChargeOrder

Inherits:
OrderCommand show all
Defined in:
lib/google-checkout/command.rb

Overview

Create a new ChargeOrder object, set the amount, then post it.

Constant Summary

Constants inherited from Command

GoogleCheckout::Command::PRODUCTION_REQUEST_URL, GoogleCheckout::Command::SANDBOX_REQUEST_URL

Instance Attribute Summary

Attributes inherited from OrderCommand

#amount, #google_order_number

Attributes inherited from Command

#currency, #merchant_id, #merchant_key

Instance Method Summary collapse

Methods inherited from OrderCommand

#initialize

Methods inherited from Command

#initialize, #post, #url, x509_store

Constructor Details

This class inherits a constructor from GoogleCheckout::OrderCommand

Instance Method Details

#to_xmlObject



119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/google-checkout/command.rb', line 119

def to_xml
  raise "Charge amount must be greater than 0!" unless @amount.to_f > 0.0

  xml = Builder::XmlMarkup.new
  xml.instruct!
  @xml = xml.tag!('charge-order', {
    :xmlns => "http://checkout.google.com/schema/2",
    "google-order-number" => @google_order_number
  }) do
    xml.tag!("amount", @amount, {:currency => @currency})
  end
  @xml
end