Class: ActiveMerchant::Billing::UsaEpayTransactionGateway
- Inherits:
-
Gateway
- Object
- Gateway
- ActiveMerchant::Billing::UsaEpayTransactionGateway
show all
- Defined in:
- lib/active_merchant/billing/gateways/usa_epay_transaction.rb
Constant Summary
collapse
- TRANSACTIONS =
{
authorization: 'cc:authonly',
purchase: 'cc:sale',
capture: 'cc:capture',
refund: 'cc:refund',
void: 'cc:void',
void_release: 'cc:void:release',
check_purchase: 'check:sale',
store: 'cc:save'
}
- STANDARD_ERROR_CODE_MAPPING =
{
'00011' => STANDARD_ERROR_CODE[:incorrect_number],
'00012' => STANDARD_ERROR_CODE[:incorrect_number],
'00013' => STANDARD_ERROR_CODE[:incorrect_number],
'00014' => STANDARD_ERROR_CODE[:invalid_number],
'00015' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'00016' => STANDARD_ERROR_CODE[:invalid_expiry_date],
'00017' => STANDARD_ERROR_CODE[:expired_card],
'10116' => STANDARD_ERROR_CODE[:incorrect_cvc],
'10107' => STANDARD_ERROR_CODE[:incorrect_zip],
'10109' => STANDARD_ERROR_CODE[:incorrect_address],
'10110' => STANDARD_ERROR_CODE[:incorrect_address],
'10111' => STANDARD_ERROR_CODE[:incorrect_address],
'10127' => STANDARD_ERROR_CODE[:card_declined],
'00043' => STANDARD_ERROR_CODE[:call_issuer],
'10205' => STANDARD_ERROR_CODE[:card_declined],
'10204' => STANDARD_ERROR_CODE[:pickup_card]
}
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 = {}) ⇒ UsaEpayTransactionGateway
constructor
A new instance of UsaEpayTransactionGateway.
-
#purchase(money, payment, options = {}) ⇒ Object
-
#refund(money, authorization, options = {}) ⇒ Object
-
#scrub(transcript) ⇒ Object
-
#store(payment, options = {}) ⇒ Object
-
#supports_scrubbing? ⇒ Boolean
-
#verify(creditcard, options = {}) ⇒ Object
-
#void(authorization, options = {}) ⇒ Object
Pass ‘no_release: true` to keep the void from immediately settling.
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, #strftime_yyyymm
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
Returns a new instance of UsaEpayTransactionGateway.
42
43
44
45
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 42
def initialize(options = {})
requires!(options, :login)
super
end
|
Instance Method Details
#authorize(money, payment, options = {}) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 47
def authorize(money, payment, options = {})
post = {}
add_amount(post, money)
add_invoice(post, options)
add_payment(post, payment)
unless payment.is_a?(CreditCard) && payment.track_data.present?
add_address(post, payment, options)
add_customer_data(post, options)
end
add_split_payments(post, options)
add_recurring_fields(post, options)
add_custom_fields(post, options)
add_line_items(post, options)
add_test_mode(post, options)
commit(:authorization, post)
end
|
#capture(money, authorization, options = {}) ⇒ Object
85
86
87
88
89
90
91
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 85
def capture(money, authorization, options = {})
post = { refNum: authorization }
add_amount(post, money)
add_test_mode(post, options)
commit(:capture, post)
end
|
#purchase(money, payment, options = {}) ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 66
def purchase(money, payment, options = {})
post = {}
add_amount(post, money)
add_invoice(post, options)
add_payment(post, payment, options)
unless payment.respond_to?(:track_data) && payment.track_data.present?
add_address(post, payment, options)
add_customer_data(post, options)
end
add_split_payments(post, options)
add_recurring_fields(post, options)
add_custom_fields(post, options)
add_line_items(post, options)
add_test_mode(post, options)
payment.respond_to?(:routing_number) ? commit(:check_purchase, post) : commit(:purchase, post)
end
|
#refund(money, authorization, options = {}) ⇒ Object
93
94
95
96
97
98
99
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 93
def refund(money, authorization, options = {})
post = { refNum: authorization }
add_amount(post, money)
add_test_mode(post, options)
commit(:refund, post)
end
|
#scrub(transcript) ⇒ Object
126
127
128
129
130
131
132
133
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 126
def scrub(transcript)
transcript.
gsub(%r((&?UMcard=)\d*(&?))i, '\1[FILTERED]\2').
gsub(%r((&?UMcvv2=)\d*(&?))i, '\1[FILTERED]\2').
gsub(%r((&?UMmagstripe=)[^&]*)i, '\1[FILTERED]\2').
gsub(%r((&?UMaccount=)[^&]*)i, '\1[FILTERED]').
gsub(%r((&?UMkey=)[^&]*)i, '\1[FILTERED]')
end
|
#store(payment, options = {}) ⇒ Object
101
102
103
104
105
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 101
def store(payment, options = {})
post = {}
add_payment(post, payment, options)
commit(:store, post)
end
|
#supports_scrubbing? ⇒ Boolean
122
123
124
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 122
def supports_scrubbing?
true
end
|
#verify(creditcard, options = {}) ⇒ Object
107
108
109
110
111
112
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 107
def verify(creditcard, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(1, creditcard, options) }
r.process(:ignore_result) { void(r.authorization, options) }
end
end
|
#void(authorization, options = {}) ⇒ Object
Pass ‘no_release: true` to keep the void from immediately settling
115
116
117
118
119
120
|
# File 'lib/active_merchant/billing/gateways/usa_epay_transaction.rb', line 115
def void(authorization, options = {})
command = (options[:no_release] ? :void : :void_release)
post = { refNum: authorization }
add_test_mode(post, options)
commit(command, post)
end
|