activemerchant 1.101.0 → 1.102.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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +15 -0
  3. data/README.md +1 -1
  4. data/lib/active_merchant/billing/credit_card.rb +2 -2
  5. data/lib/active_merchant/billing/credit_card_methods.rb +2 -2
  6. data/lib/active_merchant/billing/gateway.rb +7 -6
  7. data/lib/active_merchant/billing/gateways/adyen.rb +2 -2
  8. data/lib/active_merchant/billing/gateways/allied_wallet.rb +1 -1
  9. data/lib/active_merchant/billing/gateways/authorize_net.rb +72 -56
  10. data/lib/active_merchant/billing/gateways/balanced.rb +14 -12
  11. data/lib/active_merchant/billing/gateways/bank_frick.rb +2 -2
  12. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +19 -19
  13. data/lib/active_merchant/billing/gateways/blue_pay.rb +3 -3
  14. data/lib/active_merchant/billing/gateways/card_stream.rb +1 -1
  15. data/lib/active_merchant/billing/gateways/cardknox.rb +1 -1
  16. data/lib/active_merchant/billing/gateways/cashnet.rb +5 -5
  17. data/lib/active_merchant/billing/gateways/cc5.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/cecabank.rb +27 -26
  19. data/lib/active_merchant/billing/gateways/checkout.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/checkout_v2.rb +3 -1
  21. data/lib/active_merchant/billing/gateways/clearhaus.rb +9 -8
  22. data/lib/active_merchant/billing/gateways/creditcall.rb +2 -2
  23. data/lib/active_merchant/billing/gateways/ct_payment.rb +2 -2
  24. data/lib/active_merchant/billing/gateways/culqi.rb +11 -10
  25. data/lib/active_merchant/billing/gateways/cyber_source.rb +8 -8
  26. data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
  27. data/lib/active_merchant/billing/gateways/eway.rb +1 -1
  28. data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/eway_rapid.rb +9 -8
  30. data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -1
  31. data/lib/active_merchant/billing/gateways/finansbank.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/first_giving.rb +1 -1
  33. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +9 -8
  34. data/lib/active_merchant/billing/gateways/garanti.rb +1 -1
  35. data/lib/active_merchant/billing/gateways/global_collect.rb +1 -1
  36. data/lib/active_merchant/billing/gateways/inspire.rb +10 -10
  37. data/lib/active_merchant/billing/gateways/iridium.rb +1 -1
  38. data/lib/active_merchant/billing/gateways/iveri.rb +1 -1
  39. data/lib/active_merchant/billing/gateways/ixopay.rb +287 -0
  40. data/lib/active_merchant/billing/gateways/linkpoint.rb +6 -6
  41. data/lib/active_merchant/billing/gateways/litle.rb +1 -1
  42. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +4 -4
  43. data/lib/active_merchant/billing/gateways/merchant_one.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/merchant_partners.rb +1 -1
  45. data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -2
  46. data/lib/active_merchant/billing/gateways/micropayment.rb +1 -1
  47. data/lib/active_merchant/billing/gateways/migs.rb +1 -1
  48. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -1
  49. data/lib/active_merchant/billing/gateways/moneris.rb +2 -2
  50. data/lib/active_merchant/billing/gateways/moneris_us.rb +4 -4
  51. data/lib/active_merchant/billing/gateways/money_movers.rb +1 -1
  52. data/lib/active_merchant/billing/gateways/netbanx.rb +2 -2
  53. data/lib/active_merchant/billing/gateways/nmi.rb +3 -3
  54. data/lib/active_merchant/billing/gateways/ogone.rb +12 -11
  55. data/lib/active_merchant/billing/gateways/optimal_payment.rb +19 -18
  56. data/lib/active_merchant/billing/gateways/orbital.rb +13 -11
  57. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +8 -7
  58. data/lib/active_merchant/billing/gateways/pay_conex.rb +1 -1
  59. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +5 -5
  60. data/lib/active_merchant/billing/gateways/pay_hub.rb +1 -1
  61. data/lib/active_merchant/billing/gateways/pay_junction.rb +11 -10
  62. data/lib/active_merchant/billing/gateways/pay_secure.rb +1 -1
  63. data/lib/active_merchant/billing/gateways/paybox_direct.rb +1 -1
  64. data/lib/active_merchant/billing/gateways/payflow.rb +2 -2
  65. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  66. data/lib/active_merchant/billing/gateways/paymentez.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/paymill.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/payscout.rb +2 -2
  69. data/lib/active_merchant/billing/gateways/paystation.rb +1 -1
  70. data/lib/active_merchant/billing/gateways/payu_in.rb +15 -14
  71. data/lib/active_merchant/billing/gateways/plugnpay.rb +2 -2
  72. data/lib/active_merchant/billing/gateways/pro_pay.rb +1 -1
  73. data/lib/active_merchant/billing/gateways/psl_card.rb +1 -1
  74. data/lib/active_merchant/billing/gateways/quantum.rb +1 -1
  75. data/lib/active_merchant/billing/gateways/quickbooks.rb +19 -12
  76. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/redsys.rb +12 -12
  78. data/lib/active_merchant/billing/gateways/s5.rb +1 -1
  79. data/lib/active_merchant/billing/gateways/safe_charge.rb +3 -3
  80. data/lib/active_merchant/billing/gateways/sage.rb +4 -4
  81. data/lib/active_merchant/billing/gateways/sage_pay.rb +7 -6
  82. data/lib/active_merchant/billing/gateways/secure_net.rb +2 -2
  83. data/lib/active_merchant/billing/gateways/secure_pay.rb +2 -2
  84. data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -1
  85. data/lib/active_merchant/billing/gateways/smart_ps.rb +5 -5
  86. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -1
  87. data/lib/active_merchant/billing/gateways/trust_commerce.rb +15 -14
  88. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +10 -9
  89. data/lib/active_merchant/billing/gateways/wepay.rb +1 -1
  90. data/lib/active_merchant/billing/gateways/worldpay.rb +1 -1
  91. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +1 -1
  92. data/lib/active_merchant/billing/gateways/worldpay_us.rb +2 -2
  93. data/lib/active_merchant/billing/response.rb +2 -2
  94. data/lib/active_merchant/connection.rb +26 -25
  95. data/lib/active_merchant/posts_data.rb +1 -1
  96. data/lib/active_merchant/version.rb +1 -1
  97. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cadecd1cc8fe450e59061eac7cf2c2ce023513d1338858809fe828df46a1b745
