Class: ActiveMerchant::Billing::FatZebraGateway

Inherits:
Gateway
  • Object
show all
Defined in:
lib/active_merchant/billing/gateways/fat_zebra.rb

Constant Summary

Constants inherited from Gateway

Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE

Instance Attribute Summary

Attributes inherited from Gateway

#options

Instance Method Summary collapse

Methods inherited from Gateway

#card_brand, card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?

Methods included from CreditCardFormatting

#expdate, #format

Methods included from PostsData

included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request

Constructor Details

#initialize(options = {}) ⇒ FatZebraGateway

Returns a new instance of FatZebraGateway.



17
18
19
20
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 17

def initialize(options = {})
  requires!(options, :username, :token)
  super
end

Instance Method Details

#authorize(money, creditcard, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 34

def authorize(money, creditcard, options = {})
  post = {}

  add_amount(post, money, options)
  add_creditcard(post, creditcard, options)
  add_extra_options(post, options)
  add_order_id(post, options)
  add_ip(post, options)

  post[:capture] = false

  commit(:post, 'purchases', post)
end

#capture(money, authorization, options = {}) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 48

def capture(money, authorization, options = {})
  post = {}
  add_amount(post, money, options)
  add_extra_options(post, options)

  commit(:post, "purchases/#{CGI.escape(authorization)}/capture", post)
end

#purchase(money, creditcard, options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 22

def purchase(money, creditcard, options = {})
  post = {}

  add_amount(post, money, options)
  add_creditcard(post, creditcard, options)
  add_extra_options(post, options)
  add_order_id(post, options)
  add_ip(post, options)

  commit(:post, 'purchases', post)
end

#refund(money, txn_id, options = {}) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 56

def refund(money, txn_id, options={})
  post = {}

  add_extra_options(post, options)
  add_amount(post, money, options)
  post[:transaction_id] = txn_id
  add_order_id(post, options)

  commit(:post, 'refunds', post)
end

#scrub(transcript) ⇒ Object



78
79
80
81
82
83
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 78

def scrub(transcript)
  transcript.
    gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
    gsub(%r(("card_number\\?":\\?")[^"\\]*)i, '\1[FILTERED]').
    gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
end

#store(creditcard, options = {}) ⇒ Object



67
68
69
70
71
72
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 67

def store(creditcard, options={})
  post = {}
  add_creditcard(post, creditcard)

  commit(:post, 'credit_cards', post)
end

#supports_scrubbing?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 74

def supports_scrubbing?
  true
end