activemerchant 1.54.0 → 1.55.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +51 -0
  3. data/CONTRIBUTORS +24 -0
  4. data/README.md +8 -2
  5. data/lib/active_merchant/billing/base.rb +11 -22
  6. data/lib/active_merchant/billing/credit_card.rb +24 -1
  7. data/lib/active_merchant/billing/gateway.rb +18 -8
  8. data/lib/active_merchant/billing/gateways/allied_wallet.rb +1 -1
  9. data/lib/active_merchant/billing/gateways/authorize_net.rb +12 -14
  10. data/lib/active_merchant/billing/gateways/blue_pay.rb +3 -2
  11. data/lib/active_merchant/billing/gateways/bogus.rb +63 -17
  12. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/braintree_blue.rb +19 -10
  14. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  15. data/lib/active_merchant/billing/gateways/card_stream.rb +1 -1
  16. data/lib/active_merchant/billing/gateways/clearhaus.rb +238 -0
  17. data/lib/active_merchant/billing/gateways/creditcall.rb +1 -1
  18. data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -0
  19. data/lib/active_merchant/billing/gateways/elavon.rb +21 -18
  20. data/lib/active_merchant/billing/gateways/eway_rapid.rb +7 -7
  21. data/lib/active_merchant/billing/gateways/ezic.rb +2 -12
  22. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +15 -9
  23. data/lib/active_merchant/billing/gateways/forte.rb +32 -21
  24. data/lib/active_merchant/billing/gateways/inspire.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/jetpay.rb +141 -38
  26. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  27. data/lib/active_merchant/billing/gateways/litle.rb +7 -3
  28. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/micropayment.rb +18 -14
  30. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
  31. data/lib/active_merchant/billing/gateways/monei.rb +1 -1
  32. data/lib/active_merchant/billing/gateways/netbilling.rb +10 -11
  33. data/lib/active_merchant/billing/gateways/omise.rb +2 -2
  34. data/lib/active_merchant/billing/gateways/optimal_payment.rb +3 -2
  35. data/lib/active_merchant/billing/gateways/orbital.rb +1 -0
  36. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
  37. data/lib/active_merchant/billing/gateways/paybox_direct.rb +2 -1
  38. data/lib/active_merchant/billing/gateways/payeezy.rb +238 -0
  39. data/lib/active_merchant/billing/gateways/payflow.rb +16 -3
  40. data/lib/active_merchant/billing/gateways/paymill.rb +101 -44
  41. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -2
  42. data/lib/active_merchant/billing/gateways/paypal_express.rb +8 -0
  43. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/sage_pay.rb +6 -14
  45. data/lib/active_merchant/billing/gateways/secure_net.rb +3 -4
  46. data/lib/active_merchant/billing/gateways/securion_pay.rb +238 -0
  47. data/lib/active_merchant/billing/gateways/stripe.rb +9 -7
  48. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +1 -2
  49. data/lib/active_merchant/billing/gateways/tns.rb +2 -8
  50. data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
  51. data/lib/active_merchant/billing/gateways/trust_commerce.rb +2 -2
  52. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +5 -7
  53. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +12 -11
  54. data/lib/active_merchant/billing/gateways/vanco.rb +8 -3
  55. data/lib/active_merchant/billing/gateways/viaklix.rb +1 -9
  56. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +22 -8
  57. data/lib/active_merchant/posts_data.rb +2 -2
  58. data/lib/active_merchant/version.rb +1 -1
  59. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fc6f0d2cdaee90794c21b2a864c1f388e137b7a
4
- data.tar.gz: b8d2bdfb76e707aecd003b60ba388bd4e4c35b16
3
+ metadata.gz: 7e8d9130eaadeedc543af0a5b2cf5b060a2f1399
4
+ data.tar.gz: 868d04daf3f0dbd97f7f87adb0d96add9e868a57
5
5
  SHA512:
