Class: ActiveMerchant::Billing::FatZebraGateway
- Defined in:
- lib/active_merchant/billing/gateways/fat_zebra.rb
Constant Summary
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::CURRENCIES_WITHOUT_FRACTIONS, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
- #authorize(money, creditcard, options = {}) ⇒ Object
- #capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ FatZebraGateway
constructor
Setup a new instance of the gateway.
-
#purchase(money, creditcard, options = {}) ⇒ Object
To create a purchase on a credit card use:.
-
#refund(money, txn_id, options = {}) ⇒ Object
Refund a transaction.
-
#store(creditcard, options = {}) ⇒ Object
Tokenize a credit card.
Methods inherited from Gateway
#card_brand, card_brand, #generate_unique_id, inherited, non_fractional_currency?, #scrub, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ FatZebraGateway
Setup a new instance of the gateway.
The options hash should include :username and :token You can find your username and token at dashboard.fatzebra.com.au Under the Your Account section
22 23 24 25 |
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 22 def initialize( = {}) requires!(, :username, :token) super end |
Instance Method Details
#authorize(money, creditcard, options = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 46 def (money, creditcard, = {}) post = {} add_amount(post, money, ) add_creditcard(post, creditcard, ) (post, ) add_order_id(post, ) add_ip(post, ) post[:capture] = false commit(:post, 'purchases', post) end |
#capture(money, authorization, options = {}) ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 60 def capture(money, , = {}) post = {} add_amount(post, money, ) (post, ) commit(:post, "purchases/#{CGI.escape()}/capture", post) end |
#purchase(money, creditcard, options = {}) ⇒ Object
To create a purchase on a credit card use:
purchase(money, creditcard)
To charge a tokenized card
purchase(money, "abzy87u", :cvv => "123")
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 34 def purchase(money, creditcard, = {}) post = {} add_amount(post, money, ) add_creditcard(post, creditcard, ) (post, ) add_order_id(post, ) add_ip(post, ) commit(:post, 'purchases', post) end |
#refund(money, txn_id, options = {}) ⇒ Object
Refund a transaction
amount - Integer - the amount to refund txn_id - String - the original transaction to be refunded reference - String - your transaction reference
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 73 def refund(money, txn_id, ={}) post = {} (post, ) add_amount(post, money, ) post[:transaction_id] = txn_id add_order_id(post, ) commit(:post, "refunds", post) end |
#store(creditcard, options = {}) ⇒ Object
Tokenize a credit card
The token is returned in the Response#authorization
87 88 89 90 91 92 |
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 87 def store(creditcard, ={}) post = {} add_creditcard(post, creditcard) commit(:post, "credit_cards", post) end |