activemerchant 1.79.2 → 1.80.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.
Files changed (219) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +33 -0
  3. data/README.md +10 -2
  4. data/lib/active_merchant.rb +1 -1
  5. data/lib/active_merchant/billing/check.rb +4 -4
  6. data/lib/active_merchant/billing/compatibility.rb +1 -1
  7. data/lib/active_merchant/billing/credit_card.rb +21 -21
  8. data/lib/active_merchant/billing/credit_card_formatting.rb +2 -2
  9. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  10. data/lib/active_merchant/billing/gateway.rb +13 -13
  11. data/lib/active_merchant/billing/gateways/adyen.rb +31 -15
  12. data/lib/active_merchant/billing/gateways/allied_wallet.rb +22 -22
  13. data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -72
  14. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +3 -3
  16. data/lib/active_merchant/billing/gateways/axcessms.rb +51 -51
  17. data/lib/active_merchant/billing/gateways/balanced.rb +29 -29
  18. data/lib/active_merchant/billing/gateways/bank_frick.rb +3 -3
  19. data/lib/active_merchant/billing/gateways/banwire.rb +8 -8
  20. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +5 -5
  21. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
  22. data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/beanstream.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +69 -69
  25. data/lib/active_merchant/billing/gateways/blue_pay.rb +19 -19
  26. data/lib/active_merchant/billing/gateways/blue_snap.rb +42 -42
  27. data/lib/active_merchant/billing/gateways/bogus.rb +10 -10
  28. data/lib/active_merchant/billing/gateways/borgun.rb +10 -10
  29. data/lib/active_merchant/billing/gateways/bpoint.rb +1 -1
  30. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +2 -2
  31. data/lib/active_merchant/billing/gateways/braintree_blue.rb +94 -94
  32. data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/bridge_pay.rb +39 -39
  34. data/lib/active_merchant/billing/gateways/cams.rb +12 -12
  35. data/lib/active_merchant/billing/gateways/card_connect.rb +38 -13
  36. data/lib/active_merchant/billing/gateways/card_stream.rb +116 -116
  37. data/lib/active_merchant/billing/gateways/cardknox.rb +7 -7
  38. data/lib/active_merchant/billing/gateways/cardprocess.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/cashnet.rb +10 -10
  40. data/lib/active_merchant/billing/gateways/cc5.rb +3 -5
  41. data/lib/active_merchant/billing/gateways/cecabank.rb +6 -6
  42. data/lib/active_merchant/billing/gateways/cenpos.rb +36 -36
  43. data/lib/active_merchant/billing/gateways/checkout.rb +5 -5
  44. data/lib/active_merchant/billing/gateways/checkout_v2.rb +31 -31
  45. data/lib/active_merchant/billing/gateways/clearhaus.rb +5 -5
  46. data/lib/active_merchant/billing/gateways/commercegate.rb +6 -6
  47. data/lib/active_merchant/billing/gateways/conekta.rb +24 -19
  48. data/lib/active_merchant/billing/gateways/creditcall.rb +41 -41
  49. data/lib/active_merchant/billing/gateways/credorax.rb +104 -103
  50. data/lib/active_merchant/billing/gateways/culqi.rb +25 -25
  51. data/lib/active_merchant/billing/gateways/cyber_source.rb +65 -65
  52. data/lib/active_merchant/billing/gateways/data_cash.rb +4 -4
  53. data/lib/active_merchant/billing/gateways/dibs.rb +24 -24
  54. data/lib/active_merchant/billing/gateways/digitzs.rb +35 -35
  55. data/lib/active_merchant/billing/gateways/ebanx.rb +26 -26
  56. data/lib/active_merchant/billing/gateways/efsnet.rb +10 -10
  57. data/lib/active_merchant/billing/gateways/elavon.rb +5 -5
  58. data/lib/active_merchant/billing/gateways/element.rb +35 -35
  59. data/lib/active_merchant/billing/gateways/epay.rb +4 -4
  60. data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/eway.rb +65 -65
  62. data/lib/active_merchant/billing/gateways/eway_managed.rb +11 -11
  63. data/lib/active_merchant/billing/gateways/eway_rapid.rb +31 -31
  64. data/lib/active_merchant/billing/gateways/exact.rb +12 -12
  65. data/lib/active_merchant/billing/gateways/ezic.rb +13 -13
  66. data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -24
  67. data/lib/active_merchant/billing/gateways/federated_canada.rb +3 -3
  68. data/lib/active_merchant/billing/gateways/first_giving.rb +16 -16
  69. data/lib/active_merchant/billing/gateways/first_pay.rb +7 -4
  70. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +71 -71
  71. data/lib/active_merchant/billing/gateways/flo2cash.rb +12 -12
  72. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/forte.rb +26 -16
  74. data/lib/active_merchant/billing/gateways/garanti.rb +10 -12
  75. data/lib/active_merchant/billing/gateways/global_collect.rb +88 -88
  76. data/lib/active_merchant/billing/gateways/global_transport.rb +4 -4
  77. data/lib/active_merchant/billing/gateways/hdfc.rb +33 -33
  78. data/lib/active_merchant/billing/gateways/hps.rb +28 -28
  79. data/lib/active_merchant/billing/gateways/iats_payments.rb +26 -26
  80. data/lib/active_merchant/billing/gateways/inspire.rb +15 -15
  81. data/lib/active_merchant/billing/gateways/instapay.rb +4 -4
  82. data/lib/active_merchant/billing/gateways/ipp.rb +17 -17
  83. data/lib/active_merchant/billing/gateways/iridium.rb +207 -207
  84. data/lib/active_merchant/billing/gateways/iveri.rb +8 -8
  85. data/lib/active_merchant/billing/gateways/jetpay.rb +134 -134
  86. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +141 -141
  87. data/lib/active_merchant/billing/gateways/komoju.rb +15 -15
  88. data/lib/active_merchant/billing/gateways/kushki.rb +31 -37
  89. data/lib/active_merchant/billing/gateways/latitude19.rb +64 -64
  90. data/lib/active_merchant/billing/gateways/linkpoint.rb +22 -22
  91. data/lib/active_merchant/billing/gateways/litle.rb +4 -4
  92. data/lib/active_merchant/billing/gateways/mastercard.rb +3 -3
  93. data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
  94. data/lib/active_merchant/billing/gateways/mercado_pago.rb +28 -28
  95. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +9 -9
  96. data/lib/active_merchant/billing/gateways/merchant_one.rb +6 -6
  97. data/lib/active_merchant/billing/gateways/merchant_partners.rb +24 -24
  98. data/lib/active_merchant/billing/gateways/merchant_ware.rb +49 -49
  99. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +36 -36
  100. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +4 -4
  101. data/lib/active_merchant/billing/gateways/mercury.rb +28 -28
  102. data/lib/active_merchant/billing/gateways/metrics_global.rb +7 -7
  103. data/lib/active_merchant/billing/gateways/micropayment.rb +31 -31
  104. data/lib/active_merchant/billing/gateways/migs.rb +11 -9
  105. data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
  106. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +16 -16
  107. data/lib/active_merchant/billing/gateways/monei.rb +5 -5
  108. data/lib/active_merchant/billing/gateways/moneris.rb +26 -26
  109. data/lib/active_merchant/billing/gateways/moneris_us.rb +81 -37
  110. data/lib/active_merchant/billing/gateways/money_movers.rb +3 -3
  111. data/lib/active_merchant/billing/gateways/mundipagg.rb +1 -1
  112. data/lib/active_merchant/billing/gateways/nab_transact.rb +6 -6
  113. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +3 -3
  114. data/lib/active_merchant/billing/gateways/netaxept.rb +15 -15
  115. data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
  116. data/lib/active_merchant/billing/gateways/netbilling.rb +1 -1
  117. data/lib/active_merchant/billing/gateways/netpay.rb +5 -5
  118. data/lib/active_merchant/billing/gateways/nmi.rb +18 -18
  119. data/lib/active_merchant/billing/gateways/ogone.rb +22 -22
  120. data/lib/active_merchant/billing/gateways/omise.rb +3 -3
  121. data/lib/active_merchant/billing/gateways/openpay.rb +6 -4
  122. data/lib/active_merchant/billing/gateways/opp.rb +4 -4
  123. data/lib/active_merchant/billing/gateways/optimal_payment.rb +2 -2
  124. data/lib/active_merchant/billing/gateways/orbital.rb +61 -61
  125. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +4 -4
  126. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +5 -5
  127. data/lib/active_merchant/billing/gateways/pagarme.rb +27 -27
  128. data/lib/active_merchant/billing/gateways/pago_facil.rb +8 -8
  129. data/lib/active_merchant/billing/gateways/pay_conex.rb +25 -25
  130. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +32 -32
  131. data/lib/active_merchant/billing/gateways/pay_hub.rb +29 -29
  132. data/lib/active_merchant/billing/gateways/pay_junction.rb +7 -7
  133. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +30 -30
  134. data/lib/active_merchant/billing/gateways/pay_secure.rb +4 -4
  135. data/lib/active_merchant/billing/gateways/paybox_direct.rb +15 -15
  136. data/lib/active_merchant/billing/gateways/payeezy.rb +5 -5
  137. data/lib/active_merchant/billing/gateways/payex.rb +4 -4
  138. data/lib/active_merchant/billing/gateways/payflow.rb +7 -7
  139. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +23 -22
  140. data/lib/active_merchant/billing/gateways/payflow_express.rb +2 -2
  141. data/lib/active_merchant/billing/gateways/payment_express.rb +40 -37
  142. data/lib/active_merchant/billing/gateways/paymentez.rb +11 -3
  143. data/lib/active_merchant/billing/gateways/paymill.rb +115 -115
  144. data/lib/active_merchant/billing/gateways/paypal.rb +1 -1
  145. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
  146. data/lib/active_merchant/billing/gateways/payscout.rb +1 -1
  147. data/lib/active_merchant/billing/gateways/paystation.rb +14 -14
  148. data/lib/active_merchant/billing/gateways/payu_in.rb +43 -43
  149. data/lib/active_merchant/billing/gateways/payu_latam.rb +41 -41
  150. data/lib/active_merchant/billing/gateways/payway.rb +6 -6
  151. data/lib/active_merchant/billing/gateways/pin.rb +7 -7
  152. data/lib/active_merchant/billing/gateways/plugnpay.rb +62 -62
  153. data/lib/active_merchant/billing/gateways/pro_pay.rb +123 -123
  154. data/lib/active_merchant/billing/gateways/psigate.rb +16 -16
  155. data/lib/active_merchant/billing/gateways/psl_card.rb +13 -13
  156. data/lib/active_merchant/billing/gateways/qbms.rb +52 -52
  157. data/lib/active_merchant/billing/gateways/quantum.rb +5 -5
  158. data/lib/active_merchant/billing/gateways/quickbooks.rb +10 -10
  159. data/lib/active_merchant/billing/gateways/quickpay.rb +1 -1
  160. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +11 -11
  161. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
  162. data/lib/active_merchant/billing/gateways/qvalent.rb +55 -55
  163. data/lib/active_merchant/billing/gateways/realex.rb +16 -15
  164. data/lib/active_merchant/billing/gateways/redsys.rb +128 -121
  165. data/lib/active_merchant/billing/gateways/s5.rb +5 -5
  166. data/lib/active_merchant/billing/gateways/safe_charge.rb +16 -16
  167. data/lib/active_merchant/billing/gateways/sage.rb +20 -20
  168. data/lib/active_merchant/billing/gateways/sage_pay.rb +32 -32
  169. data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -11
  170. data/lib/active_merchant/billing/gateways/secure_net.rb +19 -19
  171. data/lib/active_merchant/billing/gateways/secure_pay.rb +5 -5
  172. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +7 -7
  173. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +9 -9
  174. data/lib/active_merchant/billing/gateways/securion_pay.rb +12 -12
  175. data/lib/active_merchant/billing/gateways/skip_jack.rb +28 -28
  176. data/lib/active_merchant/billing/gateways/smart_ps.rb +31 -31
  177. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +3 -3
  178. data/lib/active_merchant/billing/gateways/spreedly_core.rb +1 -1
  179. data/lib/active_merchant/billing/gateways/stripe.rb +63 -63
  180. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +5 -5
  181. data/lib/active_merchant/billing/gateways/telr.rb +26 -26
  182. data/lib/active_merchant/billing/gateways/trans_first.rb +28 -28
  183. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +224 -224
  184. data/lib/active_merchant/billing/gateways/transact_pro.rb +7 -7
  185. data/lib/active_merchant/billing/gateways/transnational.rb +1 -1
  186. data/lib/active_merchant/billing/gateways/trexle.rb +5 -5
  187. data/lib/active_merchant/billing/gateways/trust_commerce.rb +38 -38
  188. data/lib/active_merchant/billing/gateways/usa_epay.rb +3 -3
  189. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +37 -37
  190. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -3
  191. data/lib/active_merchant/billing/gateways/vanco.rb +25 -25
  192. data/lib/active_merchant/billing/gateways/verifi.rb +40 -40
  193. data/lib/active_merchant/billing/gateways/viaklix.rb +5 -5
  194. data/lib/active_merchant/billing/gateways/visanet_peru.rb +64 -36
  195. data/lib/active_merchant/billing/gateways/webpay.rb +8 -8
  196. data/lib/active_merchant/billing/gateways/wepay.rb +25 -25
  197. data/lib/active_merchant/billing/gateways/wirecard.rb +26 -26
  198. data/lib/active_merchant/billing/gateways/worldpay.rb +15 -15
  199. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +42 -42
  200. data/lib/active_merchant/billing/gateways/worldpay_us.rb +17 -17
  201. data/lib/active_merchant/billing/model.rb +2 -2
  202. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +1 -1
  203. data/lib/active_merchant/billing/rails.rb +1 -1
  204. data/lib/active_merchant/connection.rb +10 -8
  205. data/lib/active_merchant/country.rb +1 -1
  206. data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
  207. data/lib/active_merchant/network_connection_retries.rb +12 -12
  208. data/lib/active_merchant/post_data.rb +1 -1
  209. data/lib/active_merchant/posts_data.rb +1 -1
  210. data/lib/active_merchant/version.rb +1 -1
  211. data/lib/certs/cacert.pem +37 -0
  212. data/lib/support/gateway_support.rb +2 -2
  213. data/lib/support/ssl_verify.rb +5 -5
  214. data/lib/support/ssl_version.rb +7 -7
  215. metadata +3 -7
  216. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  217. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  218. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  219. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
