activemerchant 1.43.3 → 1.44.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -68,6 +68,13 @@ module ActiveMerchant #:nodoc:
|
|
68
68
|
commit(post)
|
69
69
|
end
|
70
70
|
|
71
|
+
def verify(creditcard, options = {})
|
72
|
+
MultiResponse.run(:use_first_response) do |r|
|
73
|
+
r.process { authorize(100, creditcard, options) }
|
74
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
71
78
|
private
|
72
79
|
|
73
80
|
def post_required_fields(transaction_type)
|
@@ -0,0 +1,184 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CashnetGateway < Gateway
|
4
|
+
self.live_url = "https://commerce.cashnet.com/"
|
5
|
+
|
6
|
+
self.supported_countries = ["US"]
|
7
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
8
|
+
self.homepage_url = "http://www.higherone.com/"
|
9
|
+
self.display_name = "Cashnet"
|
10
|
+
self.money_format = :dollars
|
11
|
+
|
12
|
+
# Creates a new CashnetGateway
|
13
|
+
#
|
14
|
+
# ==== Options
|
15
|
+
#
|
16
|
+
# * <tt>:merchant</tt> -- Gateway Merchant (REQUIRED)
|
17
|
+
# * <tt>:operator</tt> -- Operator (REQUIRED)
|
18
|
+
# * <tt>:password</tt> -- Password (REQUIRED)
|
19
|
+
# * <tt>:merchant_gateway_name</tt> -- Site name (REQUIRED)
|
20
|
+
# * <tt>:station</tt> -- Station (defaults to "WEB")
|
21
|
+
# * <tt>:default_item_code</tt> -- Item code (defaults to "FEE")
|
22
|
+
def initialize(options = {})
|
23
|
+
requires!(
|
24
|
+
options,
|
25
|
+
:merchant,
|
26
|
+
:operator,
|
27
|
+
:password,
|
28
|
+
:merchant_gateway_name
|
29
|
+
)
|
30
|
+
options[:default_item_code] ||= "FEE"
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def purchase(money, payment_object, fields = {})
|
35
|
+
post = {}
|
36
|
+
add_creditcard(post, payment_object)
|
37
|
+
add_invoice(post, fields)
|
38
|
+
add_address(post, fields)
|
39
|
+
add_customer_data(post, fields)
|
40
|
+
commit('SALE', money, post)
|
41
|
+
end
|
42
|
+
|
43
|
+
def refund(money, identification, fields = {})
|
44
|
+
fields[:origtx] = identification
|
45
|
+
commit('REFUND', money, fields)
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def commit(action, money, fields)
|
51
|
+
fields[:amount] = amount(money)
|
52
|
+
url = live_url + @options[:merchant_gateway_name]
|
53
|
+
response = parse(ssl_post(url, post_data(action, fields)))
|
54
|
+
|
55
|
+
success = (response[:result] == '0')
|
56
|
+
Response.new(
|
57
|
+
success,
|
58
|
+
CASHNET_CODES[response[:result]],
|
59
|
+
response,
|
60
|
+
test: test?,
|
61
|
+
authorization: (success ? response[:tx] : '')
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
def post_data(action, parameters = {})
|
66
|
+
post = {}
|
67
|
+
post[:command] = action
|
68
|
+
post[:merchant] = @options[:merchant]
|
69
|
+
post[:operator] = @options[:operator]
|
70
|
+
post[:password] = @options[:password]
|
71
|
+
post[:station] = (@options[:station] || "WEB")
|
72
|
+
post[:itemcode] = (options[:item_code] || @options[:default_item_code])
|
73
|
+
post[:custcode] = "ActiveMerchant/#{ActiveMerchant::VERSION}"
|
74
|
+
post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
75
|
+
end
|
76
|
+
|
77
|
+
def add_creditcard(post, creditcard)
|
78
|
+
post[:cardno] = creditcard.number
|
79
|
+
post[:cid] = creditcard.verification_value
|
80
|
+
post[:expdate] = expdate(creditcard)
|
81
|
+
post[:card_name_g] = creditcard.name
|
82
|
+
end
|
83
|
+
|
84
|
+
def add_invoice(post, options)
|
85
|
+
post[:order_number] = options[:order_id] if options[:order_id].present?
|
86
|
+
end
|
87
|
+
|
88
|
+
def add_address(post, options)
|
89
|
+
if address = (options[:shipping_address] || options[:billing_address] || options[:address])
|
90
|
+
post[:addr_g] = String(address[:address1]) + ',' + String(address[:address2])
|
91
|
+
post[:city_g] = address[:city]
|
92
|
+
post[:state_g] = address[:state]
|
93
|
+
post[:zip_g] = address[:zip]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def add_customer_data(post, options)
|
98
|
+
post[:email_g] = options[:email]
|
99
|
+
end
|
100
|
+
|
101
|
+
def expdate(creditcard)
|
102
|
+
year = format(creditcard.year, :two_digits)
|
103
|
+
month = format(creditcard.month, :two_digits)
|
104
|
+
|
105
|
+
"#{month}#{year}"
|
106
|
+
end
|
107
|
+
|
108
|
+
def parse(body)
|
109
|
+
response_data = body.match(/<cngateway>(.*)<\/cngateway>/)[1]
|
110
|
+
Hash[CGI::parse(response_data).map{|k,v| [k.to_sym,v.first]}]
|
111
|
+
end
|
112
|
+
|
113
|
+
def handle_response(response)
|
114
|
+
if (200...300).include?(response.code.to_i)
|
115
|
+
return response.body
|
116
|
+
elsif 302 == response.code.to_i
|
117
|
+
return ssl_get(URI.parse(response['location']))
|
118
|
+
end
|
119
|
+
raise ResponseError.new(response)
|
120
|
+
end
|
121
|
+
|
122
|
+
CASHNET_CODES = {
|
123
|
+
'0' => 'Success',
|
124
|
+
'1' => 'Invalid customer code, no customer code specified',
|
125
|
+
'2' => 'Invalid operator code, no operator specified',
|
126
|
+
'3' => 'Invalid workstation code, no station specified',
|
127
|
+
'4' => 'Invalid item code, no code specified',
|
128
|
+
'5' => 'Negative amount is not allowed',
|
129
|
+
'6' => 'Invalid credit card number, no credit card number provided',
|
130
|
+
'7' => 'Invalid expiration date, no expiration date provided',
|
131
|
+
'8' => 'Please only provide either ACH or credit card information',
|
132
|
+
'9' => 'Invalid ACH account number, no account number provided',
|
133
|
+
'10' => 'Invalid routing/transit number, no routing/transit number provided',
|
134
|
+
'11' => 'Invalid account type, no account type provided',
|
135
|
+
'12' => 'Invalid check digit for routing/transit number',
|
136
|
+
'13' => 'No ACH merchant account set up for the location of the station being used',
|
137
|
+
'21' => 'Invalid merchant code, no merchant code provided',
|
138
|
+
'22' => 'Invalid client code, no client code provided',
|
139
|
+
'23' => 'Invalid password, no password provided',
|
140
|
+
'24' => 'Invalid transaction type, no transaction type provided',
|
141
|
+
'25' => 'Invalid amount, amount not provided',
|
142
|
+
'26' => 'Invalid payment code provided',
|
143
|
+
'27' => 'Invalid version number, version not found',
|
144
|
+
'31' => 'Application amount exceeds account balance',
|
145
|
+
'150' => 'Invalid payment information, no payment information provided',
|
146
|
+
'200' => 'Invalid command',
|
147
|
+
'201' => 'Customer not on file',
|
148
|
+
'205' => 'Invalid operator or password',
|
149
|
+
'206' => 'Operator is not authorized for this function',
|
150
|
+
'208' => 'Customer/PIN authentication unsuccessful',
|
151
|
+
'209' => 'Credit card error',
|
152
|
+
'211' => 'Credit card error',
|
153
|
+
'212' => 'Customer/PIN not on file',
|
154
|
+
'213' => 'Customer information not on file',
|
155
|
+
'215' => 'Old PIN does not validate ',
|
156
|
+
'221' => 'Invalid credit card processor type specified in location or payment code',
|
157
|
+
'222' => 'Credit card processor error',
|
158
|
+
'280' => 'SmartPay transaction not posted',
|
159
|
+
'301' => 'Original transaction not found for this customer',
|
160
|
+
'302' => 'Amount to refund exceeds original payment amount or is missing',
|
161
|
+
'304' => 'Original credit card payment not found or corrupted',
|
162
|
+
'305' => 'Refund amounts should be expressed as positive amounts',
|
163
|
+
'306' => 'Original ACH payment not found',
|
164
|
+
'307' => 'Original electronic payment not found',
|
165
|
+
'308' => 'Invalid original transaction number, original transaction number not found',
|
166
|
+
'310' => 'Refund amount exceeds amount still available for a refund',
|
167
|
+
'321' => 'Store has not been implemented',
|
168
|
+
'501' => 'Unable to roll over batch',
|
169
|
+
'502' => 'Batch not found',
|
170
|
+
'503' => 'Batch information not available',
|
171
|
+
'650' => 'Invalid quick code',
|
172
|
+
'651' => 'Transaction amount does not match amount specified in quick code',
|
173
|
+
'652' => 'Invalid item code in the detail of the quick code',
|
174
|
+
'701' => 'This website has been disabled. Please contact the system administrator.',
|
175
|
+
'702' => 'Improper merchant code. Please contact the system administrator.',
|
176
|
+
'703' => 'This site is temporarily down for maintenance. We regret the inconvenience. Please try again later.',
|
177
|
+
'704' => 'Duplicate item violation. Please contact the system administrator.',
|
178
|
+
'705' => 'An invalid reference type has been passed into the system. Please contact the system administrator',
|
179
|
+
'706' => 'Items violating unique selection have been passed in. Please contact the system administrator.',
|
180
|
+
'999' => 'An unexpected error has occurred. Please consult the event log.'
|
181
|
+
}
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
@@ -33,6 +33,18 @@ module ActiveMerchant #:nodoc:
|
|
33
33
|
commit(build_capture_request(money, authorization, options))
|
34
34
|
end
|
35
35
|
|
36
|
+
def void(authorization, options = {})
|
37
|
+
commit(build_void_request(authorization, options))
|
38
|
+
end
|
39
|
+
|
40
|
+
def refund(money, authorization, options = {})
|
41
|
+
commit(build_authorization_credit_request(money, authorization, options))
|
42
|
+
end
|
43
|
+
|
44
|
+
def credit(money, creditcard, options = {})
|
45
|
+
commit(build_creditcard_credit_request(money, creditcard, options))
|
46
|
+
end
|
47
|
+
|
36
48
|
protected
|
37
49
|
|
38
50
|
def build_sale_request(type, money, creditcard, options = {})
|
@@ -75,6 +87,39 @@ module ActiveMerchant #:nodoc:
|
|
75
87
|
end
|
76
88
|
end
|
77
89
|
|
90
|
+
def build_void_request(authorization, options = {})
|
91
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
92
|
+
|
93
|
+
xml.tag! 'CC5Request' do
|
94
|
+
add_login_tags(xml)
|
95
|
+
xml.tag! 'OrderId', authorization
|
96
|
+
xml.tag! 'Type', 'Void'
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def build_authorization_credit_request(money, authorization, options = {})
|
101
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
102
|
+
|
103
|
+
xml.tag! 'CC5Request' do
|
104
|
+
add_login_tags(xml)
|
105
|
+
xml.tag! 'OrderId', authorization
|
106
|
+
xml.tag! 'Type', 'Credit'
|
107
|
+
add_amount_tags(money, options, xml)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def build_creditcard_credit_request(money, creditcard, options = {})
|
112
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
113
|
+
|
114
|
+
xml.tag! 'CC5Request' do
|
115
|
+
add_login_tags(xml)
|
116
|
+
xml.tag! 'Type', 'Credit'
|
117
|
+
xml.tag! 'Number', creditcard.number
|
118
|
+
|
119
|
+
add_amount_tags(money, options, xml)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
78
123
|
def add_address(xml, address)
|
79
124
|
xml.tag! 'Name', normalize(address[:name])
|
80
125
|
xml.tag! 'Street1', normalize(address[:address1])
|
@@ -101,10 +101,11 @@ module ActiveMerchant #:nodoc:
|
|
101
101
|
# ==== Options
|
102
102
|
#
|
103
103
|
def recurring(identification, options={})
|
104
|
+
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
|
105
|
+
|
104
106
|
commit(build_recurring_request(identification, options))
|
105
107
|
end
|
106
108
|
|
107
|
-
|
108
109
|
private
|
109
110
|
|
110
111
|
def commit(request_xml)
|
@@ -155,7 +156,7 @@ module ActiveMerchant #:nodoc:
|
|
155
156
|
|
156
157
|
def build_recurring_request(identification, options)
|
157
158
|
build_request_xml('Sale') do |xml|
|
158
|
-
xml.tag! 'order' do
|
159
|
+
xml.tag! 'order' do
|
159
160
|
xml.tag!('test', 'true') if test?
|
160
161
|
xml.tag! 'initial_order_id', identification, :type => 'integer'
|
161
162
|
|
@@ -0,0 +1,143 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CommercegateGateway < Gateway
|
4
|
+
self.test_url = self.live_url = 'https://secure.commercegate.com/gateway/nvp'
|
5
|
+
|
6
|
+
self.supported_countries = %w(
|
7
|
+
AD AT AX BE BG CH CY CZ DE DK ES FI FR GB GG
|
8
|
+
GI GR HR HU IE IM IS IT JE LI LT LU LV MC MT
|
9
|
+
NL NO PL PT RO SE SI SK VA
|
10
|
+
)
|
11
|
+
|
12
|
+
self.money_format = :dollars
|
13
|
+
self.default_currency = 'EUR'
|
14
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
15
|
+
self.homepage_url = 'http://www.commercegate.com/'
|
16
|
+
self.display_name = 'CommerceGate'
|
17
|
+
|
18
|
+
def initialize(options = {})
|
19
|
+
requires!(options, :login, :password, :site_id, :offer_id)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def authorize(money, creditcard, options = {})
|
24
|
+
post = {}
|
25
|
+
add_creditcard(post, creditcard)
|
26
|
+
add_auth_purchase_options(post, money, options)
|
27
|
+
commit('AUTH', post)
|
28
|
+
end
|
29
|
+
|
30
|
+
def capture(money, authorization, options = {})
|
31
|
+
post = {}
|
32
|
+
post[:currencyCode] = (options[:currency] || currency(money))
|
33
|
+
post[:amount] = amount(money)
|
34
|
+
post[:transID] = authorization
|
35
|
+
commit('CAPTURE', post)
|
36
|
+
end
|
37
|
+
|
38
|
+
def purchase(money, creditcard, options = {})
|
39
|
+
post = {}
|
40
|
+
add_creditcard(post, creditcard)
|
41
|
+
add_auth_purchase_options(post, money, options)
|
42
|
+
commit('SALE', post)
|
43
|
+
end
|
44
|
+
|
45
|
+
def refund(money, identification, options = {})
|
46
|
+
post = {}
|
47
|
+
post[:currencyCode] = options[:currency] || currency(money)
|
48
|
+
post[:amount] = amount(money)
|
49
|
+
post[:transID] = identification
|
50
|
+
commit('REFUND', post)
|
51
|
+
end
|
52
|
+
|
53
|
+
def void(identification, options = {})
|
54
|
+
post = {}
|
55
|
+
post[:transID] = identification
|
56
|
+
commit('VOID_AUTH', post)
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def add_address(post, address)
|
62
|
+
if address
|
63
|
+
post[:address] = address[:address1]
|
64
|
+
post[:city] = address[:city]
|
65
|
+
post[:state] = address[:state]
|
66
|
+
post[:postalCode] = address[:zip]
|
67
|
+
end
|
68
|
+
post[:countryCode] = ((address && address[:country]) || "US")
|
69
|
+
end
|
70
|
+
|
71
|
+
def add_auth_purchase_options(post, money, options)
|
72
|
+
add_address(post, options[:address])
|
73
|
+
|
74
|
+
post[:customerIP] = options[:ip] || "127.0.0.1"
|
75
|
+
post[:amount] = amount(money)
|
76
|
+
post[:email] = options[:email] || "unknown@example.com"
|
77
|
+
post[:currencyCode]= options[:currency] || currency(money)
|
78
|
+
post[:merchAcct] = options[:merchant]
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
def add_creditcard(params, creditcard)
|
83
|
+
params[:firstName] = creditcard.first_name
|
84
|
+
params[:lastName] = creditcard.last_name
|
85
|
+
params[:cardNumber] = creditcard.number
|
86
|
+
params[:expiryMonth] = creditcard.month
|
87
|
+
params[:expiryYear] = creditcard.year
|
88
|
+
params[:cvv] = creditcard.verification_value if creditcard.verification_value?
|
89
|
+
end
|
90
|
+
|
91
|
+
def commit(action, parameters)
|
92
|
+
parameters[:apiUsername] = @options[:login]
|
93
|
+
parameters[:apiPassword] = @options[:password]
|
94
|
+
parameters[:siteID] = @options[:site_id]
|
95
|
+
parameters[:offerID] = @options[:offer_id]
|
96
|
+
parameters[:action] = action
|
97
|
+
|
98
|
+
response = parse(ssl_post(self.live_url, post_data(parameters)))
|
99
|
+
|
100
|
+
Response.new(
|
101
|
+
successful?(response),
|
102
|
+
message_from(response),
|
103
|
+
response,
|
104
|
+
authorization: response['transID'],
|
105
|
+
test: test?,
|
106
|
+
avs_result: {code: response['avsCode']},
|
107
|
+
cvv_result: response['cvvCode']
|
108
|
+
)
|
109
|
+
end
|
110
|
+
|
111
|
+
def parse(body)
|
112
|
+
results = {}
|
113
|
+
|
114
|
+
body.split(/\&/).each do |pair|
|
115
|
+
key,val = pair.split(%r{=})
|
116
|
+
results[key] = CGI.unescape(val)
|
117
|
+
end
|
118
|
+
|
119
|
+
results
|
120
|
+
end
|
121
|
+
|
122
|
+
def successful?(response)
|
123
|
+
response['returnCode'] == '0'
|
124
|
+
end
|
125
|
+
|
126
|
+
def message_from(response)
|
127
|
+
if response['returnText'].present?
|
128
|
+
response['returnText']
|
129
|
+
else
|
130
|
+
"Invalid response received from the CommerceGate API. " +
|
131
|
+
"Please contact CommerceGate support if you continue to receive this message. " +
|
132
|
+
"(The raw response returned by the API was #{response.inspect})"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
def post_data(parameters)
|
137
|
+
parameters.collect do |key, value|
|
138
|
+
"#{key}=#{CGI.escape(value.to_s)}"
|
139
|
+
end.join("&")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
|
|
12
12
|
|
13
13
|
def initialize(options = {})
|
14
14
|
requires!(options, :key)
|
15
|
-
options[:version] ||= '0.
|
15
|
+
options[:version] ||= '0.3.0'
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
@@ -55,41 +55,22 @@ module ActiveMerchant #:nodoc:
|
|
55
55
|
commit(:post, "charges/#{identifier}/refund", post)
|
56
56
|
end
|
57
57
|
|
58
|
-
def store(creditcard, options = {})
|
59
|
-
post = {}
|
60
|
-
add_payment_source(post, creditcard, options)
|
61
|
-
post[:name] = options[:name]
|
62
|
-
post[:email] = options[:email]
|
63
|
-
|
64
|
-
path = if options[:customer]
|
65
|
-
"customers/#{CGI.escape(options[:customer])}"
|
66
|
-
else
|
67
|
-
'customers'
|
68
|
-
end
|
69
|
-
|
70
|
-
commit(:post, path, post)
|
71
|
-
end
|
72
|
-
|
73
|
-
def unstore(customer_id, options = {})
|
74
|
-
commit(:delete, "customers/#{CGI.escape(customer_id)}", nil)
|
75
|
-
end
|
76
|
-
|
77
58
|
private
|
78
59
|
|
79
60
|
def add_order(post, money, options)
|
80
61
|
post[:description] = options[:description] || "Active Merchant Purchase"
|
81
|
-
post[:reference_id] = options[:order_id]
|
62
|
+
post[:reference_id] = options[:order_id] if options[:order_id]
|
82
63
|
post[:currency] = (options[:currency] || currency(money)).downcase
|
83
64
|
post[:amount] = amount(money)
|
84
65
|
end
|
85
66
|
|
86
67
|
def add_details_data(post, options)
|
87
68
|
details = {}
|
88
|
-
details[:name] = options[:customer]
|
89
|
-
details[:email] = options[:email]
|
90
|
-
details[:phone] = options[:phone]
|
91
|
-
details[:device_fingerprint] = options[:device_fingerprint]
|
92
|
-
details[:ip] = options[:ip]
|
69
|
+
details[:name] = options[:customer] if options[:customer]
|
70
|
+
details[:email] = options[:email] if options[:email]
|
71
|
+
details[:phone] = options[:phone] if options[:phone]
|
72
|
+
details[:device_fingerprint] = options[:device_fingerprint] if options[:device_fingerprint]
|
73
|
+
details[:ip] = options[:ip] if options[:ip]
|
93
74
|
add_billing_address(details, options)
|
94
75
|
add_line_items(details, options)
|
95
76
|
add_shipment(details, options)
|
@@ -99,24 +80,25 @@ module ActiveMerchant #:nodoc:
|
|
99
80
|
|
100
81
|
def add_shipment(post, options)
|
101
82
|
shipment = {}
|
102
|
-
shipment[:carrier] = options[:carrier]
|
103
|
-
shipment[:service] = options[:service]
|
104
|
-
shipment[:tracking_number] = options[:tracking_number]
|
105
|
-
shipment[:price] = options[:price]
|
83
|
+
shipment[:carrier] = options[:carrier] if options[:carrier]
|
84
|
+
shipment[:service] = options[:service] if options[:service]
|
85
|
+
shipment[:tracking_number] = options[:tracking_number] if options[:tracking_number]
|
86
|
+
shipment[:price] = options[:price] if options[:price]
|
106
87
|
add_shipment_address(shipment, options)
|
107
88
|
post[:shipment] = shipment
|
108
89
|
end
|
109
90
|
|
110
91
|
def add_shipment_address(post, options)
|
111
|
-
address =
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
92
|
+
if(address = options[:shipping_address])
|
93
|
+
post[:address] = {}
|
94
|
+
post[:address][:street1] = address[:address1] if address[:address1]
|
95
|
+
post[:address][:street2] = address[:address2] if address[:address2]
|
96
|
+
post[:address][:street3] = address[:address3] if address[:address3]
|
97
|
+
post[:address][:city] = address[:city] if address[:city]
|
98
|
+
post[:address][:state] = address[:state] if address[:state]
|
99
|
+
post[:address][:country] = address[:country] if address[:country]
|
100
|
+
post[:address][:zip] = address[:zip] if address[:zip]
|
101
|
+
end
|
120
102
|
end
|
121
103
|
|
122
104
|
def add_line_items(post, options)
|
@@ -126,45 +108,46 @@ module ActiveMerchant #:nodoc:
|
|
126
108
|
end
|
127
109
|
|
128
110
|
def add_billing_address(post, options)
|
129
|
-
address =
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
111
|
+
if(address = (options[:billing_address] || options[:address]))
|
112
|
+
post[:billing_address] = {}
|
113
|
+
post[:billing_address][:street1] = address[:address1] if address[:address1]
|
114
|
+
post[:billing_address][:street2] = address[:address2] if address[:address2]
|
115
|
+
post[:billing_address][:street3] = address[:address3] if address[:address3]
|
116
|
+
post[:billing_address][:city] = address[:city] if address[:city]
|
117
|
+
post[:billing_address][:state] = address[:state] if address[:state]
|
118
|
+
post[:billing_address][:country] = address[:country] if address[:country]
|
119
|
+
post[:billing_address][:zip] = address[:zip] if address[:zip]
|
120
|
+
post[:billing_address][:company_name] = address[:company_name] if address[:company_name]
|
121
|
+
post[:billing_address][:tax_id] = address[:tax_id] if address[:tax_id]
|
122
|
+
post[:billing_address][:name] = address[:name] if address[:name]
|
123
|
+
post[:billing_address][:phone] = address[:phone] if address[:phone]
|
124
|
+
post[:billing_address][:email] = address[:email] if address[:email]
|
125
|
+
end
|
143
126
|
end
|
144
127
|
|
145
128
|
def add_address(post, options)
|
146
|
-
address =
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
129
|
+
if(address = (options[:billing_address] || options[:address]))
|
130
|
+
post[:address] = {}
|
131
|
+
post[:address][:street1] = address[:address1] if address[:address1]
|
132
|
+
post[:address][:street2] = address[:address2] if address[:address2]
|
133
|
+
post[:address][:street3] = address[:address3] if address[:address3]
|
134
|
+
post[:address][:city] = address[:city] if address[:city]
|
135
|
+
post[:address][:state] = address[:state] if address[:state]
|
136
|
+
post[:address][:country] = address[:country] if address[:country]
|
137
|
+
post[:address][:zip] = address[:zip] if address[:zip]
|
138
|
+
end
|
155
139
|
end
|
156
140
|
|
157
141
|
def add_payment_source(post, payment_source, options)
|
158
142
|
if payment_source.kind_of?(String)
|
159
143
|
post[:card] = payment_source
|
160
144
|
elsif payment_source.respond_to?(:number)
|
161
|
-
card = {}
|
162
|
-
card[:name] = payment_source.name
|
163
|
-
card[:cvc] = payment_source.verification_value
|
164
|
-
card[:number] = payment_source.number
|
165
|
-
card[:exp_month] = "#{sprintf("%02d", payment_source.month)}"
|
166
|
-
card[:exp_year] = "#{"#{payment_source.year}"[-2, 2]}"
|
167
|
-
post[:card] = card
|
145
|
+
post[:card] = {}
|
146
|
+
post[:card][:name] = payment_source.name
|
147
|
+
post[:card][:cvc] = payment_source.verification_value
|
148
|
+
post[:card][:number] = payment_source.number
|
149
|
+
post[:card][:exp_month] = "#{sprintf("%02d", payment_source.month)}"
|
150
|
+
post[:card][:exp_year] = "#{"#{payment_source.year}"[-2, 2]}"
|
168
151
|
add_address(post[:card], options)
|
169
152
|
end
|
170
153
|
end
|
@@ -175,20 +158,12 @@ module ActiveMerchant #:nodoc:
|
|
175
158
|
end
|
176
159
|
|
177
160
|
def headers(meta)
|
178
|
-
@@ua ||= JSON.dump({
|
179
|
-
:bindings_version => ActiveMerchant::VERSION,
|
180
|
-
:lang => 'ruby',
|
181
|
-
:lang_version => "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})",
|
182
|
-
:platform => RUBY_PLATFORM,
|
183
|
-
:publisher => 'active_merchant'
|
184
|
-
})
|
185
|
-
|
186
161
|
{
|
187
162
|
"Accept" => "application/vnd.conekta-v#{options[:version]}+json",
|
188
163
|
"Authorization" => "Basic " + Base64.encode64("#{options[:key]}:"),
|
189
164
|
"RaiseHtmlError" => "false",
|
190
|
-
"User-Agent" => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
191
|
-
"X-Conekta-Client-User-Agent" =>
|
165
|
+
"Conekta-Client-User-Agent" => {"agent"=>"Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
|
166
|
+
"X-Conekta-Client-User-Agent" => user_agent,
|
192
167
|
"X-Conekta-Client-User-Metadata" => meta.to_json
|
193
168
|
}
|
194
169
|
end
|
@@ -208,8 +183,8 @@ module ActiveMerchant #:nodoc:
|
|
208
183
|
success,
|
209
184
|
raw_response["message"],
|
210
185
|
raw_response,
|
211
|
-
:
|
212
|
-
:
|
186
|
+
test: test?,
|
187
|
+
authorization: raw_response["id"]
|
213
188
|
)
|
214
189
|
end
|
215
190
|
|