Class: ActiveMerchant::Billing::Shift4V2Gateway
Constant Summary
ActiveMerchant::Billing::SecurionPayGateway::STANDARD_ERROR_CODE_MAPPING
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, #capture, #customer, #initialize, #purchase, #refund, #store, #supports_scrubbing?, #verify, #void
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #initialize, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
#expdate, #format
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Instance Method Details
#add_amount(post, money, options, include_currency = false) ⇒ Object
52
53
54
55
|
# File 'lib/active_merchant/billing/gateways/shift4_v2.rb', line 52
def add_amount(post, money, options, include_currency = false)
super
post[:currency]&.upcase!
end
|
#add_stored_credentials(post, options) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/active_merchant/billing/gateways/shift4_v2.rb', line 20
def add_stored_credentials(post, options)
return unless options[:stored_credential].present?
initiator = options.dig(:stored_credential, :initiator)
reason_type = options.dig(:stored_credential, :reason_type)
post_type = {
%w[cardholder recurring] => 'first_recurring',
%w[merchant recurring] => 'subsequent_recurring',
%w[cardholder unscheduled] => 'customer_initiated',
%w[merchant installment] => 'merchant_initiated'
}[[initiator, reason_type]]
post[:type] = post_type if post_type
end
|
#create_post_for_auth_or_purchase(money, payment, options) ⇒ Object
14
15
16
17
18
|
# File 'lib/active_merchant/billing/gateways/shift4_v2.rb', line 14
def create_post_for_auth_or_purchase(money, payment, options)
super.tap do |post|
add_stored_credentials(post, options)
end
end
|
#credit(money, payment, options = {}) ⇒ Object
9
10
11
12
|
# File 'lib/active_merchant/billing/gateways/shift4_v2.rb', line 9
def credit(money, payment, options = {})
post = create_post_for_auth_or_purchase(money, payment, options)
commit('credits', post, options)
end
|
35
36
37
38
39
|
# File 'lib/active_merchant/billing/gateways/shift4_v2.rb', line 35
def (options = {})
super.tap do ||
['User-Agent'] = "Shift4/v2 ActiveMerchantBindings/#{ActiveMerchant::VERSION}"
end
end
|
#json_error(raw_response) ⇒ Object
48
49
50
|
# File 'lib/active_merchant/billing/gateways/shift4_v2.rb', line 48
def json_error(raw_response)
super(raw_response, 'Shift4 V2')
end
|
#scrub(transcript) ⇒ Object
41
42
43
44
45
46
|
# File 'lib/active_merchant/billing/gateways/shift4_v2.rb', line 41
def scrub(transcript)
super.
gsub(%r((card\[expMonth\]=)\d+), '\1[FILTERED]').
gsub(%r((card\[expYear\]=)\d+), '\1[FILTERED]').
gsub(%r((card\[cardholderName\]=)\w+[^ ]\w+), '\1[FILTERED]')
end
|