4
- data.tar.gz: cc7e81f49b5b4b0f17cbd73c921a7b73cbd4c8f468d70722dc844a4973191ffa
3
+ metadata.gz: 676020bb24cc6d3a8b17a3d2ed035398803a436371c3c6a368ab3b49104d618e
4
+ data.tar.gz: 5a46ff06616a3b914c599d7da7455f0a4dc1b7579907a03a2c51463d6c81a8ef
5
5
  SHA512:
6
- metadata.gz: 4d3889d6325099cff6ffef0dc9de3259afac3ff6d86292cd5dfa9e85208e9eae671436222ec84e08ad1104e77ede4ab475519229f5121c61498f79adaf7da104
7
- data.tar.gz: 3e0b7935750ab8d772d62d78d6c359187d287835e997076ba0a1d66a3586424e63897892a736cbf7b720aa7e04633112aca6fb4cad57a8bcbee2885f13701ea7
6
+ metadata.gz: b06c1bd98e25faed372c68877041f127a64b21021f88ec102dd0910d976eeaba2f19a4414a5b9d122fb5a92f64489d34e961652ad1a7aac6f85e802ada89d1cf
7
+ data.tar.gz: 7cb0c86d44cbc7d23ea441aba7dc90ec58d7d5be2d972dd63c0b3545c4372c752d7fc068a173f0d26532f4cede6a97dcecae8fd86c40f17551c6017a9c07db1c
data/CHANGELOG CHANGED
@@ -1,6 +1,21 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
3
  == HEAD