6
- metadata.gz: 7f022f77e95737535d03582cf5d79c3b93ef2ff44215e1343b73c574fe78269447c36bc8400ff1b4bacbdcf98a453a1dbffc3dce1b1452046fca6f4bb8230426
7
- data.tar.gz: c4e19a130993eb296dddc128109873204078c2cf480d48c2cc47f57310ef79f1cd2b62a88cdc02af00791a7d1be08c78957bbc172df728ec18d6236369144a90
6
+ metadata.gz: c079b666da79f7f8e77f47ca08003f2712a5daefb801b927454234c9c25f7b1b7d311e63b9432f758dcbb1594d111a323a8606e8636d50cd45da33a87cc35434
7
+ data.tar.gz: 0c77b4dbbf7f9f8b3bcbb5e1ae1bbc9af213cab749a0690b1337d46772813043dc65aefb2cc816b86c26dd8fe42cf53b0ce11cb93de53587bc2af3b55b6ecd49
data/CHANGELOG CHANGED
@@ -1,6 +1,57 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
3
 
4
+ == Version 1.55.0 (November 9, 2015)
5
+ * CyberSource: send customer IP address when provided [fastjames]
6
+ * Braintree: Simplify Braintree scrubbing when no transcript [duff]
7
+ * AuthorizeNet: Allow market_type override [duff]
8
+ * FirstData_e4: Support level_2 data [duff]
9
+ * FirstData_e4: Fix level_2 and level_3 [duff]
10
+ * MerchantWareFour: Use Void not PreAuthorizationVoid [duff]
11
+ * JetPay: Allow partial captures [duff]
12
+ * Creditcall: Fix production url [duff]
13
+ * FirstData_e4: Fix float error in Void [duff]
14
+ * Micropayment: Upgrade to new API [mrezentes]
15
+ * Netbilling: Add order_id to user_info [mrezentes]
16
+ * Stripe: scrub swipe/track, EMV data out of gateway transcripts [girasquid]
17
+ * Remove integration_mode [mattfawcett]
18
+ * Allow setting CVV requirement at instance level [fabiokr]
19
+ * Add SecurionPay gateway [szajbus]
20
+ * AuthorizeNet: Don't send currency to void [duff]
21
+ * Add Komoju gateway [k2nr]
22
+ * Replace Connection magic numbers with constant references [larrylv]
23
+ * Add CAMS gateway [trevorgrayson]
24
+ * PayPal Express: Fix AllowedPaymentMethod [edclements]
25
+ * Litle: Store credit card from PayPage [dontmatta]
26
+ * Orbital: Deprecate profile management API [ntalbott]
27
+ * FirstData e4: Honor currency when supplied [tchill]
28
+ * Authorize.net: Add config_error standard error code [andrewpaliga]
29
+ * PayPal Express: Add support for TotalType in SetExpressCheckout [gingerhendrix]
30
+ * eWay Rapid: Add :invoice option [DylanFM]
31
+ * Braintree: Add nonce payment method [eric1234,cwoodcox]
32
+ * Payflow: Allow passing of 3D Secure details via options [marquisong]
33
+ * Elavon: Support capture via CCCOMPLETE without credit card [marquisong]
34
+ * Securenet: Allow setting test_mode independently [wedstar]
35
+ * Replace Base.integration_mode and Base.gateway_mode with just Base.mode [aprofeit]
36
+ * Micropayment: Allow specification of a project [duff]
37
+ * QuickpayV10: Truncate order_id [duff]
38
+ * FirstData_e4: Fix Level 2 data [duff]
39
+ * Remove some duplication around name handling [duff]
40
+ * FirstData_e4: Support Tax1Number [duff]
41
+ * Add Transact Pro gateway [varyonic]
42
+ * Add Payeezy gateway [huoxito]
43
+ * USAePay: Add test mode setting via options [marquisong]
44
+ * Add Clearhaus gateway [dinesh]
45
+ * WorldpayOnlinePayments: Fix logic to determine success [ao]
46
+ * Paymill: store order_id in description field [nikoloff]
47
+ * TWD isn't a zero decimal currency [duff]
48
+ * PaypalExpress: Use custom zero decimal currencies [duff]
49
+ * Stripe: Migrate from /refund to /refunds [matthelm]
50
+ * Bogus: Adding basic EMV support [ryanbalsdon]
51
+ * PayBox Direct: Refunds and working test credentials [ivanfer]
52
+ * Vanco: Handle case of no billing_address [duff]
53
+ * BluePay: Add support for CUSTOM_ID2 field [ajporterfield]
54
+
4
55
  == Version 1.54.0 (October 2, 2015)
