activemerchant 1.38.0 → 1.78.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1344 -3
- data/CONTRIBUTORS +154 -0
- data/README.md +157 -144
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/base.rb +21 -17
- data/lib/active_merchant/billing/check.rb +32 -22
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +215 -67
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +149 -52
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +170 -24
- data/lib/active_merchant/billing/gateways/adyen.rb +284 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +206 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +899 -606
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +43 -18
- data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +134 -346
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +13 -2
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +325 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +96 -15
- data/lib/active_merchant/billing/gateways/beanstream.rb +52 -9
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +12 -8
- data/lib/active_merchant/billing/gateways/blue_pay.rb +520 -501
- data/lib/active_merchant/billing/gateways/blue_snap.rb +343 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +94 -50
- data/lib/active_merchant/billing/gateways/borgun.rb +222 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +14 -2
- data/lib/active_merchant/billing/gateways/braintree.rb +2 -2
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +372 -137
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +4 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +245 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +286 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +269 -118
- data/lib/active_merchant/billing/gateways/cardknox.rb +328 -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 +45 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +239 -0
- 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 +226 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +23 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +222 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +224 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +345 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +228 -98
- data/lib/active_merchant/billing/gateways/data_cash.rb +41 -314
- data/lib/active_merchant/billing/gateways/dibs.rb +205 -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 +3 -14
- data/lib/active_merchant/billing/gateways/elavon.rb +143 -142
- data/lib/active_merchant/billing/gateways/element.rb +356 -0
- data/lib/active_merchant/billing/gateways/epay.rb +23 -12
- data/lib/active_merchant/billing/gateways/eway.rb +12 -12
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +417 -204
- data/lib/active_merchant/billing/gateways/exact.rb +10 -1
- data/lib/active_merchant/billing/gateways/ezic.rb +196 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +65 -37
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -2
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +109 -124
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +155 -29
- 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 +256 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +11 -5
- data/lib/active_merchant/billing/gateways/global_collect.rb +334 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
- 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/ideal/ideal_base.rb +2 -5
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +1 -1
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +8 -10
- data/lib/active_merchant/billing/gateways/instapay.rb +0 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +175 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +210 -4
- data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +176 -49
- 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 +227 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +416 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +17 -13
- data/lib/active_merchant/billing/gateways/litle.rb +329 -439
- data/lib/active_merchant/billing/gateways/mastercard.rb +268 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +262 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +15 -7
- data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +12 -15
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +24 -13
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +21 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +74 -29
- data/lib/active_merchant/billing/gateways/metrics_global.rb +2 -21
- data/lib/active_merchant/billing/gateways/micropayment.rb +185 -0
- data/lib/active_merchant/billing/gateways/migs.rb +74 -13
- data/lib/active_merchant/billing/gateways/modern_payments.rb +1 -1
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +1 -3
- data/lib/active_merchant/billing/gateways/monei.rb +307 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +119 -36
- data/lib/active_merchant/billing/gateways/moneris_us.rb +146 -45
- data/lib/active_merchant/billing/gateways/money_movers.rb +152 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +78 -53
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -3
- data/lib/active_merchant/billing/gateways/netbanx.rb +289 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +61 -26
- data/lib/active_merchant/billing/gateways/netpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/network_merchants.rb +242 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +265 -10
- data/lib/active_merchant/billing/gateways/ogone.rb +85 -27
- data/lib/active_merchant/billing/gateways/omise.rb +324 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +227 -0
- data/lib/active_merchant/billing/gateways/opp.rb +372 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +59 -28
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/orbital.rb +346 -56
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +207 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +248 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +246 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -14
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +19 -25
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +190 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +16 -12
- data/lib/active_merchant/billing/gateways/payeezy.rb +386 -0
- data/lib/active_merchant/billing/gateways/payex.rb +412 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +38 -17
- data/lib/active_merchant/billing/gateways/payflow.rb +100 -19
- data/lib/active_merchant/billing/gateways/payflow_express.rb +22 -22
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -2
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +6 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +15 -3
- data/lib/active_merchant/billing/gateways/paymentez.rb +283 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +237 -48
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +41 -8
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +18 -4
- data/lib/active_merchant/billing/gateways/paypal.rb +49 -20
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +6 -5
- 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 +162 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +22 -24
- data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +440 -0
- data/lib/active_merchant/billing/gateways/pin.rb +68 -13
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
- data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +3 -14
- data/lib/active_merchant/billing/gateways/psl_card.rb +3 -3
- data/lib/active_merchant/billing/gateways/qbms.rb +1 -1
- data/lib/active_merchant/billing/gateways/quantum.rb +2 -2
- data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +188 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +299 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +227 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -319
- data/lib/active_merchant/billing/gateways/qvalent.rb +236 -0
- data/lib/active_merchant/billing/gateways/realex.rb +27 -25
- data/lib/active_merchant/billing/gateways/redsys.rb +212 -80
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +258 -0
- data/lib/active_merchant/billing/gateways/sage.rb +412 -119
- data/lib/active_merchant/billing/gateways/sage_pay.rb +176 -59
- data/lib/active_merchant/billing/gateways/secure_net.rb +35 -29
- data/lib/active_merchant/billing/gateways/secure_pay.rb +182 -9
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +21 -7
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
- data/lib/active_merchant/billing/gateways/securion_pay.rb +267 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -3
- data/lib/active_merchant/billing/gateways/smart_ps.rb +13 -2
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +36 -11
- data/lib/active_merchant/billing/gateways/stripe.rb +461 -82
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +156 -0
- data/lib/active_merchant/billing/gateways/telr.rb +275 -0
- data/lib/active_merchant/billing/gateways/tns.rb +22 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +142 -28
- 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/transnational.rb +2 -231
- data/lib/active_merchant/billing/gateways/trexle.rb +217 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +17 -11
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +193 -75
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +150 -63
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
- data/lib/active_merchant/billing/gateways/viaklix.rb +1 -15
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +209 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +45 -28
- data/lib/active_merchant/billing/gateways/wepay.rb +238 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +167 -49
- data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +131 -36
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +218 -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 +24 -17
- data/lib/active_merchant/billing.rb +7 -1
- data/lib/active_merchant/connection.rb +177 -0
- data/lib/active_merchant/country.rb +334 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +35 -0
- data/lib/active_merchant/network_connection_retries.rb +79 -0
- data/lib/active_merchant/post_data.rb +24 -0
- data/lib/active_merchant/posts_data.rb +84 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +24 -21
- data/lib/certs/cacert.pem +3951 -0
- data/lib/support/gateway_support.rb +16 -10
- data/lib/support/outbound_hosts.rb +13 -10
- metadata +161 -306
- data/gem-public_cert.pem +0 -20
- data/lib/active_merchant/billing/expiry_date.rb +0 -34
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +0 -155
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -277
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +0 -93
- 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 -73
- 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/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/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/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 -114
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +0 -95
- data/lib/active_merchant/billing/integrations/ipay88.rb +0 -19
- 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 -129
- 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/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 -28
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +0 -74
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +0 -165
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +0 -36
- data/lib/active_merchant/billing/integrations/payu_in.rb +0 -43
- 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 -74
- 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 -91
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +0 -139
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +0 -17
- 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/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 -0
@@ -0,0 +1,334 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
class InvalidCountryCodeError < StandardError
|
5
|
+
end
|
6
|
+
|
7
|
+
class CountryCodeFormatError < StandardError
|
8
|
+
end
|
9
|
+
|
10
|
+
class CountryCode
|
11
|
+
attr_reader :value, :format
|
12
|
+
def initialize(value)
|
13
|
+
@value = value.to_s.upcase
|
14
|
+
detect_format
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_s
|
18
|
+
value
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def detect_format
|
24
|
+
case @value
|
25
|
+
when /^[[:alpha:]]{2}$/
|
26
|
+
@format = :alpha2
|
27
|
+
when /^[[:alpha:]]{3}$/
|
28
|
+
@format = :alpha3
|
29
|
+
when /^[[:digit:]]{3}$/
|
30
|
+
@format = :numeric
|
31
|
+
else
|
32
|
+
raise CountryCodeFormatError, "The country code is not formatted correctly #{@value}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Country
|
38
|
+
attr_reader :name
|
39
|
+
|
40
|
+
def initialize(options = {})
|
41
|
+
@name = options.delete(:name)
|
42
|
+
@codes = options.collect{|k,v| CountryCode.new(v)}
|
43
|
+
end
|
44
|
+
|
45
|
+
def code(format)
|
46
|
+
@codes.detect{|c| c.format == format}
|
47
|
+
end
|
48
|
+
|
49
|
+
def ==(other)
|
50
|
+
if other.class == ActiveMerchant::Country
|
51
|
+
(@name == other.name)
|
52
|
+
else
|
53
|
+
super
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
alias eql? ==
|
58
|
+
|
59
|
+
def hash
|
60
|
+
@name.hash
|
61
|
+
end
|
62
|
+
|
63
|
+
def to_s
|
64
|
+
@name
|
65
|
+
end
|
66
|
+
|
67
|
+
COUNTRIES = [
|
68
|
+
{ alpha2: 'AF', name: 'Afghanistan', alpha3: 'AFG', numeric: '004' },
|
69
|
+
{ alpha2: 'AL', name: 'Albania', alpha3: 'ALB', numeric: '008' },
|
70
|
+
{ alpha2: 'DZ', name: 'Algeria', alpha3: 'DZA', numeric: '012' },
|
71
|
+
{ alpha2: 'AS', name: 'American Samoa', alpha3: 'ASM', numeric: '016' },
|
72
|
+
{ alpha2: 'AD', name: 'Andorra', alpha3: 'AND', numeric: '020' },
|
73
|
+
{ alpha2: 'AO', name: 'Angola', alpha3: 'AGO', numeric: '024' },
|
74
|
+
{ alpha2: 'AI', name: 'Anguilla', alpha3: 'AIA', numeric: '660' },
|
75
|
+
{ alpha2: 'AQ', name: 'Antarctica', alpha3: 'ATA', numeric: '010' },
|
76
|
+
{ alpha2: 'AG', name: 'Antigua and Barbuda', alpha3: 'ATG', numeric: '028' },
|
77
|
+
{ alpha2: 'AR', name: 'Argentina', alpha3: 'ARG', numeric: '032' },
|
78
|
+
{ alpha2: 'AM', name: 'Armenia', alpha3: 'ARM', numeric: '051' },
|
79
|
+
{ alpha2: 'AW', name: 'Aruba', alpha3: 'ABW', numeric: '533' },
|
80
|
+
{ alpha2: 'AU', name: 'Australia', alpha3: 'AUS', numeric: '036' },
|
81
|
+
{ alpha2: 'AT', name: 'Austria', alpha3: 'AUT', numeric: '040' },
|
82
|
+
{ alpha2: 'AZ', name: 'Azerbaijan', alpha3: 'AZE', numeric: '031' },
|
83
|
+
{ alpha2: 'BS', name: 'Bahamas', alpha3: 'BHS', numeric: '044' },
|
84
|
+
{ alpha2: 'BH', name: 'Bahrain', alpha3: 'BHR', numeric: '048' },
|
85
|
+
{ alpha2: 'BD', name: 'Bangladesh', alpha3: 'BGD', numeric: '050' },
|
86
|
+
{ alpha2: 'BB', name: 'Barbados', alpha3: 'BRB', numeric: '052' },
|
87
|
+
{ alpha2: 'BY', name: 'Belarus', alpha3: 'BLR', numeric: '112' },
|
88
|
+
{ alpha2: 'BE', name: 'Belgium', alpha3: 'BEL', numeric: '056' },
|
89
|
+
{ alpha2: 'BZ', name: 'Belize', alpha3: 'BLZ', numeric: '084' },
|
90
|
+
{ alpha2: 'BJ', name: 'Benin', alpha3: 'BEN', numeric: '204' },
|
91
|
+
{ alpha2: 'BM', name: 'Bermuda', alpha3: 'BMU', numeric: '060' },
|
92
|
+
{ alpha2: 'BT', name: 'Bhutan', alpha3: 'BTN', numeric: '064' },
|
93
|
+
{ alpha2: 'BO', name: 'Bolivia', alpha3: 'BOL', numeric: '068' },
|
94
|
+
{ alpha2: 'BQ', name: 'Bonaire, Sint Eustatius and Saba', alpha3: 'BES', numeric: '535' },
|
95
|
+
{ alpha2: 'BA', name: 'Bosnia and Herzegovina', alpha3: 'BIH', numeric: '070' },
|
96
|
+
{ alpha2: 'BW', name: 'Botswana', alpha3: 'BWA', numeric: '072' },
|
97
|
+
{ alpha2: 'BV', name: 'Bouvet Island', alpha3: 'BVD', numeric: '074' },
|
98
|
+
{ alpha2: 'BR', name: 'Brazil', alpha3: 'BRA', numeric: '076' },
|
99
|
+
{ alpha2: 'IO', name: 'British Indian Ocean Territory', alpha3: 'IOT', numeric: '086' },
|
100
|
+
{ alpha2: 'BN', name: 'Brunei Darussalam', alpha3: 'BRN', numeric: '096' },
|
101
|
+
{ alpha2: 'BG', name: 'Bulgaria', alpha3: 'BGR', numeric: '100' },
|
102
|
+
{ alpha2: 'BF', name: 'Burkina Faso', alpha3: 'BFA', numeric: '854' },
|
103
|
+
{ alpha2: 'BI', name: 'Burundi', alpha3: 'BDI', numeric: '108' },
|
104
|
+
{ alpha2: 'KH', name: 'Cambodia', alpha3: 'KHM', numeric: '116' },
|
105
|
+
{ alpha2: 'CM', name: 'Cameroon', alpha3: 'CMR', numeric: '120' },
|
106
|
+
{ alpha2: 'CA', name: 'Canada', alpha3: 'CAN', numeric: '124' },
|
107
|
+
{ alpha2: 'CV', name: 'Cape Verde', alpha3: 'CPV', numeric: '132' },
|
108
|
+
{ alpha2: 'KY', name: 'Cayman Islands', alpha3: 'CYM', numeric: '136' },
|
109
|
+
{ alpha2: 'CF', name: 'Central African Republic', alpha3: 'CAF', numeric: '140' },
|
110
|
+
{ alpha2: 'TD', name: 'Chad', alpha3: 'TCD', numeric: '148' },
|
111
|
+
{ alpha2: 'CL', name: 'Chile', alpha3: 'CHL', numeric: '152' },
|
112
|
+
{ alpha2: 'CN', name: 'China', alpha3: 'CHN', numeric: '156' },
|
113
|
+
{ alpha2: 'CX', name: 'Christmas Island', alpha3: 'CXR', numeric: '162' },
|
114
|
+
{ alpha2: 'CC', name: 'Cocos (Keeling) Islands', alpha3: 'CCK', numeric: '166' },
|
115
|
+
{ alpha2: 'CO', name: 'Colombia', alpha3: 'COL', numeric: '170' },
|
116
|
+
{ alpha2: 'KM', name: 'Comoros', alpha3: 'COM', numeric: '174' },
|
117
|
+
{ alpha2: 'CG', name: 'Congo', alpha3: 'COG', numeric: '178' },
|
118
|
+
{ alpha2: 'CD', name: 'Congo, the Democratic Republic of the', alpha3: 'COD', numeric: '180' },
|
119
|
+
{ alpha2: 'CK', name: 'Cook Islands', alpha3: 'COK', numeric: '184' },
|
120
|
+
{ alpha2: 'CR', name: 'Costa Rica', alpha3: 'CRI', numeric: '188' },
|
121
|
+
{ alpha2: 'CI', name: 'Cote D\'Ivoire', alpha3: 'CIV', numeric: '384' },
|
122
|
+
{ alpha2: 'HR', name: 'Croatia', alpha3: 'HRV', numeric: '191' },
|
123
|
+
{ alpha2: 'CU', name: 'Cuba', alpha3: 'CUB', numeric: '192' },
|
124
|
+
{ alpha2: 'CW', name: 'Curaçao', alpha3: 'CUW', numeric: '531' },
|
125
|
+
{ alpha2: 'CY', name: 'Cyprus', alpha3: 'CYP', numeric: '196' },
|
126
|
+
{ alpha2: 'CZ', name: 'Czech Republic', alpha3: 'CZE', numeric: '203' },
|
127
|
+
{ alpha2: 'DK', name: 'Denmark', alpha3: 'DNK', numeric: '208' },
|
128
|
+
{ alpha2: 'DJ', name: 'Djibouti', alpha3: 'DJI', numeric: '262' },
|
129
|
+
{ alpha2: 'DM', name: 'Dominica', alpha3: 'DMA', numeric: '212' },
|
130
|
+
{ alpha2: 'DO', name: 'Dominican Republic', alpha3: 'DOM', numeric: '214' },
|
131
|
+
{ alpha2: 'EC', name: 'Ecuador', alpha3: 'ECU', numeric: '218' },
|
132
|
+
{ alpha2: 'EG', name: 'Egypt', alpha3: 'EGY', numeric: '818' },
|
133
|
+
{ alpha2: 'SV', name: 'El Salvador', alpha3: 'SLV', numeric: '222' },
|
134
|
+
{ alpha2: 'GQ', name: 'Equatorial Guinea', alpha3: 'GNQ', numeric: '226' },
|
135
|
+
{ alpha2: 'ER', name: 'Eritrea', alpha3: 'ERI', numeric: '232' },
|
136
|
+
{ alpha2: 'EE', name: 'Estonia', alpha3: 'EST', numeric: '233' },
|
137
|
+
{ alpha2: 'ET', name: 'Ethiopia', alpha3: 'ETH', numeric: '231' },
|
138
|
+
{ alpha2: 'FK', name: 'Falkland Islands (Malvinas)', alpha3: 'FLK', numeric: '238' },
|
139
|
+
{ alpha2: 'FO', name: 'Faroe Islands', alpha3: 'FRO', numeric: '234' },
|
140
|
+
{ alpha2: 'FJ', name: 'Fiji', alpha3: 'FJI', numeric: '242' },
|
141
|
+
{ alpha2: 'FI', name: 'Finland', alpha3: 'FIN', numeric: '246' },
|
142
|
+
{ alpha2: 'FR', name: 'France', alpha3: 'FRA', numeric: '250' },
|
143
|
+
{ alpha2: 'GF', name: 'French Guiana', alpha3: 'GUF', numeric: '254' },
|
144
|
+
{ alpha2: 'PF', name: 'French Polynesia', alpha3: 'PYF', numeric: '258' },
|
145
|
+
{ alpha2: 'TF', name: 'French Southern Territories', alpha3: 'ATF', numeric: '260' },
|
146
|
+
{ alpha2: 'GA', name: 'Gabon', alpha3: 'GAB', numeric: '266' },
|
147
|
+
{ alpha2: 'GM', name: 'Gambia', alpha3: 'GMB', numeric: '270' },
|
148
|
+
{ alpha2: 'GE', name: 'Georgia', alpha3: 'GEO', numeric: '268' },
|
149
|
+
{ alpha2: 'DE', name: 'Germany', alpha3: 'DEU', numeric: '276' },
|
150
|
+
{ alpha2: 'GH', name: 'Ghana', alpha3: 'GHA', numeric: '288' },
|
151
|
+
{ alpha2: 'GI', name: 'Gibraltar', alpha3: 'GIB', numeric: '292' },
|
152
|
+
{ alpha2: 'GR', name: 'Greece', alpha3: 'GRC', numeric: '300' },
|
153
|
+
{ alpha2: 'GL', name: 'Greenland', alpha3: 'GRL', numeric: '304' },
|
154
|
+
{ alpha2: 'GD', name: 'Grenada', alpha3: 'GRD', numeric: '308' },
|
155
|
+
{ alpha2: 'GP', name: 'Guadeloupe', alpha3: 'GLP', numeric: '312' },
|
156
|
+
{ alpha2: 'GU', name: 'Guam', alpha3: 'GUM', numeric: '316' },
|
157
|
+
{ alpha2: 'GT', name: 'Guatemala', alpha3: 'GTM', numeric: '320' },
|
158
|
+
{ alpha2: 'GG', name: 'Guernsey', alpha3: 'GGY', numeric: '831' },
|
159
|
+
{ alpha2: 'GN', name: 'Guinea', alpha3: 'GIN', numeric: '324' },
|
160
|
+
{ alpha2: 'GW', name: 'Guinea-Bissau', alpha3: 'GNB', numeric: '624' },
|
161
|
+
{ alpha2: 'GY', name: 'Guyana', alpha3: 'GUY', numeric: '328' },
|
162
|
+
{ alpha2: 'HT', name: 'Haiti', alpha3: 'HTI', numeric: '332' },
|
163
|
+
{ alpha2: 'HM', name: 'Heard Island And Mcdonald Islands', alpha3: 'HMD', numeric: '334' },
|
164
|
+
{ alpha2: 'VA', name: 'Holy See (Vatican City State)', alpha3: 'VAT', numeric: '336' },
|
165
|
+
{ alpha2: 'HN', name: 'Honduras', alpha3: 'HND', numeric: '340' },
|
166
|
+
{ alpha2: 'HK', name: 'Hong Kong', alpha3: 'HKG', numeric: '344' },
|
167
|
+
{ alpha2: 'HU', name: 'Hungary', alpha3: 'HUN', numeric: '348' },
|
168
|
+
{ alpha2: 'IS', name: 'Iceland', alpha3: 'ISL', numeric: '352' },
|
169
|
+
{ alpha2: 'IN', name: 'India', alpha3: 'IND', numeric: '356' },
|
170
|
+
{ alpha2: 'ID', name: 'Indonesia', alpha3: 'IDN', numeric: '360' },
|
171
|
+
{ alpha2: 'IR', name: 'Iran, Islamic Republic of', alpha3: 'IRN', numeric: '364' },
|
172
|
+
{ alpha2: 'IQ', name: 'Iraq', alpha3: 'IRQ', numeric: '368' },
|
173
|
+
{ alpha2: 'IE', name: 'Ireland', alpha3: 'IRL', numeric: '372' },
|
174
|
+
{ alpha2: 'IM', name: 'Isle Of Man', alpha3: 'IMN', numeric: '833' },
|
175
|
+
{ alpha2: 'IL', name: 'Israel', alpha3: 'ISR', numeric: '376' },
|
176
|
+
{ alpha2: 'IT', name: 'Italy', alpha3: 'ITA', numeric: '380' },
|
177
|
+
{ alpha2: 'JM', name: 'Jamaica', alpha3: 'JAM', numeric: '388' },
|
178
|
+
{ alpha2: 'JP', name: 'Japan', alpha3: 'JPN', numeric: '392' },
|
179
|
+
{ alpha2: 'JE', name: 'Jersey', alpha3: 'JEY', numeric: '832' },
|
180
|
+
{ alpha2: 'JO', name: 'Jordan', alpha3: 'JOR', numeric: '400' },
|
181
|
+
{ alpha2: 'KZ', name: 'Kazakhstan', alpha3: 'KAZ', numeric: '398' },
|
182
|
+
{ alpha2: 'KE', name: 'Kenya', alpha3: 'KEN', numeric: '404' },
|
183
|
+
{ alpha2: 'KI', name: 'Kiribati', alpha3: 'KIR', numeric: '296' },
|
184
|
+
{ alpha2: 'KP', name: 'Korea, Democratic People\'s Republic of', alpha3: 'PRK', numeric: '408' },
|
185
|
+
{ alpha2: 'KR', name: 'Korea, Republic of', alpha3: 'KOR', numeric: '410' },
|
186
|
+
{ alpha2: 'KW', name: 'Kuwait', alpha3: 'KWT', numeric: '414' },
|
187
|
+
{ alpha2: 'KG', name: 'Kyrgyzstan', alpha3: 'KGZ', numeric: '417' },
|
188
|
+
{ alpha2: 'LA', name: 'Lao People\'s Democratic Republic', alpha3: 'LAO', numeric: '418' },
|
189
|
+
{ alpha2: 'LV', name: 'Latvia', alpha3: 'LVA', numeric: '428' },
|
190
|
+
{ alpha2: 'LB', name: 'Lebanon', alpha3: 'LBN', numeric: '422' },
|
191
|
+
{ alpha2: 'LS', name: 'Lesotho', alpha3: 'LSO', numeric: '426' },
|
192
|
+
{ alpha2: 'LR', name: 'Liberia', alpha3: 'LBR', numeric: '430' },
|
193
|
+
{ alpha2: 'LY', name: 'Libyan Arab Jamahiriya', alpha3: 'LBY', numeric: '434' },
|
194
|
+
{ alpha2: 'LI', name: 'Liechtenstein', alpha3: 'LIE', numeric: '438' },
|
195
|
+
{ alpha2: 'LT', name: 'Lithuania', alpha3: 'LTU', numeric: '440' },
|
196
|
+
{ alpha2: 'LU', name: 'Luxembourg', alpha3: 'LUX', numeric: '442' },
|
197
|
+
{ alpha2: 'MO', name: 'Macao', alpha3: 'MAC', numeric: '446' },
|
198
|
+
{ alpha2: 'MK', name: 'Macedonia, the Former Yugoslav Republic of', alpha3: 'MKD', numeric: '807' },
|
199
|
+
{ alpha2: 'MG', name: 'Madagascar', alpha3: 'MDG', numeric: '450' },
|
200
|
+
{ alpha2: 'MW', name: 'Malawi', alpha3: 'MWI', numeric: '454' },
|
201
|
+
{ alpha2: 'MY', name: 'Malaysia', alpha3: 'MYS', numeric: '458' },
|
202
|
+
{ alpha2: 'MV', name: 'Maldives', alpha3: 'MDV', numeric: '462' },
|
203
|
+
{ alpha2: 'ML', name: 'Mali', alpha3: 'MLI', numeric: '466' },
|
204
|
+
{ alpha2: 'MT', name: 'Malta', alpha3: 'MLT', numeric: '470' },
|
205
|
+
{ alpha2: 'MH', name: 'Marshall Islands', alpha3: 'MHL', numeric: '584' },
|
206
|
+
{ alpha2: 'MQ', name: 'Martinique', alpha3: 'MTQ', numeric: '474' },
|
207
|
+
{ alpha2: 'MR', name: 'Mauritania', alpha3: 'MRT', numeric: '478' },
|
208
|
+
{ alpha2: 'MU', name: 'Mauritius', alpha3: 'MUS', numeric: '480' },
|
209
|
+
{ alpha2: 'YT', name: 'Mayotte', alpha3: 'MYT', numeric: '175' },
|
210
|
+
{ alpha2: 'MX', name: 'Mexico', alpha3: 'MEX', numeric: '484' },
|
211
|
+
{ alpha2: 'FM', name: 'Micronesia, Federated States of', alpha3: 'FSM', numeric: '583' },
|
212
|
+
{ alpha2: 'MD', name: 'Moldova, Republic of', alpha3: 'MDA', numeric: '498' },
|
213
|
+
{ alpha2: 'MC', name: 'Monaco', alpha3: 'MCO', numeric: '492' },
|
214
|
+
{ alpha2: 'MN', name: 'Mongolia', alpha3: 'MNG', numeric: '496' },
|
215
|
+
{ alpha2: 'ME', name: 'Montenegro', alpha3: 'MNE', numeric: '499' },
|
216
|
+
{ alpha2: 'MS', name: 'Montserrat', alpha3: 'MSR', numeric: '500' },
|
217
|
+
{ alpha2: 'MA', name: 'Morocco', alpha3: 'MAR', numeric: '504' },
|
218
|
+
{ alpha2: 'MZ', name: 'Mozambique', alpha3: 'MOZ', numeric: '508' },
|
219
|
+
{ alpha2: 'MM', name: 'Myanmar', alpha3: 'MMR', numeric: '104' },
|
220
|
+
{ alpha2: 'NA', name: 'Namibia', alpha3: 'NAM', numeric: '516' },
|
221
|
+
{ alpha2: 'NR', name: 'Nauru', alpha3: 'NRU', numeric: '520' },
|
222
|
+
{ alpha2: 'NP', name: 'Nepal', alpha3: 'NPL', numeric: '524' },
|
223
|
+
{ alpha2: 'NL', name: 'Netherlands', alpha3: 'NLD', numeric: '528' },
|
224
|
+
{ alpha2: 'NC', name: 'New Caledonia', alpha3: 'NCL', numeric: '540' },
|
225
|
+
{ alpha2: 'NZ', name: 'New Zealand', alpha3: 'NZL', numeric: '554' },
|
226
|
+
{ alpha2: 'NI', name: 'Nicaragua', alpha3: 'NIC', numeric: '558' },
|
227
|
+
{ alpha2: 'NE', name: 'Niger', alpha3: 'NER', numeric: '562' },
|
228
|
+
{ alpha2: 'NG', name: 'Nigeria', alpha3: 'NGA', numeric: '566' },
|
229
|
+
{ alpha2: 'NU', name: 'Niue', alpha3: 'NIU', numeric: '570' },
|
230
|
+
{ alpha2: 'NF', name: 'Norfolk Island', alpha3: 'NFK', numeric: '574' },
|
231
|
+
{ alpha2: 'MP', name: 'Northern Mariana Islands', alpha3: 'MNP', numeric: '580' },
|
232
|
+
{ alpha2: 'NO', name: 'Norway', alpha3: 'NOR', numeric: '578' },
|
233
|
+
{ alpha2: 'OM', name: 'Oman', alpha3: 'OMN', numeric: '512' },
|
234
|
+
{ alpha2: 'PK', name: 'Pakistan', alpha3: 'PAK', numeric: '586' },
|
235
|
+
{ alpha2: 'PW', name: 'Palau', alpha3: 'PLW', numeric: '585' },
|
236
|
+
{ alpha2: 'PS', name: 'Palestinian Territory, Occupied', alpha3: 'PSE', numeric: '275' },
|
237
|
+
{ alpha2: 'PA', name: 'Panama', alpha3: 'PAN', numeric: '591' },
|
238
|
+
{ alpha2: 'PG', name: 'Papua New Guinea', alpha3: 'PNG', numeric: '598' },
|
239
|
+
{ alpha2: 'PY', name: 'Paraguay', alpha3: 'PRY', numeric: '600' },
|
240
|
+
{ alpha2: 'PE', name: 'Peru', alpha3: 'PER', numeric: '604' },
|
241
|
+
{ alpha2: 'PH', name: 'Philippines', alpha3: 'PHL', numeric: '608' },
|
242
|
+
{ alpha2: 'PN', name: 'Pitcairn', alpha3: 'PCN', numeric: '612' },
|
243
|
+
{ alpha2: 'PL', name: 'Poland', alpha3: 'POL', numeric: '616' },
|
244
|
+
{ alpha2: 'PT', name: 'Portugal', alpha3: 'PRT', numeric: '620' },
|
245
|
+
{ alpha2: 'PR', name: 'Puerto Rico', alpha3: 'PRI', numeric: '630' },
|
246
|
+
{ alpha2: 'QA', name: 'Qatar', alpha3: 'QAT', numeric: '634' },
|
247
|
+
{ alpha2: 'RE', name: 'Reunion', alpha3: 'REU', numeric: '638' },
|
248
|
+
{ alpha2: 'RO', name: 'Romania', alpha3: 'ROM', numeric: '642' },
|
249
|
+
{ alpha2: 'RU', name: 'Russian Federation', alpha3: 'RUS', numeric: '643' },
|
250
|
+
{ alpha2: 'RW', name: 'Rwanda', alpha3: 'RWA', numeric: '646' },
|
251
|
+
{ alpha2: 'BL', name: 'Saint Barthélemy', alpha3: 'BLM', numeric: '652' },
|
252
|
+
{ alpha2: 'SH', name: 'Saint Helena', alpha3: 'SHN', numeric: '654' },
|
253
|
+
{ alpha2: 'KN', name: 'Saint Kitts and Nevis', alpha3: 'KNA', numeric: '659' },
|
254
|
+
{ alpha2: 'LC', name: 'Saint Lucia', alpha3: 'LCA', numeric: '662' },
|
255
|
+
{ alpha2: 'MF', name: 'Saint Martin (French part)', alpha3: 'MAF', numeric: '663' },
|
256
|
+
{ alpha2: 'PM', name: 'Saint Pierre and Miquelon', alpha3: 'SPM', numeric: '666' },
|
257
|
+
{ alpha2: 'VC', name: 'Saint Vincent and the Grenadines', alpha3: 'VCT', numeric: '670' },
|
258
|
+
{ alpha2: 'WS', name: 'Samoa', alpha3: 'WSM', numeric: '882' },
|
259
|
+
{ alpha2: 'SM', name: 'San Marino', alpha3: 'SMR', numeric: '674' },
|
260
|
+
{ alpha2: 'ST', name: 'Sao Tome and Principe', alpha3: 'STP', numeric: '678' },
|
261
|
+
{ alpha2: 'SA', name: 'Saudi Arabia', alpha3: 'SAU', numeric: '682' },
|
262
|
+
{ alpha2: 'SN', name: 'Senegal', alpha3: 'SEN', numeric: '686' },
|
263
|
+
{ alpha2: 'RS', name: 'Serbia', alpha3: 'SRB', numeric: '688' },
|
264
|
+
{ alpha2: 'SC', name: 'Seychelles', alpha3: 'SYC', numeric: '690' },
|
265
|
+
{ alpha2: 'SL', name: 'Sierra Leone', alpha3: 'SLE', numeric: '694' },
|
266
|
+
{ alpha2: 'SG', name: 'Singapore', alpha3: 'SGP', numeric: '702' },
|
267
|
+
{ alpha2: 'SX', name: 'Sint Maarten', alpha3: 'SXM', numeric: '534' },
|
268
|
+
{ alpha2: 'SK', name: 'Slovakia', alpha3: 'SVK', numeric: '703' },
|
269
|
+
{ alpha2: 'SI', name: 'Slovenia', alpha3: 'SVN', numeric: '705' },
|
270
|
+
{ alpha2: 'SB', name: 'Solomon Islands', alpha3: 'SLB', numeric: '090' },
|
271
|
+
{ alpha2: 'SO', name: 'Somalia', alpha3: 'SOM', numeric: '706' },
|
272
|
+
{ alpha2: 'ZA', name: 'South Africa', alpha3: 'ZAF', numeric: '710' },
|
273
|
+
{ alpha2: 'GS', name: 'South Georgia and the South Sandwich Islands', alpha3: 'SGS', numeric: '239' },
|
274
|
+
{ alpha2: 'SS', name: 'South Sudan', alpha3: 'SSD', numeric: '728' },
|
275
|
+
{ alpha2: 'ES', name: 'Spain', alpha3: 'ESP', numeric: '724' },
|
276
|
+
{ alpha2: 'LK', name: 'Sri Lanka', alpha3: 'LKA', numeric: '144' },
|
277
|
+
{ alpha2: 'SD', name: 'Sudan', alpha3: 'SDN', numeric: '729' },
|
278
|
+
{ alpha2: 'SR', name: 'Suriname', alpha3: 'SUR', numeric: '740' },
|
279
|
+
{ alpha2: 'SJ', name: 'Svalbard and Jan Mayen', alpha3: 'SJM', numeric: '744' },
|
280
|
+
{ alpha2: 'SZ', name: 'Swaziland', alpha3: 'SWZ', numeric: '748' },
|
281
|
+
{ alpha2: 'SE', name: 'Sweden', alpha3: 'SWE', numeric: '752' },
|
282
|
+
{ alpha2: 'CH', name: 'Switzerland', alpha3: 'CHE', numeric: '756' },
|
283
|
+
{ alpha2: 'SY', name: 'Syrian Arab Republic', alpha3: 'SYR', numeric: '760' },
|
284
|
+
{ alpha2: 'TW', name: 'Taiwan, Province of China', alpha3: 'TWN', numeric: '158' },
|
285
|
+
{ alpha2: 'TJ', name: 'Tajikistan', alpha3: 'TJK', numeric: '762' },
|
286
|
+
{ alpha2: 'TZ', name: 'Tanzania, United Republic of', alpha3: 'TZA', numeric: '834' },
|
287
|
+
{ alpha2: 'TH', name: 'Thailand', alpha3: 'THA', numeric: '764' },
|
288
|
+
{ alpha2: 'TL', name: 'Timor Leste', alpha3: 'TLS', numeric: '626' },
|
289
|
+
{ alpha2: 'TG', name: 'Togo', alpha3: 'TGO', numeric: '768' },
|
290
|
+
{ alpha2: 'TK', name: 'Tokelau', alpha3: 'TKL', numeric: '772' },
|
291
|
+
{ alpha2: 'TO', name: 'Tonga', alpha3: 'TON', numeric: '776' },
|
292
|
+
{ alpha2: 'TT', name: 'Trinidad and Tobago', alpha3: 'TTO', numeric: '780' },
|
293
|
+
{ alpha2: 'TN', name: 'Tunisia', alpha3: 'TUN', numeric: '788' },
|
294
|
+
{ alpha2: 'TR', name: 'Turkey', alpha3: 'TUR', numeric: '792' },
|
295
|
+
{ alpha2: 'TM', name: 'Turkmenistan', alpha3: 'TKM', numeric: '795' },
|
296
|
+
{ alpha2: 'TC', name: 'Turks and Caicos Islands', alpha3: 'TCA', numeric: '796' },
|
297
|
+
{ alpha2: 'TV', name: 'Tuvalu', alpha3: 'TUV', numeric: '798' },
|
298
|
+
{ alpha2: 'UG', name: 'Uganda', alpha3: 'UGA', numeric: '800' },
|
299
|
+
{ alpha2: 'UA', name: 'Ukraine', alpha3: 'UKR', numeric: '804' },
|
300
|
+
{ alpha2: 'AE', name: 'United Arab Emirates', alpha3: 'ARE', numeric: '784' },
|
301
|
+
{ alpha2: 'GB', name: 'United Kingdom', alpha3: 'GBR', numeric: '826' },
|
302
|
+
{ alpha2: 'US', name: 'United States', alpha3: 'USA', numeric: '840' },
|
303
|
+
{ alpha2: 'UM', name: 'United States Minor Outlying Islands', alpha3: 'UMI', numeric: '581' },
|
304
|
+
{ alpha2: 'UY', name: 'Uruguay', alpha3: 'URY', numeric: '858' },
|
305
|
+
{ alpha2: 'UZ', name: 'Uzbekistan', alpha3: 'UZB', numeric: '860' },
|
306
|
+
{ alpha2: 'VU', name: 'Vanuatu', alpha3: 'VUT', numeric: '548' },
|
307
|
+
{ alpha2: 'VE', name: 'Venezuela', alpha3: 'VEN', numeric: '862' },
|
308
|
+
{ alpha2: 'VN', name: 'Viet Nam', alpha3: 'VNM', numeric: '704' },
|
309
|
+
{ alpha2: 'VG', name: 'Virgin Islands, British', alpha3: 'VGB', numeric: '092' },
|
310
|
+
{ alpha2: 'VI', name: 'Virgin Islands, U.S.', alpha3: 'VIR', numeric: '850' },
|
311
|
+
{ alpha2: 'WF', name: 'Wallis and Futuna', alpha3: 'WLF', numeric: '876' },
|
312
|
+
{ alpha2: 'EH', name: 'Western Sahara', alpha3: 'ESH', numeric: '732' },
|
313
|
+
{ alpha2: 'YE', name: 'Yemen', alpha3: 'YEM', numeric: '887' },
|
314
|
+
{ alpha2: 'ZM', name: 'Zambia', alpha3: 'ZMB', numeric: '894' },
|
315
|
+
{ alpha2: 'ZW', name: 'Zimbabwe', alpha3: 'ZWE', numeric: '716' },
|
316
|
+
{ alpha2: 'AX', name: 'Åland Islands', alpha3: 'ALA', numeric: '248' }
|
317
|
+
]
|
318
|
+
|
319
|
+
def self.find(name)
|
320
|
+
raise InvalidCountryCodeError, "Cannot lookup country for an empty name" if name.blank?
|
321
|
+
|
322
|
+
case name.length
|
323
|
+
when 2, 3
|
324
|
+
upcase_name = name.upcase
|
325
|
+
country_code = CountryCode.new(name)
|
326
|
+
country = COUNTRIES.detect{|c| c[country_code.format] == upcase_name }
|
327
|
+
else
|
328
|
+
country = COUNTRIES.detect{|c| c[:name].upcase == name.upcase }
|
329
|
+
end
|
330
|
+
raise InvalidCountryCodeError, "No country could be found for the country #{name}" if country.nil?
|
331
|
+
Country.new(country.dup)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Empty
|
3
|
+
private
|
4
|
+
|
5
|
+
def empty?(value)
|
6
|
+
case value
|
7
|
+
when nil
|
8
|
+
true
|
9
|
+
when Array, Hash
|
10
|
+
value.empty?
|
11
|
+
when String
|
12
|
+
value.strip.empty?
|
13
|
+
when Numeric
|
14
|
+
(value == 0)
|
15
|
+
else
|
16
|
+
false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
class ActiveMerchantError < StandardError #:nodoc:
|
3
|
+
end
|
4
|
+
|
5
|
+
class ConnectionError < ActiveMerchantError # :nodoc:
|
6
|
+
attr_reader :triggering_exception
|
7
|
+
|
8
|
+
def initialize(message, triggering_exception)
|
9
|
+
super(message)
|
10
|
+
@triggering_exception = triggering_exception
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class RetriableConnectionError < ConnectionError # :nodoc:
|
15
|
+
end
|
16
|
+
|
17
|
+
class ResponseError < ActiveMerchantError # :nodoc:
|
18
|
+
attr_reader :response
|
19
|
+
|
20
|
+
def initialize(response, message = nil)
|
21
|
+
@response = response
|
22
|
+
@message = message
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
"Failed with #{response.code} #{response.message if response.respond_to?(:message)}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class ClientCertificateError < ActiveMerchantError # :nodoc
|
31
|
+
end
|
32
|
+
|
33
|
+
class InvalidResponseError < ActiveMerchantError # :nodoc
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module NetworkConnectionRetries
|
3
|
+
DEFAULT_RETRIES = 3
|
4
|
+
DEFAULT_CONNECTION_ERRORS = {
|
5
|
+
EOFError => "The remote server dropped the connection",
|
6
|
+
Errno::ECONNRESET => "The remote server reset the connection",
|
7
|
+
Timeout::Error => "The connection to the remote server timed out",
|
8
|
+
Errno::ETIMEDOUT => "The connection to the remote server timed out",
|
9
|
+
SocketError => "The connection to the remote server could not be established",
|
10
|
+
Errno::EHOSTUNREACH => "The connection to the remote server could not be established",
|
11
|
+
OpenSSL::SSL::SSLError => "The SSL connection to the remote server could not be established"
|
12
|
+
}
|
13
|
+
|
14
|
+
def self.included(base)
|
15
|
+
base.send(:attr_accessor, :retry_safe)
|
16
|
+
end
|
17
|
+
|
18
|
+
def retry_exceptions(options={})
|
19
|
+
connection_errors = DEFAULT_CONNECTION_ERRORS.merge(options[:connection_exceptions] || {})
|
20
|
+
|
21
|
+
retry_network_exceptions(options) do
|
22
|
+
begin
|
23
|
+
yield
|
24
|
+
rescue Errno::ECONNREFUSED => e
|
25
|
+
raise ActiveMerchant::RetriableConnectionError.new("The remote server refused the connection", e)
|
26
|
+
rescue OpenSSL::X509::CertificateError => e
|
27
|
+
NetworkConnectionRetries.log(options[:logger], :error, e.message, options[:tag])
|
28
|
+
raise ActiveMerchant::ClientCertificateError, "The remote server did not accept the provided SSL certificate"
|
29
|
+
rescue Zlib::BufError => e
|
30
|
+
raise ActiveMerchant::InvalidResponseError, "The remote server replied with an invalid response"
|
31
|
+
rescue *connection_errors.keys => e
|
32
|
+
raise ActiveMerchant::ConnectionError.new(derived_error_message(connection_errors, e.class), e)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def retry_network_exceptions(options = {})
|
40
|
+
initial_retries = options[:max_retries] || DEFAULT_RETRIES
|
41
|
+
retries = initial_retries
|
42
|
+
request_start = nil
|
43
|
+
|
44
|
+
begin
|
45
|
+
request_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
46
|
+
result = yield
|
47
|
+
log_with_retry_details(options[:logger], initial_retries-retries + 1, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, "success", options[:tag])
|
48
|
+
result
|
49
|
+
rescue ActiveMerchant::RetriableConnectionError => e
|
50
|
+
retries -= 1
|
51
|
+
|
52
|
+
log_with_retry_details(options[:logger], initial_retries-retries, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, e.message, options[:tag])
|
53
|
+
retry unless retries.zero?
|
54
|
+
raise ActiveMerchant::ConnectionError.new(e.message, e)
|
55
|
+
rescue ActiveMerchant::ConnectionError, ActiveMerchant::InvalidResponseError => e
|
56
|
+
retries -= 1
|
57
|
+
log_with_retry_details(options[:logger], initial_retries-retries, Process.clock_gettime(Process::CLOCK_MONOTONIC) - request_start, e.message, options[:tag])
|
58
|
+
retry if (options[:retry_safe] || retry_safe) && !retries.zero?
|
59
|
+
raise
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.log(logger, level, message, tag=nil)
|
64
|
+
tag ||= self.class.to_s
|
65
|
+
message = "[#{tag}] #{message}"
|
66
|
+
logger.send(level, message) if logger
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
def log_with_retry_details(logger, attempts, time, message, tag)
|
71
|
+
NetworkConnectionRetries.log(logger, :info, "connection_attempt=%d connection_request_time=%.4fs connection_msg=\"%s\"" % [attempts, time, message], tag)
|
72
|
+
end
|
73
|
+
|
74
|
+
def derived_error_message(errors, klass)
|
75
|
+
key = (errors.keys & klass.ancestors).first
|
76
|
+
key ? errors[key] : nil
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
3
|
+
module ActiveMerchant
|
4
|
+
class PostData < Hash
|
5
|
+
class_attribute :required_fields, :instance_writer => false
|
6
|
+
self.required_fields = []
|
7
|
+
|
8
|
+
def []=(key, value)
|
9
|
+
return if value.blank? && !required?(key)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_post_data
|
14
|
+
collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
15
|
+
end
|
16
|
+
|
17
|
+
alias_method :to_s, :to_post_data
|
18
|
+
|
19
|
+
private
|
20
|
+
def required?(key)
|
21
|
+
required_fields.include?(key)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module PostsData #:nodoc:
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.class_attribute :ssl_strict
|
6
|
+
base.ssl_strict = true
|
7
|
+
|
8
|
+
base.class_attribute :ssl_version
|
9
|
+
base.ssl_version = nil
|
10
|
+
|
11
|
+
base.class_attribute :retry_safe
|
12
|
+
base.retry_safe = false
|
13
|
+
|
14
|
+
base.class_attribute :open_timeout
|
15
|
+
base.open_timeout = Connection::OPEN_TIMEOUT
|
16
|
+
|
17
|
+
base.class_attribute :read_timeout
|
18
|
+
base.read_timeout = Connection::READ_TIMEOUT
|
19
|
+
|
20
|
+
base.class_attribute :max_retries
|
21
|
+
base.max_retries = Connection::MAX_RETRIES
|
22
|
+
|
23
|
+
base.class_attribute :logger
|
24
|
+
base.class_attribute :wiredump_device
|
25
|
+
|
26
|
+
base.class_attribute :proxy_address
|
27
|
+
base.class_attribute :proxy_port
|
28
|
+
end
|
29
|
+
|
30
|
+
def ssl_get(endpoint, headers={})
|
31
|
+
ssl_request(:get, endpoint, nil, headers)
|
32
|
+
end
|
33
|
+
|
34
|
+
def ssl_post(endpoint, data, headers = {})
|
35
|
+
ssl_request(:post, endpoint, data, headers)
|
36
|
+
end
|
37
|
+
|
38
|
+
def ssl_request(method, endpoint, data, headers)
|
39
|
+
handle_response(raw_ssl_request(method, endpoint, data, headers))
|
40
|
+
end
|
41
|
+
|
42
|
+
def raw_ssl_request(method, endpoint, data, headers = {})
|
43
|
+
logger.warn "#{self.class} using ssl_strict=false, which is insecure" if logger unless ssl_strict
|
44
|
+
logger.warn "#{self.class} posting to plaintext endpoint, which is insecure" if logger unless endpoint.to_s =~ /^https:/
|
45
|
+
|
46
|
+
connection = new_connection(endpoint)
|
47
|
+
connection.open_timeout = open_timeout
|
48
|
+
connection.read_timeout = read_timeout
|
49
|
+
connection.retry_safe = retry_safe
|
50
|
+
connection.verify_peer = ssl_strict
|
51
|
+
connection.ssl_version = ssl_version
|
52
|
+
connection.logger = logger
|
53
|
+
connection.max_retries = max_retries
|
54
|
+
connection.tag = self.class.name
|
55
|
+
connection.wiredump_device = wiredump_device
|
56
|
+
|
57
|
+
connection.pem = @options[:pem] if @options
|
58
|
+
connection.pem_password = @options[:pem_password] if @options
|
59
|
+
|
60
|
+
connection.ignore_http_status = @options[:ignore_http_status] if @options
|
61
|
+
|
62
|
+
connection.proxy_address = proxy_address
|
63
|
+
connection.proxy_port = proxy_port
|
64
|
+
|
65
|
+
connection.request(method, data, headers)
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def new_connection(endpoint)
|
71
|
+
Connection.new(endpoint)
|
72
|
+
end
|
73
|
+
|
74
|
+
def handle_response(response)
|
75
|
+
case response.code.to_i
|
76
|
+
when 200...300
|
77
|
+
response.body
|
78
|
+
else
|
79
|
+
raise ResponseError.new(response)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
data/lib/active_merchant.rb
CHANGED
@@ -27,37 +27,40 @@ require 'active_support/core_ext/hash/indifferent_access'
|
|
27
27
|
require 'active_support/core_ext/hash/conversions'
|
28
28
|
require 'active_support/core_ext/object/conversions'
|
29
29
|
require 'active_support/core_ext/class/attribute'
|
30
|
-
require 'active_support/core_ext/
|
31
|
-
require 'active_support/core_ext/class/delegating_attributes'
|
32
|
-
require 'active_support/core_ext/module/attribute_accessors'
|
33
|
-
|
34
|
-
begin
|
35
|
-
require 'active_support/base64'
|
36
|
-
|
37
|
-
unless defined?(Base64)
|
38
|
-
Base64 = ActiveSupport::Base64
|
39
|
-
end
|
30
|
+
require 'active_support/core_ext/enumerable'
|
40
31
|
|
41
|
-
|
42
|
-
|
43
|
-
ActiveSupport::Base64.encode64s(v)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
rescue LoadError
|
47
|
-
require 'base64'
|
32
|
+
if(!defined?(ActiveSupport::VERSION) || (ActiveSupport::VERSION::STRING < "4.1"))
|
33
|
+
require 'active_support/core_ext/class/attribute_accessors'
|
48
34
|
end
|
49
35
|
|
36
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
37
|
+
|
38
|
+
require 'base64'
|
50
39
|
require 'securerandom'
|
51
40
|
require 'builder'
|
52
41
|
require 'cgi'
|
53
42
|
require 'rexml/document'
|
43
|
+
require 'timeout'
|
44
|
+
require 'socket'
|
45
|
+
|
46
|
+
require 'active_merchant/network_connection_retries'
|
47
|
+
require 'active_merchant/connection'
|
48
|
+
require 'active_merchant/post_data'
|
49
|
+
require 'active_merchant/posts_data'
|
54
50
|
|
55
|
-
require 'active_utils'
|
56
51
|
require 'active_merchant/billing'
|
57
52
|
require 'active_merchant/version'
|
53
|
+
require 'active_merchant/country'
|
58
54
|
|
59
|
-
module ActiveMerchant
|
60
|
-
|
61
|
-
|
55
|
+
module ActiveMerchant
|
56
|
+
def self.deprecated(message, caller=Kernel.caller[1])
|
57
|
+
warning = caller + ": " + message
|
58
|
+
if(respond_to?(:logger) && logger.present?)
|
59
|
+
logger.warn(warning)
|
60
|
+
else
|
61
|
+
warn(warning)
|
62
|
+
end
|
62
63
|
end
|
63
64
|
end
|
65
|
+
|
66
|
+
I18n.enforce_available_locales = false
|