4
+
5
+ == Version 1.102.0 (Nov 14, 2019)
6
+ * Quickbooks: Make token refresh optional with allow_refresh flag [britth] #3419
7
+ * Paymentez: Update supported countries [curiousepic] #3425
8
+ * Ixopay: Add new gateway [jasonxp] #3426
9
+ * Ixopay: Add support for currency option to refund method #3433
10
+ * Ixopay: Remove default callback URL #3436
11
+ * Ixopay: Refactor capture #3431
12
+ * Update supported countries list. Add currencies without fractions / with 3 decimal places #3424
13
+ * RuboCop: Fix Layout/EndAlignment [leila-alderman] #3427
14
+ * RuboCop: Fix Layout/ExtraSpacing [leila-alderman] #3429
15
+ * RuboCop: Fix Layout/MultilineOperationIndentation [leila-alderman] #3439
16
+ * Worldpay: Update logic to set cardholderName for 3DS transactions [britth] #3444
17
+ * Adopt new enrolled key for 3DS1 transactions. enrolled contains the 3… #3442
18
+
4
19
  == Version 1.101.0 (Nov 4, 2019)
5
20
  * Add UYI to list of currencies without fractions [curiousepic] #3416
6
21
  * Quickbooks: Add OAuth 2.0 support and void action [britth] #3397
