Class: ActiveMerchant::Billing::FatZebraGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::FatZebraGateway
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
-
#authorize(money, creditcard, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ FatZebraGateway
constructor
A new instance of FatZebraGateway.
-
#purchase(money, creditcard, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(creditcard, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#void(authorization, options = {}) ⇒ Object
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, card_brand, #card_brand, #generate_unique_id, inherited, supported_countries, #supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 35
def authorize(money, creditcard, options = {})
post = {}
add_amount(post, money, options)
add_creditcard(post, creditcard, options)
(post, options)
add_order_id(post, options)
add_ip(post, options)
add_metadata(post, options)
post[:capture] = false
commit(:post, 'purchases', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
50
51
52
53
54
55
56
57
58
|
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 50
def capture(money, authorization, options = {})
txn_id, = authorization.to_s.split('|')
post = {}
add_amount(post, money, options)
(post, options)
commit(:post, "purchases/#{CGI.escape(txn_id)}/capture", post)
end
|
#purchase(money, creditcard, options = {}) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# 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)
(post, options)
add_order_id(post, options)
add_ip(post, options)
add_metadata(post, options)
commit(:post, 'purchases', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 60
def refund(money, authorization, options = {})
txn_id, = authorization.to_s.split('|')
post = {}
(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
91
92
93
94
95
96
|
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 91
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
78
79
80
81
82
83
84
85
|
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 78
def store(creditcard, options = {})
post = {}
add_creditcard(post, creditcard)
post[:is_billing] = true if options[:recurring]
commit(:post, 'credit_cards', post)
end
|
#supports_scrubbing? ⇒ Boolean
87
88
89
|
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 87
def supports_scrubbing?
true
end
|
#void(authorization, options = {}) ⇒ Object
72
73
74
75
76
|
# File 'lib/active_merchant/billing/gateways/fat_zebra.rb', line 72
def void(authorization, options = {})
txn_id, endpoint = authorization.to_s.split('|')
commit(:post, "#{endpoint}/void?id=#{txn_id}", {})
end
|