Class: ActiveMerchant::Billing::CredoraxGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::CredoraxGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/credorax.rb
Constant Summary
Constants inherited
from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::DEBIT_CARDS, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
#options
Instance Method Summary
collapse
-
#authorize(amount, payment_method, options = {}) ⇒ Object
-
#capture(amount, authorization, options = {}) ⇒ Object
-
#credit(amount, payment_method, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ CredoraxGateway
constructor
A new instance of CredoraxGateway.
-
#purchase(amount, payment_method, options = {}) ⇒ Object
-
#refund(amount, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#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?, #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 CredoraxGateway.
23
24
25
26
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 23
def initialize(options={})
requires!(options, :merchant_id, :cipher_key)
super
end
|
Instance Method Details
#authorize(amount, payment_method, options = {}) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 39
def authorize(amount, payment_method, options={})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method)
add_customer_data(post, options)
add_email(post, options)
add_echo(post, options)
commit(:authorize, post)
end
|
#capture(amount, authorization, options = {}) ⇒ Object
50
51
52
53
54
55
56
57
58
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 50
def capture(amount, authorization, options={})
post = {}
add_invoice(post, amount, options)
add_reference(post, authorization)
add_customer_data(post, options)
add_echo(post, options)
commit(:capture, post)
end
|
#credit(amount, payment_method, options = {}) ⇒ Object
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 80
def credit(amount, payment_method, options={})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method)
add_customer_data(post, options)
add_email(post, options)
add_echo(post, options)
commit(:credit, post)
end
|
#purchase(amount, payment_method, options = {}) ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 28
def purchase(amount, payment_method, options={})
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method)
add_customer_data(post, options)
add_email(post, options)
add_echo(post, options)
commit(:purchase, post)
end
|
#refund(amount, authorization, options = {}) ⇒ Object
70
71
72
73
74
75
76
77
78
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 70
def refund(amount, authorization, options={})
post = {}
add_invoice(post, amount, options)
add_reference(post, authorization)
add_customer_data(post, options)
add_echo(post, options)
commit(:refund, post)
end
|
#scrub(transcript) ⇒ Object
102
103
104
105
106
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 102
def scrub(transcript)
transcript.
gsub(%r((b1=)\d+), '\1[FILTERED]').
gsub(%r((b5=)\d+), '\1[FILTERED]')
end
|
#supports_scrubbing? ⇒ Boolean
98
99
100
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 98
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
91
92
93
94
95
96
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 91
def verify(credit_card, options={})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
60
61
62
63
64
65
66
67
68
|
# File 'lib/active_merchant/billing/gateways/credorax.rb', line 60
def void(authorization, options={})
post = {}
add_customer_data(post, options)
reference_action = add_reference(post, authorization)
add_echo(post, options)
post[:a1] = generate_unique_id
commit(:void, post, reference_action)
end
|