activemerchant 1.126.0 → 1.129.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.
- checksums.yaml +4 -4
- data/CHANGELOG +241 -0
- data/lib/active_merchant/billing/check.rb +40 -8
- data/lib/active_merchant/billing/credit_card.rb +28 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +79 -23
- data/lib/active_merchant/billing/gateways/adyen.rb +67 -8
- data/lib/active_merchant/billing/gateways/airwallex.rb +40 -11
- data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +21 -4
- data/lib/active_merchant/billing/gateways/beanstream.rb +18 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +22 -1
- data/lib/active_merchant/billing/gateways/bogus.rb +4 -0
- data/lib/active_merchant/billing/gateways/borgun.rb +56 -16
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +64 -17
- data/lib/active_merchant/billing/gateways/card_connect.rb +27 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +23 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +228 -57
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +47 -27
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +100 -26
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +44 -5
- data/lib/active_merchant/billing/gateways/decidir.rb +15 -4
- data/lib/active_merchant/billing/gateways/ebanx.rb +36 -24
- data/lib/active_merchant/billing/gateways/element.rb +21 -1
- data/lib/active_merchant/billing/gateways/global_collect.rb +73 -22
- data/lib/active_merchant/billing/gateways/ipg.rb +13 -8
- data/lib/active_merchant/billing/gateways/iveri.rb +39 -3
- data/lib/active_merchant/billing/gateways/kushki.rb +21 -1
- data/lib/active_merchant/billing/gateways/litle.rb +25 -5
- data/lib/active_merchant/billing/gateways/mastercard.rb +1 -8
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +17 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +44 -10
- data/lib/active_merchant/billing/gateways/monei.rb +2 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +20 -5
- data/lib/active_merchant/billing/gateways/mundipagg.rb +3 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +35 -7
- data/lib/active_merchant/billing/gateways/openpay.rb +20 -3
- data/lib/active_merchant/billing/gateways/orbital.rb +43 -22
- data/lib/active_merchant/billing/gateways/pay_trace.rb +64 -18
- data/lib/active_merchant/billing/gateways/payeezy.rb +59 -4
- data/lib/active_merchant/billing/gateways/paymentez.rb +18 -6
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paysafe.rb +22 -14
- data/lib/active_merchant/billing/gateways/payu_latam.rb +3 -0
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/priority.rb +29 -6
- data/lib/active_merchant/billing/gateways/rapyd.rb +110 -49
- data/lib/active_merchant/billing/gateways/reach.rb +277 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +9 -5
- data/lib/active_merchant/billing/gateways/sage_pay.rb +1 -1
- data/lib/active_merchant/billing/gateways/securion_pay.rb +40 -0
- data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +28 -22
- data/lib/active_merchant/billing/gateways/stripe.rb +21 -1
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +62 -22
- data/lib/active_merchant/billing/gateways/tns.rb +2 -5
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +14 -3
- data/lib/active_merchant/billing/gateways/vanco.rb +12 -3
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +1 -1
- data/lib/active_merchant/billing/gateways/vpos.rb +7 -4
- data/lib/active_merchant/billing/gateways/wompi.rb +8 -4
- data/lib/active_merchant/billing/gateways/worldpay.rb +117 -9
- data/lib/active_merchant/billing/response.rb +15 -1
- data/lib/active_merchant/connection.rb +0 -2
- data/lib/active_merchant/country.rb +1 -0
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/version.rb +1 -1
- metadata +24 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 415c09ab9b38e3503d10b38cd42959b50c131f8b47237f39b36a8da7bc044d82
|
4
|
+
data.tar.gz: 2b2cdd2955bd0ed6e2b808cad4fa31888749ee6cbe91b2a75c563f1cc09429d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 104444c88b66340a16502ae980ae4c2795f25cd8f9d3a78a05d636d55730a462d9ead8a565291774096dd3fa75149961f64ec472d2a74c7499ce6b472ec6de95
|
7
|
+
data.tar.gz: bc738912b2788963721d232e43cf02675cc6a672c7aca913c6bd876fd73b72fd0cd0b7d43e734dca7f5494957e9092e8054d75b788b59ef3a2ca25a917d3d949
|
data/CHANGELOG
CHANGED
@@ -3,6 +3,244 @@
|
|
3
3
|
|
4
4
|
== HEAD
|
5
5
|
|
6
|
+
== Version 1.129.0 (April 24th, 2023)
|
7
|
+
* Adyen: Update selectedBrand mapping for Google Pay [jcreiff] #4763
|
8
|
+
* Shift4: Add vendorReference field [jcreiff] #4762
|
9
|
+
* Shift4: Add OAuth error [aenand] #4760
|
10
|
+
* Stripe PI: Add billing address details to Apple Pay and Google Pay tokenization request [BritneyS] #4761
|
11
|
+
* Make gem compatible with Ruby 3+ [pi3r] #4768
|
12
|
+
|
13
|
+
== Version 1.128.0 (April 24th, 2023)
|
14
|
+
* CheckoutV2: Add support for Shipping Address [nicolas-maalouf-cko] #4755
|
15
|
+
* Element: Include Apple Pay - Google pay methods [jherrera] #4647
|
16
|
+
* dLocal: Add transaction query API(s) request [almalee24] #4584
|
17
|
+
* MercadoPago: Add transaction inquire request [molbrown] #4588
|
18
|
+
* Worldpay: Add transaction inquire request [molbrown] #4592
|
19
|
+
* Alelo: Adding homologation changes [heavyblade] #4590
|
20
|
+
* Adyen: Map standard error codes for `processing_error`, `config_error`, `invalid_amount`, and `incorrect_address` [ajawadmirza] #4593
|
21
|
+
* MerchantE: Add support for recurring transactions [naashton] #4594
|
22
|
+
* CyberSource: Add support for `discount_management_indicator`, `purchase_tax_amount`, `installment_total_amount`, and `installment_annual_interest_rate` fields. [rachelkirk] #4595
|
23
|
+
* Shift4: Remove `customer` from refund and `clerk` from store requests [ajawadmirza] #4596
|
24
|
+
* TransFirst Transaction Express: Update xml prefixing to be compatible with Nokogiri 1.13.4 [dsmcclain] #4582
|
25
|
+
* Iveri: Adding support for external MPI 3DS2 [heavyblade] #4598
|
26
|
+
* Credorax: Pass Network Transaction ID on MIT [jherreraa] #4600
|
27
|
+
* iVeri: Remove schema validation on Live requests [curiousepic] #4606
|
28
|
+
* Beanstream: Adding Third Party 3DS fields [heavyblade] #4602
|
29
|
+
* Borgun: Add support for 3DS preauth [ajawadmirza] #4603
|
30
|
+
* Cardstream: Add third party 3ds2 support [sainterman] #4570
|
31
|
+
* Accept both formats of Canadian routing numbers [molbrown] #4568
|
32
|
+
* DLocal: Add support for `original_order_id` [rachelkirk] #4605
|
33
|
+
* CheckoutV2: Add support for `merchant_initiated_transaction_id` [rachelkirk] #4611
|
34
|
+
* CardConnect: Add stored credential & pass any valid `ecomind` field [ajawadmirza] #4609
|
35
|
+
* Alelo: Trigger access token refresh on 404 [curiousepic] #4614
|
36
|
+
* DLocal: Add Network Tokens [gasb150] #4608
|
37
|
+
* Redsys: enable NTID generation with zero-value verify [jcreiff] #4615
|
38
|
+
* IPG: Add support for passing in `store_id` on transactions [aenand] #4619
|
39
|
+
* Adyen: Field support for Level 2 and level 3 information [sainterman] #4617
|
40
|
+
* Add alternate alpha2 country code for Kosovo [jcreiff] #4622
|
41
|
+
* CyberSource: Add support for several fields [rachelkirk] #4623
|
42
|
+
* Reach: adding gateway [cristian] #4618
|
43
|
+
* Orbital: integration improvements [molbrown] #4626
|
44
|
+
* iVeri: add new url [almalee24] #4630
|
45
|
+
* Payeezy: Enable Apple Pay support [naashton] #4631
|
46
|
+
* Payeezy: Scrub Cryptogram [naashton] #4633
|
47
|
+
* Checkout: Fix for `[:source][:stored]` in stored credentials [marioarranzr] #4629
|
48
|
+
* Mundipagg: send authorization_secret_key on all transaction types [edgarv09] #4635
|
49
|
+
* CommerceHub: Add new gateway [naashton] #4640
|
50
|
+
* CyberSource: Update installment data method [rachelkirk] #4642
|
51
|
+
* Element: fix bug with billing address email [jcreiff] #4644
|
52
|
+
* Openpay: set URL by merchant country [edgarv09] #4637
|
53
|
+
* Alelo: Improving credentials refresh process [heavyblade] #4616
|
54
|
+
* Decidir: Add transaction inquire request [almalee24] #4649
|
55
|
+
* EBANX: add soft_descriptor field [jcreiff] #4658
|
56
|
+
* CommerceHub: Add Apple Pay and Google Pay [gasb150] #4648
|
57
|
+
* Global Collect & Alelo: Fixing year dependent failing tests [heavyblade] #4665
|
58
|
+
* Moneris: Add Google Pay [sinourain] #4666
|
59
|
+
* Global Collect: Add transaction inquire request [almalee24] #4669
|
60
|
+
* Stripe PI: Add Level 3 support [almalee24] #4673
|
61
|
+
* Braintree: return additional processor response [jcreiff] #4653
|
62
|
+
* Payeezy: name from `billing_address` on `purchase` [naashton] #4674
|
63
|
+
* Stripe: add reverse_transfer to void transactions [jcreiff] #4668
|
64
|
+
* Global Collect: fix bug on transaction inquire request [almalee24] #4676
|
65
|
+
* Credorax: Support google pay and apple pay [edgarv09] #4661
|
66
|
+
* Plexo: Add support for 5 new credit card brands (passcard, edenred, anda, tarjeta-d, sodexo) [edgarv09] #4652
|
67
|
+
* Authorize.net: Google pay token support [sainterman] #4659
|
68
|
+
* Credorax: Add support for Network Tokens [jherreraa] #4679
|
69
|
+
* Stripe PI: use MultiResponse in create_setup_intent [jcreiff] #4683
|
70
|
+
* Credorax: Correct NTID logic for MIT transactions [aenand] #4686
|
71
|
+
* Adyen: Add support for `skip_mpi_data` flag [rachelkirk] #4654
|
72
|
+
* Add Canadian Institution Numbers [jcreiff] #4687
|
73
|
+
* Tns: update test URL [almalee24] #4698
|
74
|
+
* TrustCommerce: Update `authorization_from` to handle `store` response [jherreraa] #4691
|
75
|
+
* TrustCommerce: Verify feature added [jherreraa] #4692
|
76
|
+
* Rapyd: Add customer object to transactions [javierpedrozaing] #4664
|
77
|
+
* CybersourceRest: Add new gateway with authorize and purchase [heavyblade] #4690
|
78
|
+
* Litle: Add prelive_url option [aenand] #4710
|
79
|
+
* CommerceHub: Fixing verify status and prevent tokenization [heavyblade] #4716
|
80
|
+
* Payeezy: Update Stored Credentials [almalee24] #4711
|
81
|
+
* CheckoutV2: Add store/unstore [gasb150] #4712
|
82
|
+
* CybersourceREST - Refund | Credit [sinourain] #4700
|
83
|
+
* Braintree - Add Paypal custom fields [yunnydang] #4713
|
84
|
+
* BlueSnap - Add descriptor phone number field [yunnydang] #4717
|
85
|
+
* Braintree - Update transaction hash to include processor_authorization_code [yunnydang] #4718
|
86
|
+
* CyberSourceRest: Add apple pay, google pay [gasb150] #4708
|
87
|
+
* CybersourceREST - Void | Verify [sinourain] #4695
|
88
|
+
* Credorax: Set default ECI values for token transactions [sainterman] #4693
|
89
|
+
* CyberSourceRest: Add ACH Support [edgarv09] #4722
|
90
|
+
* CybersourceREST: Add capture request [heavyblade] #4726
|
91
|
+
* Paymentez: Add transaction inquire request [aenand] #4729
|
92
|
+
* Ebanx: Add transaction inquire request [almalee24] #4725
|
93
|
+
* Ebanx: Add support for Elo & Hipercard [almalee24] #4702
|
94
|
+
* CheckoutV2: Add Idempotency key support [yunnydang] #4728
|
95
|
+
* Adyen: Add support for shopper_statement field for capture [yunnydang] #4736
|
96
|
+
* CheckoutV2: Update idempotency_key name [yunnydang] #4737
|
97
|
+
* Payeezy: Enable external 3DS [jherreraa] #4715
|
98
|
+
* Ebanx: Remove default email [aenand] #4747
|
99
|
+
* CyberSourceRest: Add stored credentials support [jherreraa] #4707
|
100
|
+
* Payeezy: Add `last_name` for `add_network_tokenization` [naashton] #4743
|
101
|
+
* Stripe PI: Tokenize payment method at Stripe for `verify` [aenand] #4748
|
102
|
+
* Kushki: Add support for the months and deferred fields [yunnydang] #4752
|
103
|
+
* Borgun: Update TrCurrencyExponent for 3DS transactions with `ISK` [aenand] #4751
|
104
|
+
* CyberSourceRest: Add gateway specific fields handling [jherreraa] #4746
|
105
|
+
* IPG: Improve error handling [heavyblade] #4753
|
106
|
+
* Shift4: Handle access token failed calls [heavyblade] #4745
|
107
|
+
* Bogus: Add verify functionality [willemk] #4749
|
108
|
+
* Litle: Update successful_from method [almalee24] #4765
|
109
|
+
|
110
|
+
== Version 1.127.0 (September 20th, 2022)
|
111
|
+
* BraintreeBlue: Add venmo profile_id [molbrown] #4512
|
112
|
+
* Maestro: Adding missing BIN ranges [bradbroge] #4423
|
113
|
+
* Simetrik: Fix integer and float types, update scrub method [rachelkirk] #4405
|
114
|
+
* Credorax: Convert country codes for `recipient_country_code` field [ajawadmirza] #4408
|
115
|
+
* BlueSnap: Correctly parse `refund-transaction-id` [dsmcclain] #4411
|
116
|
+
* Worldpay: Add level II and level III data [javierpedrozaing] #4393
|
117
|
+
* Worldpay: extract `issuer_response_code` and `issuer_response_description` from gateway response [dsmcclain] #4412
|
118
|
+
* Vantiv: Support `duplicate` field read from saleResponse.duplicate attr [mashton] #4413
|
119
|
+
* Ogone: Add support for 3dsv2 [gasb150] #4410
|
120
|
+
* BlueSnap: Add support for stored credentials [ajawadmirza] #4414
|
121
|
+
* Monei: Add support for `lang` field [drkjc] #4421
|
122
|
+
* Wompi: Redirect `refund` to `void` [drkjc] #4424
|
123
|
+
* Rapyd: 3DS Support [naashton] #4422
|
124
|
+
* Adyen: Update API version [jherreraa] #4418
|
125
|
+
* Ogone: Updated home gateway URL [gasb150] #4419
|
126
|
+
* Credorax: Update url gateway and credit cards [javierpedrozaing] #4417
|
127
|
+
* Kushki: Pass extra_taxes with USD [therufs] #4426
|
128
|
+
* DLocal: fix bug with `X-Idempotency-Key` header [dsmcclain] #4431
|
129
|
+
* DLocal: Mark support for additional countries [gasb150] #4427
|
130
|
+
* Rapyd: Additional Fields [naashton] #4434
|
131
|
+
* Braintree: Return generated client token [BritneyS] #4416
|
132
|
+
* Simetrik: Update `audience` field [simetrik-frank] #4433
|
133
|
+
* CyberSource: Add bank account payment method support [heavyblade] #4428
|
134
|
+
* Rapyd: Zero Dollar Auth [naashton] #4435
|
135
|
+
* Rapyd: Scrub ACH [naashton] #4436
|
136
|
+
* VisaNet Peru: Update `purchase_number` [rachelkirk] #4437
|
137
|
+
* CardConnect: Add support for 3ds V2 [javierpedrozaing] #4429
|
138
|
+
* Rapyd: Support `store` and `unstore` [naashton] #4439
|
139
|
+
* Orbital: Update API version to 9.0 [gasb150] #4440
|
140
|
+
* Plexo: Add `meta_data` fields and reorder amount object in response [ajawadmirza] #4441
|
141
|
+
* Plexo: Change field name from `meta_data` to `metadata` [ajawadmirza] #4443
|
142
|
+
* Simetrik: Update `vat` to be in cents [simetrik-frank] #4425
|
143
|
+
* Cybersource: Handle Amex cryptograms [heavyblade] #4445
|
144
|
+
* Rapyd: Pass fields to `refund` and `store` [naashton] #4449
|
145
|
+
* VPOS: Allow reuse of encryption key [therufs] #4450
|
146
|
+
* Orbital: Add `payment_action_ind` field and refund through credit card to support tandem implementation [ajawadmirza] #4420
|
147
|
+
* Airwallex: Send `referrer_data` on setup transactions [drkjc] #4453
|
148
|
+
* Adyen and StripPI: Updated error messaging [mbreenlyles] #4454
|
149
|
+
* Airwallex: Update `referrer_data` field [drkjc] #4455
|
150
|
+
* Simetrik: Update `order_id` and `description` to be top level fields [simetrik-frank] #4451
|
151
|
+
* Plexo: Update `ip`, `description`, and `email` fields request format and scrub method to not filter cardholder name and reference id [ajawadmirza] #4457
|
152
|
+
* Plexo: Update `verify` implementation and add `verify_amount` field [ajawadmirza] #4462
|
153
|
+
* Vanco: Update `purchase` to complete a purchase transaction with an existing session id [BritneyS] #4461
|
154
|
+
* Authorize.net: Allow custom verify_amount and validate it [jherreraa] #4464
|
155
|
+
* Shift4: Add gateway adapter [ali-hassan] #4415
|
156
|
+
* Rapyd: Correctly add `billing_address` [naashton] #4465
|
157
|
+
* Credorax: Update processor response messages [jcreiff] #4466
|
158
|
+
* Shift4: add `customer_reference`, `destination_postal_code`, `product_descriptors` fields and core refactoring [ajawadmirza] #4469
|
159
|
+
* Paypal Express: Add checkout status to response object [mbreenlyles] #4467
|
160
|
+
* Shift4: Scrub security code [naashton] #4470
|
161
|
+
* Shift4: Update `cardOnFile` transaction requests [ajawadmirza] #4471
|
162
|
+
* Plexo: Update `success_from` definition [ajawadmirza] #4468
|
163
|
+
* Rapyd: Un-nest the payment urls [naashton] #4472
|
164
|
+
* Paypal Express: Correct naming mistake for accessor [mbreenlyles] #4473
|
165
|
+
* GlobalCollect: Enable Google Pay and Apple Pay [gasb150] #4388
|
166
|
+
* Shift4: $0 auth [naashton] #4474
|
167
|
+
* CyberSource: Updatie API version to 1.198 and fix 3DS test [cristian] #4456
|
168
|
+
* Shift4: add `store` method, `present` field in card, and to pass amount in cents [ajawadmirza] #4475
|
169
|
+
* Shift4: add `3ds2` implementation [ajawadmirza] #4476
|
170
|
+
* Shift4: update `success_from` definition to consider response code [ajawadmirza] #4477
|
171
|
+
* Rapyd: Customer Object [naashton] #4478
|
172
|
+
* Shift4: Verify Endopint Fix [naashton] #4479
|
173
|
+
* CheckoutV2: Scrub cryptogram and credit card number [ajawadmirza] #4488
|
174
|
+
* CheckoutV2: Add `3ds.status` field to send status of 3DS flow of all 3DS transactions [BritneyS] #4492
|
175
|
+
* CheckoutV2: Add `challenge_indicator`, `exemption`, `authorization_type`, `processing_channel_id`, and `capture_type` fields [ajawadmirza] #4482
|
176
|
+
* Add `mada` card type and associated BINs; add support for `mada` in CheckoutV2 gateway [dsmcclain] #4486
|
177
|
+
* Authorize.net: Refactor custom verify amount handling [jherreraa] #4485
|
178
|
+
* EBANX: Change amount for Colombia [flaaviaa] #4481
|
179
|
+
* Worldpay: Update `required_status_message` and `message_from` methods for response. [rachelkirk] #4493
|
180
|
+
* CheckoutV2: Add support for transactions through OAuth [ajawadmirza] #4483
|
181
|
+
* Vanco: Update unit test to remove remote call to gateway [ajawadmirza] #4497
|
182
|
+
* Shift4: remove support for 3ds2 [ajawadmirza] #4503
|
183
|
+
* Rapyd: Add support for stored credential [ajawadmirza] #4487
|
184
|
+
* MerchantE: Update `store` and add `verify` method [ajawadmirza] #4507
|
185
|
+
* Shift4: Add default `numericId`, add `InterfaceVersion`, `InterfaceName`, and `CompanyName` header fields, change date time format and allow merchant time zone [ajawadmirza] #4509
|
186
|
+
* BraintreeBlue: Add support for partial capture [aenand] #4515
|
187
|
+
* Rapyd: Change key name to `network_transaction_id` [ajawadmirza] #4514
|
188
|
+
* CyberSource: Handle unsupported Network Token brands [heavyblade] #4500
|
189
|
+
* Ingenico(Global Collect): Add support for `payment_product_id` [rachelkirk] #4521
|
190
|
+
* Adyen: Add network transaction id to store call [jcreiff] #4522
|
191
|
+
* Worldpay: Add machine cookie to subsequent calls during 3DS challenge [mbreenlyles] #4513*
|
192
|
+
* Shift4: Scrub `securityCode` fix [naashton] #4524
|
193
|
+
* Credorax: Update `OpCode` for credit transactions [dsmcclain] #4279
|
194
|
+
* CheckoutV2: Add `credit` method [ajawadmirza] #4490
|
195
|
+
* Stripe Payment Intents: Add `options` for retrieve_setup_intent [aenand] #4529
|
196
|
+
* CheckoutV2: Send payment id via `incremental_authorization` field [ajawadmirza] #4518
|
197
|
+
* Shift4: Add card `present` field, use previous transaction authorization for capture, and hardcode header values [ajawadmirza] #4528
|
198
|
+
* Orbital: Remove `DPANInd` field for RC transactions [ajawadmirza] #4502
|
199
|
+
* EBANX: Add Spreedly tag to payment body [flaaviaa] #4527
|
200
|
+
* Shift4: Add `expiration_date` field for refund transactions [ajawadmirza] #4532
|
201
|
+
* Improve handling of AVS and CVV Results in Multiresponses [gasb150] #4516
|
202
|
+
* Airwallex: Add `skip_3ds` field for create payment transactions [ajawadmirza] #4534
|
203
|
+
* Shift4: Typo correction for `initial_transaction` [ajawadmirza] #4537
|
204
|
+
* Rapyd: Pass Customer ID and fix `add_token` method [naashton] #4538
|
205
|
+
* Shift4: If no timezone is sent on transactions, the code uses the hours and minutes as a timezone offset [ali-hassan] #4536
|
206
|
+
* Priority: Add support for general credit and updating cvv and zip [priorityspreedly] #4517
|
207
|
+
* Worldpay: Update actions for generated message in `required_status_message` method [rachelkirk] #4530
|
208
|
+
* Adyen: Modify handling of countryCode for ACH [jcreiff] #4543
|
209
|
+
* CardConnect: update api end-point urls [heavyblade] #4541
|
210
|
+
* Vantiv(Litle): Add support for `fraudFilterOverride` field [rachelkirk] #4544
|
211
|
+
* Stripe: Add shipping address [jcreiff] #4539
|
212
|
+
* PayuLatam: Add extra1, extra2, extra3 fields [jcreiff] #4550
|
213
|
+
* Paysafe: Add fundingTransaction object [jcreiff] #4552
|
214
|
+
* MerchantE: Add tests for `moto_ecommerce_ind` field [ajawadmirza] #4554
|
215
|
+
* Plexo: Update `purchase` method, add flags for header fields, add new fields `billing_address`, `identification_type`, `identification_value`, and `cardholder_birthdate` [ajawadmirza] #4540
|
216
|
+
* Rapyd: Remove `BR`, `MX`, and `US` from supported countries [ajawadmirza] #4558
|
217
|
+
* Stripe Payment Intents: fix bug with billing address email [jcreiff] #4556
|
218
|
+
* Shift4: Add customer to `purchase` & `store` and remove transaction from `store` [ajawadmirza] #4557
|
219
|
+
* MerchantE: only add `moto_commerce_ind` to request if it is present [ajawadmirza] #4560
|
220
|
+
* Add BpPlus card type along with custom validation logic [dsmcclain] #4559
|
221
|
+
* PayTrace: Support ACH implementation for new endpoints and request body [ajawadmirza] #4545
|
222
|
+
* Rapyd: No force capture for ACH [naashton] #4562
|
223
|
+
* Shift4: Applied checks on Shift4 Time/Timezone offset [ali-hassan] #4561
|
224
|
+
* Alelo: Add gateway [heavyblade] #4555
|
225
|
+
* Wompi: Allow partial refund amount on void_sync [jcreiff] #4535
|
226
|
+
* Shift4: Timezone Offset [naashton] #4566
|
227
|
+
* MerchantE: `recurring_pmt_num` and `recurring_pmt_count` fields [ali-hassan] #4553
|
228
|
+
* Orbital: Add South African Rand to supported currencies [molbrown] #4569
|
229
|
+
* Orbital: Fix CardSecValInd [molbrown] #4563
|
230
|
+
* Shift4: Add `usage_indicator`, `indicator`, `scheduled_indicator`, and `transaction_id` fields [ajawadmirza] #4564
|
231
|
+
* Shift4: Retrieve `access_token` once [naashton] #4572
|
232
|
+
* Redsys: Update Base64 encryption handling for secret key [jcreiff] #4565
|
233
|
+
* Shift4: refuse `postalCode` when its null [ajawadmirza] #4574
|
234
|
+
* Plexo: Update param key to `refund_type` [ajawadmirza] #4575
|
235
|
+
* Shift4: Update request params for `verify`, `capture`, and `refund` [ajawadmirza] #4577
|
236
|
+
* CyberSource: Add support for `sec_code` [rachelkirk] #4581
|
237
|
+
* BraintreeBlue: Correctly vault payment method token for PayPal Checkout with Vault [almalee24] #4579
|
238
|
+
* BpPlus: Allow spaces in card number [ajawadmirza] #4585
|
239
|
+
* Shift4: Decline referral transactions and parse message for internal server errors [ajawadmirza] #4583
|
240
|
+
* Litle: Update homepage_url [gasb150] #4491
|
241
|
+
* Priority: Update credential handling [therufs] #4571
|
242
|
+
* Shift4: Fix authorization and remove `entryMode` from verify and store transactions [ajawadmirza] #4589
|
243
|
+
|
6
244
|
== Version 1.126.0 (April 15th, 2022)
|
7
245
|
* Moneris: Add 3DS MPI field support [esmitperez] #4373
|
8
246
|
* StripePI: Add ability to change payment_method_type to confirm_intent [aenand] #4300
|
@@ -75,6 +313,9 @@
|
|
75
313
|
* Multiple Gateways: Resolve when/case bug [naashton] #4399
|
76
314
|
* Airwallex: Add 3DS MPI support [drkjc] #4395
|
77
315
|
* Add Cartes Bancaires card bin ranges [leahriffell] #4398
|
316
|
+
* Airwallex: Add support for `original_transaction_id` field [drkjc] #4401
|
317
|
+
* Securion Pay: Pass external 3DS data [jherreraa] #4404
|
318
|
+
* Airwallex: Update Stored Credentials testing, remove support for `original_transaction_id` field [drkjc] 4407
|
78
319
|
|
79
320
|
== Version 1.125.0 (January 20, 2022)
|
80
321
|
* Wompi: support gateway [therufs] #4173
|
@@ -20,7 +20,7 @@ module ActiveMerchant #:nodoc:
|
|
20
20
|
309 310 315 320 338 340 509 540 608 614 623 809 815 819 828 829 837 839
|
21
21
|
865 879 889 899 241 242 248 250 265 275 277 290 294 301 303 307 311 314
|
22
22
|
321 323 327 328 330 332 334 335 342 343 346 352 355 361 362 366 370 372
|
23
|
-
376 378 807 853 890
|
23
|
+
376 378 807 853 890 618 842
|
24
24
|
)
|
25
25
|
|
26
26
|
def name
|
@@ -60,20 +60,52 @@ module ActiveMerchant #:nodoc:
|
|
60
60
|
false
|
61
61
|
end
|
62
62
|
|
63
|
+
def valid_routing_number?
|
64
|
+
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
65
|
+
case digits.size
|
66
|
+
when 9
|
67
|
+
return checksum(digits) == 0 || CAN_INSTITUTION_NUMBERS.include?(routing_number[1..3])
|
68
|
+
when 8
|
69
|
+
return CAN_INSTITUTION_NUMBERS.include?(routing_number[5..7])
|
70
|
+
end
|
71
|
+
|
72
|
+
false
|
73
|
+
end
|
74
|
+
|
63
75
|
# Routing numbers may be validated by calculating a checksum and dividing it by 10. The
|
64
76
|
# formula is:
|
65
77
|
# (3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
|
66
78
|
# See http://en.wikipedia.org/wiki/Routing_transit_number#Internal_checksums
|
67
|
-
def
|
79
|
+
def checksum(digits)
|
80
|
+
((3 * (digits[0] + digits[3] + digits[6])) +
|
81
|
+
(7 * (digits[1] + digits[4] + digits[7])) +
|
82
|
+
(digits[2] + digits[5] + digits[8])) % 10
|
83
|
+
end
|
84
|
+
|
85
|
+
# Always return MICR-formatted routing number for Canadian routing numbers, US routing numbers unchanged
|
86
|
+
def micr_format_routing_number
|
68
87
|
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
88
|
+
case digits.size
|
89
|
+
when 9
|
90
|
+
if checksum(digits) == 0
|
91
|
+
return routing_number
|
92
|
+
else
|
93
|
+
return routing_number[4..8] + routing_number[1..3]
|
94
|
+
end
|
95
|
+
when 8
|
96
|
+
return routing_number
|
97
|
+
end
|
98
|
+
end
|
73
99
|
|
74
|
-
|
100
|
+
# Always return electronic-formatted routing number for Canadian routing numbers, US routing numbers unchanged
|
101
|
+
def electronic_format_routing_number
|
102
|
+
digits = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).cover?(d) }
|
103
|
+
case digits.size
|
104
|
+
when 9
|
105
|
+
return routing_number
|
106
|
+
when 8
|
107
|
+
return '0' + routing_number[5..7] + routing_number[0..4]
|
75
108
|
end
|
76
|
-
false
|
77
109
|
end
|
78
110
|
end
|
79
111
|
end
|
@@ -32,6 +32,12 @@ module ActiveMerchant #:nodoc:
|
|
32
32
|
# * Olimpica
|
33
33
|
# * Creditel
|
34
34
|
# * Confiable
|
35
|
+
# * Mada
|
36
|
+
# * BpPlus
|
37
|
+
# * Passcard
|
38
|
+
# * Edenred
|
39
|
+
# * Anda
|
40
|
+
# * Creditos directos (Tarjeta D)
|
35
41
|
#
|
36
42
|
# For testing purposes, use the 'bogus' credit card brand. This skips the vast majority of
|
37
43
|
# validations, allowing you to focus on your core concerns until you're ready to be more concerned
|
@@ -61,6 +67,8 @@ module ActiveMerchant #:nodoc:
|
|
61
67
|
class CreditCard < Model
|
62
68
|
include CreditCardMethods
|
63
69
|
|
70
|
+
BRANDS_WITH_SPACES_IN_NUMBER = %w(bp_plus)
|
71
|
+
|
64
72
|
class << self
|
65
73
|
# Inherited, but can be overridden w/o changing parent's value
|
66
74
|
attr_accessor :require_verification_value
|
@@ -76,7 +84,7 @@ module ActiveMerchant #:nodoc:
|
|
76
84
|
attr_reader :number
|
77
85
|
|
78
86
|
def number=(value)
|
79
|
-
@number = (empty?(value) ? value : value
|
87
|
+
@number = (empty?(value) ? value : filter_number(value))
|
80
88
|
end
|
81
89
|
|
82
90
|
# Returns or sets the expiry month for the card.
|
@@ -116,6 +124,12 @@ module ActiveMerchant #:nodoc:
|
|
116
124
|
# * +'olimpica'+
|
117
125
|
# * +'creditel'+
|
118
126
|
# * +'confiable'+
|
127
|
+
# * +'mada'+
|
128
|
+
# * +'bp_plus'+
|
129
|
+
# * +'passcard'+
|
130
|
+
# * +'edenred'+
|
131
|
+
# * +'anda'+
|
132
|
+
# * +'tarjeta-d'+
|
119
133
|
#
|
120
134
|
# Or, if you wish to test your implementation, +'bogus'+.
|
121
135
|
#
|
@@ -337,8 +351,21 @@ module ActiveMerchant #:nodoc:
|
|
337
351
|
icc_data.present?
|
338
352
|
end
|
339
353
|
|
354
|
+
def allow_spaces_in_card?(number = nil)
|
355
|
+
BRANDS_WITH_SPACES_IN_NUMBER.include?(self.class.brand?(self.number || number))
|
356
|
+
end
|
357
|
+
|
340
358
|
private
|
341
359
|
|
360
|
+
def filter_number(value)
|
361
|
+
regex = if allow_spaces_in_card?(value)
|
362
|
+
/[^\d ]/
|
363
|
+
else
|
364
|
+
/[^\d]/
|
365
|
+
end
|
366
|
+
value.to_s.gsub(regex, '')
|
367
|
+
end
|
368
|
+
|
342
369
|
def validate_essential_attributes #:nodoc:
|
343
370
|
errors = []
|
344
371
|
|
@@ -8,6 +8,7 @@ module ActiveMerchant #:nodoc:
|
|
8
8
|
'visa' => ->(num) { num =~ /^4\d{12}(\d{3})?(\d{3})?$/ },
|
9
9
|
'master' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), MASTERCARD_RANGES) },
|
10
10
|
'elo' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), ELO_RANGES) },
|
11
|
+
'cabal' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 8), CABAL_RANGES) },
|
11
12
|
'alelo' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), ALELO_RANGES) },
|
12
13
|
'discover' => ->(num) { num =~ /^(6011|65\d{2}|64[4-9]\d)\d{12,15}$/ },
|
13
14
|
'american_express' => ->(num) { num =~ /^3[47]\d{13}$/ },
|
@@ -23,10 +24,9 @@ module ActiveMerchant #:nodoc:
|
|
23
24
|
},
|
24
25
|
'maestro_no_luhn' => ->(num) { num =~ /^(501080|501081|501082)\d{6,13}$/ },
|
25
26
|
'forbrugsforeningen' => ->(num) { num =~ /^600722\d{10}$/ },
|
26
|
-
'sodexo' => ->(num) { num =~ /^(606071|603389|606070|606069|606068|600818)\d{10}$/ },
|
27
|
+
'sodexo' => ->(num) { num =~ /^(606071|603389|606070|606069|606068|600818|505864|505865)\d{10}$/ },
|
27
28
|
'alia' => ->(num) { num =~ /^(504997|505878|601030|601073|505874)\d{10}$/ },
|
28
29
|
'vr' => ->(num) { num =~ /^(627416|637036)\d{10}$/ },
|
29
|
-
'cabal' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 8), CABAL_RANGES) },
|
30
30
|
'unionpay' => ->(num) { (16..19).cover?(num&.size) && in_bin_range?(num.slice(0, 8), UNIONPAY_RANGES) },
|
31
31
|
'carnet' => lambda { |num|
|
32
32
|
num&.size == 16 && (
|
@@ -39,9 +39,18 @@ module ActiveMerchant #:nodoc:
|
|
39
39
|
'creditel' => ->(num) { num =~ /^601933\d{10}$/ },
|
40
40
|
'confiable' => ->(num) { num =~ /^560718\d{10}$/ },
|
41
41
|
'synchrony' => ->(num) { num =~ /^700600\d{10}$/ },
|
42
|
-
'routex' => ->(num) { num =~ /^(700676|700678)\d{13}$/ }
|
42
|
+
'routex' => ->(num) { num =~ /^(700676|700678)\d{13}$/ },
|
43
|
+
'mada' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), MADA_RANGES) },
|
44
|
+
'bp_plus' => ->(num) { num =~ /^(7050\d\s\d{9}\s\d{3}$|705\d\s\d{8}\s\d{5}$)/ },
|
45
|
+
'passcard' => ->(num) { num =~ /^628026\d{10}$/ },
|
46
|
+
'edenred' => ->(num) { num =~ /^637483\d{10}$/ },
|
47
|
+
'anda' => ->(num) { num =~ /^603199\d{10}$/ },
|
48
|
+
'tarjeta-d' => ->(num) { num =~ /^601828\d{10}$/ },
|
49
|
+
'hipercard' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), HIPERCARD_RANGES) }
|
43
50
|
}
|
44
51
|
|
52
|
+
SODEXO_NO_LUHN = ->(num) { num =~ /^(505864|505865)\d{10}$/ }
|
53
|
+
|
45
54
|
# http://www.barclaycard.co.uk/business/files/bin_rules.pdf
|
46
55
|
ELECTRON_RANGES = [
|
47
56
|
[400115],
|
@@ -101,8 +110,8 @@ module ActiveMerchant #:nodoc:
|
|
101
110
|
%w[ 500057
|
102
111
|
501018 501043 501045 501047 501049 501051 501072 501075 501083 501087 501089 501095
|
103
112
|
501500
|
104
|
-
501879 502113 502301
|
105
|
-
503645 503670
|
113
|
+
501879 502113 502120 502121 502301
|
114
|
+
503175 503337 503645 503670
|
106
115
|
504310 504338 504363 504533 504587 504620 504639 504656 504738 504781 504910
|
107
116
|
507001 507002 507004 507082 507090
|
108
117
|
560014 560565 561033
|
@@ -113,7 +122,7 @@ module ActiveMerchant #:nodoc:
|
|
113
122
|
585274 585697
|
114
123
|
586509
|
115
124
|
588729 588792
|
116
|
-
589244 589407 589471 589605 589633 589647 589671
|
125
|
+
589244 589407 589471 589605 589633 589647 589671 589916
|
117
126
|
590043 590206 590263 590265 590278 590361 590362 590379 590393 590590
|
118
127
|
591235 591420 591481 591620 591770 591948 591994
|
119
128
|
592024 592161 592184 592186 592201 592384 592393 592528 592566 592704 592735 592879 592884
|
@@ -124,12 +133,16 @@ module ActiveMerchant #:nodoc:
|
|
124
133
|
597077 597094 597143 597370 597410 597765 597855 597862
|
125
134
|
598053 598054 598395 598585 598793 598794 598815 598835 598838 598880 598889
|
126
135
|
599000 599069 599089 599148 599191 599310 599741 599742 599867
|
127
|
-
601070 601638
|
136
|
+
601070 601452 601628 601638
|
137
|
+
602648
|
138
|
+
603326 603450 603689
|
128
139
|
604983
|
129
140
|
606126
|
130
|
-
|
131
|
-
|
132
|
-
|
141
|
+
608710
|
142
|
+
627339 627453 627454 627973
|
143
|
+
636117 636380 636422 636502 636639
|
144
|
+
637046 637529 637568 637600 637756
|
145
|
+
639130 639229 639350
|
133
146
|
690032]
|
134
147
|
)
|
135
148
|
|
@@ -181,10 +194,10 @@ module ActiveMerchant #:nodoc:
|
|
181
194
|
506745..506747, 506753..506753, 506774..506778, 509000..509007, 509009..509014,
|
182
195
|
509020..509030, 509035..509042, 509044..509089, 509091..509101, 509104..509807,
|
183
196
|
509831..509877, 509897..509900, 509918..509964, 509971..509986, 509995..509999,
|
184
|
-
627780..627780, 636368..636368, 650031..650033, 650035..650051,
|
185
|
-
650406..650439, 650485..650504, 650506..650538, 650552..650598,
|
186
|
-
650901..650922, 650928..650928, 650938..650939, 650946..650978,
|
187
|
-
655000..655019, 655021..655057
|
197
|
+
627780..627780, 636297..636298, 636368..636368, 650031..650033, 650035..650051,
|
198
|
+
650057..650081, 650406..650439, 650485..650504, 650506..650538, 650552..650598,
|
199
|
+
650720..650727, 650901..650922, 650928..650928, 650938..650939, 650946..650978,
|
200
|
+
651652..651704, 655000..655019, 655021..655057
|
188
201
|
]
|
189
202
|
|
190
203
|
# Alelo provides BIN ranges by e-mailing them out periodically.
|
@@ -204,7 +217,15 @@ module ActiveMerchant #:nodoc:
|
|
204
217
|
CABAL_RANGES = [
|
205
218
|
60420100..60440099,
|
206
219
|
58965700..58965799,
|
207
|
-
60352200..60352299
|
220
|
+
60352200..60352299,
|
221
|
+
65027200..65027299,
|
222
|
+
65008700..65008700
|
223
|
+
]
|
224
|
+
|
225
|
+
MADA_RANGES = [
|
226
|
+
504300..504300, 506968..506968, 508160..508160, 585265..585265, 588848..588848,
|
227
|
+
588850..588850, 588982..588983, 589005..589005, 589206..589206, 604906..604906,
|
228
|
+
605141..605141, 636120..636120, 968201..968209, 968211..968211
|
208
229
|
]
|
209
230
|
|
210
231
|
NARANJA_RANGES = [
|
@@ -221,6 +242,11 @@ module ActiveMerchant #:nodoc:
|
|
221
242
|
3528..3589, 3088..3094, 3096..3102, 3112..3120, 3158..3159, 3337..3349
|
222
243
|
]
|
223
244
|
|
245
|
+
HIPERCARD_RANGES = [
|
246
|
+
384100..384100, 384140..384140, 384160..384160, 606282..606282, 637095..637095,
|
247
|
+
637568..637568, 637599..637599, 637609..637609, 637612..637612
|
248
|
+
]
|
249
|
+
|
224
250
|
def self.included(base)
|
225
251
|
base.extend(ClassMethods)
|
226
252
|
end
|
@@ -295,7 +321,7 @@ module ActiveMerchant #:nodoc:
|
|
295
321
|
def valid_number?(number)
|
296
322
|
valid_test_mode_card_number?(number) ||
|
297
323
|
valid_card_number_length?(number) &&
|
298
|
-
valid_card_number_characters?(number) &&
|
324
|
+
valid_card_number_characters?(brand?(number), number) &&
|
299
325
|
valid_by_algorithm?(brand?(number), number)
|
300
326
|
end
|
301
327
|
|
@@ -362,8 +388,9 @@ module ActiveMerchant #:nodoc:
|
|
362
388
|
number.length >= 12
|
363
389
|
end
|
364
390
|
|
365
|
-
def valid_card_number_characters?(number) #:nodoc:
|
391
|
+
def valid_card_number_characters?(brand, number) #:nodoc:
|
366
392
|
return false if number.nil?
|
393
|
+
return number =~ /\A[0-9 ]+\Z/ if brand == 'bp_plus'
|
367
394
|
|
368
395
|
!number.match(/\D/)
|
369
396
|
end
|
@@ -373,20 +400,28 @@ module ActiveMerchant #:nodoc:
|
|
373
400
|
%w[1 2 3 success failure error].include?(number)
|
374
401
|
end
|
375
402
|
|
403
|
+
def sodexo_no_luhn?(numbers)
|
404
|
+
SODEXO_NO_LUHN.call(numbers)
|
405
|
+
end
|
406
|
+
|
376
407
|
def valid_by_algorithm?(brand, numbers) #:nodoc:
|
377
408
|
case brand
|
378
409
|
when 'naranja'
|
379
410
|
valid_naranja_algo?(numbers)
|
380
411
|
when 'creditel'
|
381
412
|
valid_creditel_algo?(numbers)
|
382
|
-
when 'alia', 'confiable', 'maestro_no_luhn'
|
413
|
+
when 'alia', 'confiable', 'maestro_no_luhn', 'anda', 'tarjeta-d', 'hipercard'
|
383
414
|
true
|
415
|
+
when 'sodexo'
|
416
|
+
sodexo_no_luhn?(numbers) ? true : valid_luhn?(numbers)
|
417
|
+
when 'bp_plus', 'passcard', 'edenred'
|
418
|
+
valid_luhn_non_zero_check_digit?(numbers)
|
384
419
|
else
|
385
420
|
valid_luhn?(numbers)
|
386
421
|
end
|
387
422
|
end
|
388
423
|
|
389
|
-
|
424
|
+
BYTES_TO_DIGITS = {
|
390
425
|
48 => 0,
|
391
426
|
49 => 1,
|
392
427
|
50 => 2,
|
@@ -400,7 +435,7 @@ module ActiveMerchant #:nodoc:
|
|
400
435
|
nil => 0
|
401
436
|
}.freeze
|
402
437
|
|
403
|
-
|
438
|
+
BYTES_TO_DIGITS_DOUBLED = {
|
404
439
|
48 => 0, # 0 * 2
|
405
440
|
49 => 2, # 1 * 2
|
406
441
|
50 => 4, # 2 * 2
|
@@ -420,19 +455,40 @@ module ActiveMerchant #:nodoc:
|
|
420
455
|
sum = 0
|
421
456
|
|
422
457
|
odd = true
|
423
|
-
numbers.reverse.bytes.each do |
|
458
|
+
numbers.reverse.bytes.each do |bytes|
|
424
459
|
if odd
|
425
460
|
odd = false
|
426
|
-
sum +=
|
461
|
+
sum += BYTES_TO_DIGITS[bytes]
|
427
462
|
else
|
428
463
|
odd = true
|
429
|
-
sum +=
|
464
|
+
sum += BYTES_TO_DIGITS_DOUBLED[bytes]
|
430
465
|
end
|
431
466
|
end
|
432
467
|
|
433
468
|
sum % 10 == 0
|
434
469
|
end
|
435
470
|
|
471
|
+
def valid_luhn_with_check_digit?(numbers, check_digit)
|
472
|
+
sum = 0
|
473
|
+
|
474
|
+
doubler = true
|
475
|
+
|
476
|
+
numbers.reverse.bytes.each do |bytes|
|
477
|
+
doubler ? sum += BYTES_TO_DIGITS_DOUBLED[bytes] : sum += BYTES_TO_DIGITS[bytes]
|
478
|
+
doubler = !doubler
|
479
|
+
end
|
480
|
+
|
481
|
+
(10 - (sum % 10)) % 10 == check_digit.to_i
|
482
|
+
end
|
483
|
+
|
484
|
+
def valid_luhn_non_zero_check_digit?(numbers)
|
485
|
+
return valid_luhn?(numbers.delete(' ')) if numbers[5] == ' '
|
486
|
+
|
487
|
+
check_digit = numbers[-1]
|
488
|
+
luhn_payload = numbers.delete(' ').chop
|
489
|
+
valid_luhn_with_check_digit?(luhn_payload, check_digit)
|
490
|
+
end
|
491
|
+
|
436
492
|
# Checks the validity of a card number by use of specific algorithms
|
437
493
|
def valid_naranja_algo?(numbers) #:nodoc:
|
438
494
|
num_array = numbers.to_s.chars.map(&:to_i)
|