Class: Samurai::Processor
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- Samurai::Processor
- Defined in:
- lib/samurai/processor.rb
Overview
This class represents a Samurai Processor connection It can be used to create purchase & authorize transactions
Class Method Summary collapse
-
.authorize(*args) ⇒ Object
Convenience method that calls the authorize method on the default processor.
-
.purchase(*args) ⇒ Object
Convenience method that calls the purchase method on the default processor.
-
.the_processor ⇒ Object
Returns the default processor specified by Samurai.processor_token if you passed it into Samurai.setup_site.
Instance Method Summary collapse
-
#authorize(payment_method_token, amount, options = {}) ⇒ Object
Authorize a payment_method for a particular amount.
-
#purchase(payment_method_token, amount, options = {}) ⇒ Object
Convenience method to authorize and capture a payment_method for a particular amount in one transaction.
Methods inherited from Base
Class Method Details
.authorize(*args) ⇒ Object
Convenience method that calls the authorize method on the default processor.
20 21 22 |
# File 'lib/samurai/processor.rb', line 20 def self.(*args) the_processor.(*args) end |
.purchase(*args) ⇒ Object
Convenience method that calls the purchase method on the default processor.
15 16 17 |
# File 'lib/samurai/processor.rb', line 15 def self.purchase(*args) the_processor.purchase(*args) end |
.the_processor ⇒ Object
Returns the default processor specified by Samurai.processor_token if you passed it into Samurai.setup_site.
10 11 12 |
# File 'lib/samurai/processor.rb', line 10 def self.the_processor Samurai::Processor.new(:id => Samurai.processor_token) end |
Instance Method Details
#authorize(payment_method_token, amount, options = {}) ⇒ Object
Authorize a payment_method for a particular amount. Parameters:
-
payment_method_token: token identifying the payment method to authorize -
amount: amount to authorize -
options: an optional has of additional values to pass in accepted values are:
description: description for the transactiondescriptor_name: dynamic descriptor name fielddescriptor_phone: dynamic descriptor phone fieldcustom: custom data, this data does not get passed to the processor, it is stored within api.samurai.feefighters.com onlycustomer_reference: an identifier for the customer, this will appear in the processor if supportedbilling_reference: an identifier for the purchase, this will appear in the processor if supported
Returns a Samurai::Transaction containing the processor's response.
57 58 59 |
# File 'lib/samurai/processor.rb', line 57 def (payment_method_token, amount, = {}) execute(:authorize, .merge(:payment_method_token => payment_method_token, :amount => amount)) end |
#purchase(payment_method_token, amount, options = {}) ⇒ Object
Convenience method to authorize and capture a payment_method for a particular amount in one transaction. Parameters:
payment_method_token: token identifying the payment method to authorizeamount: amount to authorize-
options: an optional has of additional values to pass in accepted values are:description: description for the transactiondescriptor_name: dynamic descriptor name fielddescriptor_phone: dynamic descriptor phone fieldcustom: custom data, this data does not get passed to the processor, it is stored withinapi.samurai.feefighters.comonlycustomer_reference: an identifier for the customer, this will appear in the processor if supportedbilling_reference: an identifier for the purchase, this will appear in the processor if supported
Returns a Samurai::Transaction containing the processor's response.
38 39 40 |
# File 'lib/samurai/processor.rb', line 38 def purchase(payment_method_token, amount, = {}) execute(:purchase, .merge(:payment_method_token => payment_method_token, :amount => amount)) end |