data/README.md CHANGED
@@ -112,7 +112,7 @@ The [ActiveMerchant Wiki](https://github.com/activemerchant/active_merchant/wiki
112
112
  * [Cecabank](http://www.ceca.es/es/) - ES
113
113
  * [Cenpos](https://www.cenpos.com/) - AD, AI, AG, AR, AU, AT, BS, BB, BE, BZ, BM, BR, BN, BG, CA, HR, CY, CZ, DK, DM, EE, FI, FR, DE, GR, GD, GY, HK, HU, IS, IN, IL, IT, JP, LV, LI, LT, LU, MY, MT, MX, MC, MS, NL, PA, PL, PT, KN, LC, MF, VC, SM, SG, SK, SI, ZA, ES, SR, SE, CH, TR, GB, US, UY
114
114
  * [CAMS: Central Account Management System](https://www.centralams.com/) - US
115
- * [Checkout.com](https://www.checkout.com/) - AT, BE, BG, CY, CZ, DE, DK, EE, ES, FI, FR, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, MU, NL, NO, PL, PT, RO, SE, SI, SK, US
115
+ * [Checkout.com](https://www.checkout.com/) - AD, AE, AR, AT, AU, BE, BG, BH, BR, CH, CL, CN, CO, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GR, HK, HR, HU, IE, IS, IT, JO, JP, KW, LI, LT, LU, LV, MC, MT, MX, MY, NL, NO, NZ, OM, PE, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, US
116
116
  * [Clearhaus](https://www.clearhaus.com) - AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GL, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK
117
117
  * [Commercegate](http://www.commercegate.com/) - AD, AT, AX, BE, BG, CH, CY, CZ, DE, DK, ES, FI, FR, GB, GG, GI, GR, HR, HU, IE, IM, IS, IT, JE, LI, LT, LU, LV, MC, MT, NL, NO, PL, PT, RO, SE, SI, SK, VA
118
118
  * [Conekta](https://conekta.io) - MX
@@ -336,7 +336,7 @@ module ActiveMerchant #:nodoc:
336
336
  if expired?
337
337
  errors << [:year, 'expired']
338
338
  else
339
- errors << [:year, 'is not a valid year'] if !valid_expiry_year?(year)
339
+ errors << [:year, 'is not a valid year'] if !valid_expiry_year?(year)
340
340
  end
341
341
  end
342
342
 
@@ -347,7 +347,7 @@ module ActiveMerchant #:nodoc:
347
347
  errors = []
348
348
 
349
349
  if !empty?(brand)
350
- errors << [:brand, 'is invalid'] if !CreditCard.card_companies.include?(brand)
350
+ errors << [:brand, 'is invalid'] if !CreditCard.card_companies.include?(brand)
351
351
  end
352
352
 
353
353
  if empty?(number)
@@ -197,8 +197,8 @@ module ActiveMerchant #:nodoc:
197
197
  def valid_number?(number)
198
198
  valid_test_mode_card_number?(number) ||
199
199
  valid_card_number_length?(number) &&
200
- valid_card_number_characters?(number) &&
201
- valid_by_algorithm?(brand?(number), number)
200
+ valid_card_number_characters?(number) &&
201
+ valid_by_algorithm?(brand?(number), number)
202
202
  end
203
203
 
204
204
  def card_companies
@@ -249,12 +249,13 @@ module ActiveMerchant #:nodoc:
249
249
 
250
250
  def amount(money)
251
251
  return nil if money.nil?
252
- cents = if money.respond_to?(:cents)
253
- ActiveMerchant.deprecated 'Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents'
254
- money.cents
255
- else
256
- money
257
- end
252
+ cents =
253
+ if money.respond_to?(:cents)
254
+ ActiveMerchant.deprecated 'Support for Money objects is deprecated and will be removed from a future release of ActiveMerchant. Please use an Integer value in cents'
255
+ money.cents
256
+ else
257
+ money
258
+ end
258
259
 
259
260
  raise ArgumentError, 'money amount must be a positive Integer in cents.' if money.is_a?(String)
260
261
 
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
10
10
  self.supported_countries = ['AT', 'AU', 'BE', 'BG', 'BR', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GI', 'GR', 'HK', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'MX', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SG', 'SK', 'SI', 'US']
11
11
  self.default_currency = 'USD'
12
12
  self.currencies_without_fractions = %w(CVE DJF GNF IDR JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
13
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover, :elo, :naranja, :cabal]
13
+ self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :jcb, :dankort, :maestro, :discover, :elo, :naranja, :cabal]
14
14
 
15
15
  self.money_format = :cents
16
16
 
@@ -371,7 +371,7 @@ module ActiveMerchant #:nodoc:
371
371
  cavvAlgorithm: three_d_secure_options[:cavv_algorithm],
372
372
  eci: three_d_secure_options[:eci],
373
373
  xid: three_d_secure_options[:xid],
374
- directoryResponse: three_d_secure_options[:directory_response_status],
374
+ directoryResponse: three_d_secure_options[:enrolled],
375
375
  authenticationResponse: three_d_secure_options[:authentication_response_status]
376
376
  }
377
377
  end
@@ -113,7 +113,7 @@ module ActiveMerchant #:nodoc:
113
113
  post[:city] = billing_address[:city]
114
114
  post[:state] = billing_address[:state]
115
115
  post[:countryId] = billing_address[:country]
116
- post[:postalCode] = billing_address[:zip]
116
+ post[:postalCode] = billing_address[:zip]
117
117
  post[:phone] = billing_address[:phone]
118
118
  end
119
119
  end
@@ -132,11 +132,12 @@ module ActiveMerchant
132
132
  end
133
133
 
134
134
  def refund(amount, authorization, options={})
135
- response = if auth_was_for_cim?(authorization)
136
- cim_refund(amount, authorization, options)
137
- else
138
- normal_refund(amount, authorization, options)
139
- end
135
+ response =
136
+ if auth_was_for_cim?(authorization)
137
+ cim_refund(amount, authorization, options)
138
+ else
139
+ normal_refund(amount, authorization, options)
140
+ end
140
141
 
141
142
  return response if response.success?
142
143
  return response unless options[:force_full_refund_if_unsettled]
@@ -596,11 +597,12 @@ module ActiveMerchant
596
597
  return unless address
597
598
 
598
599
  xml.send(root_node) do
599
- first_name, last_name = if address[:name]
600
- split_names(address[:name])
601
- else
602
- [address[:first_name], address[:last_name]]
603
- end
600
+ first_name, last_name =
601
+ if address[:name]
602
+ split_names(address[:name])
603
+ else
604
+ [address[:first_name], address[:last_name]]
605
+ end
604
606
  full_address = "#{address[:address1]} #{address[:address2]}".strip
605
607
 
606
608
  xml.firstName(truncate(first_name, 50)) unless empty?(first_name)
@@ -840,8 +842,8 @@ module ActiveMerchant
840
842
  response = {action: action}
841
843
 
842
844
  response[:response_code] = if(element = doc.at_xpath('//transactionResponse/responseCode'))
843
- (empty?(element.content) ? nil : element.content.to_i)
844
- end
845
+ empty?(element.content) ? nil : element.content.to_i
846
+ end
845
847
 
846
848
  if(element = doc.at_xpath('//errors/error'))
847
849
  response[:response_reason_code] = element.at_xpath('errorCode').content[/0*(\d+)$/, 1]
@@ -857,37 +859,45 @@ module ActiveMerchant
857
859
  response[:response_reason_text] = ''
858
860
  end
859
861
 
860
- response[:avs_result_code] = if(element = doc.at_xpath('//avsResultCode'))
861
- (empty?(element.content) ? nil : element.content)
862
- end
862
+ response[:avs_result_code] =
863
+ if(element = doc.at_xpath('//avsResultCode'))
864
+ empty?(element.content) ? nil : element.content
865
+ end
863
866
 
864
- response[:transaction_id] = if(element = doc.at_xpath('//transId'))
865
- (empty?(element.content) ? nil : element.content)
866
- end
867
+ response[:transaction_id] =
868
+ if element = doc.at_xpath('//transId')
869
+ empty?(element.content) ? nil : element.content
870
+ end
867
871
 
868
- response[:card_code] = if(element = doc.at_xpath('//cvvResultCode'))
869
- (empty?(element.content) ? nil : element.content)
870
- end
872
+ response[:card_code] =
873
+ if element = doc.at_xpath('//cvvResultCode')
874
+ empty?(element.content) ? nil : element.content
875
+ end
871
876
 
872
- response[:authorization_code] = if(element = doc.at_xpath('//authCode'))
873
- (empty?(element.content) ? nil : element.content)
874
- end
877
+ response[:authorization_code] =
878
+ if element = doc.at_xpath('//authCode')
879
+ empty?(element.content) ? nil : element.content
880
+ end
875
881
 
876
- response[:cardholder_authentication_code] = if(element = doc.at_xpath('//cavvResultCode'))
877
- (empty?(element.content) ? nil : element.content)
878
- end
882
+ response[:cardholder_authentication_code] =
883
+ if element = doc.at_xpath('//cavvResultCode')
884
+ empty?(element.content) ? nil : element.content
885
+ end
879
886
 
880
- response[:account_number] = if(element = doc.at_xpath('//accountNumber'))
881
- (empty?(element.content) ? nil : element.content[-4..-1])
882
- end
887
+ response[:account_number] =
888
+ if element = doc.at_xpath('//accountNumber')
889
+ empty?(element.content) ? nil : element.content[-4..-1]
890
+ end
883
891
 
884
- response[:test_request] = if(element = doc.at_xpath('//testRequest'))
885
- (empty?(element.content) ? nil : element.content)
886
- end
892
+ response[:test_request] =
893
+ if element = doc.at_xpath('//testRequest')
894
+ empty?(element.content) ? nil : element.content
895
+ end
887
896
 
888
- response[:full_response_code] = if(element = doc.at_xpath('//messages/message/code'))
889
- (empty?(element.content) ? nil : element.content)
890
- end
897
+ response[:full_response_code] =
898
+ if element = doc.at_xpath('//messages/message/code')
899
+ empty?(element.content) ? nil : element.content
900
+ end
891
901
 
892
902
  response
893
903
  end
@@ -897,35 +907,41 @@ module ActiveMerchant
897
907
 
898
908
  doc = Nokogiri::XML(body).remove_namespaces!
899
909
 
900
- if (element = doc.at_xpath('//messages/message'))
910
+ if element = doc.at_xpath('//messages/message')
901
911
  response[:message_code] = element.at_xpath('code').content[/0*(\d+)$/, 1]
902
912
  response[:message_text] = element.at_xpath('text').content.chomp('.')
903
913
  end
904
914
 
905
- response[:result_code] = if(element = doc.at_xpath('//messages/resultCode'))
906
- (empty?(element.content) ? nil : element.content)
907
- end
915
+ response[:result_code] =
916
+ if element = doc.at_xpath('//messages/resultCode')
917
+ empty?(element.content) ? nil : element.content
918
+ end
908
919
 
909
- response[:test_request] = if(element = doc.at_xpath('//testRequest'))
910
- (empty?(element.content) ? nil : element.content)
911
- end
920
+ response[:test_request] =
921
+ if element = doc.at_xpath('//testRequest')
922
+ empty?(element.content) ? nil : element.content
923
+ end
912
924
 
913
- response[:customer_profile_id] = if(element = doc.at_xpath('//customerProfileId'))
914
- (empty?(element.content) ? nil : element.content)
915
- end
925
+ response[:customer_profile_id] =
926
+ if element = doc.at_xpath('//customerProfileId')
927
+ empty?(element.content) ? nil : element.content
928
+ end
916
929
 
917
- response[:customer_payment_profile_id] = if(element = doc.at_xpath('//customerPaymentProfileIdList/numericString'))
918
- (empty?(element.content) ? nil : element.content)
919
- end
930
+ response[:customer_payment_profile_id] =
931
+ if element = doc.at_xpath('//customerPaymentProfileIdList/numericString')
932
+ empty?(element.content) ? nil : element.content
933
+ end
920
934
 
921
- response[:customer_payment_profile_id] = if(element = doc.at_xpath('//customerPaymentProfileIdList/numericString') ||
922
- doc.at_xpath('//customerPaymentProfileId'))
923
- (empty?(element.content) ? nil : element.content)
924
- end
935
+ response[:customer_payment_profile_id] =
936
+ if element = doc.at_xpath('//customerPaymentProfileIdList/numericString') ||
937
+ doc.at_xpath('//customerPaymentProfileId')
938
+ empty?(element.content) ? nil : element.content
939
+ end
925
940
 
926
- response[:direct_response] = if(element = doc.at_xpath('//directResponse'))
927
- (empty?(element.content) ? nil : element.content)
928
- end
941
+ response[:direct_response] =
942
+ if element = doc.at_xpath('//directResponse')
943
+ empty?(element.content) ? nil : element.content
944
+ end
929
945
 
930
946
  response.merge!(parse_direct_response_elements(response, options))
931
947
 
@@ -44,12 +44,13 @@ module ActiveMerchant #:nodoc:
44
44
  add_common_params(post, options)
45
45
 
46
46
  MultiResponse.run do |r|
47
- identifier = if(payment_method.respond_to?(:number))
48
- r.process { store(payment_method, options) }
49
- r.authorization
50
- else
51
- payment_method
52
- end
47
+ identifier =
48
+ if(payment_method.respond_to?(:number))
49
+ r.process { store(payment_method, options) }
50
+ r.authorization
51
+ else
52
+ payment_method
53
+ end
53
54
  r.process { commit('debits', "cards/#{card_identifier_from(identifier)}/debits", post) }
54
55
  end
55
56
  end
@@ -61,12 +62,13 @@ module ActiveMerchant #:nodoc:
61
62
  add_common_params(post, options)
62
63
 
63
64
  MultiResponse.run do |r|
64
- identifier = if(payment_method.respond_to?(:number))
65
- r.process { store(payment_method, options) }
66
- r.authorization
67
- else
68
- payment_method
69
- end
65
+ identifier =
66
+ if(payment_method.respond_to?(:number))
67
+ r.process { store(payment_method, options) }
68
+ r.authorization
69
+ else
70
+ payment_method
71
+ end
70
72
  r.process { commit('card_holds', "cards/#{card_identifier_from(identifier)}/card_holds", post) }
71
73
  end
72
74
  end
@@ -97,7 +97,7 @@ module ActiveMerchant #:nodoc:
97
97
  post[:zip] = address[:zip].to_s
98
98
  post[:city] = address[:city].to_s
99
99
  post[:country] = address[:country].to_s
100
- post[:state] = address[:state].blank? ? 'n/a' : address[:state]
100
+ post[:state] = address[:state].blank? ? 'n/a' : address[:state]
101
101
  end
102
102
  end
103
103
 
@@ -119,7 +119,7 @@ module ActiveMerchant #:nodoc:
119
119
  end
120
120
 
121
121
  def parse(body)
122
- results = {}
122
+ results = {}
123
123
  xml = Nokogiri::XML(body)
124
124
  resp = xml.xpath('//Response/Transaction/Identification')
125
125
  resp.children.each do |element|
@@ -129,25 +129,25 @@ module ActiveMerchant #:nodoc:
129
129
  # Smartpay may return AVS codes not covered by standard AVSResult codes.
130
130
  # Smartpay's descriptions noted below.
131
131
  AVS_MAPPING = {
132
- '0' => 'R', # Unknown
133
- '1' => 'A', # Address matches, postal code doesn't
134
- '2' => 'N', # Neither postal code nor address match
135
- '3' => 'R', # AVS unavailable
136
- '4' => 'E', # AVS not supported for this card type
137
- '5' => 'U', # No AVS data provided
138
- '6' => 'Z', # Postal code matches, address doesn't match
139
- '7' => 'D', # Both postal code and address match
140
- '8' => 'U', # Address not checked, postal code unknown
141
- '9' => 'B', # Address matches, postal code unknown
142
- '10' => 'N', # Address doesn't match, postal code unknown
143
- '11' => 'U', # Postal code not checked, address unknown
144
- '12' => 'B', # Address matches, postal code not checked
145
- '13' => 'U', # Address doesn't match, postal code not checked
146
- '14' => 'P', # Postal code matches, address unknown
147
- '15' => 'P', # Postal code matches, address not checked
148
- '16' => 'N', # Postal code doesn't match, address unknown
149
- '17' => 'U', # Postal code doesn't match, address not checked
150
- '18' => 'I' # Neither postal code nor address were checked
132
+ '0' => 'R', # Unknown
133
+ '1' => 'A', # Address matches, postal code doesn't
134
+ '2' => 'N', # Neither postal code nor address match
135
+ '3' => 'R', # AVS unavailable
136
+ '4' => 'E', # AVS not supported for this card type
137
+ '5' => 'U', # No AVS data provided
138
+ '6' => 'Z', # Postal code matches, address doesn't match
139
+ '7' => 'D', # Both postal code and address match
140
+ '8' => 'U', # Address not checked, postal code unknown
141
+ '9' => 'B', # Address matches, postal code unknown
142
+ '10' => 'N', # Address doesn't match, postal code unknown
143
+ '11' => 'U', # Postal code not checked, address unknown
144
+ '12' => 'B', # Address matches, postal code not checked
145
+ '13' => 'U', # Address doesn't match, postal code not checked
146
+ '14' => 'P', # Postal code matches, address unknown
147
+ '15' => 'P', # Postal code matches, address not checked
148
+ '16' => 'N', # Postal code doesn't match, address unknown
149
+ '17' => 'U', # Postal code doesn't match, address not checked
150
+ '18' => 'I' # Neither postal code nor address were checked
151
151
  }
152
152
 
153
153
  def commit(action, post, account = 'ws', password = @options[:password])
@@ -84,7 +84,7 @@ module ActiveMerchant #:nodoc:
84
84
  add_customer_data(post, options)
85
85
  add_rebill(post, options) if options[:rebill]
86
86
  add_duplicate_override(post, options)
87
- post[:TRANS_TYPE] = 'AUTH'
87
+ post[:TRANS_TYPE] = 'AUTH'
88
88
  commit('AUTH_ONLY', money, post, options)
89
89
  end
90
90
 
@@ -107,7 +107,7 @@ module ActiveMerchant #:nodoc:
107
107
  add_customer_data(post, options)
108
108
  add_rebill(post, options) if options[:rebill]
109
109
  add_duplicate_override(post, options)
110
- post[:TRANS_TYPE] = 'SALE'
110
+ post[:TRANS_TYPE] = 'SALE'
111
111
  commit('AUTH_CAPTURE', money, post, options)
112
112
  end
113
113
 
@@ -385,7 +385,7 @@ module ActiveMerchant #:nodoc:
385
385
  elsif message =~ /Approved/
386
386
  message = 'This transaction has been approved'
387
387
  elsif message =~ /Expired/
388
- message = 'The credit card has expired'
388
+ message = 'The credit card has expired'
389
389
  end
390
390
  message
391
391
  end
@@ -341,7 +341,7 @@ module ActiveMerchant #:nodoc:
341
341
  'A'
342
342
  else
343
343
  'I'
344
- end
344
+ end
345
345
 
346
346
  AVSResult.new({
347
347
  :code => code,
@@ -186,7 +186,7 @@ module ActiveMerchant #:nodoc:
186
186
  post[address_key(prefix, 'FirstName')] = address[:first_name]
187
187
  post[address_key(prefix, 'LastName')] = address[:last_name]
188
188
  end
189
- post[address_key(prefix, 'MiddleName')] = address[:middle_name]
189
+ post[address_key(prefix, 'MiddleName')] = address[:middle_name]
190
190
 
191
191
  post[address_key(prefix, 'Company')] = address[:company]
192
192
  post[address_key(prefix, 'Street')] = address[:address1]