Class: ActiveMerchant::Billing::NetbanxGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::NetbanxGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/netbanx.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, payment, options = {}) ⇒ Object
-
#capture(money, authorization, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ NetbanxGateway
constructor
A new instance of NetbanxGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
note: when passing options we only attempt to add the card to the profile_id passed as the options.
-
#supports_scrubbing? ⇒ Boolean
-
#unstore(identification, options = {}) ⇒ Object
-
#verify(credit_card, options = {}) ⇒ Object
-
#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?
#format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of NetbanxGateway.
25
26
27
28
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 25
def initialize(options={})
requires!(options, :account_number, :api_key)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 39
def authorize(money, payment, options={})
post = {}
add_invoice(post, money, options)
add_payment(post, payment, options)
commit(:post, 'auths', post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
47
48
49
50
51
52
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 47
def capture(money, authorization, options={})
post = {}
add_invoice(post, money, options)
commit(:post, "auths/#{authorization}/settlements", post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 30
def purchase(money, payment, options={})
post = {}
add_invoice(post, money, options)
add_settle_with_auth(post)
add_payment(post, payment, options)
commit(:post, 'auths', post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 54
def refund(money, authorization, options={})
post = {}
add_invoice(post, money, options)
post[:merchantRefNum] = SecureRandom.uuid
commit(:post, "settlements/#{authorization}/refunds", post)
end
|
#scrub(transcript) ⇒ Object
108
109
110
111
112
113
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 108
def scrub(transcript)
transcript.
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
gsub(%r(("card\\?":{\\?"cardNum\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
end
|
#store(credit_card, options = {}) ⇒ Object
note: when passing options we only attempt to add the
card to the profile_id passed as the options[:customer]
82
83
84
85
86
87
88
89
90
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 82
def store(credit_card, options={})
requires!(options, :locale)
post = {}
add_credit_card(post, credit_card, options)
add_customer_data(post, options)
commit(:post, 'customervault/v1/profiles', post)
end
|
#supports_scrubbing? ⇒ Boolean
104
105
106
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 104
def supports_scrubbing?
true
end
|
#unstore(identification, options = {}) ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 92
def unstore(identification, options = {})
customer_id, card_id = identification.split('|')
if card_id.nil?
commit(:delete, "customervault/v1/profiles/#{CGI.escape(customer_id)}", nil)
else
commit(:delete, "customervault/v1/profiles/#{CGI.escape(customer_id)}/cards/#{CGI.escape(card_id)}", nil)
end
end
|
#verify(credit_card, options = {}) ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 72
def verify(credit_card, options={})
post = {}
add_payment(post, credit_card)
add_order_id(post, options)
commit(:post, 'verifications', post)
end
|
#void(authorization, options = {}) ⇒ Object
65
66
67
68
69
70
|
# File 'lib/active_merchant/billing/gateways/netbanx.rb', line 65
def void(authorization, options={})
post = {}
add_order_id(post, options)
commit(:post, "auths/#{authorization}/voidauths", post)
end
|