Class: GoogleCheckout::RefundOrder

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

Overview

Tells Google to refund the order.

Constant Summary

Constants inherited from Command

Command::PRODUCTION_REQUEST_URL, Command::SANDBOX_REQUEST_URL

Instance Attribute Summary collapse

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 Attribute Details

#commentObject

Returns the value of attribute comment.



160
161
162
# File 'lib/google-checkout/command.rb', line 160

def comment
  @comment
end

#reasonObject

Returns the value of attribute reason.



160
161
162
# File 'lib/google-checkout/command.rb', line 160

def reason
  @reason
end

Instance Method Details

#to_xmlObject



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/google-checkout/command.rb', line 162

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

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