@@ -48,11 +48,11 @@ module ActiveMerchant #:nodoc:
48
48
  }
49
49
 
50
50
  TRANSACTIONS = {
51
- :purchase => "Sale",
52
- :authorization => "Authorization",
53
- :capture => "Capture",
54
- :void => "Void",
55
- :credit => "Credit"
51
+ :purchase => 'Sale',
52
+ :authorization => 'Authorization',
53
+ :capture => 'Capture',
54
+ :void => 'Void',
55
+ :credit => 'Credit'
56
56
  }
57
57
 
58
58
  CVV_CODE = {
@@ -83,7 +83,7 @@ module ActiveMerchant #:nodoc:
83
83
  def build_request(body, options = {})
84
84
  xml = Builder::XmlMarkup.new
85
85
  xml.instruct!
86
- xml.tag! 'XMLPayRequest', 'Timeout' => timeout.to_s, 'version' => "2.1", "xmlns" => XMLNS do
86
+ xml.tag! 'XMLPayRequest', 'Timeout' => timeout.to_s, 'version' => '2.1', 'xmlns' => XMLNS do
87
87
  xml.tag! 'RequestData' do
88
88
  xml.tag! 'Vendor', @options[:login]
89
89
  xml.tag! 'Partner', @options[:partner]
@@ -137,8 +137,9 @@ module ActiveMerchant #:nodoc:
137
137
 
138
138
  xml.tag! 'Address' do
139
139
  xml.tag! 'Street', address[:address1] unless address[:address1].blank?
140
+ xml.tag! 'Street2', address[:address2] unless address[:address2].blank?
140
141
  xml.tag! 'City', address[:city] unless address[:city].blank?
141
- xml.tag! 'State', address[:state].blank? ? "N/A" : address[:state]
142
+ xml.tag! 'State', address[:state].blank? ? 'N/A' : address[:state]
142
143
  xml.tag! 'Country', address[:country] unless address[:country].blank?
143
144
  xml.tag! 'Zip', address[:zip] unless address[:zip].blank?
144
145
  end
@@ -149,16 +150,16 @@ module ActiveMerchant #:nodoc:
149
150
  response = {}
150
151
  xml = Nokogiri::XML(data)
151
152
  xml.remove_namespaces!
152
- root = xml.xpath("//ResponseData")
153
+ root = xml.xpath('//ResponseData')
153
154
 
154
155
  # REXML::XPath in Ruby 1.8.6 is now unable to match nodes based on their attributes
155
- tx_result = root.xpath(".//TransactionResult").first
156
+ tx_result = root.xpath('.//TransactionResult').first
156
157
 
157
- if tx_result && tx_result.attributes['Duplicate'].to_s == "true"
158
+ if tx_result && tx_result.attributes['Duplicate'].to_s == 'true'
158
159
  response[:duplicate] = true
159
160
  end
160
161
 
161
- root.xpath(".//*").each do |node|
162
+ root.xpath('.//*').each do |node|
162
163
  parse_element(response, node)
163
164
  end
164
165
 
@@ -174,9 +175,9 @@ module ActiveMerchant #:nodoc:
174
175
  # in an RPPaymentResults element so we'll come here multiple times
175
176
  response[node_name] ||= []
176
177
  response[node_name] << ( payment_result_response = {} )
177
- node.xpath(".//*").each{ |e| parse_element(payment_result_response, e) }
178
- when node.xpath(".//*").to_a.any?
179
- node.xpath(".//*").each{|e| parse_element(response, e) }
178
+ node.xpath('.//*').each{ |e| parse_element(payment_result_response, e) }
179
+ when node.xpath('.//*').to_a.any?
180
+ node.xpath('.//*').each{|e| parse_element(response, e) }
180
181
  when node_name.to_s =~ /amt$/
181
182
  # *Amt elements don't put the value in the #text - instead they use a Currency attribute
182
183
  response[node_name] = node.attributes['Currency'].to_s
@@ -189,15 +190,15 @@ module ActiveMerchant #:nodoc:
189
190
 
190
191
  def build_headers(content_length)
191
192
  headers = {
192
- "Content-Type" => "text/xml",
193
- "Content-Length" => content_length.to_s,
194
- "X-VPS-Client-Timeout" => timeout.to_s,
195
- "X-VPS-VIT-Integration-Product" => "ActiveMerchant",
196
- "X-VPS-VIT-Runtime-Version" => RUBY_VERSION,
197
- "X-VPS-Request-ID" => SecureRandom.hex(16)
193
+ 'Content-Type' => 'text/xml',
194
+ 'Content-Length' => content_length.to_s,
195
+ 'X-VPS-Client-Timeout' => timeout.to_s,
196
+ 'X-VPS-VIT-Integration-Product' => 'ActiveMerchant',
197
+ 'X-VPS-VIT-Runtime-Version' => RUBY_VERSION,
198
+ 'X-VPS-Request-ID' => SecureRandom.hex(16)
198
199
  }
199
200
 
200
- headers.merge!("PAYPAL-NVP" => "Y") if self.use_paypal_nvp
201
+ headers.merge!('PAYPAL-NVP' => 'Y') if self.use_paypal_nvp
201
202
  headers
202
203
  end
203
204
 
@@ -223,7 +224,7 @@ module ActiveMerchant #:nodoc:
223
224
  end
224
225
 
225
226
  def under_fraud_review?(response)
226
- (response[:result] == "126")
227
+ (response[:result] == '126')
227
228
  end
228
229
  end
229
230
  end
@@ -178,7 +178,7 @@ module ActiveMerchant #:nodoc:
178
178
  end
179
179
  if items.any?
180
180
  xml.tag! 'ExtData', 'Name' => 'CURRENCY', 'Value' => options[:currency] || currency(money)
181
- xml.tag! 'ExtData', 'Name' => "ITEMAMT", 'Value' => amount(options[:subtotal] || money)
181
+ xml.tag! 'ExtData', 'Name' => 'ITEMAMT', 'Value' => amount(options[:subtotal] || money)
182
182
  end
183
183
  xml.tag! 'DiscountAmt', amount(options[:discount]) if options[:discount]
184
184
  xml.tag! 'TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money)
@@ -192,7 +192,7 @@ module ActiveMerchant #:nodoc:
192
192
  end
193
193
 
194
194
  def add_paypal_details(xml, options)
195
- xml.tag! 'PayPal' do
195
+ xml.tag! 'PayPal' do
196
196
  xml.tag! 'EMail', options[:email] unless options[:email].blank?
197
197
  xml.tag! 'ReturnURL', options[:return_url] unless options[:return_url].blank?
198
198
  xml.tag! 'CancelURL', options[:cancel_return_url] unless options[:cancel_return_url].blank?
@@ -21,7 +21,8 @@ module ActiveMerchant #:nodoc:
21
21
  self.homepage_url = 'http://www.paymentexpress.com/'
22
22
  self.display_name = 'PaymentExpress'
23
23
 
24
- self.live_url = self.test_url = 'https://sec.paymentexpress.com/pxpost.aspx'
24
+ self.live_url = 'https://sec.paymentexpress.com/pxpost.aspx'
25
+ self.test_url = 'https://uat.paymentexpress.com/pxpost.aspx'
25
26
 
26
27
  APPROVED = '1'
27
28
 
@@ -176,66 +177,66 @@ module ActiveMerchant #:nodoc:
176
177
  end
177
178
 
178
179
  def add_credentials(xml)
179
- xml.add_element("PostUsername").text = @options[:login]
180
- xml.add_element("PostPassword").text = @options[:password]
180
+ xml.add_element('PostUsername').text = @options[:login]
181
+ xml.add_element('PostPassword').text = @options[:password]
181
182
  end
182
183
 
183
184
  def add_reference(xml, identification)
184
- xml.add_element("DpsTxnRef").text = identification
185
+ xml.add_element('DpsTxnRef').text = identification
185
186
  end
186
187
 
187
188
  def add_credit_card(xml, credit_card)
188
- xml.add_element("CardHolderName").text = credit_card.name
189
- xml.add_element("CardNumber").text = credit_card.number
190
- xml.add_element("DateExpiry").text = format_date(credit_card.month, credit_card.year)
189
+ xml.add_element('CardHolderName').text = credit_card.name
190
+ xml.add_element('CardNumber').text = credit_card.number
191
+ xml.add_element('DateExpiry').text = format_date(credit_card.month, credit_card.year)
191
192
 
192
193
  if credit_card.verification_value?
193
- xml.add_element("Cvc2").text = credit_card.verification_value
194
- xml.add_element("Cvc2Presence").text = "1"
194
+ xml.add_element('Cvc2').text = credit_card.verification_value
195
+ xml.add_element('Cvc2Presence').text = '1'
195
196
  end
196
197
 
197
198
  if requires_start_date_or_issue_number?(credit_card)
198
- xml.add_element("DateStart").text = format_date(credit_card.start_month, credit_card.start_year) unless credit_card.start_month.blank? || credit_card.start_year.blank?
199
- xml.add_element("IssueNumber").text = credit_card.issue_number unless credit_card.issue_number.blank?
199
+ xml.add_element('DateStart').text = format_date(credit_card.start_month, credit_card.start_year) unless credit_card.start_month.blank? || credit_card.start_year.blank?
200
+ xml.add_element('IssueNumber').text = credit_card.issue_number unless credit_card.issue_number.blank?
200
201
  end
201
202
  end
202
203
 
203
204
  def add_billing_token(xml, token)
204
205
  if use_custom_payment_token?
205
- xml.add_element("BillingId").text = token
206
+ xml.add_element('BillingId').text = token
206
207
  else
207
- xml.add_element("DpsBillingId").text = token
208
+ xml.add_element('DpsBillingId').text = token
208
209
  end
209
210
  end
210
211
 
211
212
  def add_token_request(xml, options)
212
- xml.add_element("BillingId").text = options[:billing_id] if options[:billing_id]
213
- xml.add_element("EnableAddBillCard").text = 1
213
+ xml.add_element('BillingId').text = options[:billing_id] if options[:billing_id]
214
+ xml.add_element('EnableAddBillCard').text = 1
214
215
  end
215
216
 
216
217
  def add_amount(xml, money, options)
217
- xml.add_element("Amount").text = amount(money)
218
- xml.add_element("InputCurrency").text = options[:currency] || currency(money)
218
+ xml.add_element('Amount').text = amount(money)
219
+ xml.add_element('InputCurrency').text = options[:currency] || currency(money)
219
220
  end
220
221
 
221
222
  def add_transaction_type(xml, action)
222
- xml.add_element("TxnType").text = TRANSACTIONS[action]
223
+ xml.add_element('TxnType').text = TRANSACTIONS[action]
223
224
  end
224
225
 
225
226
  def add_invoice(xml, options)
226
- xml.add_element("TxnId").text = options[:order_id].to_s.slice(0, 16) unless options[:order_id].blank?
227
- xml.add_element("MerchantReference").text = options[:description].to_s.slice(0, 50) unless options[:description].blank?
227
+ xml.add_element('TxnId').text = options[:order_id].to_s.slice(0, 16) unless options[:order_id].blank?
228
+ xml.add_element('MerchantReference').text = options[:description].to_s.slice(0, 50) unless options[:description].blank?
228
229
  end
229
230
 
230
231
  def add_address_verification_data(xml, options)
231
232
  address = options[:billing_address] || options[:address]
232
233
  return if address.nil?
233
234
 
234
- xml.add_element("EnableAvsData").text = 1
235
- xml.add_element("AvsAction").text = 1
235
+ xml.add_element('EnableAvsData').text = 1
236
+ xml.add_element('AvsAction').text = 1
236
237
 
237
- xml.add_element("AvsStreetAddress").text = address[:address1]
238
- xml.add_element("AvsPostCode").text = address[:zip]
238
+ xml.add_element('AvsStreetAddress').text = address[:address1]
239
+ xml.add_element('AvsPostCode').text = address[:zip]
239
240
  end
240
241
 
241
242
  # The options hash may contain optional data which will be passed
@@ -276,16 +277,16 @@ module ActiveMerchant #:nodoc:
276
277
  # +purchase+, +authorize+, +capture+, +refund+, +store+
277
278
  def add_optional_elements(xml, options)
278
279
  if client_type = normalized_client_type(options[:client_type])
279
- xml.add_element("ClientType").text = client_type
280
+ xml.add_element('ClientType').text = client_type
280
281
  end
281
282
 
282
- xml.add_element("TxnData1").text = options[:txn_data1].to_s.slice(0,255) unless options[:txn_data1].blank?
283
- xml.add_element("TxnData2").text = options[:txn_data2].to_s.slice(0,255) unless options[:txn_data2].blank?
284
- xml.add_element("TxnData3").text = options[:txn_data3].to_s.slice(0,255) unless options[:txn_data3].blank?
283
+ xml.add_element('TxnData1').text = options[:txn_data1].to_s.slice(0,255) unless options[:txn_data1].blank?
284
+ xml.add_element('TxnData2').text = options[:txn_data2].to_s.slice(0,255) unless options[:txn_data2].blank?
285
+ xml.add_element('TxnData3').text = options[:txn_data3].to_s.slice(0,255) unless options[:txn_data3].blank?
285
286
  end
286
287
 
287
288
  def new_transaction
288
- REXML::Document.new.add_element("Txn")
289
+ REXML::Document.new.add_element('Txn')
289
290
  end
290
291
 
291
292
  # Take in the request and post it to DPS
@@ -293,8 +294,10 @@ module ActiveMerchant #:nodoc:
293
294
  add_credentials(request)
294
295
  add_transaction_type(request, action)
295
296
 
297
+ url = test? ? self.test_url : self.live_url
298
+
296
299
  # Parse the XML response
297
- response = parse( ssl_post(self.live_url, request.to_s) )
300
+ response = parse(ssl_post(url, request.to_s))
298
301
 
299
302
  # Return a response
300
303
  PaymentExpressResponse.new(response[:success] == APPROVED, message_from(response), response,
@@ -343,12 +346,12 @@ module ActiveMerchant #:nodoc:
343
346
 
344
347
  def normalized_client_type(client_type_from_options)
345
348
  case client_type_from_options.to_s.downcase
346
- when 'web' then "Web"
347
- when 'ivr' then "IVR"
348
- when 'moto' then "MOTO"
349
- when 'unattended' then "Unattended"
350
- when 'internet' then "Internet"
351
- when 'recurring' then "Recurring"
349
+ when 'web' then 'Web'
350
+ when 'ivr' then 'IVR'
351
+ when 'moto' then 'MOTO'
352
+ when 'unattended' then 'Unattended'
353
+ when 'internet' then 'Internet'
354
+ when 'recurring' then 'Recurring'
352
355
  else nil
353
356
  end
354
357
  end
@@ -358,7 +361,7 @@ module ActiveMerchant #:nodoc:
358
361
  # add a method to response so we can easily get the token
359
362
  # for Validate transactions
360
363
  def token
361
- @params["billing_id"] || @params["dps_billing_id"]
364
+ @params['billing_id'] || @params['dps_billing_id']
362
365
  end
363
366
  end
364
367
  end
@@ -67,8 +67,11 @@ module ActiveMerchant #:nodoc:
67
67
  commit_transaction('authorize', post)
68
68
  end
69
69
 
70
- def capture(_money, authorization, _options = {})
71
- post = { transaction: { id: authorization } }
70
+ def capture(money, authorization, _options = {})
71
+ post = {
72
+ transaction: { id: authorization }
73
+ }
74
+ post[:order] = {amount: amount(money).to_f} if money
72
75
 
73
76
  commit_transaction('capture', post)
74
77
  end
@@ -171,7 +174,12 @@ module ActiveMerchant #:nodoc:
171
174
  rescue ResponseError => e
172
175
  raw_response = e.response.body
173
176
  end
174
- parse(raw_response)
177
+
178
+ begin
179
+ parse(raw_response)
180
+ rescue JSON::ParserError
181
+ {'status' => 'Internal server error'}
182
+ end
175
183
  end
176
184
 
177
185
  def commit_transaction(action, parameters)
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
10
10
  self.display_name = 'PAYMILL'
11
11
  self.money_format = :cents
12
12
  self.default_currency = 'EUR'
13
- self.live_url = "https://api.paymill.com/v2/"
13
+ self.live_url = 'https://api.paymill.com/v2/'
14
14
 
15
15
  def initialize(options = {})
16
16
  requires!(options, :public_key, :private_key)
@@ -64,7 +64,7 @@ module ActiveMerchant #:nodoc:
64
64
 
65
65
  def verify_credentials
66
66
  begin
67
- ssl_get(live_url + "transactions/nonexistent", headers)
67
+ ssl_get(live_url + 'transactions/nonexistent', headers)
68
68
  rescue ResponseError => e
69
69
  return false if e.response.code.to_i == 401
70
70
  end
@@ -75,10 +75,10 @@ module ActiveMerchant #:nodoc:
75
75
  private
76
76
 
77
77
  def add_credit_card(post, credit_card, options)
78
- post['account.holder'] = (credit_card.try(:name) || "")
78
+ post['account.holder'] = (credit_card.try(:name) || '')
79
79
  post['account.number'] = credit_card.number
80
- post['account.expiry.month'] = sprintf("%.2i", credit_card.month)
81
- post['account.expiry.year'] = sprintf("%.4i", credit_card.year)
80
+ post['account.expiry.month'] = sprintf('%.2i', credit_card.month)
81
+ post['account.expiry.year'] = sprintf('%.4i', credit_card.year)
82
82
  post['account.verification'] = credit_card.verification_value
83
83
  post['account.email'] = (options[:email] || nil)
84
84
  post['presentation.amount3D'] = (options[:money] || nil)
@@ -122,7 +122,7 @@ module ActiveMerchant #:nodoc:
122
122
  [
123
123
  parsed_data['id'],
124
124
  parsed_data['preauthorization'].try(:[], 'id')
125
- ].join(";")
125
+ ].join(';')
126
126
  end
127
127
 
128
128
  def action_with_token(action, money, payment_method, options)
@@ -132,9 +132,9 @@ module ActiveMerchant #:nodoc:
132
132
  self.send("#{action}_with_token", money, payment_method, options)
133
133
  else
134
134
  MultiResponse.run do |r|
135
- r.process { save_card(payment_method, options) }
136
- r.process { self.send("#{action}_with_token", money, r.authorization, options) }
137
- end
135
+ r.process { save_card(payment_method, options) }
136
+ r.process { self.send("#{action}_with_token", money, r.authorization, options) }
137
+ end
138
138
  end
139
139
  end
140
140
 
@@ -194,7 +194,7 @@ module ActiveMerchant #:nodoc:
194
194
  return nil unless params
195
195
 
196
196
  no_blanks = params.reject { |key, value| value.blank? }
197
- no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
197
+ no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
198
198
  end
199
199
 
200
200
  def add_amount(post, money, options)
@@ -203,7 +203,7 @@ module ActiveMerchant #:nodoc:
203
203
  end
204
204
 
205
205
  def preauth(authorization)
206
- authorization.split(";").last
206
+ authorization.split(';').last
207
207
  end
208
208
 
209
209
  def transaction_id(authorization)
@@ -211,113 +211,113 @@ module ActiveMerchant #:nodoc:
211
211
  end
212
212
 
213
213
  RESPONSE_CODES = {
214
- 10001 => "Undefined response",
215
- 10002 => "Waiting for something",
216
- 11000 => "Retry request at a later time",
217
-
218
- 20000 => "Operation successful",
219
- 20100 => "Funds held by acquirer",
220
- 20101 => "Funds held by acquirer because merchant is new",
221
- 20200 => "Transaction reversed",
222
- 20201 => "Reversed due to chargeback",
223
- 20202 => "Reversed due to money-back guarantee",
224
- 20203 => "Reversed due to complaint by buyer",
225
- 20204 => "Payment has been refunded",
226
- 20300 => "Reversal has been canceled",
227
- 22000 => "Initiation of transaction successful",
228
-
229
- 30000 => "Transaction still in progress",
230
- 30100 => "Transaction has been accepted",
231
- 31000 => "Transaction pending",
232
- 31100 => "Pending due to address",
233
- 31101 => "Pending due to uncleared eCheck",
234
- 31102 => "Pending due to risk review",
235
- 31103 => "Pending due regulatory review",
236
- 31104 => "Pending due to unregistered/unconfirmed receiver",
237
- 31200 => "Pending due to unverified account",
238
- 31201 => "Pending due to non-captured funds",
239
- 31202 => "Pending due to international account (accept manually)",
240
- 31203 => "Pending due to currency conflict (accept manually)",
241
- 31204 => "Pending due to fraud filters (accept manually)",
242
-
243
-
244
- 40000 => "Problem with transaction data",
245
- 40001 => "Problem with payment data",
246
- 40002 => "Invalid checksum",
247
- 40100 => "Problem with credit card data",
248
- 40101 => "Problem with CVV",
249
- 40102 => "Card expired or not yet valid",
250
- 40103 => "Card limit exceeded",
251
- 40104 => "Card is not valid",
252
- 40105 => "Expiry date not valid",
253
- 40106 => "Credit card brand required",
254
- 40200 => "Problem with bank account data",
255
- 40201 => "Bank account data combination mismatch",
256
- 40202 => "User authentication failed",
257
- 40300 => "Problem with 3-D Secure data",
258
- 40301 => "Currency/amount mismatch",
259
- 40400 => "Problem with input data",
260
- 40401 => "Amount too low or zero",
261
- 40402 => "Usage field too long",
262
- 40403 => "Currency not allowed",
263
- 40410 => "Problem with shopping cart data",
264
- 40420 => "Problem with address data",
265
- 40500 => "Permission error with acquirer API",
266
- 40510 => "Rate limit reached for acquirer API",
267
- 42000 => "Initiation of transaction failed",
268
- 42410 => "Initiation of transaction expired",
269
-
270
- 50000 => "Problem with back end",
271
- 50001 => "Country blacklisted",
272
- 50002 => "IP address blacklisted",
273
- 50004 => "Live mode not allowed",
274
- 50005 => "Insufficient permissions (API key)",
275
- 50100 => "Technical error with credit card",
276
- 50101 => "Error limit exceeded",
277
- 50102 => "Card declined",
278
- 50103 => "Manipulation or stolen card",
279
- 50104 => "Card restricted",
280
- 50105 => "Invalid configuration data",
281
- 50200 => "Technical error with bank account",
282
- 50201 => "Account blacklisted",
283
- 50300 => "Technical error with 3-D Secure",
284
- 50400 => "Declined because of risk issues",
285
- 50401 => "Checksum was wrong",
286
- 50402 => "Bank account number was invalid (formal check)",
287
- 50403 => "Technical error with risk check",
288
- 50404 => "Unknown error with risk check",
289
- 50405 => "Unknown bank code",
290
- 50406 => "Open chargeback",
291
- 50407 => "Historical chargeback",
292
- 50408 => "Institution / public bank account (NCA)",
293
- 50409 => "KUNO/Fraud",
294
- 50410 => "Personal Account Protection (PAP)",
295
- 50420 => "Rejected due to acquirer fraud settings",
296
- 50430 => "Rejected due to acquirer risk settings",
297
- 50440 => "Failed due to restrictions with acquirer account",
298
- 50450 => "Failed due to restrictions with user account",
299
- 50500 => "General timeout",
300
- 50501 => "Timeout on side of the acquirer",
301
- 50502 => "Risk management transaction timeout",
302
- 50600 => "Duplicate operation",
303
- 50700 => "Cancelled by user",
304
- 50710 => "Failed due to funding source",
305
- 50711 => "Payment method not usable, use other payment method",
306
- 50712 => "Limit of funding source was exceeded",
307
- 50713 => "Means of payment not reusable (canceled by user)",
308
- 50714 => "Means of payment not reusable (expired)",
309
- 50720 => "Rejected by acquirer",
310
- 50730 => "Transaction denied by merchant",
311
- 50800 => "Preauthorisation failed",
312
- 50810 => "Authorisation has been voided",
313
- 50820 => "Authorisation period expired"
214
+ 10001 => 'Undefined response',
215
+ 10002 => 'Waiting for something',
216
+ 11000 => 'Retry request at a later time',
217
+
218
+ 20000 => 'Operation successful',
219
+ 20100 => 'Funds held by acquirer',
220
+ 20101 => 'Funds held by acquirer because merchant is new',
221
+ 20200 => 'Transaction reversed',
222
+ 20201 => 'Reversed due to chargeback',
223
+ 20202 => 'Reversed due to money-back guarantee',
224
+ 20203 => 'Reversed due to complaint by buyer',
225
+ 20204 => 'Payment has been refunded',
226
+ 20300 => 'Reversal has been canceled',
227
+ 22000 => 'Initiation of transaction successful',
228
+
229
+ 30000 => 'Transaction still in progress',
230
+ 30100 => 'Transaction has been accepted',
231
+ 31000 => 'Transaction pending',
232
+ 31100 => 'Pending due to address',
233
+ 31101 => 'Pending due to uncleared eCheck',
234
+ 31102 => 'Pending due to risk review',
235
+ 31103 => 'Pending due regulatory review',
236
+ 31104 => 'Pending due to unregistered/unconfirmed receiver',
237
+ 31200 => 'Pending due to unverified account',
238
+ 31201 => 'Pending due to non-captured funds',
239
+ 31202 => 'Pending due to international account (accept manually)',
240
+ 31203 => 'Pending due to currency conflict (accept manually)',
241
+ 31204 => 'Pending due to fraud filters (accept manually)',
242
+
243
+
244
+ 40000 => 'Problem with transaction data',
245
+ 40001 => 'Problem with payment data',
246
+ 40002 => 'Invalid checksum',
247
+ 40100 => 'Problem with credit card data',
248
+ 40101 => 'Problem with CVV',
249
+ 40102 => 'Card expired or not yet valid',
250
+ 40103 => 'Card limit exceeded',
251
+ 40104 => 'Card is not valid',
252
+ 40105 => 'Expiry date not valid',
253
+ 40106 => 'Credit card brand required',
254
+ 40200 => 'Problem with bank account data',
255
+ 40201 => 'Bank account data combination mismatch',
256
+ 40202 => 'User authentication failed',
257
+ 40300 => 'Problem with 3-D Secure data',
258
+ 40301 => 'Currency/amount mismatch',
259
+ 40400 => 'Problem with input data',
260
+ 40401 => 'Amount too low or zero',
261
+ 40402 => 'Usage field too long',
262
+ 40403 => 'Currency not allowed',
263
+ 40410 => 'Problem with shopping cart data',
264
+ 40420 => 'Problem with address data',
265
+ 40500 => 'Permission error with acquirer API',
266
+ 40510 => 'Rate limit reached for acquirer API',
267
+ 42000 => 'Initiation of transaction failed',
268
+ 42410 => 'Initiation of transaction expired',
269
+
270
+ 50000 => 'Problem with back end',
271
+ 50001 => 'Country blacklisted',
272
+ 50002 => 'IP address blacklisted',
273
+ 50004 => 'Live mode not allowed',
274
+ 50005 => 'Insufficient permissions (API key)',
275
+ 50100 => 'Technical error with credit card',
276
+ 50101 => 'Error limit exceeded',
277
+ 50102 => 'Card declined',
278
+ 50103 => 'Manipulation or stolen card',
279
+ 50104 => 'Card restricted',
280
+ 50105 => 'Invalid configuration data',
281
+ 50200 => 'Technical error with bank account',
282
+ 50201 => 'Account blacklisted',
283
+ 50300 => 'Technical error with 3-D Secure',
284
+ 50400 => 'Declined because of risk issues',
285
+ 50401 => 'Checksum was wrong',
286
+ 50402 => 'Bank account number was invalid (formal check)',
287
+ 50403 => 'Technical error with risk check',
288
+ 50404 => 'Unknown error with risk check',
289
+ 50405 => 'Unknown bank code',
290
+ 50406 => 'Open chargeback',
291
+ 50407 => 'Historical chargeback',
292
+ 50408 => 'Institution / public bank account (NCA)',
293
+ 50409 => 'KUNO/Fraud',
294
+ 50410 => 'Personal Account Protection (PAP)',
295
+ 50420 => 'Rejected due to acquirer fraud settings',
296
+ 50430 => 'Rejected due to acquirer risk settings',
297
+ 50440 => 'Failed due to restrictions with acquirer account',
298
+ 50450 => 'Failed due to restrictions with user account',
299
+ 50500 => 'General timeout',
300
+ 50501 => 'Timeout on side of the acquirer',
301
+ 50502 => 'Risk management transaction timeout',
302
+ 50600 => 'Duplicate operation',
303
+ 50700 => 'Cancelled by user',
304
+ 50710 => 'Failed due to funding source',
305
+ 50711 => 'Payment method not usable, use other payment method',
306
+ 50712 => 'Limit of funding source was exceeded',
307
+ 50713 => 'Means of payment not reusable (canceled by user)',
308
+ 50714 => 'Means of payment not reusable (expired)',
309
+ 50720 => 'Rejected by acquirer',
310
+ 50730 => 'Transaction denied by merchant',
311
+ 50800 => 'Preauthorisation failed',
312
+ 50810 => 'Authorisation has been voided',
313
+ 50820 => 'Authorisation period expired'
314
314
  }
315
315
 
316
316
  def response_message(parsed_response)
317
- return parsed_response["error"] if parsed_response["error"]
318
- return "Transaction approved." if (parsed_response['data'] == [])
317
+ return parsed_response['error'] if parsed_response['error']
318
+ return 'Transaction approved.' if (parsed_response['data'] == [])
319
319
 
320
- code = parsed_response["data"]["response_code"].to_i
320
+ code = parsed_response['data']['response_code'].to_i
321
321
  RESPONSE_CODES[code] || code.to_s
322
322
  end
323
323
 
@@ -325,7 +325,7 @@ module ActiveMerchant #:nodoc:
325
325
  class ResponseParser
326
326
  attr_reader :raw_response, :parsed, :succeeded, :message, :options
327
327
 
328
- def initialize(raw_response="", options={})
328
+ def initialize(raw_response='', options={})
329
329
  @raw_response = raw_response
330
330
  @options = options
331
331
  end