class SpreedlyCore::AuthorizeTransaction
Attributes
payment_method[R]
Public Class Methods
new(attrs={})
click to toggle source
Calls superclass method
SpreedlyCore::Transaction::new
# File lib/spreedly-core-ruby/transactions.rb, line 113 def initialize(attrs={}) @payment_method = PaymentMethod.new(attrs.delete("payment_method") || {}) @response = Response.new(attrs.delete("response") || {}) super(attrs) end
Public Instance Methods
capture(amount=nil, ip_address=nil)
click to toggle source
Capture the previously authorized payment. If the amount is nil, the captured amount will the amount from the original authorization. Some gateways support partial captures which can be done by specifiying an amount
# File lib/spreedly-core-ruby/transactions.rb, line 123 def capture(amount=nil, ip_address=nil) body = if amount.nil? {} else {:transaction => {:amount => amount, :ip => ip_address}} end self.class.verify_post("/transactions/#{token}/capture.xml", :body => body, :has_key => "transaction") do |response| CaptureTransaction.new(response.parsed_response["transaction"]) end end