Class: ActiveMerchant::Billing::CommerceHubGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::CommerceHubGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/commerce_hub.rb
Constant Summary
collapse
- STANDARD_ERROR_CODE_MAPPING =
{}
- SCHEDULED_REASON_TYPES =
%w(recurring installment)
- ENDPOINTS =
{
'sale' => "/payments/#{fetch_version}/charges",
'void' => "/payments/#{fetch_version}/cancels",
'refund' => "/payments/#{fetch_version}/refunds",
'vault' => "/payments-vas/#{fetch_version}/tokens",
'verify' => "/payments-vas/#{fetch_version}/accounts/verification"
}
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
-
#credit(money, payment_method, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ CommerceHubGateway
constructor
A new instance of CommerceHubGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(credit_card, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#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?
#fetch_version, included
#expdate, #format, #strftime_yyyymm, #strftime_yyyymmdd_last_day
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of CommerceHubGateway.
27
28
29
30
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 27
def initialize(options = {})
requires!(options, :api_key, :api_secret, :merchant_id, :terminal_id)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 43
def authorize(money, payment, options = {})
post = {}
options[:capture_flag] = false
options[:create_token] = false
add_transaction_details(post, options, 'sale')
build_purchase_and_auth_request(post, money, payment, options)
commit('sale', post, options)
end
|
#capture(money, authorization, options = {}) ⇒ Object
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 54
def capture(money, authorization, options = {})
post = {}
options[:capture_flag] = true
add_invoice(post, money, options)
add_transaction_details(post, options, 'capture')
add_reference_transaction_details(post, authorization, options, :capture)
add_dynamic_descriptors(post, options)
commit('sale', post, options)
end
|
#credit(money, payment_method, options = {}) ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 74
def credit(money, payment_method, options = {})
post = {}
add_invoice(post, money, options)
add_transaction_details(post, options)
add_transaction_interaction(post, options)
add_payment(post, payment_method, options)
commit('refund', post, options)
end
|
#purchase(money, payment, options = {}) ⇒ Object
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 32
def purchase(money, payment, options = {})
post = {}
options[:capture_flag] = true
options[:create_token] = false
add_transaction_details(post, options, 'sale')
build_purchase_and_auth_request(post, money, payment, options)
commit('sale', post, options)
end
|
#refund(money, authorization, options = {}) ⇒ Object
65
66
67
68
69
70
71
72
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 65
def refund(money, authorization, options = {})
post = {}
add_invoice(post, money, options) if money
add_transaction_details(post, options)
add_reference_transaction_details(post, authorization, options, :refund)
commit('refund', post, options)
end
|
#scrub(transcript) ⇒ Object
115
116
117
118
119
120
121
122
123
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 115
def scrub(transcript)
transcript.
gsub(%r((Authorization: )[a-zA-Z0-9+./=]+), '\1[FILTERED]').
gsub(%r((Api-Key: )\w+), '\1[FILTERED]').
gsub(%r(("apiKey\\?":\\?")\w+), '\1[FILTERED]').
gsub(%r(("cardData\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("securityCode\\?":\\?")\d+), '\1[FILTERED]').
gsub(%r(("cavv\\?":\\?")\w+), '\1[FILTERED]')
end
|
#store(credit_card, options = {}) ⇒ Object
92
93
94
95
96
97
98
99
100
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 92
def store(credit_card, options = {})
post = {}
add_payment(post, credit_card, options)
add_billing_address(post, credit_card, options)
add_transaction_details(post, options)
add_transaction_interaction(post, options)
commit('vault', post, options)
end
|
#supports_scrubbing? ⇒ Boolean
111
112
113
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 111
def supports_scrubbing?
true
end
|
#verify(credit_card, options = {}) ⇒ Object
102
103
104
105
106
107
108
109
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 102
def verify(credit_card, options = {})
post = {}
add_payment(post, credit_card, options)
add_billing_address(post, credit_card, options)
add_transaction_details(post, options, 'verify')
commit('verify', post, options)
end
|
#void(authorization, options = {}) ⇒ Object
84
85
86
87
88
89
90
|
# File 'lib/active_merchant/billing/gateways/commerce_hub.rb', line 84
def void(authorization, options = {})
post = {}
add_transaction_details(post, options)
add_reference_transaction_details(post, authorization, options, :void)
commit('void', post, options)
end
|