Class: ActiveMerchant::Billing::FirstdataE4Gateway
- Defined in:
- lib/active_merchant/billing/gateways/firstdata_e4.rb
Constant Summary collapse
- TRANSACTIONS =
{ sale: "00", authorization: "01", verify: "05", capture: "32", void: "33", credit: "34", store: "05" }
- POST_HEADERS =
{ "Accepts" => "application/xml", "Content-Type" => "application/xml" }
- SUCCESS =
"true"
- SENSITIVE_FIELDS =
[:verification_str2, :expiry_date, :card_number]
- BRANDS =
{ :visa => 'Visa', :master => "Mastercard", :american_express => "American Express", :jcb => "JCB", :discover => "Discover" }
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, credit_card_or_store_authorization, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ FirstdataE4Gateway
constructor
Create a new FirstdataE4Gateway.
- #purchase(money, credit_card_or_store_authorization, options = {}) ⇒ Object
- #refund(money, authorization, options = {}) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
Tokenize a credit card with TransArmor.
- #verify(credit_card, options = {}) ⇒ Object
- #void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #test?
Methods included from CreditCardFormatting
Constructor Details
#initialize(options = {}) ⇒ FirstdataE4Gateway
Create a new FirstdataE4Gateway
The gateway requires that a valid login and password be passed in the options
hash.
Options
-
:login
– The EXACT ID. Also known as the Gateway ID.(Found in your administration terminal settings)
-
:password
– The terminal password (not your account password)
51 52 53 54 55 56 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 51 def initialize( = {}) requires!(, :login, :password) @options = super end |
Instance Method Details
#authorize(money, credit_card_or_store_authorization, options = {}) ⇒ Object
58 59 60 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 58 def (money, , = {}) commit(:authorization, (money, , )) end |
#capture(money, authorization, options = {}) ⇒ Object
66 67 68 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 66 def capture(money, , = {}) commit(:capture, build_capture_or_credit_request(money, , )) end |
#purchase(money, credit_card_or_store_authorization, options = {}) ⇒ Object
62 63 64 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 62 def purchase(money, , = {}) commit(:sale, (money, , )) end |
#refund(money, authorization, options = {}) ⇒ Object
74 75 76 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 74 def refund(money, , = {}) commit(:credit, build_capture_or_credit_request(money, , )) end |
#store(credit_card, options = {}) ⇒ Object
Tokenize a credit card with TransArmor
The TransArmor token and other card data necessary for subsequent transactions is stored in the response’s authorization
attribute. The authorization string may be passed to authorize
and purchase
instead of a ActiveMerchant::Billing::CreditCard
instance.
TransArmor support must be explicitly activated on your gateway account by FirstData. If your authorization string is empty, contact FirstData support for account setup assistance.
Example
# Generate token
result = gateway.store(credit_card)
if result.success?
my_record.update_attributes(:authorization => result.)
end
# Use token
result = gateway.purchase(1000, my_record.)
firstdata.zendesk.com/entries/21303361-transarmor-tokenization
105 106 107 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 105 def store(credit_card, = {}) commit(:store, build_store_request(credit_card, ), credit_card) end |
#verify(credit_card, options = {}) ⇒ Object
78 79 80 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 78 def verify(credit_card, = {}) commit(:verify, (0, credit_card, )) end |
#void(authorization, options = {}) ⇒ Object
70 71 72 |
# File 'lib/active_merchant/billing/gateways/firstdata_e4.rb', line 70 def void(, = {}) commit(:void, build_capture_or_credit_request((), , )) end |