activemerchant 1.42.6 → 1.90.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 +5 -13
- data/CHANGELOG +1420 -2
- data/CONTRIBUTORS +106 -0
- data/README.md +107 -103
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +12 -13
- data/lib/active_merchant/billing/base.rb +13 -16
- data/lib/active_merchant/billing/check.rb +35 -24
- data/lib/active_merchant/billing/compatibility.rb +117 -0
- data/lib/active_merchant/billing/credit_card.rb +196 -81
- data/lib/active_merchant/billing/credit_card_formatting.rb +6 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +199 -75
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +171 -39
- data/lib/active_merchant/billing/gateways/adyen.rb +380 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +933 -604
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +74 -54
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +130 -370
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +23 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +351 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +6 -6
- data/lib/active_merchant/billing/gateways/be2bill.rb +2 -2
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +109 -32
- data/lib/active_merchant/billing/gateways/beanstream.rb +59 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -9
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -498
- data/lib/active_merchant/billing/gateways/blue_snap.rb +347 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +80 -46
- data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +15 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +311 -121
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +311 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +6 -7
- data/lib/active_merchant/billing/gateways/card_stream.rb +235 -89
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +50 -8
- data/lib/active_merchant/billing/gateways/cecabank.rb +27 -14
- data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +233 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +91 -97
- data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +356 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +294 -158
- data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +59 -347
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +24 -39
- data/lib/active_merchant/billing/gateways/elavon.rb +146 -147
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +41 -31
- data/lib/active_merchant/billing/gateways/evo_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway.rb +79 -78
- data/lib/active_merchant/billing/gateways/eway_managed.rb +35 -36
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +369 -228
- data/lib/active_merchant/billing/gateways/exact.rb +32 -26
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +90 -64
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -14
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +128 -122
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +190 -64
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +446 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +270 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +29 -27
- data/lib/active_merchant/billing/gateways/global_collect.rb +340 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +35 -36
- data/lib/active_merchant/billing/gateways/hps.rb +305 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +271 -16
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +29 -32
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -6
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +247 -41
- data/lib/active_merchant/billing/gateways/itransact.rb +4 -5
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +198 -71
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +45 -43
- data/lib/active_merchant/billing/gateways/litle.rb +328 -444
- data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +145 -115
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +37 -19
- data/lib/active_merchant/billing/gateways/merchant_one.rb +13 -15
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +57 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +59 -48
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +38 -19
- data/lib/active_merchant/billing/gateways/mercury.rb +77 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +11 -30
- data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
- data/lib/active_merchant/billing/gateways/migs.rb +81 -22
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +23 -25
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +146 -64
- data/lib/active_merchant/billing/gateways/moneris_us.rb +197 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -15
- data/lib/active_merchant/billing/gateways/mundipagg.rb +292 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +86 -64
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +11 -5
- data/lib/active_merchant/billing/gateways/netaxept.rb +21 -22
- data/lib/active_merchant/billing/gateways/netbanx.rb +290 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +70 -35
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -6
- data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +274 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +90 -47
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +48 -20
- data/lib/active_merchant/billing/gateways/opp.rb +369 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +79 -44
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -102
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +48 -29
- data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +67 -48
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +20 -26
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +7 -15
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +40 -36
- data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
- data/lib/active_merchant/billing/gateways/payex.rb +38 -30
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +62 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -7
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +74 -27
- data/lib/active_merchant/billing/gateways/payflow_express.rb +77 -81
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +54 -45
- data/lib/active_merchant/billing/gateways/paymentez.rb +304 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +160 -66
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +54 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +17 -3
- data/lib/active_merchant/billing/gateways/paypal.rb +36 -27
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +7 -6
- data/lib/active_merchant/billing/gateways/paypal_express.rb +32 -4
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/payscout.rb +2 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -88
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +445 -0
- data/lib/active_merchant/billing/gateways/payway.rb +8 -8
- data/lib/active_merchant/billing/gateways/pin.rb +74 -18
- data/lib/active_merchant/billing/gateways/plugnpay.rb +66 -76
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +30 -30
- data/lib/active_merchant/billing/gateways/psl_card.rb +27 -34
- data/lib/active_merchant/billing/gateways/qbms.rb +65 -54
- data/lib/active_merchant/billing/gateways/quantum.rb +18 -18
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +295 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -350
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +78 -48
- data/lib/active_merchant/billing/gateways/redsys.rb +310 -170
- data/lib/active_merchant/billing/gateways/s5.rb +246 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
- data/lib/active_merchant/billing/gateways/sage.rb +415 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +195 -90
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +11 -12
- data/lib/active_merchant/billing/gateways/secure_net.rb +51 -43
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -10
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +25 -14
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +10 -18
- data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +35 -38
- data/lib/active_merchant/billing/gateways/smart_ps.rb +50 -42
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +9 -9
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +62 -12
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -103
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +12 -18
- data/lib/active_merchant/billing/gateways/telr.rb +274 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +143 -30
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
- data/lib/active_merchant/billing/gateways/transax.rb +5 -6
- data/lib/active_merchant/billing/gateways/transnational.rb +2 -232
- data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +86 -57
- data/lib/active_merchant/billing/gateways/usa_epay.rb +4 -4
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +196 -89
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +157 -32
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +42 -49
- data/lib/active_merchant/billing/gateways/viaklix.rb +11 -24
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +233 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +26 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +153 -31
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +207 -63
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +31 -24
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +195 -0
- data/lib/active_merchant/country.rb +335 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
- data/lib/active_merchant/network_connection_retries.rb +80 -0
- data/lib/active_merchant/post_data.rb +25 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +23 -27
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3988 -0
- data/lib/support/gateway_support.rb +7 -9
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +6 -7
- data/lib/support/ssl_version.rb +87 -0
- metadata +148 -323
- checksums.yaml.gz.sig +0 -0
- data/gem-public_cert.pem +0 -21
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/app55.rb +0 -185
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -249
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/orbital/cvv_result.rb +0 -34
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -93
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/samurai.rb +0 -118
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -361
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +0 -31
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +0 -186
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +0 -38
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/alipay/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/alipay/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/alipay.rb +0 -18
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +0 -229
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +0 -340
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +0 -64
- data/lib/active_merchant/billing/integrations/bit_pay/notification.rb +0 -74
- data/lib/active_merchant/billing/integrations/bit_pay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bit_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +0 -17
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +0 -11
- data/lib/active_merchant/billing/integrations/bogus/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/bogus.rb +0 -23
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +0 -120
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +0 -158
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/chronopay.rb +0 -23
- data/lib/active_merchant/billing/integrations/citrus/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus/notification.rb +0 -133
- data/lib/active_merchant/billing/integrations/citrus/return.rb +0 -40
- data/lib/active_merchant/billing/integrations/citrus.rb +0 -51
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +0 -200
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +0 -76
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +0 -32
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +0 -37
- data/lib/active_merchant/billing/integrations/direc_pay.rb +0 -41
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +0 -90
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +0 -120
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/directebanking.rb +0 -47
- data/lib/active_merchant/billing/integrations/doku/helper.rb +0 -102
- data/lib/active_merchant/billing/integrations/doku/notification.rb +0 -69
- data/lib/active_merchant/billing/integrations/doku/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/doku.rb +0 -24
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +0 -77
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +0 -86
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +0 -11
- data/lib/active_merchant/billing/integrations/dotpay.rb +0 -22
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +0 -23
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +0 -49
- data/lib/active_merchant/billing/integrations/dwolla.rb +0 -23
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +0 -34
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +0 -84
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +0 -48
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +0 -40
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +0 -36
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/easy_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/epay/helper.rb +0 -55
- data/lib/active_merchant/billing/integrations/epay/notification.rb +0 -110
- data/lib/active_merchant/billing/integrations/epay.rb +0 -21
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +0 -61
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +0 -56
- data/lib/active_merchant/billing/integrations/first_data.rb +0 -38
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +0 -70
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +0 -85
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/gestpay.rb +0 -25
- data/lib/active_merchant/billing/integrations/helper.rb +0 -117
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +0 -58
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +0 -68
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +0 -118
- data/lib/active_merchant/billing/integrations/ipay88/notification.rb +0 -103
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -29
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -23
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +0 -43
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +0 -89
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +0 -83
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +0 -48
- data/lib/active_merchant/billing/integrations/maksuturva.rb +0 -86
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +0 -75
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +0 -123
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +0 -94
- data/lib/active_merchant/billing/integrations/nochex/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/nochex.rb +0 -88
- data/lib/active_merchant/billing/integrations/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/paxum/common.rb +0 -24
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +0 -42
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +0 -33
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +0 -42
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +0 -134
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/pay_fast.rb +0 -70
- data/lib/active_merchant/billing/integrations/paydollar/helper.rb +0 -41
- data/lib/active_merchant/billing/integrations/paydollar/notification.rb +0 -60
- data/lib/active_merchant/billing/integrations/paydollar/return.rb +0 -15
- data/lib/active_merchant/billing/integrations/paydollar.rb +0 -59
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +0 -116
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +0 -78
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +0 -119
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +0 -227
- data/lib/active_merchant/billing/integrations/paypal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/paypal.rb +0 -39
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +0 -39
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -76
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -154
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in_paisa/helper.rb +0 -19
- data/lib/active_merchant/billing/integrations/payu_in_paisa/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/payu_in_paisa/return.rb +0 -16
- data/lib/active_merchant/billing/integrations/payu_in_paisa.rb +0 -30
- data/lib/active_merchant/billing/integrations/platron/helper.rb +0 -32
- data/lib/active_merchant/billing/integrations/platron/notification.rb +0 -113
- data/lib/active_merchant/billing/integrations/platron.rb +0 -28
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -112
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +0 -157
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +0 -25
- data/lib/active_merchant/billing/integrations/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +0 -96
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +0 -137
- data/lib/active_merchant/billing/integrations/quickpay.rb +0 -21
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +0 -23
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +0 -91
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +0 -17
- data/lib/active_merchant/billing/integrations/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +0 -19
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +0 -50
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +0 -55
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +0 -17
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +0 -33
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +0 -136
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +0 -210
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +0 -31
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +0 -37
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +0 -107
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -171
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -58
- data/lib/active_merchant/billing/integrations/two_checkout.rb +0 -44
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +0 -86
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +0 -97
- data/lib/active_merchant/billing/integrations/valitor/return.rb +0 -13
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +0 -88
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +0 -59
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +0 -20
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +0 -50
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +0 -68
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +0 -51
- data/lib/active_merchant/billing/integrations/web_pay.rb +0 -45
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +0 -17
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +0 -40
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +0 -47
- data/lib/active_merchant/billing/integrations/webmoney.rb +0 -43
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/common.rb +0 -104
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/helper.rb +0 -145
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/notification.rb +0 -101
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page/return.rb +0 -35
- data/lib/active_merchant/billing/integrations/wirecard_checkout_page.rb +0 -39
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
- data/lib/active_merchant/billing/integrations/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
require
|
|
1
|
+
require 'active_merchant/billing/gateways/braintree/braintree_common'
|
|
2
2
|
|
|
3
3
|
begin
|
|
4
|
-
require
|
|
4
|
+
require 'braintree'
|
|
5
5
|
rescue LoadError
|
|
6
|
-
raise
|
|
6
|
+
raise 'Could not load the braintree gem. Use `gem install braintree` to install it.'
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
unless Braintree::Version::Major == 2 && Braintree::Version::Minor >= 78
|
|
10
|
+
raise "Need braintree gem >= 2.78.0. Run `gem install braintree --version '~>2.78'` to get the correct version."
|
|
11
|
+
end
|
|
10
12
|
|
|
11
13
|
module ActiveMerchant #:nodoc:
|
|
12
14
|
module Billing #:nodoc:
|
|
@@ -37,17 +39,22 @@ module ActiveMerchant #:nodoc:
|
|
|
37
39
|
#
|
|
38
40
|
class BraintreeBlueGateway < Gateway
|
|
39
41
|
include BraintreeCommon
|
|
42
|
+
include Empty
|
|
40
43
|
|
|
41
44
|
self.display_name = 'Braintree (Blue Platform)'
|
|
42
45
|
|
|
46
|
+
ERROR_CODES = {
|
|
47
|
+
cannot_refund_if_unsettled: 91506
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
def initialize(options = {})
|
|
44
51
|
requires!(options, :merchant_id, :public_key, :private_key)
|
|
45
52
|
@merchant_account_id = options[:merchant_account_id]
|
|
46
53
|
|
|
47
54
|
super
|
|
48
55
|
|
|
49
|
-
if wiredump_device
|
|
50
|
-
logger = (
|
|
56
|
+
if wiredump_device.present?
|
|
57
|
+
logger = (Logger === wiredump_device ? wiredump_device : Logger.new(wiredump_device))
|
|
51
58
|
logger.level = Logger::DEBUG
|
|
52
59
|
else
|
|
53
60
|
logger = Braintree::Configuration.logger.clone
|
|
@@ -60,10 +67,10 @@ module ActiveMerchant #:nodoc:
|
|
|
60
67
|
:private_key => options[:private_key],
|
|
61
68
|
:environment => (options[:environment] || (test? ? :sandbox : :production)).to_sym,
|
|
62
69
|
:custom_user_agent => "ActiveMerchant #{ActiveMerchant::VERSION}",
|
|
63
|
-
:logger => logger
|
|
70
|
+
:logger => options[:logger] || logger
|
|
64
71
|
)
|
|
65
72
|
|
|
66
|
-
@braintree_gateway = Braintree::Gateway.new(
|
|
73
|
+
@braintree_gateway = Braintree::Gateway.new(@configuration)
|
|
67
74
|
end
|
|
68
75
|
|
|
69
76
|
def authorize(money, credit_card_or_vault_id, options = {})
|
|
@@ -72,8 +79,8 @@ module ActiveMerchant #:nodoc:
|
|
|
72
79
|
|
|
73
80
|
def capture(money, authorization, options = {})
|
|
74
81
|
commit do
|
|
75
|
-
result = @braintree_gateway.transaction.submit_for_settlement(authorization,
|
|
76
|
-
|
|
82
|
+
result = @braintree_gateway.transaction.submit_for_settlement(authorization, localized_amount(money, options[:currency] || default_currency).to_s)
|
|
83
|
+
response_from_result(result)
|
|
77
84
|
end
|
|
78
85
|
end
|
|
79
86
|
|
|
@@ -88,25 +95,28 @@ module ActiveMerchant #:nodoc:
|
|
|
88
95
|
def refund(*args)
|
|
89
96
|
# legacy signature: #refund(transaction_id, options = {})
|
|
90
97
|
# new signature: #refund(money, transaction_id, options = {})
|
|
91
|
-
money, transaction_id,
|
|
92
|
-
money =
|
|
98
|
+
money, transaction_id, options = extract_refund_args(args)
|
|
99
|
+
money = localized_amount(money, options[:currency] || default_currency).to_s if money
|
|
93
100
|
|
|
94
101
|
commit do
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
response = response_from_result(@braintree_gateway.transaction.refund(transaction_id, money))
|
|
103
|
+
return response if response.success?
|
|
104
|
+
return response unless options[:force_full_refund_if_unsettled]
|
|
105
|
+
|
|
106
|
+
void(transaction_id) if response.message =~ /#{ERROR_CODES[:cannot_refund_if_unsettled]}/
|
|
100
107
|
end
|
|
101
108
|
end
|
|
102
109
|
|
|
103
110
|
def void(authorization, options = {})
|
|
104
111
|
commit do
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
response_from_result(@braintree_gateway.transaction.void(authorization))
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def verify(credit_card, options = {})
|
|
117
|
+
MultiResponse.run(:use_first_response) do |r|
|
|
118
|
+
r.process { authorize(100, credit_card, options) }
|
|
119
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
|
110
120
|
end
|
|
111
121
|
end
|
|
112
122
|
|
|
@@ -114,9 +124,9 @@ module ActiveMerchant #:nodoc:
|
|
|
114
124
|
if options[:customer].present?
|
|
115
125
|
MultiResponse.new.tap do |r|
|
|
116
126
|
customer_exists_response = nil
|
|
117
|
-
r.process{customer_exists_response = check_customer_exists(options[:customer])}
|
|
127
|
+
r.process { customer_exists_response = check_customer_exists(options[:customer]) }
|
|
118
128
|
r.process do
|
|
119
|
-
if customer_exists_response.params[
|
|
129
|
+
if customer_exists_response.params['exists']
|
|
120
130
|
add_credit_card_to_customer(creditcard, options)
|
|
121
131
|
else
|
|
122
132
|
add_customer_with_credit_card(creditcard, options)
|
|
@@ -131,15 +141,16 @@ module ActiveMerchant #:nodoc:
|
|
|
131
141
|
def update(vault_id, creditcard, options = {})
|
|
132
142
|
braintree_credit_card = nil
|
|
133
143
|
commit do
|
|
134
|
-
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect
|
|
144
|
+
braintree_credit_card = @braintree_gateway.customer.find(vault_id).credit_cards.detect(&:default?)
|
|
135
145
|
return Response.new(false, 'Braintree::NotFoundError') if braintree_credit_card.nil?
|
|
136
146
|
|
|
137
|
-
options
|
|
147
|
+
options[:update_existing_token] = braintree_credit_card.token
|
|
138
148
|
credit_card_params = merge_credit_card_options({
|
|
139
149
|
:credit_card => {
|
|
150
|
+
:cardholder_name => creditcard.name,
|
|
140
151
|
:number => creditcard.number,
|
|
141
152
|
:cvv => creditcard.verification_value,
|
|
142
|
-
:expiration_month => creditcard.month.to_s.rjust(2,
|
|
153
|
+
:expiration_month => creditcard.month.to_s.rjust(2, '0'),
|
|
143
154
|
:expiration_year => creditcard.year.to_s
|
|
144
155
|
}
|
|
145
156
|
}, options)[:credit_card]
|
|
@@ -148,6 +159,8 @@ module ActiveMerchant #:nodoc:
|
|
|
148
159
|
:first_name => creditcard.first_name,
|
|
149
160
|
:last_name => creditcard.last_name,
|
|
150
161
|
:email => scrub_email(options[:email]),
|
|
162
|
+
:phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
|
163
|
+
options[:billing_address][:phone]),
|
|
151
164
|
:credit_card => credit_card_params
|
|
152
165
|
)
|
|
153
166
|
Response.new(result.success?, message_from_result(result),
|
|
@@ -164,39 +177,65 @@ module ActiveMerchant #:nodoc:
|
|
|
164
177
|
else
|
|
165
178
|
@braintree_gateway.customer.delete(customer_vault_id)
|
|
166
179
|
end
|
|
167
|
-
Response.new(true,
|
|
180
|
+
Response.new(true, 'OK')
|
|
168
181
|
end
|
|
169
182
|
end
|
|
170
183
|
alias_method :delete, :unstore
|
|
171
184
|
|
|
185
|
+
def supports_network_tokenization?
|
|
186
|
+
true
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def verify_credentials
|
|
190
|
+
begin
|
|
191
|
+
@braintree_gateway.transaction.find('non_existent_token')
|
|
192
|
+
rescue Braintree::AuthenticationError
|
|
193
|
+
return false
|
|
194
|
+
rescue Braintree::NotFoundError
|
|
195
|
+
return true
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
true
|
|
199
|
+
end
|
|
200
|
+
|
|
172
201
|
private
|
|
173
202
|
|
|
174
203
|
def check_customer_exists(customer_vault_id)
|
|
175
204
|
commit do
|
|
176
205
|
begin
|
|
177
206
|
@braintree_gateway.customer.find(customer_vault_id)
|
|
178
|
-
ActiveMerchant::Billing::Response.new(true,
|
|
207
|
+
ActiveMerchant::Billing::Response.new(true, 'Customer found', {exists: true}, authorization: customer_vault_id)
|
|
179
208
|
rescue Braintree::NotFoundError
|
|
180
|
-
ActiveMerchant::Billing::Response.new(true,
|
|
209
|
+
ActiveMerchant::Billing::Response.new(true, 'Customer not found', {exists: false})
|
|
181
210
|
end
|
|
182
211
|
end
|
|
183
212
|
end
|
|
184
213
|
|
|
185
214
|
def add_customer_with_credit_card(creditcard, options)
|
|
186
215
|
commit do
|
|
216
|
+
if options[:payment_method_nonce]
|
|
217
|
+
credit_card_params = { payment_method_nonce: options[:payment_method_nonce] }
|
|
218
|
+
else
|
|
219
|
+
credit_card_params = {
|
|
220
|
+
:credit_card => {
|
|
221
|
+
:cardholder_name => creditcard.name,
|
|
222
|
+
:number => creditcard.number,
|
|
223
|
+
:cvv => creditcard.verification_value,
|
|
224
|
+
:expiration_month => creditcard.month.to_s.rjust(2, '0'),
|
|
225
|
+
:expiration_year => creditcard.year.to_s,
|
|
226
|
+
:token => options[:credit_card_token]
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
end
|
|
187
230
|
parameters = {
|
|
188
231
|
:first_name => creditcard.first_name,
|
|
189
232
|
:last_name => creditcard.last_name,
|
|
190
233
|
:email => scrub_email(options[:email]),
|
|
234
|
+
:phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
|
235
|
+
options[:billing_address][:phone]),
|
|
191
236
|
:id => options[:customer],
|
|
192
|
-
:
|
|
193
|
-
|
|
194
|
-
:cvv => creditcard.verification_value,
|
|
195
|
-
:expiration_month => creditcard.month.to_s.rjust(2, "0"),
|
|
196
|
-
:expiration_year => creditcard.year.to_s,
|
|
197
|
-
:token => options[:credit_card_token]
|
|
198
|
-
}
|
|
199
|
-
}
|
|
237
|
+
:device_data => options[:device_data],
|
|
238
|
+
}.merge credit_card_params
|
|
200
239
|
result = @braintree_gateway.customer.create(merge_credit_card_options(parameters, options))
|
|
201
240
|
Response.new(result.success?, message_from_result(result),
|
|
202
241
|
{
|
|
@@ -214,12 +253,17 @@ module ActiveMerchant #:nodoc:
|
|
|
214
253
|
parameters = {
|
|
215
254
|
customer_id: options[:customer],
|
|
216
255
|
token: options[:credit_card_token],
|
|
256
|
+
cardholder_name: credit_card.name,
|
|
217
257
|
number: credit_card.number,
|
|
218
258
|
cvv: credit_card.verification_value,
|
|
219
|
-
expiration_month: credit_card.month.to_s.rjust(2,
|
|
259
|
+
expiration_month: credit_card.month.to_s.rjust(2, '0'),
|
|
220
260
|
expiration_year: credit_card.year.to_s,
|
|
261
|
+
device_data: options[:device_data],
|
|
221
262
|
}
|
|
222
|
-
|
|
263
|
+
if options[:billing_address]
|
|
264
|
+
address = map_address(options[:billing_address])
|
|
265
|
+
parameters[:credit_card][:billing_address] = address unless address.all? { |_k, v| empty?(v) }
|
|
266
|
+
end
|
|
223
267
|
|
|
224
268
|
result = @braintree_gateway.credit_card.create(parameters)
|
|
225
269
|
ActiveMerchant::Billing::Response.new(
|
|
@@ -236,10 +280,10 @@ module ActiveMerchant #:nodoc:
|
|
|
236
280
|
|
|
237
281
|
def scrub_email(email)
|
|
238
282
|
return nil unless email.present?
|
|
239
|
-
return nil if
|
|
283
|
+
return nil if
|
|
240
284
|
email !~ /^.+@[^\.]+(\.[^\.]+)+[a-z]$/i ||
|
|
241
285
|
email =~ /\.(con|met)$/i
|
|
242
|
-
|
|
286
|
+
|
|
243
287
|
email
|
|
244
288
|
end
|
|
245
289
|
|
|
@@ -258,14 +302,20 @@ module ActiveMerchant #:nodoc:
|
|
|
258
302
|
valid_options[key] = value if [:update_existing_token, :verify_card, :verification_merchant_account_id].include?(key)
|
|
259
303
|
end
|
|
260
304
|
|
|
305
|
+
if valid_options.include?(:verify_card) && @merchant_account_id
|
|
306
|
+
valid_options[:verification_merchant_account_id] ||= @merchant_account_id
|
|
307
|
+
end
|
|
308
|
+
|
|
261
309
|
parameters[:credit_card] ||= {}
|
|
262
|
-
parameters[:credit_card]
|
|
263
|
-
|
|
310
|
+
parameters[:credit_card][:options] = valid_options
|
|
311
|
+
if options[:billing_address]
|
|
312
|
+
address = map_address(options[:billing_address])
|
|
313
|
+
parameters[:credit_card][:billing_address] = address unless address.all? { |_k, v| empty?(v) }
|
|
314
|
+
end
|
|
264
315
|
parameters
|
|
265
316
|
end
|
|
266
317
|
|
|
267
318
|
def map_address(address)
|
|
268
|
-
return {} if address.nil?
|
|
269
319
|
mapped = {
|
|
270
320
|
:street_address => address[:address1],
|
|
271
321
|
:extended_address => address[:address2],
|
|
@@ -274,7 +324,7 @@ module ActiveMerchant #:nodoc:
|
|
|
274
324
|
:region => address[:state],
|
|
275
325
|
:postal_code => scrub_zip(address[:zip]),
|
|
276
326
|
}
|
|
277
|
-
if
|
|
327
|
+
if address[:country] || address[:country_code_alpha2]
|
|
278
328
|
mapped[:country_code_alpha2] = (address[:country] || address[:country_code_alpha2])
|
|
279
329
|
elsif address[:country_name]
|
|
280
330
|
mapped[:country_name] = address[:country_name]
|
|
@@ -294,42 +344,88 @@ module ActiveMerchant #:nodoc:
|
|
|
294
344
|
|
|
295
345
|
def message_from_result(result)
|
|
296
346
|
if result.success?
|
|
297
|
-
|
|
298
|
-
elsif result.errors.
|
|
347
|
+
'OK'
|
|
348
|
+
elsif result.errors.any?
|
|
349
|
+
result.errors.map { |e| "#{e.message} (#{e.code})" }.join(' ')
|
|
350
|
+
elsif result.credit_card_verification
|
|
299
351
|
"Processor declined: #{result.credit_card_verification.processor_response_text} (#{result.credit_card_verification.processor_response_code})"
|
|
300
352
|
else
|
|
301
|
-
result.
|
|
353
|
+
result.message.to_s
|
|
302
354
|
end
|
|
303
355
|
end
|
|
304
356
|
|
|
357
|
+
def response_from_result(result)
|
|
358
|
+
response_hash = { braintree_transaction: transaction_hash(result) }
|
|
359
|
+
|
|
360
|
+
Response.new(
|
|
361
|
+
result.success?,
|
|
362
|
+
message_from_result(result),
|
|
363
|
+
response_hash,
|
|
364
|
+
authorization: result.transaction&.id,
|
|
365
|
+
test: test?
|
|
366
|
+
)
|
|
367
|
+
end
|
|
368
|
+
|
|
305
369
|
def response_params(result)
|
|
306
370
|
params = {}
|
|
307
|
-
if result.success?
|
|
308
|
-
|
|
309
|
-
params[:customer_vault_id] = result.transaction.customer_details.id
|
|
310
|
-
end
|
|
371
|
+
params[:customer_vault_id] = result.transaction.customer_details.id if result.success?
|
|
372
|
+
params[:braintree_transaction] = transaction_hash(result)
|
|
311
373
|
params
|
|
312
374
|
end
|
|
313
375
|
|
|
314
376
|
def response_options(result)
|
|
315
377
|
options = {}
|
|
316
|
-
if result.success?
|
|
317
|
-
options[:authorization] = result.transaction.id
|
|
318
|
-
end
|
|
319
378
|
if result.transaction
|
|
320
|
-
options[:
|
|
321
|
-
|
|
322
|
-
:street_match => result.transaction.avs_street_address_response_code,
|
|
323
|
-
:postal_match => result.transaction.avs_postal_code_response_code
|
|
324
|
-
}
|
|
379
|
+
options[:authorization] = result.transaction.id
|
|
380
|
+
options[:avs_result] = { code: avs_code_from(result.transaction) }
|
|
325
381
|
options[:cvv_result] = result.transaction.cvv_response_code
|
|
326
382
|
end
|
|
383
|
+
options[:test] = test?
|
|
327
384
|
options
|
|
328
385
|
end
|
|
329
386
|
|
|
387
|
+
def avs_code_from(transaction)
|
|
388
|
+
transaction.avs_error_response_code ||
|
|
389
|
+
avs_mapping["street: #{transaction.avs_street_address_response_code}, zip: #{transaction.avs_postal_code_response_code}"]
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
def avs_mapping
|
|
393
|
+
{
|
|
394
|
+
'street: M, zip: M' => 'M',
|
|
395
|
+
'street: M, zip: N' => 'A',
|
|
396
|
+
'street: M, zip: U' => 'B',
|
|
397
|
+
'street: M, zip: I' => 'B',
|
|
398
|
+
'street: M, zip: A' => 'B',
|
|
399
|
+
|
|
400
|
+
'street: N, zip: M' => 'Z',
|
|
401
|
+
'street: N, zip: N' => 'C',
|
|
402
|
+
'street: N, zip: U' => 'C',
|
|
403
|
+
'street: N, zip: I' => 'C',
|
|
404
|
+
'street: N, zip: A' => 'C',
|
|
405
|
+
|
|
406
|
+
'street: U, zip: M' => 'P',
|
|
407
|
+
'street: U, zip: N' => 'N',
|
|
408
|
+
'street: U, zip: U' => 'I',
|
|
409
|
+
'street: U, zip: I' => 'I',
|
|
410
|
+
'street: U, zip: A' => 'I',
|
|
411
|
+
|
|
412
|
+
'street: I, zip: M' => 'P',
|
|
413
|
+
'street: I, zip: N' => 'C',
|
|
414
|
+
'street: I, zip: U' => 'I',
|
|
415
|
+
'street: I, zip: I' => 'I',
|
|
416
|
+
'street: I, zip: A' => 'I',
|
|
417
|
+
|
|
418
|
+
'street: A, zip: M' => 'P',
|
|
419
|
+
'street: A, zip: N' => 'C',
|
|
420
|
+
'street: A, zip: U' => 'I',
|
|
421
|
+
'street: A, zip: I' => 'I',
|
|
422
|
+
'street: A, zip: A' => 'I'
|
|
423
|
+
}
|
|
424
|
+
end
|
|
425
|
+
|
|
330
426
|
def message_from_transaction_result(result)
|
|
331
|
-
if result.transaction && result.transaction.status ==
|
|
332
|
-
|
|
427
|
+
if result.transaction && result.transaction.status == 'gateway_rejected'
|
|
428
|
+
'Transaction declined - gateway rejected'
|
|
333
429
|
elsif result.transaction
|
|
334
430
|
"#{result.transaction.processor_response_code} #{result.transaction.processor_response_text}"
|
|
335
431
|
else
|
|
@@ -337,8 +433,19 @@ module ActiveMerchant #:nodoc:
|
|
|
337
433
|
end
|
|
338
434
|
end
|
|
339
435
|
|
|
436
|
+
def response_code_from_result(result)
|
|
437
|
+
if result.transaction
|
|
438
|
+
result.transaction.processor_response_code
|
|
439
|
+
elsif result.errors.size == 0 && result.credit_card_verification
|
|
440
|
+
result.credit_card_verification.processor_response_code
|
|
441
|
+
elsif result.errors.size > 0
|
|
442
|
+
result.errors.first.code
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
|
|
340
446
|
def create_transaction(transaction_type, money, credit_card_or_vault_id, options)
|
|
341
447
|
transaction_params = create_transaction_parameters(money, credit_card_or_vault_id, options)
|
|
448
|
+
|
|
342
449
|
commit do
|
|
343
450
|
result = @braintree_gateway.transaction.send(transaction_type, transaction_params)
|
|
344
451
|
response = Response.new(result.success?, message_from_transaction_result(result), response_params(result), response_options(result))
|
|
@@ -362,22 +469,22 @@ module ActiveMerchant #:nodoc:
|
|
|
362
469
|
|
|
363
470
|
def customer_hash(customer, include_credit_cards=false)
|
|
364
471
|
hash = {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
472
|
+
'email' => customer.email,
|
|
473
|
+
'phone' => customer.phone,
|
|
474
|
+
'first_name' => customer.first_name,
|
|
475
|
+
'last_name' => customer.last_name,
|
|
476
|
+
'id' => customer.id
|
|
369
477
|
}
|
|
370
478
|
|
|
371
479
|
if include_credit_cards
|
|
372
|
-
hash[
|
|
480
|
+
hash['credit_cards'] = customer.credit_cards.map do |cc|
|
|
373
481
|
{
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
"token" => cc.token
|
|
482
|
+
'bin' => cc.bin,
|
|
483
|
+
'expiration_date' => cc.expiration_date,
|
|
484
|
+
'token' => cc.token,
|
|
485
|
+
'last_4' => cc.last_4,
|
|
486
|
+
'card_type' => cc.card_type,
|
|
487
|
+
'masked_number' => cc.masked_number
|
|
381
488
|
}
|
|
382
489
|
end
|
|
383
490
|
end
|
|
@@ -385,13 +492,18 @@ module ActiveMerchant #:nodoc:
|
|
|
385
492
|
hash
|
|
386
493
|
end
|
|
387
494
|
|
|
388
|
-
def transaction_hash(
|
|
495
|
+
def transaction_hash(result)
|
|
496
|
+
unless result.success?
|
|
497
|
+
return { 'processor_response_code' => response_code_from_result(result) }
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
transaction = result.transaction
|
|
389
501
|
if transaction.vault_customer
|
|
390
502
|
vault_customer = {
|
|
391
503
|
}
|
|
392
|
-
vault_customer[
|
|
504
|
+
vault_customer['credit_cards'] = transaction.vault_customer.credit_cards.map do |cc|
|
|
393
505
|
{
|
|
394
|
-
|
|
506
|
+
'bin' => cc.bin
|
|
395
507
|
}
|
|
396
508
|
end
|
|
397
509
|
else
|
|
@@ -399,65 +511,76 @@ module ActiveMerchant #:nodoc:
|
|
|
399
511
|
end
|
|
400
512
|
|
|
401
513
|
customer_details = {
|
|
402
|
-
|
|
403
|
-
|
|
514
|
+
'id' => transaction.customer_details.id,
|
|
515
|
+
'email' => transaction.customer_details.email,
|
|
516
|
+
'phone' => transaction.customer_details.phone,
|
|
404
517
|
}
|
|
405
518
|
|
|
406
519
|
billing_details = {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
520
|
+
'street_address' => transaction.billing_details.street_address,
|
|
521
|
+
'extended_address' => transaction.billing_details.extended_address,
|
|
522
|
+
'company' => transaction.billing_details.company,
|
|
523
|
+
'locality' => transaction.billing_details.locality,
|
|
524
|
+
'region' => transaction.billing_details.region,
|
|
525
|
+
'postal_code' => transaction.billing_details.postal_code,
|
|
526
|
+
'country_name' => transaction.billing_details.country_name,
|
|
414
527
|
}
|
|
415
528
|
|
|
416
529
|
shipping_details = {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
530
|
+
'street_address' => transaction.shipping_details.street_address,
|
|
531
|
+
'extended_address' => transaction.shipping_details.extended_address,
|
|
532
|
+
'company' => transaction.shipping_details.company,
|
|
533
|
+
'locality' => transaction.shipping_details.locality,
|
|
534
|
+
'region' => transaction.shipping_details.region,
|
|
535
|
+
'postal_code' => transaction.shipping_details.postal_code,
|
|
536
|
+
'country_name' => transaction.shipping_details.country_name,
|
|
424
537
|
}
|
|
425
538
|
credit_card_details = {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
539
|
+
'masked_number' => transaction.credit_card_details.masked_number,
|
|
540
|
+
'bin' => transaction.credit_card_details.bin,
|
|
541
|
+
'last_4' => transaction.credit_card_details.last_4,
|
|
542
|
+
'card_type' => transaction.credit_card_details.card_type,
|
|
543
|
+
'token' => transaction.credit_card_details.token
|
|
431
544
|
}
|
|
432
545
|
|
|
433
546
|
{
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
547
|
+
'order_id' => transaction.order_id,
|
|
548
|
+
'amount' => transaction.amount.to_s,
|
|
549
|
+
'status' => transaction.status,
|
|
550
|
+
'credit_card_details' => credit_card_details,
|
|
551
|
+
'customer_details' => customer_details,
|
|
552
|
+
'billing_details' => billing_details,
|
|
553
|
+
'shipping_details' => shipping_details,
|
|
554
|
+
'vault_customer' => vault_customer,
|
|
555
|
+
'merchant_account_id' => transaction.merchant_account_id,
|
|
556
|
+
'processor_response_code' => response_code_from_result(result)
|
|
442
557
|
}
|
|
443
558
|
end
|
|
444
559
|
|
|
445
560
|
def create_transaction_parameters(money, credit_card_or_vault_id, options)
|
|
446
561
|
parameters = {
|
|
447
|
-
:amount =>
|
|
562
|
+
:amount => localized_amount(money, options[:currency] || default_currency).to_s,
|
|
448
563
|
:order_id => options[:order_id],
|
|
449
564
|
:customer => {
|
|
450
|
-
:id => options[:store] == true ?
|
|
451
|
-
:email => scrub_email(options[:email])
|
|
565
|
+
:id => options[:store] == true ? '' : options[:store],
|
|
566
|
+
:email => scrub_email(options[:email]),
|
|
567
|
+
:phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
|
|
568
|
+
options[:billing_address][:phone])
|
|
452
569
|
},
|
|
453
570
|
:options => {
|
|
454
571
|
:store_in_vault => options[:store] ? true : false,
|
|
455
|
-
:submit_for_settlement => options[:submit_for_settlement]
|
|
572
|
+
:submit_for_settlement => options[:submit_for_settlement],
|
|
573
|
+
:hold_in_escrow => options[:hold_in_escrow],
|
|
456
574
|
}
|
|
457
575
|
}
|
|
458
576
|
|
|
577
|
+
if options[:skip_advanced_fraud_checking]
|
|
578
|
+
parameters[:options][:skip_advanced_fraud_checking] = options[:skip_advanced_fraud_checking]
|
|
579
|
+
end
|
|
580
|
+
|
|
459
581
|
parameters[:custom_fields] = options[:custom_fields]
|
|
460
582
|
parameters[:device_data] = options[:device_data] if options[:device_data]
|
|
583
|
+
parameters[:service_fee_amount] = options[:service_fee_amount] if options[:service_fee_amount]
|
|
461
584
|
if merchant_account_id = (options[:merchant_account_id] || @merchant_account_id)
|
|
462
585
|
parameters[:merchant_account_id] = merchant_account_id
|
|
463
586
|
end
|
|
@@ -466,23 +589,90 @@ module ActiveMerchant #:nodoc:
|
|
|
466
589
|
parameters[:recurring] = true
|
|
467
590
|
end
|
|
468
591
|
|
|
592
|
+
add_payment_method(parameters, credit_card_or_vault_id, options)
|
|
593
|
+
|
|
594
|
+
parameters[:billing] = map_address(options[:billing_address]) if options[:billing_address]
|
|
595
|
+
parameters[:shipping] = map_address(options[:shipping_address]) if options[:shipping_address]
|
|
596
|
+
|
|
597
|
+
channel = @options[:channel] || application_id
|
|
598
|
+
parameters[:channel] = channel if channel
|
|
599
|
+
|
|
600
|
+
if options[:descriptor_name] || options[:descriptor_phone] || options[:descriptor_url]
|
|
601
|
+
parameters[:descriptor] = {
|
|
602
|
+
name: options[:descriptor_name],
|
|
603
|
+
phone: options[:descriptor_phone],
|
|
604
|
+
url: options[:descriptor_url]
|
|
605
|
+
}
|
|
606
|
+
end
|
|
607
|
+
|
|
608
|
+
if options[:three_d_secure]
|
|
609
|
+
parameters[:three_d_secure_pass_thru] = {
|
|
610
|
+
cavv: options[:three_d_secure][:cavv],
|
|
611
|
+
eci_flag: options[:three_d_secure][:eci],
|
|
612
|
+
xid: options[:three_d_secure][:xid],
|
|
613
|
+
}
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
parameters[:tax_amount] = options[:tax_amount] if options[:tax_amount]
|
|
617
|
+
parameters[:tax_exempt] = options[:tax_exempt] if options[:tax_exempt]
|
|
618
|
+
parameters[:purchase_order_number] = options[:purchase_order_number] if options[:purchase_order_number]
|
|
619
|
+
|
|
620
|
+
parameters[:shipping_amount] = options[:shipping_amount] if options[:shipping_amount]
|
|
621
|
+
parameters[:discount_amount] = options[:discount_amount] if options[:discount_amount]
|
|
622
|
+
parameters[:ships_from_postal_code] = options[:ships_from_postal_code] if options[:ships_from_postal_code]
|
|
623
|
+
|
|
624
|
+
parameters[:line_items] = options[:line_items] if options[:line_items]
|
|
625
|
+
|
|
626
|
+
parameters
|
|
627
|
+
end
|
|
628
|
+
|
|
629
|
+
def add_payment_method(parameters, credit_card_or_vault_id, options)
|
|
469
630
|
if credit_card_or_vault_id.is_a?(String) || credit_card_or_vault_id.is_a?(Integer)
|
|
470
|
-
|
|
631
|
+
if options[:payment_method_token]
|
|
632
|
+
parameters[:payment_method_token] = credit_card_or_vault_id
|
|
633
|
+
options.delete(:billing_address)
|
|
634
|
+
elsif options[:payment_method_nonce]
|
|
635
|
+
parameters[:payment_method_nonce] = credit_card_or_vault_id
|
|
636
|
+
else
|
|
637
|
+
parameters[:customer_id] = credit_card_or_vault_id
|
|
638
|
+
end
|
|
471
639
|
else
|
|
472
640
|
parameters[:customer].merge!(
|
|
473
641
|
:first_name => credit_card_or_vault_id.first_name,
|
|
474
642
|
:last_name => credit_card_or_vault_id.last_name
|
|
475
643
|
)
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
644
|
+
if credit_card_or_vault_id.is_a?(NetworkTokenizationCreditCard)
|
|
645
|
+
if credit_card_or_vault_id.source == :apple_pay
|
|
646
|
+
parameters[:apple_pay_card] = {
|
|
647
|
+
:number => credit_card_or_vault_id.number,
|
|
648
|
+
:expiration_month => credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
|
649
|
+
:expiration_year => credit_card_or_vault_id.year.to_s,
|
|
650
|
+
:cardholder_name => credit_card_or_vault_id.name,
|
|
651
|
+
:cryptogram => credit_card_or_vault_id.payment_cryptogram,
|
|
652
|
+
:eci_indicator => credit_card_or_vault_id.eci
|
|
653
|
+
}
|
|
654
|
+
elsif credit_card_or_vault_id.source == :android_pay || credit_card_or_vault_id.source == :google_pay
|
|
655
|
+
parameters[:android_pay_card] = {
|
|
656
|
+
:number => credit_card_or_vault_id.number,
|
|
657
|
+
:cryptogram => credit_card_or_vault_id.payment_cryptogram,
|
|
658
|
+
:expiration_month => credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
|
659
|
+
:expiration_year => credit_card_or_vault_id.year.to_s,
|
|
660
|
+
:google_transaction_id => credit_card_or_vault_id.transaction_id,
|
|
661
|
+
:source_card_type => credit_card_or_vault_id.brand,
|
|
662
|
+
:source_card_last_four => credit_card_or_vault_id.last_digits,
|
|
663
|
+
:eci_indicator => credit_card_or_vault_id.eci
|
|
664
|
+
}
|
|
665
|
+
end
|
|
666
|
+
else
|
|
667
|
+
parameters[:credit_card] = {
|
|
668
|
+
:number => credit_card_or_vault_id.number,
|
|
669
|
+
:cvv => credit_card_or_vault_id.verification_value,
|
|
670
|
+
:expiration_month => credit_card_or_vault_id.month.to_s.rjust(2, '0'),
|
|
671
|
+
:expiration_year => credit_card_or_vault_id.year.to_s,
|
|
672
|
+
:cardholder_name => credit_card_or_vault_id.name
|
|
673
|
+
}
|
|
674
|
+
end
|
|
482
675
|
end
|
|
483
|
-
parameters[:billing] = map_address(options[:billing_address]) if options[:billing_address]
|
|
484
|
-
parameters[:shipping] = map_address(options[:shipping_address]) if options[:shipping_address]
|
|
485
|
-
parameters
|
|
486
676
|
end
|
|
487
677
|
end
|
|
488
678
|
end
|