Class: MerbMerchant::Billing::SageGateway
- Defined in:
- lib/merb_merchant/billing/gateways/sage.rb
Constant Summary
Constants inherited from Gateway
Constants included from PostsData
PostsData::MAX_RETRIES, PostsData::OPEN_TIMEOUT, PostsData::READ_TIMEOUT
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#authorize(money, credit_card, options = {}) ⇒ Object
Performs an authorization transaction.
-
#capture(money, reference, options = {}) ⇒ Object
Captures authorized funds.
-
#credit(money, source, options = {}) ⇒ Object
Performs a credit transaction.
-
#initialize(options = {}) ⇒ SageGateway
constructor
Creates a new SageGateway.
-
#purchase(money, source, options = {}) ⇒ Object
Performs a purchase, which is essentially an authorization and capture in a single operation.
-
#void(reference, options = {}) ⇒ Object
Voids a prior transaction.
Methods inherited from Gateway
#card_brand, card_brand, inherited, supports?, #test?
Methods included from Utils
Methods included from CreditCardFormatting
Methods included from RequiresParameters
Methods included from PostsData
Constructor Details
#initialize(options = {}) ⇒ SageGateway
Creates a new SageGateway
The gateway requires that a valid login and password be passed in the options
hash.
Options
-
:login
- The Sage Payment Solutions Merchant ID Number. -
:password
- The Sage Payment Solutions Merchant Key Number.
19 20 21 22 23 |
# File 'lib/merb_merchant/billing/gateways/sage.rb', line 19 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Method Details
#authorize(money, credit_card, options = {}) ⇒ Object
Performs an authorization transaction
Parameters
-
money
- The amount to be authorized as an integer value in cents. -
credit_card
- The CreditCard object to be used as the funding source for the transaction. -
options
- A hash of optional parameters.-
:order_id
- A unique reference for this order. (maximum of 20 characters). -
:email
- The customer’s email address -
:customer
- The Customer Number for Purchase Card Level II Transactions -
:billing_address
- The customer’s billing address as a hash of address information.-
:address1
- The billing address street -
:city
- The billing address city -
:state
- The billing address state -
:country
- The 2 digit ISO billing address country code -
:zip
- The billing address zip code -
:phone
- The billing address phone number -
:fax
- The billing address fax number
-
-
:shipping_address
- The customer’s shipping address as a hash of address information.-
:name
- The name at the shipping address -
:address1
- The shipping address street -
:city
- The shipping address city -
:state
- The shipping address state code -
:country
- The 2 digit ISO shipping address country code -
:zip
- The shipping address zip code
-
-
:tax
- The tax amount for the transaction as an Integer value in cents. Maps to SageT_tax
. -
:shipping
- The shipping amount for the transaction as an Integer value in cents. Maps to SageT_shipping
.
-
51 52 53 |
# File 'lib/merb_merchant/billing/gateways/sage.rb', line 51 def (money, credit_card, = {}) bankcard.(money, credit_card, ) end |
#capture(money, reference, options = {}) ⇒ Object
Captures authorized funds.
Parameters
-
money
- The amount to be authorized as an integer value in cents. Sage doesn’t support changing the capture amount, so the full amount of the initial transaction will be captured. -
reference
- The authorization reference string returned by the original transaction’s Response#authorization.
104 105 106 |
# File 'lib/merb_merchant/billing/gateways/sage.rb', line 104 def capture(money, reference, = {}) bankcard.capture(money, reference, ) end |
#credit(money, source, options = {}) ⇒ Object
Performs a credit transaction. (Sage Credit
transaction).
Parameters
-
money
- The amount to be authorized as an integer value in cents. -
source
- The CreditCard or Check object to be used as the target for the credit.
127 128 129 130 131 132 133 |
# File 'lib/merb_merchant/billing/gateways/sage.rb', line 127 def credit(money, source, = {}) if source.type == "check" virtual_check.credit(money, source, ) else bankcard.credit(money, source, ) end end |
#purchase(money, source, options = {}) ⇒ Object
Performs a purchase, which is essentially an authorization and capture in a single operation.
Parameters
-
money
- The amount to be authorized as an integer value in cents. -
source
- The CreditCard or Check object to be used as the funding source for the transaction. -
options
- A hash of optional parameters.-
:order_id
- A unique reference for this order. (maximum of 20 characters). -
:email
- The customer’s email address -
:customer
- The Customer Number for Purchase Card Level II Transactions -
:billing_address
- The customer’s billing address as a hash of address information.-
:address1
- The billing address street -
:city
- The billing address city -
:state
- The billing address state -
:country
- The 2 digit ISO billing address country code -
:zip
- The billing address zip code -
:phone
- The billing address phone number -
:fax
- The billing address fax number
-
-
:shipping_address
- The customer’s shipping address as a hash of address information.-
:name
- The name at the shipping address -
:address1
- The shipping address street -
:city
- The shipping address city -
:state
- The shipping address state code -
:country
- The 2 digit ISO shipping address country code -
:zip
- The shipping address zip code
-
-
:tax
- The tax amount for the transaction as an integer value in cents. Maps to SageT_tax
. -
:shipping
- The shipping amount for the transaction as an integer value in cents. Maps to SageT_shipping
.
-
Additional options in the options
hash for when using a Check as the funding source
-
:originator_id
- 10 digit originator. If not provided, Sage will use the default Originator ID for the specific customer type. -
:addenda
- Transaction addenda. -
:ssn
- The customer’s Social Security Number. -
:drivers_license_state
- The customer’s drivers license state code. -
:drivers_license_number
- The customer’s drivers license number. -
:date_of_birth
- The customer’s date of birth as a Time or Date object or a string in the formatmm/dd/yyyy
.
90 91 92 93 94 95 96 |
# File 'lib/merb_merchant/billing/gateways/sage.rb', line 90 def purchase(money, source, = {}) if source.type == "check" virtual_check.purchase(money, source, ) else bankcard.purchase(money, source, ) end end |
#void(reference, options = {}) ⇒ Object
Voids a prior transaction. Works for both CreditCard and Check transactions.
Parameters
-
reference
- The authorization reference string returned by the original transaction’s Response#authorization.
113 114 115 116 117 118 119 |
# File 'lib/merb_merchant/billing/gateways/sage.rb', line 113 def void(reference, = {}) if reference.split(";").last == "virtual_check" virtual_check.void(reference, ) else bankcard.void(reference, ) end end |