activemerchant 1.43.3 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG +133 -3
- data/CONTRIBUTORS +25 -0
- data/README.md +14 -39
- data/lib/active_merchant.rb +43 -2
- data/lib/active_merchant/billing.rb +3 -1
- data/lib/active_merchant/billing/base.rb +10 -2
- data/lib/active_merchant/billing/check.rb +29 -22
- data/lib/active_merchant/billing/compatibility.rb +120 -0
- data/lib/active_merchant/billing/credit_card.rb +129 -60
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -1
- data/lib/active_merchant/billing/credit_card_methods.rb +60 -43
- data/lib/active_merchant/billing/cvv_result.rb +15 -15
- data/lib/active_merchant/billing/gateway.rb +46 -11
- data/lib/active_merchant/billing/gateways/adyen.rb +205 -0
- data/lib/active_merchant/billing/gateways/app55.rb +1 -9
- data/lib/active_merchant/billing/gateways/authorize_net.rb +7 -391
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +20 -4
- data/lib/active_merchant/billing/gateways/balanced.rb +127 -367
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +1 -1
- data/lib/active_merchant/billing/gateways/beanstream.rb +25 -6
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +3 -3
- data/lib/active_merchant/billing/gateways/blue_pay.rb +11 -3
- data/lib/active_merchant/billing/gateways/bogus.rb +1 -13
- data/lib/active_merchant/billing/gateways/borgun.rb +211 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +31 -13
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +7 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +184 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +45 -0
- data/lib/active_merchant/billing/gateways/certo_direct.rb +3 -2
- data/lib/active_merchant/billing/gateways/commercegate.rb +143 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +56 -81
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +3 -1
- data/lib/active_merchant/billing/gateways/efsnet.rb +3 -14
- data/lib/active_merchant/billing/gateways/elavon.rb +45 -9
- data/lib/active_merchant/billing/gateways/epay.rb +2 -2
- data/lib/active_merchant/billing/gateways/eway.rb +1 -12
- data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +233 -202
- data/lib/active_merchant/billing/gateways/exact.rb +1 -1
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +1 -1
- data/lib/active_merchant/billing/gateways/federated_canada.rb +1 -8
- data/lib/active_merchant/billing/gateways/finansbank.rb +2 -1
- data/lib/active_merchant/billing/gateways/first_pay.rb +108 -124
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +43 -13
- data/lib/active_merchant/billing/gateways/garanti.rb +2 -2
- data/lib/active_merchant/billing/gateways/hps.rb +281 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +1 -4
- data/lib/active_merchant/billing/gateways/inspire.rb +0 -8
- data/lib/active_merchant/billing/gateways/iridium.rb +25 -3
- data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
- data/lib/active_merchant/billing/gateways/linkpoint.rb +4 -13
- data/lib/active_merchant/billing/gateways/litle.rb +10 -4
- data/lib/active_merchant/billing/gateways/maxipago.rb +7 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +0 -6
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +4 -11
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +3 -10
- data/lib/active_merchant/billing/gateways/mercury.rb +0 -7
- data/lib/active_merchant/billing/gateways/metrics_global.rb +1 -20
- data/lib/active_merchant/billing/gateways/migs.rb +1 -1
- data/lib/active_merchant/billing/gateways/moneris.rb +29 -21
- data/lib/active_merchant/billing/gateways/moneris_us.rb +1 -11
- data/lib/active_merchant/billing/gateways/money_movers.rb +1 -8
- data/lib/active_merchant/billing/gateways/nab_transact.rb +16 -15
- data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
- data/lib/active_merchant/billing/gateways/netbilling.rb +0 -7
- data/lib/active_merchant/billing/gateways/network_merchants.rb +21 -18
- data/lib/active_merchant/billing/gateways/ogone.rb +3 -3
- data/lib/active_merchant/billing/gateways/openpay.rb +1 -8
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +34 -23
- data/lib/active_merchant/billing/gateways/orbital.rb +121 -4
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +22 -21
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +2 -9
- data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +3 -13
- data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -7
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +1 -9
- data/lib/active_merchant/billing/gateways/payex.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +7 -1
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +15 -15
- data/lib/active_merchant/billing/gateways/payflow_express.rb +19 -19
- data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/paymill.rb +7 -2
- data/lib/active_merchant/billing/gateways/paypal.rb +25 -14
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +16 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +3 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +25 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +1 -8
- data/lib/active_merchant/billing/gateways/pin.rb +39 -7
- data/lib/active_merchant/billing/gateways/plugnpay.rb +1 -12
- data/lib/active_merchant/billing/gateways/psigate.rb +1 -12
- 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/quickpay.rb +17 -15
- data/lib/active_merchant/billing/gateways/realex.rb +3 -12
- data/lib/active_merchant/billing/gateways/sage.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +2 -8
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +1 -1
- data/lib/active_merchant/billing/gateways/sage_pay.rb +93 -28
- data/lib/active_merchant/billing/gateways/secure_net.rb +1 -8
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +3 -3
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -7
- data/lib/active_merchant/billing/gateways/skip_jack.rb +1 -2
- data/lib/active_merchant/billing/gateways/smart_ps.rb +8 -2
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +2 -1
- data/lib/active_merchant/billing/gateways/stripe.rb +14 -15
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +0 -1
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +4 -9
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +46 -43
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +7 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +1 -8
- data/lib/active_merchant/billing/gateways/viaklix.rb +0 -6
- data/lib/active_merchant/billing/gateways/vindicia.rb +68 -44
- data/lib/active_merchant/billing/gateways/webpay.rb +1 -9
- data/lib/active_merchant/billing/gateways/wirecard.rb +117 -11
- data/lib/active_merchant/billing/gateways/worldpay.rb +50 -22
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +181 -0
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +20 -15
- data/lib/active_merchant/country.rb +327 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +29 -0
- data/lib/active_merchant/offsite_payments_shim.rb +19 -0
- data/lib/active_merchant/version.rb +1 -1
- metadata +60 -243
- metadata.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/orbital/avs_result.rb +0 -93
- data/lib/active_merchant/billing/gateways/orbital/cvv_result.rb +0 -34
- data/lib/active_merchant/billing/integrations.rb +0 -17
- data/lib/active_merchant/billing/integrations/a1agregator.rb +0 -26
- 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/action_view_helper.rb +0 -78
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +0 -38
- 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/bit_pay.rb +0 -30
- data/lib/active_merchant/billing/integrations/bit_pay/helper.rb +0 -66
- 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/bogus.rb +0 -23
- 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/chronopay.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/citrus.rb +0 -28
- data/lib/active_merchant/billing/integrations/citrus/helper.rb +0 -57
- 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/direc_pay.rb +0 -41
- 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/directebanking.rb +0 -47
- 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/doku.rb +0 -24
- 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/dotpay.rb +0 -22
- 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/dwolla.rb +0 -23
- 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/e_payment_plans.rb +0 -48
- 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/easy_pay.rb +0 -30
- 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/epay.rb +0 -21
- 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/first_data.rb +0 -38
- 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/gestpay.rb +0 -25
- 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/helper.rb +0 -123
- data/lib/active_merchant/billing/integrations/hi_trust.rb +0 -27
- 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/ipay88.rb +0 -23
- 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/klarna.rb +0 -71
- data/lib/active_merchant/billing/integrations/klarna/helper.rb +0 -123
- data/lib/active_merchant/billing/integrations/klarna/notification.rb +0 -103
- data/lib/active_merchant/billing/integrations/liqpay.rb +0 -30
- 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/maksuturva.rb +0 -86
- 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/mollie_ideal.rb +0 -98
- data/lib/active_merchant/billing/integrations/mollie_ideal/helper.rb +0 -67
- data/lib/active_merchant/billing/integrations/mollie_ideal/notification.rb +0 -69
- data/lib/active_merchant/billing/integrations/mollie_ideal/return.rb +0 -10
- data/lib/active_merchant/billing/integrations/moneybookers.rb +0 -26
- 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/nochex.rb +0 -88
- 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/notification.rb +0 -71
- data/lib/active_merchant/billing/integrations/pag_seguro.rb +0 -53
- data/lib/active_merchant/billing/integrations/pag_seguro/helper.rb +0 -121
- data/lib/active_merchant/billing/integrations/pag_seguro/notification.rb +0 -104
- data/lib/active_merchant/billing/integrations/paxum.rb +0 -44
- 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/pay_fast.rb +0 -70
- 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/paydollar.rb +0 -59
- data/lib/active_merchant/billing/integrations/paydollar/helper.rb +0 -41
- data/lib/active_merchant/billing/integrations/paydollar/notification.rb +0 -64
- data/lib/active_merchant/billing/integrations/paydollar/return.rb +0 -15
- data/lib/active_merchant/billing/integrations/payflow_link.rb +0 -21
- 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/paypal.rb +0 -39
- 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_payments_advanced.rb +0 -20
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +0 -15
- data/lib/active_merchant/billing/integrations/paysbuy.rb +0 -36
- 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/payu_in.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_paisa.rb +0 -30
- 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/platron.rb +0 -28
- 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/pxpay.rb +0 -31
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +0 -113
- 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/quickpay.rb +0 -21
- 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/rbkmoney.rb +0 -17
- 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/return.rb +0 -42
- data/lib/active_merchant/billing/integrations/robokassa.rb +0 -49
- 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/sage_pay_form.rb +0 -37
- 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/two_checkout.rb +0 -44
- 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/universal.rb +0 -23
- data/lib/active_merchant/billing/integrations/universal/helper.rb +0 -76
- data/lib/active_merchant/billing/integrations/universal/notification.rb +0 -52
- data/lib/active_merchant/billing/integrations/universal/return.rb +0 -18
- data/lib/active_merchant/billing/integrations/valitor.rb +0 -33
- 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/verkkomaksut.rb +0 -20
- 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/web_pay.rb +0 -45
- 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/webmoney.rb +0 -43
- 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/wirecard_checkout_page.rb +0 -39
- 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/world_pay.rb +0 -34
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +0 -101
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +0 -160
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
require "nokogiri"
|
|
2
|
+
|
|
3
|
+
module ActiveMerchant #:nodoc:
|
|
4
|
+
module Billing #:nodoc:
|
|
5
|
+
class WorldpayUsGateway < Gateway
|
|
6
|
+
self.display_name = "Worldpay US"
|
|
7
|
+
self.homepage_url = "http://www.worldpay.com/us"
|
|
8
|
+
|
|
9
|
+
# No sandbox, just use test cards.
|
|
10
|
+
self.live_url = 'https://trans.worldpay.us/cgi-bin/process.cgi'
|
|
11
|
+
|
|
12
|
+
self.supported_countries = ['US']
|
|
13
|
+
self.default_currency = 'USD'
|
|
14
|
+
self.money_format = :dollars
|
|
15
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :jcb]
|
|
16
|
+
|
|
17
|
+
def initialize(options={})
|
|
18
|
+
requires!(options, :acctid, :subid, :merchantpin)
|
|
19
|
+
super
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def purchase(money, payment_method, options={})
|
|
23
|
+
post = {}
|
|
24
|
+
add_invoice(post, money, options)
|
|
25
|
+
add_payment_method(post, payment_method)
|
|
26
|
+
add_customer_data(post, options)
|
|
27
|
+
|
|
28
|
+
commit('purchase', post)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def authorize(money, payment, options={})
|
|
32
|
+
post = {}
|
|
33
|
+
add_invoice(post, money, options)
|
|
34
|
+
add_payment_method(post, payment)
|
|
35
|
+
add_customer_data(post, options)
|
|
36
|
+
|
|
37
|
+
commit('authorize', post)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def capture(amount, authorization, options={})
|
|
41
|
+
post = {}
|
|
42
|
+
add_invoice(post, amount, options)
|
|
43
|
+
add_reference(post, authorization)
|
|
44
|
+
add_customer_data(post, options)
|
|
45
|
+
|
|
46
|
+
commit('capture', post)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def refund(amount, authorization, options={})
|
|
50
|
+
post = {}
|
|
51
|
+
add_invoice(post, amount, options)
|
|
52
|
+
add_reference(post, authorization)
|
|
53
|
+
add_customer_data(post, options)
|
|
54
|
+
|
|
55
|
+
commit("refund", post)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def void(authorization, options={})
|
|
59
|
+
post = {}
|
|
60
|
+
add_reference(post, authorization)
|
|
61
|
+
|
|
62
|
+
commit('void', post)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def verify(credit_card, options={})
|
|
66
|
+
MultiResponse.run(:use_first_response) do |r|
|
|
67
|
+
r.process { authorize(100, credit_card, options) }
|
|
68
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def add_customer_data(post, options)
|
|
75
|
+
if(billing_address = (options[:billing_address] || options[:address]))
|
|
76
|
+
post[:ci_companyname] = billing_address[:company]
|
|
77
|
+
post[:ci_billaddr1] = billing_address[:address1]
|
|
78
|
+
post[:ci_billaddr2] = billing_address[:address2]
|
|
79
|
+
post[:ci_billcity] = billing_address[:city]
|
|
80
|
+
post[:ci_billstate] = billing_address[:state]
|
|
81
|
+
post[:ci_billzip] = billing_address[:zip]
|
|
82
|
+
post[:ci_billcountry] = billing_address[:country]
|
|
83
|
+
|
|
84
|
+
post[:ci_phone] = billing_address[:phone]
|
|
85
|
+
post[:ci_email] = billing_address[:email]
|
|
86
|
+
post[:ci_ipaddress] = billing_address[:ip]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
if(shipping_address = options[:shipping_address])
|
|
90
|
+
post[:ci_shipaddr1] = shipping_address[:address1]
|
|
91
|
+
post[:ci_shipaddr2] = shipping_address[:address2]
|
|
92
|
+
post[:ci_shipcity] = shipping_address[:city]
|
|
93
|
+
post[:ci_shipstate] = shipping_address[:state]
|
|
94
|
+
post[:ci_shipzip] = shipping_address[:zip]
|
|
95
|
+
post[:ci_shipcountry] = shipping_address[:country]
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def add_invoice(post, money, options)
|
|
100
|
+
post[:amount] = amount(money)
|
|
101
|
+
post[:currencycode] = (options[:currency] || currency(money))
|
|
102
|
+
post[:merchantordernumber] = options[:order_id] if options[:order_id]
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def add_payment_method(post, payment_method)
|
|
106
|
+
post[:ccname] = payment_method.name
|
|
107
|
+
post[:ccnum] = payment_method.number
|
|
108
|
+
post[:cvv2] = payment_method.verification_value
|
|
109
|
+
post[:expyear] = format(payment_method.year, :four_digits)
|
|
110
|
+
post[:expmon] = format(payment_method.month, :two_digits)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def split_authorization(authorization)
|
|
114
|
+
historyid, orderid = authorization.split("|")
|
|
115
|
+
[historyid, orderid]
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def add_reference(post, authorization)
|
|
119
|
+
historyid, orderid = split_authorization(authorization)
|
|
120
|
+
post[:postonly] = historyid
|
|
121
|
+
post[:historykeyid] = historyid
|
|
122
|
+
post[:orderkeyid] = orderid
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def parse(xml)
|
|
126
|
+
response = {}
|
|
127
|
+
doc = Nokogiri::XML(xml)
|
|
128
|
+
message = doc.xpath("//plaintext")
|
|
129
|
+
message.text.split(/\r?\n/).each do |line|
|
|
130
|
+
key, value = line.split(%r{=})
|
|
131
|
+
response[key] = value if key
|
|
132
|
+
end
|
|
133
|
+
response
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
ACTIONS = {
|
|
137
|
+
"purchase" => "ns_quicksale_cc",
|
|
138
|
+
"refund" => "ns_credit",
|
|
139
|
+
"authorize" => "ns_quicksale_cc",
|
|
140
|
+
"capture" => "ns_quicksale_cc",
|
|
141
|
+
"void" => "ns_void",
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
def commit(action, post)
|
|
145
|
+
post[:action] = ACTIONS[action] if ACTIONS[action]
|
|
146
|
+
post[:acctid] = @options[:acctid]
|
|
147
|
+
post[:subid] = @options[:subid]
|
|
148
|
+
post[:merchantpin] = @options[:merchantpin]
|
|
149
|
+
|
|
150
|
+
post[:authonly] = '1' if action == 'authorize'
|
|
151
|
+
|
|
152
|
+
raw = parse(ssl_post(live_url, post.to_query))
|
|
153
|
+
|
|
154
|
+
succeeded = success_from(raw['transresult'])
|
|
155
|
+
Response.new(
|
|
156
|
+
succeeded,
|
|
157
|
+
message_from(succeeded, raw),
|
|
158
|
+
raw,
|
|
159
|
+
:authorization => authorization_from(raw),
|
|
160
|
+
:test => test?
|
|
161
|
+
)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def success_from(result)
|
|
165
|
+
result == 'APPROVED'
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def message_from(succeeded, response)
|
|
169
|
+
if succeeded
|
|
170
|
+
"Succeeded"
|
|
171
|
+
else
|
|
172
|
+
(response['transresult'] || response['Reason'] || "Unable to read error message")
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def authorization_from(response)
|
|
177
|
+
[response['historyid'], response['orderid']].join("|")
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require "active_merchant/billing/compatibility"
|
|
2
|
+
require "active_merchant/empty"
|
|
3
|
+
|
|
4
|
+
module ActiveMerchant
|
|
5
|
+
module Billing
|
|
6
|
+
class Model
|
|
7
|
+
include Compatibility::Model
|
|
8
|
+
include Empty
|
|
9
|
+
|
|
10
|
+
def initialize(attributes = {})
|
|
11
|
+
attributes.each do |key, value|
|
|
12
|
+
send("#{key}=", value)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def validate
|
|
17
|
+
{}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
def errors_hash(array)
|
|
23
|
+
array.inject({}) do |hash, (attribute, error)|
|
|
24
|
+
(hash[attribute] ||= []) << error
|
|
25
|
+
hash
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -39,22 +39,31 @@ module ActiveMerchant #:nodoc:
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
class MultiResponse < Response
|
|
42
|
-
def self.run(
|
|
43
|
-
|
|
44
|
-
response.primary_response = primary_response
|
|
45
|
-
response
|
|
42
|
+
def self.run(use_first_response = false, &block)
|
|
43
|
+
new(use_first_response).tap(&block)
|
|
46
44
|
end
|
|
47
45
|
|
|
48
|
-
attr_reader :responses
|
|
49
|
-
attr_writer :primary_response
|
|
46
|
+
attr_reader :responses, :primary_response
|
|
50
47
|
|
|
51
|
-
def initialize
|
|
48
|
+
def initialize(use_first_response = false)
|
|
52
49
|
@responses = []
|
|
53
|
-
@
|
|
50
|
+
@use_first_response = use_first_response
|
|
51
|
+
@primary_response = nil
|
|
54
52
|
end
|
|
55
53
|
|
|
56
|
-
def process
|
|
57
|
-
|
|
54
|
+
def process(ignore_result=false)
|
|
55
|
+
return unless success?
|
|
56
|
+
|
|
57
|
+
response = yield
|
|
58
|
+
self << response
|
|
59
|
+
|
|
60
|
+
unless ignore_result
|
|
61
|
+
if(@use_first_response && response.success?)
|
|
62
|
+
@primary_response ||= response
|
|
63
|
+
else
|
|
64
|
+
@primary_response = response
|
|
65
|
+
end
|
|
66
|
+
end
|
|
58
67
|
end
|
|
59
68
|
|
|
60
69
|
def <<(response)
|
|
@@ -66,11 +75,7 @@ module ActiveMerchant #:nodoc:
|
|
|
66
75
|
end
|
|
67
76
|
|
|
68
77
|
def success?
|
|
69
|
-
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def primary_response
|
|
73
|
-
success? && @primary_response == :first ? @responses.first : @responses.last
|
|
78
|
+
(primary_response ? primary_response.success? : true)
|
|
74
79
|
end
|
|
75
80
|
|
|
76
81
|
%w(params message test authorization avs_result cvv_result test? fraud_review?).each do |m|
|
|
@@ -0,0 +1,327 @@
|
|
|
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
|
+
(@name == other.name)
|
|
51
|
+
end
|
|
52
|
+
alias eql? ==
|
|
53
|
+
|
|
54
|
+
def hash
|
|
55
|
+
@name.hash
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def to_s
|
|
59
|
+
@name
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
COUNTRIES = [
|
|
63
|
+
{ alpha2: 'AF', name: 'Afghanistan', alpha3: 'AFG', numeric: '004' },
|
|
64
|
+
{ alpha2: 'AL', name: 'Albania', alpha3: 'ALB', numeric: '008' },
|
|
65
|
+
{ alpha2: 'DZ', name: 'Algeria', alpha3: 'DZA', numeric: '012' },
|
|
66
|
+
{ alpha2: 'AS', name: 'American Samoa', alpha3: 'ASM', numeric: '016' },
|
|
67
|
+
{ alpha2: 'AD', name: 'Andorra', alpha3: 'AND', numeric: '020' },
|
|
68
|
+
{ alpha2: 'AO', name: 'Angola', alpha3: 'AGO', numeric: '024' },
|
|
69
|
+
{ alpha2: 'AI', name: 'Anguilla', alpha3: 'AIA', numeric: '660' },
|
|
70
|
+
{ alpha2: 'AG', name: 'Antigua and Barbuda', alpha3: 'ATG', numeric: '028' },
|
|
71
|
+
{ alpha2: 'AR', name: 'Argentina', alpha3: 'ARG', numeric: '032' },
|
|
72
|
+
{ alpha2: 'AM', name: 'Armenia', alpha3: 'ARM', numeric: '051' },
|
|
73
|
+
{ alpha2: 'AW', name: 'Aruba', alpha3: 'ABW', numeric: '533' },
|
|
74
|
+
{ alpha2: 'AU', name: 'Australia', alpha3: 'AUS', numeric: '036' },
|
|
75
|
+
{ alpha2: 'AT', name: 'Austria', alpha3: 'AUT', numeric: '040' },
|
|
76
|
+
{ alpha2: 'AZ', name: 'Azerbaijan', alpha3: 'AZE', numeric: '031' },
|
|
77
|
+
{ alpha2: 'BS', name: 'Bahamas', alpha3: 'BHS', numeric: '044' },
|
|
78
|
+
{ alpha2: 'BH', name: 'Bahrain', alpha3: 'BHR', numeric: '048' },
|
|
79
|
+
{ alpha2: 'BD', name: 'Bangladesh', alpha3: 'BGD', numeric: '050' },
|
|
80
|
+
{ alpha2: 'BB', name: 'Barbados', alpha3: 'BRB', numeric: '052' },
|
|
81
|
+
{ alpha2: 'BY', name: 'Belarus', alpha3: 'BLR', numeric: '112' },
|
|
82
|
+
{ alpha2: 'BE', name: 'Belgium', alpha3: 'BEL', numeric: '056' },
|
|
83
|
+
{ alpha2: 'BZ', name: 'Belize', alpha3: 'BLZ', numeric: '084' },
|
|
84
|
+
{ alpha2: 'BJ', name: 'Benin', alpha3: 'BEN', numeric: '204' },
|
|
85
|
+
{ alpha2: 'BM', name: 'Bermuda', alpha3: 'BMU', numeric: '060' },
|
|
86
|
+
{ alpha2: 'BT', name: 'Bhutan', alpha3: 'BTN', numeric: '064' },
|
|
87
|
+
{ alpha2: 'BO', name: 'Bolivia', alpha3: 'BOL', numeric: '068' },
|
|
88
|
+
{ alpha2: 'BA', name: 'Bosnia and Herzegovina', alpha3: 'BIH', numeric: '070' },
|
|
89
|
+
{ alpha2: 'BW', name: 'Botswana', alpha3: 'BWA', numeric: '072' },
|
|
90
|
+
{ alpha2: 'BV', name: 'Bouvet Island', alpha3: 'BVD', numeric: '074' },
|
|
91
|
+
{ alpha2: 'BR', name: 'Brazil', alpha3: 'BRA', numeric: '076' },
|
|
92
|
+
{ alpha2: 'IO', name: 'British Indian Ocean Territory', alpha3: 'IOT', numeric: '086' },
|
|
93
|
+
{ alpha2: 'BN', name: 'Brunei Darussalam', alpha3: 'BRN', numeric: '096' },
|
|
94
|
+
{ alpha2: 'BG', name: 'Bulgaria', alpha3: 'BGR', numeric: '100' },
|
|
95
|
+
{ alpha2: 'BF', name: 'Burkina Faso', alpha3: 'BFA', numeric: '854' },
|
|
96
|
+
{ alpha2: 'BI', name: 'Burundi', alpha3: 'BDI', numeric: '108' },
|
|
97
|
+
{ alpha2: 'KH', name: 'Cambodia', alpha3: 'KHM', numeric: '116' },
|
|
98
|
+
{ alpha2: 'CM', name: 'Cameroon', alpha3: 'CMR', numeric: '120' },
|
|
99
|
+
{ alpha2: 'CA', name: 'Canada', alpha3: 'CAN', numeric: '124' },
|
|
100
|
+
{ alpha2: 'CV', name: 'Cape Verde', alpha3: 'CPV', numeric: '132' },
|
|
101
|
+
{ alpha2: 'KY', name: 'Cayman Islands', alpha3: 'CYM', numeric: '136' },
|
|
102
|
+
{ alpha2: 'CF', name: 'Central African Republic', alpha3: 'CAF', numeric: '140' },
|
|
103
|
+
{ alpha2: 'TD', name: 'Chad', alpha3: 'TCD', numeric: '148' },
|
|
104
|
+
{ alpha2: 'CL', name: 'Chile', alpha3: 'CHL', numeric: '152' },
|
|
105
|
+
{ alpha2: 'CN', name: 'China', alpha3: 'CHN', numeric: '156' },
|
|
106
|
+
{ alpha2: 'CX', name: 'Christmas Island', alpha3: 'CXR', numeric: '162' },
|
|
107
|
+
{ alpha2: 'CC', name: 'Cocos (Keeling) Islands', alpha3: 'CCK', numeric: '166' },
|
|
108
|
+
{ alpha2: 'CO', name: 'Colombia', alpha3: 'COL', numeric: '170' },
|
|
109
|
+
{ alpha2: 'KM', name: 'Comoros', alpha3: 'COM', numeric: '174' },
|
|
110
|
+
{ alpha2: 'CG', name: 'Congo', alpha3: 'COG', numeric: '178' },
|
|
111
|
+
{ alpha2: 'CD', name: 'Congo, the Democratic Republic of the', alpha3: 'COD', numeric: '180' },
|
|
112
|
+
{ alpha2: 'CK', name: 'Cook Islands', alpha3: 'COK', numeric: '184' },
|
|
113
|
+
{ alpha2: 'CR', name: 'Costa Rica', alpha3: 'CRI', numeric: '188' },
|
|
114
|
+
{ alpha2: 'CI', name: 'Cote D\'Ivoire', alpha3: 'CIV', numeric: '384' },
|
|
115
|
+
{ alpha2: 'HR', name: 'Croatia', alpha3: 'HRV', numeric: '191' },
|
|
116
|
+
{ alpha2: 'CU', name: 'Cuba', alpha3: 'CUB', numeric: '192' },
|
|
117
|
+
{ alpha2: 'CW', name: 'Curaçao', alpha3: 'CUW', numeric: '531' },
|
|
118
|
+
{ alpha2: 'CY', name: 'Cyprus', alpha3: 'CYP', numeric: '196' },
|
|
119
|
+
{ alpha2: 'CZ', name: 'Czech Republic', alpha3: 'CZE', numeric: '203' },
|
|
120
|
+
{ alpha2: 'DK', name: 'Denmark', alpha3: 'DNK', numeric: '208' },
|
|
121
|
+
{ alpha2: 'DJ', name: 'Djibouti', alpha3: 'DJI', numeric: '262' },
|
|
122
|
+
{ alpha2: 'DM', name: 'Dominica', alpha3: 'DMA', numeric: '212' },
|
|
123
|
+
{ alpha2: 'DO', name: 'Dominican Republic', alpha3: 'DOM', numeric: '214' },
|
|
124
|
+
{ alpha2: 'EC', name: 'Ecuador', alpha3: 'ECU', numeric: '218' },
|
|
125
|
+
{ alpha2: 'EG', name: 'Egypt', alpha3: 'EGY', numeric: '818' },
|
|
126
|
+
{ alpha2: 'SV', name: 'El Salvador', alpha3: 'SLV', numeric: '222' },
|
|
127
|
+
{ alpha2: 'GQ', name: 'Equatorial Guinea', alpha3: 'GNQ', numeric: '226' },
|
|
128
|
+
{ alpha2: 'ER', name: 'Eritrea', alpha3: 'ERI', numeric: '232' },
|
|
129
|
+
{ alpha2: 'EE', name: 'Estonia', alpha3: 'EST', numeric: '233' },
|
|
130
|
+
{ alpha2: 'ET', name: 'Ethiopia', alpha3: 'ETH', numeric: '231' },
|
|
131
|
+
{ alpha2: 'FK', name: 'Falkland Islands (Malvinas)', alpha3: 'FLK', numeric: '238' },
|
|
132
|
+
{ alpha2: 'FO', name: 'Faroe Islands', alpha3: 'FRO', numeric: '234' },
|
|
133
|
+
{ alpha2: 'FJ', name: 'Fiji', alpha3: 'FJI', numeric: '242' },
|
|
134
|
+
{ alpha2: 'FI', name: 'Finland', alpha3: 'FIN', numeric: '246' },
|
|
135
|
+
{ alpha2: 'FR', name: 'France', alpha3: 'FRA', numeric: '250' },
|
|
136
|
+
{ alpha2: 'GF', name: 'French Guiana', alpha3: 'GUF', numeric: '254' },
|
|
137
|
+
{ alpha2: 'PF', name: 'French Polynesia', alpha3: 'PYF', numeric: '258' },
|
|
138
|
+
{ alpha2: 'TF', name: 'French Southern Territories', alpha3: 'ATF', numeric: '260' },
|
|
139
|
+
{ alpha2: 'GA', name: 'Gabon', alpha3: 'GAB', numeric: '266' },
|
|
140
|
+
{ alpha2: 'GM', name: 'Gambia', alpha3: 'GMB', numeric: '270' },
|
|
141
|
+
{ alpha2: 'GE', name: 'Georgia', alpha3: 'GEO', numeric: '268' },
|
|
142
|
+
{ alpha2: 'DE', name: 'Germany', alpha3: 'DEU', numeric: '276' },
|
|
143
|
+
{ alpha2: 'GH', name: 'Ghana', alpha3: 'GHA', numeric: '288' },
|
|
144
|
+
{ alpha2: 'GI', name: 'Gibraltar', alpha3: 'GIB', numeric: '292' },
|
|
145
|
+
{ alpha2: 'GR', name: 'Greece', alpha3: 'GRC', numeric: '300' },
|
|
146
|
+
{ alpha2: 'GL', name: 'Greenland', alpha3: 'GRL', numeric: '304' },
|
|
147
|
+
{ alpha2: 'GD', name: 'Grenada', alpha3: 'GRD', numeric: '308' },
|
|
148
|
+
{ alpha2: 'GP', name: 'Guadeloupe', alpha3: 'GLP', numeric: '312' },
|
|
149
|
+
{ alpha2: 'GU', name: 'Guam', alpha3: 'GUM', numeric: '316' },
|
|
150
|
+
{ alpha2: 'GT', name: 'Guatemala', alpha3: 'GTM', numeric: '320' },
|
|
151
|
+
{ alpha2: 'GG', name: 'Guernsey', alpha3: 'GGY', numeric: '831' },
|
|
152
|
+
{ alpha2: 'GN', name: 'Guinea', alpha3: 'GIN', numeric: '324' },
|
|
153
|
+
{ alpha2: 'GW', name: 'Guinea-Bissau', alpha3: 'GNB', numeric: '624' },
|
|
154
|
+
{ alpha2: 'GY', name: 'Guyana', alpha3: 'GUY', numeric: '328' },
|
|
155
|
+
{ alpha2: 'HT', name: 'Haiti', alpha3: 'HTI', numeric: '332' },
|
|
156
|
+
{ alpha2: 'HM', name: 'Heard Island And Mcdonald Islands', alpha3: 'HMD', numeric: '334' },
|
|
157
|
+
{ alpha2: 'VA', name: 'Holy See (Vatican City State)', alpha3: 'VAT', numeric: '336' },
|
|
158
|
+
{ alpha2: 'HN', name: 'Honduras', alpha3: 'HND', numeric: '340' },
|
|
159
|
+
{ alpha2: 'HK', name: 'Hong Kong', alpha3: 'HKG', numeric: '344' },
|
|
160
|
+
{ alpha2: 'HU', name: 'Hungary', alpha3: 'HUN', numeric: '348' },
|
|
161
|
+
{ alpha2: 'IS', name: 'Iceland', alpha3: 'ISL', numeric: '352' },
|
|
162
|
+
{ alpha2: 'IN', name: 'India', alpha3: 'IND', numeric: '356' },
|
|
163
|
+
{ alpha2: 'ID', name: 'Indonesia', alpha3: 'IDN', numeric: '360' },
|
|
164
|
+
{ alpha2: 'IR', name: 'Iran, Islamic Republic of', alpha3: 'IRN', numeric: '364' },
|
|
165
|
+
{ alpha2: 'IQ', name: 'Iraq', alpha3: 'IRQ', numeric: '368' },
|
|
166
|
+
{ alpha2: 'IE', name: 'Ireland', alpha3: 'IRL', numeric: '372' },
|
|
167
|
+
{ alpha2: 'IM', name: 'Isle Of Man', alpha3: 'IMN', numeric: '833' },
|
|
168
|
+
{ alpha2: 'IL', name: 'Israel', alpha3: 'ISR', numeric: '376' },
|
|
169
|
+
{ alpha2: 'IT', name: 'Italy', alpha3: 'ITA', numeric: '380' },
|
|
170
|
+
{ alpha2: 'JM', name: 'Jamaica', alpha3: 'JAM', numeric: '388' },
|
|
171
|
+
{ alpha2: 'JP', name: 'Japan', alpha3: 'JPN', numeric: '392' },
|
|
172
|
+
{ alpha2: 'JE', name: 'Jersey', alpha3: 'JEY', numeric: '832' },
|
|
173
|
+
{ alpha2: 'JO', name: 'Jordan', alpha3: 'JOR', numeric: '400' },
|
|
174
|
+
{ alpha2: 'KZ', name: 'Kazakhstan', alpha3: 'KAZ', numeric: '398' },
|
|
175
|
+
{ alpha2: 'KE', name: 'Kenya', alpha3: 'KEN', numeric: '404' },
|
|
176
|
+
{ alpha2: 'KI', name: 'Kiribati', alpha3: 'KIR', numeric: '296' },
|
|
177
|
+
{ alpha2: 'KP', name: 'Korea, Democratic People\'s Republic of', alpha3: 'PRK', numeric: '408' },
|
|
178
|
+
{ alpha2: 'KR', name: 'Korea, Republic of', alpha3: 'KOR', numeric: '410' },
|
|
179
|
+
{ alpha2: 'KV', name: 'Kosovo', alpha3: 'KSV', numeric: '377' },
|
|
180
|
+
{ alpha2: 'KW', name: 'Kuwait', alpha3: 'KWT', numeric: '414' },
|
|
181
|
+
{ alpha2: 'KG', name: 'Kyrgyzstan', alpha3: 'KGZ', numeric: '417' },
|
|
182
|
+
{ alpha2: 'LA', name: 'Lao People\'s Democratic Republic', alpha3: 'LAO', numeric: '418' },
|
|
183
|
+
{ alpha2: 'LV', name: 'Latvia', alpha3: 'LVA', numeric: '428' },
|
|
184
|
+
{ alpha2: 'LB', name: 'Lebanon', alpha3: 'LBN', numeric: '422' },
|
|
185
|
+
{ alpha2: 'LS', name: 'Lesotho', alpha3: 'LSO', numeric: '426' },
|
|
186
|
+
{ alpha2: 'LR', name: 'Liberia', alpha3: 'LBR', numeric: '430' },
|
|
187
|
+
{ alpha2: 'LY', name: 'Libyan Arab Jamahiriya', alpha3: 'LBY', numeric: '434' },
|
|
188
|
+
{ alpha2: 'LI', name: 'Liechtenstein', alpha3: 'LIE', numeric: '438' },
|
|
189
|
+
{ alpha2: 'LT', name: 'Lithuania', alpha3: 'LTU', numeric: '440' },
|
|
190
|
+
{ alpha2: 'LU', name: 'Luxembourg', alpha3: 'LUX', numeric: '442' },
|
|
191
|
+
{ alpha2: 'MO', name: 'Macao', alpha3: 'MAC', numeric: '446' },
|
|
192
|
+
{ alpha2: 'MK', name: 'Macedonia, the Former Yugoslav Republic of', alpha3: 'MKD', numeric: '807' },
|
|
193
|
+
{ alpha2: 'MG', name: 'Madagascar', alpha3: 'MDG', numeric: '450' },
|
|
194
|
+
{ alpha2: 'MW', name: 'Malawi', alpha3: 'MWI', numeric: '454' },
|
|
195
|
+
{ alpha2: 'MY', name: 'Malaysia', alpha3: 'MYS', numeric: '458' },
|
|
196
|
+
{ alpha2: 'MV', name: 'Maldives', alpha3: 'MDV', numeric: '462' },
|
|
197
|
+
{ alpha2: 'ML', name: 'Mali', alpha3: 'MLI', numeric: '466' },
|
|
198
|
+
{ alpha2: 'MT', name: 'Malta', alpha3: 'MLT', numeric: '470' },
|
|
199
|
+
{ alpha2: 'MH', name: 'Marshall Islands', alpha3: 'MHL', numeric: '584' },
|
|
200
|
+
{ alpha2: 'MQ', name: 'Martinique', alpha3: 'MTQ', numeric: '474' },
|
|
201
|
+
{ alpha2: 'MR', name: 'Mauritania', alpha3: 'MRT', numeric: '478' },
|
|
202
|
+
{ alpha2: 'MU', name: 'Mauritius', alpha3: 'MUS', numeric: '480' },
|
|
203
|
+
{ alpha2: 'YT', name: 'Mayotte', alpha3: 'MYT', numeric: '175' },
|
|
204
|
+
{ alpha2: 'MX', name: 'Mexico', alpha3: 'MEX', numeric: '484' },
|
|
205
|
+
{ alpha2: 'FM', name: 'Micronesia, Federated States of', alpha3: 'FSM', numeric: '583' },
|
|
206
|
+
{ alpha2: 'MD', name: 'Moldova, Republic of', alpha3: 'MDA', numeric: '498' },
|
|
207
|
+
{ alpha2: 'MC', name: 'Monaco', alpha3: 'MCO', numeric: '492' },
|
|
208
|
+
{ alpha2: 'MN', name: 'Mongolia', alpha3: 'MNG', numeric: '496' },
|
|
209
|
+
{ alpha2: 'ME', name: 'Montenegro', alpha3: 'MNE', numeric: '499' },
|
|
210
|
+
{ alpha2: 'MS', name: 'Montserrat', alpha3: 'MSR', numeric: '500' },
|
|
211
|
+
{ alpha2: 'MA', name: 'Morocco', alpha3: 'MAR', numeric: '504' },
|
|
212
|
+
{ alpha2: 'MZ', name: 'Mozambique', alpha3: 'MOZ', numeric: '508' },
|
|
213
|
+
{ alpha2: 'MM', name: 'Myanmar', alpha3: 'MMR', numeric: '104' },
|
|
214
|
+
{ alpha2: 'NA', name: 'Namibia', alpha3: 'NAM', numeric: '516' },
|
|
215
|
+
{ alpha2: 'NR', name: 'Nauru', alpha3: 'NRU', numeric: '520' },
|
|
216
|
+
{ alpha2: 'NP', name: 'Nepal', alpha3: 'NPL', numeric: '524' },
|
|
217
|
+
{ alpha2: 'NL', name: 'Netherlands', alpha3: 'NLD', numeric: '528' },
|
|
218
|
+
{ alpha2: 'AN', name: 'Netherlands Antilles', alpha3: 'ANT', numeric: '530' },
|
|
219
|
+
{ alpha2: 'NC', name: 'New Caledonia', alpha3: 'NCL', numeric: '540' },
|
|
220
|
+
{ alpha2: 'NZ', name: 'New Zealand', alpha3: 'NZL', numeric: '554' },
|
|
221
|
+
{ alpha2: 'NI', name: 'Nicaragua', alpha3: 'NIC', numeric: '558' },
|
|
222
|
+
{ alpha2: 'NE', name: 'Niger', alpha3: 'NER', numeric: '562' },
|
|
223
|
+
{ alpha2: 'NG', name: 'Nigeria', alpha3: 'NGA', numeric: '566' },
|
|
224
|
+
{ alpha2: 'NU', name: 'Niue', alpha3: 'NIU', numeric: '570' },
|
|
225
|
+
{ alpha2: 'NF', name: 'Norfolk Island', alpha3: 'NFK', numeric: '574' },
|
|
226
|
+
{ alpha2: 'MP', name: 'Northern Mariana Islands', alpha3: 'MNP', numeric: '580' },
|
|
227
|
+
{ alpha2: 'NO', name: 'Norway', alpha3: 'NOR', numeric: '578' },
|
|
228
|
+
{ alpha2: 'OM', name: 'Oman', alpha3: 'OMN', numeric: '512' },
|
|
229
|
+
{ alpha2: 'PK', name: 'Pakistan', alpha3: 'PAK', numeric: '586' },
|
|
230
|
+
{ alpha2: 'PW', name: 'Palau', alpha3: 'PLW', numeric: '585' },
|
|
231
|
+
{ alpha2: 'PS', name: 'Palestinian Territory, Occupied', alpha3: 'PSE', numeric: '275' },
|
|
232
|
+
{ alpha2: 'PA', name: 'Panama', alpha3: 'PAN', numeric: '591' },
|
|
233
|
+
{ alpha2: 'PG', name: 'Papua New Guinea', alpha3: 'PNG', numeric: '598' },
|
|
234
|
+
{ alpha2: 'PY', name: 'Paraguay', alpha3: 'PRY', numeric: '600' },
|
|
235
|
+
{ alpha2: 'PE', name: 'Peru', alpha3: 'PER', numeric: '604' },
|
|
236
|
+
{ alpha2: 'PH', name: 'Philippines', alpha3: 'PHL', numeric: '608' },
|
|
237
|
+
{ alpha2: 'PN', name: 'Pitcairn', alpha3: 'PCN', numeric: '612' },
|
|
238
|
+
{ alpha2: 'PL', name: 'Poland', alpha3: 'POL', numeric: '616' },
|
|
239
|
+
{ alpha2: 'PT', name: 'Portugal', alpha3: 'PRT', numeric: '620' },
|
|
240
|
+
{ alpha2: 'PR', name: 'Puerto Rico', alpha3: 'PRI', numeric: '630' },
|
|
241
|
+
{ alpha2: 'QA', name: 'Qatar', alpha3: 'QAT', numeric: '634' },
|
|
242
|
+
{ alpha2: 'RE', name: 'Reunion', alpha3: 'REU', numeric: '638' },
|
|
243
|
+
{ alpha2: 'RO', name: 'Romania', alpha3: 'ROM', numeric: '642' },
|
|
244
|
+
{ alpha2: 'RU', name: 'Russian Federation', alpha3: 'RUS', numeric: '643' },
|
|
245
|
+
{ alpha2: 'RW', name: 'Rwanda', alpha3: 'RWA', numeric: '646' },
|
|
246
|
+
{ alpha2: 'BL', name: 'Saint Barthélemy', alpha3: 'BLM', numeric: '652' },
|
|
247
|
+
{ alpha2: 'SH', name: 'Saint Helena', alpha3: 'SHN', numeric: '654' },
|
|
248
|
+
{ alpha2: 'KN', name: 'Saint Kitts and Nevis', alpha3: 'KNA', numeric: '659' },
|
|
249
|
+
{ alpha2: 'LC', name: 'Saint Lucia', alpha3: 'LCA', numeric: '662' },
|
|
250
|
+
{ alpha2: 'MF', name: 'Saint Martin (French part)', alpha3: 'MAF', numeric: '663' },
|
|
251
|
+
{ alpha2: 'PM', name: 'Saint Pierre and Miquelon', alpha3: 'SPM', numeric: '666' },
|
|
252
|
+
{ alpha2: 'VC', name: 'Saint Vincent and the Grenadines', alpha3: 'VCT', numeric: '670' },
|
|
253
|
+
{ alpha2: 'WS', name: 'Samoa', alpha3: 'WSM', numeric: '882' },
|
|
254
|
+
{ alpha2: 'SM', name: 'San Marino', alpha3: 'SMR', numeric: '674' },
|
|
255
|
+
{ alpha2: 'ST', name: 'Sao Tome and Principe', alpha3: 'STP', numeric: '678' },
|
|
256
|
+
{ alpha2: 'SA', name: 'Saudi Arabia', alpha3: 'SAU', numeric: '682' },
|
|
257
|
+
{ alpha2: 'SN', name: 'Senegal', alpha3: 'SEN', numeric: '686' },
|
|
258
|
+
{ alpha2: 'RS', name: 'Serbia', alpha3: 'SRB', numeric: '688' },
|
|
259
|
+
{ alpha2: 'SC', name: 'Seychelles', alpha3: 'SYC', numeric: '690' },
|
|
260
|
+
{ alpha2: 'SL', name: 'Sierra Leone', alpha3: 'SLE', numeric: '694' },
|
|
261
|
+
{ alpha2: 'SG', name: 'Singapore', alpha3: 'SGP', numeric: '702' },
|
|
262
|
+
{ alpha2: 'SK', name: 'Slovakia', alpha3: 'SVK', numeric: '703' },
|
|
263
|
+
{ alpha2: 'SI', name: 'Slovenia', alpha3: 'SVN', numeric: '705' },
|
|
264
|
+
{ alpha2: 'SB', name: 'Solomon Islands', alpha3: 'SLB', numeric: '090' },
|
|
265
|
+
{ alpha2: 'SO', name: 'Somalia', alpha3: 'SOM', numeric: '706' },
|
|
266
|
+
{ alpha2: 'ZA', name: 'South Africa', alpha3: 'ZAF', numeric: '710' },
|
|
267
|
+
{ alpha2: 'GS', name: 'South Georgia and the South Sandwich Islands', alpha3: 'SGS', numeric: '239' },
|
|
268
|
+
{ alpha2: 'ES', name: 'Spain', alpha3: 'ESP', numeric: '724' },
|
|
269
|
+
{ alpha2: 'LK', name: 'Sri Lanka', alpha3: 'LKA', numeric: '144' },
|
|
270
|
+
{ alpha2: 'SD', name: 'Sudan', alpha3: 'SDN', numeric: '736' },
|
|
271
|
+
{ alpha2: 'SR', name: 'Suriname', alpha3: 'SUR', numeric: '740' },
|
|
272
|
+
{ alpha2: 'SJ', name: 'Svalbard and Jan Mayen', alpha3: 'SJM', numeric: '744' },
|
|
273
|
+
{ alpha2: 'SZ', name: 'Swaziland', alpha3: 'SWZ', numeric: '748' },
|
|
274
|
+
{ alpha2: 'SE', name: 'Sweden', alpha3: 'SWE', numeric: '752' },
|
|
275
|
+
{ alpha2: 'CH', name: 'Switzerland', alpha3: 'CHE', numeric: '756' },
|
|
276
|
+
{ alpha2: 'SY', name: 'Syrian Arab Republic', alpha3: 'SYR', numeric: '760' },
|
|
277
|
+
{ alpha2: 'TW', name: 'Taiwan, Province of China', alpha3: 'TWN', numeric: '158' },
|
|
278
|
+
{ alpha2: 'TJ', name: 'Tajikistan', alpha3: 'TJK', numeric: '762' },
|
|
279
|
+
{ alpha2: 'TZ', name: 'Tanzania, United Republic of', alpha3: 'TZA', numeric: '834' },
|
|
280
|
+
{ alpha2: 'TH', name: 'Thailand', alpha3: 'THA', numeric: '764' },
|
|
281
|
+
{ alpha2: 'TL', name: 'Timor Leste', alpha3: 'TLS', numeric: '626' },
|
|
282
|
+
{ alpha2: 'TG', name: 'Togo', alpha3: 'TGO', numeric: '768' },
|
|
283
|
+
{ alpha2: 'TK', name: 'Tokelau', alpha3: 'TKL', numeric: '772' },
|
|
284
|
+
{ alpha2: 'TO', name: 'Tonga', alpha3: 'TON', numeric: '776' },
|
|
285
|
+
{ alpha2: 'TT', name: 'Trinidad and Tobago', alpha3: 'TTO', numeric: '780' },
|
|
286
|
+
{ alpha2: 'TN', name: 'Tunisia', alpha3: 'TUN', numeric: '788' },
|
|
287
|
+
{ alpha2: 'TR', name: 'Turkey', alpha3: 'TUR', numeric: '792' },
|
|
288
|
+
{ alpha2: 'TM', name: 'Turkmenistan', alpha3: 'TKM', numeric: '795' },
|
|
289
|
+
{ alpha2: 'TC', name: 'Turks and Caicos Islands', alpha3: 'TCA', numeric: '796' },
|
|
290
|
+
{ alpha2: 'TV', name: 'Tuvalu', alpha3: 'TUV', numeric: '798' },
|
|
291
|
+
{ alpha2: 'UG', name: 'Uganda', alpha3: 'UGA', numeric: '800' },
|
|
292
|
+
{ alpha2: 'UA', name: 'Ukraine', alpha3: 'UKR', numeric: '804' },
|
|
293
|
+
{ alpha2: 'AE', name: 'United Arab Emirates', alpha3: 'ARE', numeric: '784' },
|
|
294
|
+
{ alpha2: 'GB', name: 'United Kingdom', alpha3: 'GBR', numeric: '826' },
|
|
295
|
+
{ alpha2: 'US', name: 'United States', alpha3: 'USA', numeric: '840' },
|
|
296
|
+
{ alpha2: 'UM', name: 'United States Minor Outlying Islands', alpha3: 'UMI', numeric: '581' },
|
|
297
|
+
{ alpha2: 'UY', name: 'Uruguay', alpha3: 'URY', numeric: '858' },
|
|
298
|
+
{ alpha2: 'UZ', name: 'Uzbekistan', alpha3: 'UZB', numeric: '860' },
|
|
299
|
+
{ alpha2: 'VU', name: 'Vanuatu', alpha3: 'VUT', numeric: '548' },
|
|
300
|
+
{ alpha2: 'VE', name: 'Venezuela', alpha3: 'VEN', numeric: '862' },
|
|
301
|
+
{ alpha2: 'VN', name: 'Viet Nam', alpha3: 'VNM', numeric: '704' },
|
|
302
|
+
{ alpha2: 'VG', name: 'Virgin Islands, British', alpha3: 'VGB', numeric: '092' },
|
|
303
|
+
{ alpha2: 'VI', name: 'Virgin Islands, U.S.', alpha3: 'VIR', numeric: '850' },
|
|
304
|
+
{ alpha2: 'WF', name: 'Wallis and Futuna', alpha3: 'WLF', numeric: '876' },
|
|
305
|
+
{ alpha2: 'EH', name: 'Western Sahara', alpha3: 'ESH', numeric: '732' },
|
|
306
|
+
{ alpha2: 'YE', name: 'Yemen', alpha3: 'YEM', numeric: '887' },
|
|
307
|
+
{ alpha2: 'ZM', name: 'Zambia', alpha3: 'ZMB', numeric: '894' },
|
|
308
|
+
{ alpha2: 'ZW', name: 'Zimbabwe', alpha3: 'ZWE', numeric: '716' },
|
|
309
|
+
{ alpha2: 'AX', name: 'Åland Islands', alpha3: 'ALA', numeric: '248' }
|
|
310
|
+
]
|
|
311
|
+
|
|
312
|
+
def self.find(name)
|
|
313
|
+
raise InvalidCountryCodeError, "Cannot lookup country for an empty name" if name.blank?
|
|
314
|
+
|
|
315
|
+
case name.length
|
|
316
|
+
when 2, 3
|
|
317
|
+
upcase_name = name.upcase
|
|
318
|
+
country_code = CountryCode.new(name)
|
|
319
|
+
country = COUNTRIES.detect{|c| c[country_code.format] == upcase_name }
|
|
320
|
+
else
|
|
321
|
+
country = COUNTRIES.detect{|c| c[:name] == name }
|
|
322
|
+
end
|
|
323
|
+
raise InvalidCountryCodeError, "No country could be found for the country #{name}" if country.nil?
|
|
324
|
+
Country.new(country.dup)
|
|
325
|
+
end
|
|
326
|
+
end
|
|
327
|
+
end
|