5
56
  * Beanstream: Add Network Tokenization support [girasquid]
6
57
  * CenPOS: Allow order_id on void [duff]
@@ -538,3 +538,27 @@ Worldpay Online Payments (April 2015)
538
538
  PayU India (May 2015)
539
539
 
540
540
  * Nathaniel Talbott (ntalbott)
541
+
542
+ SecurionPay (October 2015)
543
+
544
+ * Michał Szajbe (szajbus)
545
+
546
+ Komoju (October 2015)
547
+
548
+ * Kazunori Kajihiro (k2nr)
549
+
550
+ CAMS: Central Account Management System (October 2015)
551
+
552
+ * Trevor Grayson (trevorgrayson)
553
+
554
+ Transact Pro (October 2015)
555
+
556
+ * Piers C (varyonic)
557
+
558
+ Payeezy (October 2015)
559
+
560
+ * Washington L Braga Jr (huoxito)
561
+
562
+ Clearhaus (October 2015)
563
+
564
+ * Dinesh Yadav (dinesh)
data/README.md CHANGED
@@ -102,8 +102,10 @@ The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis
102
102
  * [Cashnet](http://www.higherone.com/) - US
103
103
  * [Cecabank](http://www.ceca.es/es/) - ES
104
104
  * [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
105
+ * [CAMS: Central Account Management System](https://www.centralams.com/) - US
105
106
  * [CertoDirect](http://www.certodirect.com/) - BE, BG, CZ, DK, DE, EE, IE, EL, ES, FR, IT, CY, LV, LT, LU, HU, MT, NL, AT, PL, PT, RO, SI, SK, FI, SE, GB
106
107
  * [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
108
+ * [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
107
109
  * [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
108
110
  * [Conekta](https://conekta.io) - MX
109
111
  * [CyberSource](http://www.cybersource.com) - US, BR, CA, CN, DK, FI, FR, DE, JP, MX, NO, SE, GB, SG
@@ -135,6 +137,7 @@ The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis
135
137
  * [Iridium](http://www.iridiumcorp.co.uk/) - GB, ES
136
138
  * [iTransact](http://www.itransact.com/) - US
137
139
  * [JetPay](http://www.jetpay.com/) - US
140
+ * [Komoju](http://www.komoju.com/) - JP
138
141
  * [LinkPoint](http://www.linkpoint.com/) - US
139
142
  * [Litle & Co.](http://www.litle.com/) - US
140
143
  * [maxiPago!](http://www.maxipago.com/) - BR
@@ -151,6 +154,7 @@ The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis
151
154
  * [Moneris (US)](http://www.monerisusa.com/) - US
152
155
  * [MoneyMovers](http://mmoa.us/) - US
153
156
  * [NAB Transact](http://transact.nab.com.au) - AU
157
+ * [NELiX TransaX](https://www.nelixtransax.com/) - US
154
158
  * [NetRegistry](http://www.netregistry.com.au) - AU
155
159
  * [BBS Netaxept](http://www.betalingsterminal.no/Netthandel-forside/) - NO, DK, SE, FI
156
160
  * [NETbilling](http://www.netbilling.com) - US
@@ -168,6 +172,7 @@ The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis
168
172
  * [PayJunction](http://www.payjunction.com/) - US
169
173
  * [PaySecure](http://www.commsecure.com.au/paysecure.shtml) - AU
170
174
  * [Paybox Direct](http://www.paybox.com/) - FR
175
+ * [Payeezy](https://developer.payeezy.com/) - CA, US
171
176
  * [Payex](http://payex.com/) - DK, FI, NO, SE
172
177
  * [PaymentExpress](http://www.paymentexpress.com/) - AU, CA, DE, ES, FR, GB, HK, IE, MY, NL, NZ, SG, US, ZA
173
178
  * [PAYMILL](https://paymill.com) - AD, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FO, FR, GB, GI, GR, HU, IE, IL, IS, IT, LI, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK, TR, VA
@@ -201,14 +206,15 @@ The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis
201
206
  * [SecureNet](http://www.securenet.com/) - US
202
207
  * [SecurePay](http://www.securepay.com/) - US, CA, GB, AU
203
208
  * [SecurePayTech](http://www.securepaytech.com/) - NZ
209
+ * [SecurionPay](https://securionpay.com/) - AD, AE, AF, AG, AI, AL, AM, AN, AO, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN, KP, KR, KV, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, ST, SV, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT, ZA, ZM, ZW
204
210
  * [SkipJack](http://www.skipjack.com/) - US, CA
205
211
  * [SoEasyPay](http://www.soeasypay.com/) - US, CA, AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GR, HU, IE, IT, LV, LT, LU, MT, NL, PL, PT, RO, SK, SI, ES, SE, GB, IS, NO, CH
206
212
  * [Spreedly](https://spreedly.com) - AD, AE, AT, AU, BD, BE, BG, BN, CA, CH, CY, CZ, DE, DK, EE, EG, ES, FI, FR, GB, GI, GR, HK, HU, ID, IE, IL, IM, IN, IS, IT, JO, KW, LB, LI, LK, LT, LU, LV, MC, MT, MU, MV, MX, MY, NL, NO, NZ, OM, PH, PL, PT, QA, RO, SA, SE, SG, SI, SK, SM, TR, TT, UM, US, VA, VN, ZA
207
213
  * [Stripe](https://stripe.com/) - AT, AU, BE, CA, CH, DE, DK, ES, FI, FR, GB, IE, IT, LU, NL, NO, SE, US
208
214
  * [Swipe](https://www.swipehq.com/checkout) - CA, NZ
209
- * [TransFirst](http://www.transfirst.com/) - US
210
215
  * [TNS](http://www.tnsi.com/) - AR, AU, BR, FR, DE, HK, MX, NZ, SG, GB, US
211
- * [NELiX TransaX](https://www.nelixtransax.com/) - US
216
+ * [Transact Pro](https://www.transactpro.lv/business/online-payments-acceptance) - US
217
+ * [TransFirst](http://www.transfirst.com/) - US
212
218
  * [Transnational](http://www.tnbci.com/) - US
213
219
  * [TrustCommerce](http://www.trustcommerce.com/) - US
214
220
  * [USA ePay](http://www.usaepay.com/) - US
@@ -1,32 +1,21 @@
1
1
  module ActiveMerchant #:nodoc:
2
2
  module Billing #:nodoc:
3
3
  module Base
4
- # Set ActiveMerchant gateways in test mode.
5
- #
6
- # ActiveMerchant::Billing::Base.gateway_mode = :test
7
- mattr_accessor :gateway_mode
4
+ GATEWAY_MODE_DEPRECATION_MESSAGE = 'Base#gateway_mode is deprecated in favor of Base#mode and will be removed in a future version'
8
5
 
9
- # Set ActiveMerchant integrations in test mode.
6
+ # Set ActiveMerchant gateways in test mode.
10
7
  #
11
- # ActiveMerchant::Billing::Base.integration_mode = :test
12
- def self.integration_mode=(mode)
13
- ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
14
- @@integration_mode = mode
15
- end
8
+ # ActiveMerchant::Billing::Base.mode = :test
9
+ mattr_accessor :mode
16
10
 
17
- def self.integration_mode
18
- ActiveMerchant.deprecated(OFFSITE_PAYMENT_EXTRACTION_MESSAGE)
19
- @@integration_mode
11
+ def self.gateway_mode=(mode)
12
+ ActiveMerchant.deprecated(GATEWAY_MODE_DEPRECATION_MESSAGE)
13
+ @@mode = mode
20
14
  end
21
15
 
22
- # Set both the mode of both the gateways and integrations
23
- # at once
24
- mattr_reader :mode
25
-
26
- def self.mode=(mode)
27
- @@mode = mode
28
- self.gateway_mode = mode
29
- @@integration_mode = mode
16
+ def self.gateway_mode
17
+ ActiveMerchant.deprecated(GATEWAY_MODE_DEPRECATION_MESSAGE)
18
+ @@mode
30
19
  end
31
20
 
32
21
  self.mode = :production
@@ -65,7 +54,7 @@ module ActiveMerchant #:nodoc:
65
54
 
66
55
  # A check to see if we're in test mode
67
56
  def self.test?
68
- self.gateway_mode == :test
57
+ mode == :test
69
58
  end
70
59
  end
71
60
  end
@@ -134,6 +134,29 @@ module ActiveMerchant #:nodoc:
134
134
  # @return [String] the verification value
135
135
  attr_accessor :verification_value
136
136
 
137
+ # Sets if the credit card requires a verification value.
138
+ #
139
+ # @return [Boolean]
140
+ def require_verification_value=(value)
141
+ @require_verification_value_set = true
142
+ @require_verification_value = value
143
+ end
144
+
145
+ # Returns if this credit card needs a verification value.
146
+ #
147
+ # By default this returns the configured value from `CreditCard.require_verification_value`,
148
+ # but one can set a per instance requirement with `credit_card.require_verification_value = false`.
149
+ #
150
+ # @return [Boolean]
151
+ def requires_verification_value?
152
+ @require_verification_value_set ||= false
153
+ if @require_verification_value_set
154
+ @require_verification_value
155
+ else
156
+ self.class.requires_verification_value?
157
+ end
158
+ end
159
+
137
160
  # Returns or sets the track data for the card
138
161
  #
139
162
  # @return [String]
@@ -346,7 +369,7 @@ module ActiveMerchant #:nodoc:
346
369
  unless valid_card_verification_value?(verification_value, brand)
347
370
  errors << [:verification_value, "should be #{card_verification_value_length(brand)} digits"]
348
371
  end
349
- elsif self.class.requires_verification_value?
372
+ elsif requires_verification_value?
350
373
  errors << [:verification_value, "is required"]
351
374
  end
352
375
  errors
@@ -48,7 +48,7 @@ module ActiveMerchant #:nodoc:
48
48
  # * <tt>:zip</tt> - The zip or postal code of the customer.
49
49
  # * <tt>:phone</tt> - The phone number of the customer.
50
50
  #
51
- # == Implmenting new gateways
51
+ # == Implementing new gateways
52
52
  #
53
53
  # See the {ActiveMerchant Guide to Contributing}[https://github.com/activemerchant/active_merchant/wiki/Contributing]
54
54
  #
@@ -57,7 +57,7 @@ module ActiveMerchant #:nodoc:
57
57
  include CreditCardFormatting
58
58
 
59
59
  DEBIT_CARDS = [ :switch, :solo ]
60
- CURRENCIES_WITHOUT_FRACTIONS = [ 'BIF', 'BYR', 'CLP', 'CVE', 'DJF', 'GNF', 'HUF', 'ISK', 'JPY', 'KMF', 'KRW', 'PYG', 'RWF', 'TWD', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF' ]
60
+ CURRENCIES_WITHOUT_FRACTIONS = %w(BIF BYR CLP CVE DJF GNF HUF ISK JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
61
61
 
62
62
  CREDIT_DEPRECATION_MESSAGE = "Support for using credit to refund existing transactions is deprecated and will be removed from a future release of ActiveMerchant. Please use the refund method instead."
63
63
  RECURRING_DEPRECATION_MESSAGE = "Recurring functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it."
@@ -91,7 +91,8 @@ module ActiveMerchant #:nodoc:
91
91
  :card_declined => 'card_declined',
92
92
  :processing_error => 'processing_error',
93
93
  :call_issuer => 'call_issuer',
94
- :pickup_card => 'pick_up_card'
94
+ :pickup_card => 'pick_up_card',
95
+ :config_error => 'config_error'
95
96
  }
96
97
 
97
98
  cattr_reader :implementations
@@ -145,10 +146,6 @@ module ActiveMerchant #:nodoc:
145
146
  result.to_s.downcase
146
147
  end
147
148
 
148
- def self.non_fractional_currency?(currency)
149
- CURRENCIES_WITHOUT_FRACTIONS.include?(currency.to_s)
150
- end
151
-
152
149
  def self.supported_countries=(country_codes)
153
150
  country_codes.each do |country_code|
154
151
  unless ActiveMerchant::Country.find(country_code)
@@ -254,10 +251,14 @@ module ActiveMerchant #:nodoc:
254
251
  end
255
252
  end
256
253
 
254
+ def non_fractional_currency?(currency)
255
+ CURRENCIES_WITHOUT_FRACTIONS.include?(currency.to_s)
256
+ end
257
+
257
258
  def localized_amount(money, currency)
258
259
  amount = amount(money)
259
260
 
260
- return amount unless Gateway.non_fractional_currency?(currency)
261
+ return amount unless non_fractional_currency?(currency)
261
262
 
262
263
  if self.money_format == :cents
263
264
  sprintf("%.0f", amount.to_f / 100)
@@ -275,6 +276,15 @@ module ActiveMerchant #:nodoc:
275
276
  value.to_s[0, max_size]
276
277
  end
277
278
 
279
+ def split_names(full_name)
280
+ names = (full_name || "").split
281
+ return [nil, nil] if names.size == 0
282
+
283
+ last_name = names.pop
284
+ first_name = names.join(" ")
285
+ [first_name, last_name]
286
+ end
287
+
278
288
  def requires_start_date_or_issue_number?(credit_card)
279
289
  return false if card_brand(credit_card).blank?
280
290
  DEBIT_CARDS.include?(card_brand(credit_card).to_sym)
@@ -107,7 +107,7 @@ module ActiveMerchant #:nodoc:
107
107
  post[:email] = options[:email] || "unspecified@example.com"
108
108
  post[:iPAddress] = options[:ip]
109
109
  if (billing_address = options[:billing_address])
110
- post[:firstName], post[:lastName] = billing_address[:name].split
110
+ post[:firstName], post[:lastName] = split_names(billing_address[:name])
111
111
  post[:addressLine1] = billing_address[:address1]
112
112
  post[:addressLine2] = billing_address[:address2]
113
113
  post[:city] = billing_address[:city]
@@ -32,7 +32,9 @@ module ActiveMerchant #:nodoc:
32
32
  '23' => STANDARD_ERROR_CODE[:card_declined],
33
33
  '3153' => STANDARD_ERROR_CODE[:processing_error],
34
34
  '235' => STANDARD_ERROR_CODE[:processing_error],
35
- '24' => STANDARD_ERROR_CODE[:pickup_card]
35
+ '24' => STANDARD_ERROR_CODE[:pickup_card],
36
+ '300' => STANDARD_ERROR_CODE[:config_error],
37
+ '384' => STANDARD_ERROR_CODE[:config_error]
36
38
  }
37
39
 
38
40
  MARKET_TYPE = {
@@ -317,7 +319,6 @@ module ActiveMerchant #:nodoc:
317
319
  xml.transactionRequest do
318
320
  xml.transactionType('voidTransaction')
319
321
  xml.refTransId(transaction_id_from(authorization))
320
- add_user_fields(xml, nil, options)
321
322
  end
322
323
  end
323
324
  end
@@ -433,14 +434,18 @@ module ActiveMerchant #:nodoc:
433
434
  return if payment.is_a?(String) || card_brand(payment) == 'check' || card_brand(payment) == 'apple_pay'
434
435
  if valid_track_data
435
436
  xml.retail do
436
- xml.marketType(MARKET_TYPE[:retail])
437
-
438
- device_type = options[:device_type] || DEVICE_TYPE[:wireless_pos]
439
- xml.deviceType(device_type)
437
+ xml.marketType(options[:market_type] || MARKET_TYPE[:retail])
438
+ xml.deviceType(options[:device_type] || DEVICE_TYPE[:wireless_pos])
440
439
  end
441
440
  elsif payment.manual_entry
442
441
  xml.retail do
443
- xml.marketType(MARKET_TYPE[:moto])
442
+ xml.marketType(options[:market_type] || MARKET_TYPE[:moto])
443
+ end
444
+ else
445
+ if options[:market_type]
446
+ xml.retail do
447
+ xml.marketType(options[:market_type])
448
+ end
444
449
  end
445
450
  end
446
451
  end
@@ -542,13 +547,6 @@ module ActiveMerchant #:nodoc:
542
547
  end
543
548
  end
544
549
 
545
- def split_names(full_name)
546
- names = (full_name || "").split
547
- last_name = names.pop
548
- first_name = names.join(" ")
549
- [first_name, last_name]
550
- end
551
-
552
550
  def headers
553
551
  { 'Content-Type' => 'text/xml' }
554
552
  end
@@ -430,8 +430,9 @@ module ActiveMerchant #:nodoc:
430
430
  end
431
431
 
432
432
  def add_customer_data(post, options)
433
- post[:EMAIL] = options[:email]
434
- post[:CUSTOM_ID] = options[:customer]
433
+ post[:EMAIL] = options[:email]
434
+ post[:CUSTOM_ID] = options[:customer]
435
+ post[:CUSTOM_ID2] = options[:custom_id2]
435
436
  end
436
437
 
437
438
  def add_duplicate_override(post, options)
@@ -4,9 +4,13 @@ module ActiveMerchant #:nodoc:
4
4
  class BogusGateway < Gateway
5
5
  AUTHORIZATION = '53433'
6
6
 
7
+ AUTHORIZATION_EMV_SUCCESS = '8A023030'
8
+ AUTHORIZATION_EMV_DECLINE = '8A023035'
9
+
7
10
  SUCCESS_MESSAGE = "Bogus Gateway: Forced success"
8
11
  FAILURE_MESSAGE = "Bogus Gateway: Forced failure"
9
- ERROR_MESSAGE = "Bogus Gateway: Use CreditCard number ending in 1 for success, 2 for exception and anything else for error"
12
+ NUMBER_ERROR_MESSAGE = "Bogus Gateway: Use CreditCard number ending in 1 for success, 2 for exception and anything else for error"
13
+ AMOUNT_ERROR_MESSAGE = "Bogus Gateway: Use amount ending in 00 for success, 05 for failure and anything else for exception"
10
14
  UNSTORE_ERROR_MESSAGE = "Bogus Gateway: Use trans_id ending in 1 for success, 2 for exception and anything else for error"
11
15
  CAPTURE_ERROR_MESSAGE = "Bogus Gateway: Use authorization number ending in 1 for exception, 2 for error and anything else for success"
12
16
  VOID_ERROR_MESSAGE = "Bogus Gateway: Use authorization number ending in 1 for exception, 2 for error and anything else for success"
@@ -19,26 +23,18 @@ module ActiveMerchant #:nodoc:
19
23
  self.display_name = 'Bogus'
20
24
 
21
25
  def authorize(money, paysource, options = {})
22
- money = amount(money)
23
- case normalize(paysource)
24
- when /1$/
25
- Response.new(true, SUCCESS_MESSAGE, {:authorized_amount => money}, :test => true, :authorization => AUTHORIZATION )
26
- when /2$/
27
- Response.new(false, FAILURE_MESSAGE, {:authorized_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error])
26
+ if paysource.respond_to?(:emv?) && paysource.emv?
27
+ authorize_emv(money, paysource, options)
28
28
  else
29
- raise Error, error_message(paysource)
29
+ authorize_swipe(money, paysource, options)
30
30
  end
31
31
  end
32
32
 
33
33
  def purchase(money, paysource, options = {})
34
- money = amount(money)
35
- case normalize(paysource)
36
- when /1$/, AUTHORIZATION
37
- Response.new(true, SUCCESS_MESSAGE, {:paid_amount => money}, :test => true, :authorization => AUTHORIZATION)
38
- when /2$/
39
- Response.new(false, FAILURE_MESSAGE, {:paid_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error])
34
+ if paysource.respond_to?(:emv?) && paysource.emv?
35
+ purchase_emv(money, paysource, options)
40
36
  else
41
- raise Error, error_message(paysource)
37
+ purchase_swipe(money, paysource, options)
42
38
  end
43
39
  end
44
40
 
@@ -118,6 +114,54 @@ module ActiveMerchant #:nodoc:
118
114
 
119
115
  private
120
116
 
117
+ def authorize_emv(money, paysource, options = {})
118
+ money = amount(money)
119
+ case money
120
+ when /00$/
121
+ Response.new(true, SUCCESS_MESSAGE, {:authorized_amount => money}, :test => true, :authorization => AUTHORIZATION, :emv_authorization => AUTHORIZATION_EMV_SUCCESS)
122
+ when /05$/
123
+ Response.new(false, FAILURE_MESSAGE, {:authorized_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error], :emv_authorization => AUTHORIZATION_EMV_DECLINE)
124
+ else
125
+ raise Error, error_message(paysource)
126
+ end
127
+ end
128
+
129
+ def authorize_swipe(money, paysource, options = {})
130
+ money = amount(money)
131
+ case normalize(paysource)
132
+ when /1$/
133
+ Response.new(true, SUCCESS_MESSAGE, {:authorized_amount => money}, :test => true, :authorization => AUTHORIZATION )
134
+ when /2$/
135
+ Response.new(false, FAILURE_MESSAGE, {:authorized_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error])
136
+ else
137
+ raise Error, error_message(paysource)
138
+ end
139
+ end
140
+
141
+ def purchase_emv(money, paysource, options = {})
142
+ money = amount(money)
143
+ case money
144
+ when /00$/
145
+ Response.new(true, SUCCESS_MESSAGE, {:paid_amount => money}, :test => true, :authorization => AUTHORIZATION, :emv_authorization => AUTHORIZATION_EMV_SUCCESS)
146
+ when /05$/
147
+ Response.new(false, FAILURE_MESSAGE, {:paid_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error], :emv_authorization => AUTHORIZATION_EMV_DECLINE)
148
+ else
149
+ raise Error, error_message(paysource)
150
+ end
151
+ end
152
+
153
+ def purchase_swipe(money, paysource, options = {})
154
+ money = amount(money)
155
+ case normalize(paysource)
156
+ when /1$/, AUTHORIZATION
157
+ Response.new(true, SUCCESS_MESSAGE, {:paid_amount => money}, :test => true, :authorization => AUTHORIZATION)
158
+ when /2$/
159
+ Response.new(false, FAILURE_MESSAGE, {:paid_amount => money, :error => FAILURE_MESSAGE }, :test => true, :error_code => STANDARD_ERROR_CODE[:processing_error])
160
+ else
161
+ raise Error, error_message(paysource)
162
+ end
163
+ end
164
+
121
165
  def normalize(paysource)
122
166
  if paysource.respond_to?(:account_number) && (paysource.try(:number).blank? || paysource.number.blank?)
123
167
  paysource.account_number
@@ -129,10 +173,12 @@ module ActiveMerchant #:nodoc:
129
173
  end
130
174
 
131
175
  def error_message(paysource)
132
- if paysource.respond_to?(:account_number)
176
+ if paysource.respond_to?(:emv?) && paysource.emv?
177
+ AMOUNT_ERROR_MESSAGE
178
+ elsif paysource.respond_to?(:account_number)
133
179
  CHECK_ERROR_MESSAGE
134
180
  elsif paysource.respond_to?(:number)
135
- ERROR_MESSAGE
181
+ NUMBER_ERROR_MESSAGE
136
182
  end
137
183
  end
138
184
  end