yetanothernguyen-activemerchant 1.16.0 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +95 -0
- data/CONTRIBUTORS +29 -0
- data/lib/active_merchant/billing/credit_card.rb +105 -19
- data/lib/active_merchant/billing/credit_card_methods.rb +5 -1
- data/lib/active_merchant/billing/gateway.rb +1 -1
- data/lib/active_merchant/billing/gateways/authorize_net.rb +24 -2
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -18
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +110 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +29 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +9 -4
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +23 -0
- data/lib/active_merchant/billing/gateways/certo_direct.rb +279 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
- data/lib/active_merchant/billing/gateways/elavon.rb +2 -1
- data/lib/active_merchant/billing/gateways/epay.rb +12 -6
- data/lib/active_merchant/billing/gateways/eway_managed.rb +46 -12
- data/lib/active_merchant/billing/gateways/exact.rb +5 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +3 -3
- data/lib/active_merchant/billing/gateways/ipay88.rb +157 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +3 -3
- data/lib/active_merchant/billing/gateways/itransact.rb +450 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +1 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +4 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +244 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +94 -56
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +277 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +57 -34
- data/lib/active_merchant/billing/gateways/pay_junction.rb +6 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +1 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow.rb +10 -2
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +8 -5
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +43 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +93 -40
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +8 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +4 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +97 -22
- data/lib/active_merchant/billing/gateways/realex.rb +5 -1
- data/lib/active_merchant/billing/gateways/samurai.rb +121 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +136 -49
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +1 -1
- data/lib/active_merchant/billing/gateways/skip_jack.rb +7 -2
- data/lib/active_merchant/billing/gateways/stripe.rb +51 -19
- data/lib/active_merchant/billing/gateways/usa_epay.rb +13 -184
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1496 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +206 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +2 -2
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -1
- data/lib/active_merchant/billing/gateways/worldpay.rb +1 -1
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +6 -2
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +228 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +340 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +38 -0
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +4 -4
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +31 -0
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +55 -0
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +38 -0
- data/lib/active_merchant/billing/integrations/dwolla.rb +30 -0
- data/lib/active_merchant/billing/integrations/helper.rb +19 -2
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +120 -0
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +121 -0
- data/lib/active_merchant/billing/integrations/ipay88.rb +40 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +1 -1
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +100 -0
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +78 -0
- data/lib/active_merchant/billing/integrations/payflow_link.rb +21 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +4 -4
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +18 -2
- data/lib/active_merchant/billing/integrations/two_checkout.rb +1 -2
- data/lib/active_merchant/railtie.rb +7 -7
- data/lib/active_merchant/railtie.rb.orig +19 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +23 -10
- data/lib/active_merchant.rb.orig +78 -0
- metadata +147 -63
- data/lib/active_merchant/common/connection.rb +0 -177
- data/lib/active_merchant/common/country.rb +0 -328
- data/lib/active_merchant/common/error.rb +0 -26
- data/lib/active_merchant/common/post_data.rb +0 -24
- data/lib/active_merchant/common/posts_data.rb +0 -63
- data/lib/active_merchant/common/requires_parameters.rb +0 -16
- data/lib/active_merchant/common/utils.rb +0 -22
- data/lib/active_merchant/common/validateable.rb +0 -81
- data/lib/active_merchant/common.rb +0 -14
- data/lib/certs/cacert.pem +0 -7815
@@ -1,194 +1,23 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
|
-
|
3
|
+
##
|
4
|
+
# Delegates to the appropriate gateway, either the Transaction or Advanced
|
5
|
+
# depending on options passed to new.
|
6
|
+
#
|
4
7
|
class UsaEpayGateway < Gateway
|
5
|
-
URL = 'https://www.usaepay.com/gate.php'
|
6
|
-
|
7
|
-
self.supported_cardtypes = [:visa, :master, :american_express]
|
8
|
-
self.supported_countries = ['US']
|
9
|
-
self.homepage_url = 'http://www.usaepay.com/'
|
10
|
-
self.display_name = 'USA ePay'
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@options = options
|
21
|
-
super
|
22
|
-
end
|
23
|
-
|
24
|
-
def authorize(money, credit_card, options = {})
|
25
|
-
post = {}
|
26
|
-
|
27
|
-
add_amount(post, money)
|
28
|
-
add_invoice(post, options)
|
29
|
-
add_credit_card(post, credit_card)
|
30
|
-
add_address(post, credit_card, options)
|
31
|
-
add_customer_data(post, options)
|
32
|
-
|
33
|
-
commit(:authorization, post)
|
34
|
-
end
|
35
|
-
|
36
|
-
def purchase(money, credit_card, options = {})
|
37
|
-
post = {}
|
38
|
-
|
39
|
-
add_amount(post, money)
|
40
|
-
add_invoice(post, options)
|
41
|
-
add_credit_card(post, credit_card)
|
42
|
-
add_address(post, credit_card, options)
|
43
|
-
add_customer_data(post, options)
|
44
|
-
|
45
|
-
commit(:purchase, post)
|
46
|
-
end
|
47
|
-
|
48
|
-
def capture(money, authorization, options = {})
|
49
|
-
post = {
|
50
|
-
:refNum => authorization
|
51
|
-
}
|
52
|
-
|
53
|
-
add_amount(post, money)
|
54
|
-
commit(:capture, post)
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def add_amount(post, money)
|
60
|
-
post[:amount] = amount(money)
|
61
|
-
end
|
62
|
-
|
63
|
-
def expdate(credit_card)
|
64
|
-
year = format(credit_card.year, :two_digits)
|
65
|
-
month = format(credit_card.month, :two_digits)
|
66
|
-
|
67
|
-
"#{month}#{year}"
|
68
|
-
end
|
69
|
-
|
70
|
-
def add_customer_data(post, options)
|
71
|
-
address = options[:billing_address] || options[:address] || {}
|
72
|
-
post[:street] = address[:address1]
|
73
|
-
post[:zip] = address[:zip]
|
74
|
-
|
75
|
-
if options.has_key? :email
|
76
|
-
post[:custemail] = options[:email]
|
77
|
-
post[:custreceipt] = 'No'
|
78
|
-
end
|
79
|
-
|
80
|
-
if options.has_key? :customer
|
81
|
-
post[:custid] = options[:customer]
|
82
|
-
end
|
83
|
-
|
84
|
-
if options.has_key? :ip
|
85
|
-
post[:ip] = options[:ip]
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def add_address(post, credit_card, options)
|
90
|
-
billing_address = options[:billing_address] || options[:address]
|
91
|
-
|
92
|
-
add_address_for_type(:billing, post, credit_card, billing_address) if billing_address
|
93
|
-
add_address_for_type(:shipping, post, credit_card, options[:shipping_address]) if options[:shipping_address]
|
94
|
-
end
|
95
|
-
|
96
|
-
def add_address_for_type(type, post, credit_card, address)
|
97
|
-
prefix = address_key_prefix(type)
|
98
|
-
|
99
|
-
post[address_key(prefix, 'fname')] = credit_card.first_name
|
100
|
-
post[address_key(prefix, 'lname')] = credit_card.last_name
|
101
|
-
post[address_key(prefix, 'company')] = address[:company] unless address[:company].blank?
|
102
|
-
post[address_key(prefix, 'street')] = address[:address1] unless address[:address1].blank?
|
103
|
-
post[address_key(prefix, 'street2')] = address[:address2] unless address[:address2].blank?
|
104
|
-
post[address_key(prefix, 'city')] = address[:city] unless address[:city].blank?
|
105
|
-
post[address_key(prefix, 'state')] = address[:state] unless address[:state].blank?
|
106
|
-
post[address_key(prefix, 'zip')] = address[:zip] unless address[:zip].blank?
|
107
|
-
post[address_key(prefix, 'country')] = address[:country] unless address[:country].blank?
|
108
|
-
post[address_key(prefix, 'phone')] = address[:phone] unless address[:phone].blank?
|
109
|
-
end
|
110
|
-
|
111
|
-
def address_key_prefix(type)
|
112
|
-
case type
|
113
|
-
when :shipping then 'ship'
|
114
|
-
when :billing then 'bill'
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
def address_key(prefix, key)
|
119
|
-
"#{prefix}#{key}".to_sym
|
120
|
-
end
|
121
|
-
|
122
|
-
def add_invoice(post, options)
|
123
|
-
post[:invoice] = options[:order_id]
|
124
|
-
end
|
125
|
-
|
126
|
-
def add_credit_card(post, credit_card)
|
127
|
-
post[:card] = credit_card.number
|
128
|
-
post[:cvv2] = credit_card.verification_value if credit_card.verification_value?
|
129
|
-
post[:expir] = expdate(credit_card)
|
130
|
-
post[:name] = credit_card.name
|
131
|
-
end
|
132
|
-
|
133
|
-
def parse(body)
|
134
|
-
fields = {}
|
135
|
-
for line in body.split('&')
|
136
|
-
key, value = *line.scan( %r{^(\w+)\=(.*)$} ).flatten
|
137
|
-
fields[key] = CGI.unescape(value.to_s)
|
138
|
-
end
|
139
|
-
|
140
|
-
{
|
141
|
-
:status => fields['UMstatus'],
|
142
|
-
:auth_code => fields['UMauthCode'],
|
143
|
-
:ref_num => fields['UMrefNum'],
|
144
|
-
:batch => fields['UMbatch'],
|
145
|
-
:avs_result => fields['UMavsResult'],
|
146
|
-
:avs_result_code => fields['UMavsResultCode'],
|
147
|
-
:cvv2_result => fields['UMcvv2Result'],
|
148
|
-
:cvv2_result_code => fields['UMcvv2ResultCode'],
|
149
|
-
:vpas_result_code => fields['UMvpasResultCode'],
|
150
|
-
:result => fields['UMresult'],
|
151
|
-
:error => fields['UMerror'],
|
152
|
-
:error_code => fields['UMerrorcode'],
|
153
|
-
:acs_url => fields['UMacsurl'],
|
154
|
-
:payload => fields['UMpayload']
|
155
|
-
}.delete_if{|k, v| v.nil?}
|
156
|
-
end
|
157
|
-
|
158
|
-
|
159
|
-
def commit(action, parameters)
|
160
|
-
response = parse( ssl_post(URL, post_data(action, parameters)) )
|
161
|
-
|
162
|
-
Response.new(response[:status] == 'Approved', message_from(response), response,
|
163
|
-
:test => @options[:test] || test?,
|
164
|
-
:authorization => response[:ref_num],
|
165
|
-
:cvv_result => response[:cvv2_result_code],
|
166
|
-
:avs_result => {
|
167
|
-
:street_match => response[:avs_result_code].to_s[0,1],
|
168
|
-
:postal_match => response[:avs_result_code].to_s[1,1],
|
169
|
-
:code => response[:avs_result_code].to_s[2,1]
|
170
|
-
}
|
171
|
-
)
|
172
|
-
end
|
173
|
-
|
174
|
-
def message_from(response)
|
175
|
-
if response[:status] == "Approved"
|
176
|
-
return 'Success'
|
9
|
+
##
|
10
|
+
# Creates an instance of UsaEpayTransactionGateway by default, but if
|
11
|
+
# :software id or :live_url are passed in the options hash it will
|
12
|
+
# create an instance of UsaEpayAdvancedGateway.
|
13
|
+
#
|
14
|
+
def self.new(options={})
|
15
|
+
unless options.has_key?(:software_id) || options.has_key?(:live_url)
|
16
|
+
UsaEpayTransactionGateway.new(options)
|
177
17
|
else
|
178
|
-
|
179
|
-
return response[:error]
|
18
|
+
UsaEpayAdvancedGateway.new(options)
|
180
19
|
end
|
181
20
|
end
|
182
|
-
|
183
|
-
def post_data(action, parameters = {})
|
184
|
-
parameters[:command] = TRANSACTIONS[action]
|
185
|
-
parameters[:key] = @options[:login]
|
186
|
-
parameters[:software] = 'Active Merchant'
|
187
|
-
parameters[:testmode] = @options[:test] ? 1 : 0
|
188
|
-
|
189
|
-
parameters.collect { |key, value| "UM#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
190
|
-
end
|
191
21
|
end
|
192
22
|
end
|
193
23
|
end
|
194
|
-
|