tanga_activemerchant 1.37.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +1202 -0
- data/CONTRIBUTORS +414 -0
- data/MIT-LICENSE +20 -0
- data/README.md +221 -0
- data/gem-public_cert.pem +20 -0
- data/lib/active_merchant/billing/avs_result.rb +98 -0
- data/lib/active_merchant/billing/base.rb +57 -0
- data/lib/active_merchant/billing/check.rb +69 -0
- data/lib/active_merchant/billing/credit_card.rb +283 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +21 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +143 -0
- data/lib/active_merchant/billing/cvv_result.rb +38 -0
- data/lib/active_merchant/billing/expiry_date.rb +34 -0
- data/lib/active_merchant/billing/gateway.rb +181 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +725 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +956 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +468 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +105 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +314 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +393 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +169 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +54 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +501 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +142 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +401 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +23 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +225 -0
- data/lib/active_merchant/billing/gateways/card_stream_modern.rb +155 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +156 -0
- data/lib/active_merchant/billing/gateways/certo_direct.rb +277 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +639 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +591 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +230 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +312 -0
- data/lib/active_merchant/billing/gateways/epay.rb +275 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +308 -0
- data/lib/active_merchant/billing/gateways/eway.rb +225 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +291 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +320 -0
- data/lib/active_merchant/billing/gateways/exact.rb +218 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +173 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +167 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +176 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +314 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +257 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +207 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +35 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +249 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +13 -0
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +29 -0
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +66 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +221 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +163 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +262 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +447 -0
- data/lib/active_merchant/billing/gateways/litle.rb +554 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +176 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +115 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +322 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +275 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +191 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +311 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +322 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/migs.rb +265 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +219 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +244 -0
- data/lib/active_merchant/billing/gateways/moneris_us.rb +208 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +277 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +193 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +181 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +197 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +20 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +421 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +297 -0
- data/lib/active_merchant/billing/gateways/orbital/avs_result.rb +93 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +46 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +633 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +261 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +396 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +119 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +196 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +209 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +39 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +268 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +224 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +15 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +21 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +179 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +670 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +61 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +248 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +106 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +43 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +239 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +199 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/pin.rb +165 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +294 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +303 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +292 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +276 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +335 -0
- data/lib/active_merchant/billing/gateways/realex.rb +303 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +394 -0
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +93 -0
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +114 -0
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +102 -0
- data/lib/active_merchant/billing/gateways/sage.rb +152 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +324 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +143 -0
- data/lib/active_merchant/billing/gateways/samurai.rb +118 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +261 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +28 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +279 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +112 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +453 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +272 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +233 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +316 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +126 -0
- data/lib/active_merchant/billing/gateways/transax.rb +23 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +239 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +421 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +25 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1501 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +201 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +232 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +189 -0
- data/lib/active_merchant/billing/gateways/vindicia.rb +361 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +57 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +313 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +303 -0
- data/lib/active_merchant/billing/gateways.rb +17 -0
- data/lib/active_merchant/billing/integrations/a1agregator/helper.rb +31 -0
- data/lib/active_merchant/billing/integrations/a1agregator/notification.rb +186 -0
- data/lib/active_merchant/billing/integrations/a1agregator/status.rb +38 -0
- data/lib/active_merchant/billing/integrations/a1agregator.rb +26 -0
- data/lib/active_merchant/billing/integrations/action_view_helper.rb +73 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/helper.rb +229 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim/notification.rb +340 -0
- data/lib/active_merchant/billing/integrations/authorize_net_sim.rb +38 -0
- data/lib/active_merchant/billing/integrations/bogus/helper.rb +17 -0
- data/lib/active_merchant/billing/integrations/bogus/notification.rb +11 -0
- data/lib/active_merchant/billing/integrations/bogus/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/bogus.rb +23 -0
- data/lib/active_merchant/billing/integrations/chronopay/helper.rb +120 -0
- data/lib/active_merchant/billing/integrations/chronopay/notification.rb +158 -0
- data/lib/active_merchant/billing/integrations/chronopay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/chronopay.rb +23 -0
- data/lib/active_merchant/billing/integrations/direc_pay/helper.rb +200 -0
- data/lib/active_merchant/billing/integrations/direc_pay/notification.rb +76 -0
- data/lib/active_merchant/billing/integrations/direc_pay/return.rb +32 -0
- data/lib/active_merchant/billing/integrations/direc_pay/status.rb +37 -0
- data/lib/active_merchant/billing/integrations/direc_pay.rb +41 -0
- data/lib/active_merchant/billing/integrations/directebanking/helper.rb +90 -0
- data/lib/active_merchant/billing/integrations/directebanking/notification.rb +120 -0
- data/lib/active_merchant/billing/integrations/directebanking/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/directebanking.rb +47 -0
- data/lib/active_merchant/billing/integrations/dotpay/helper.rb +77 -0
- data/lib/active_merchant/billing/integrations/dotpay/notification.rb +86 -0
- data/lib/active_merchant/billing/integrations/dotpay/return.rb +11 -0
- data/lib/active_merchant/billing/integrations/dotpay.rb +22 -0
- data/lib/active_merchant/billing/integrations/dwolla/common.rb +23 -0
- data/lib/active_merchant/billing/integrations/dwolla/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/dwolla/notification.rb +64 -0
- data/lib/active_merchant/billing/integrations/dwolla/return.rb +49 -0
- data/lib/active_merchant/billing/integrations/dwolla.rb +23 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans/helper.rb +34 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans/notification.rb +84 -0
- data/lib/active_merchant/billing/integrations/e_payment_plans.rb +48 -0
- data/lib/active_merchant/billing/integrations/easy_pay/common.rb +40 -0
- data/lib/active_merchant/billing/integrations/easy_pay/helper.rb +36 -0
- data/lib/active_merchant/billing/integrations/easy_pay/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/easy_pay.rb +30 -0
- data/lib/active_merchant/billing/integrations/epay/helper.rb +55 -0
- data/lib/active_merchant/billing/integrations/epay/notification.rb +110 -0
- data/lib/active_merchant/billing/integrations/epay.rb +21 -0
- data/lib/active_merchant/billing/integrations/first_data/helper.rb +61 -0
- data/lib/active_merchant/billing/integrations/first_data/notification.rb +56 -0
- data/lib/active_merchant/billing/integrations/first_data.rb +38 -0
- data/lib/active_merchant/billing/integrations/gestpay/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/gestpay/helper.rb +70 -0
- data/lib/active_merchant/billing/integrations/gestpay/notification.rb +85 -0
- data/lib/active_merchant/billing/integrations/gestpay/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/gestpay.rb +25 -0
- data/lib/active_merchant/billing/integrations/helper.rb +117 -0
- data/lib/active_merchant/billing/integrations/hi_trust/helper.rb +58 -0
- data/lib/active_merchant/billing/integrations/hi_trust/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/hi_trust/return.rb +67 -0
- data/lib/active_merchant/billing/integrations/hi_trust.rb +27 -0
- data/lib/active_merchant/billing/integrations/ipay88/helper.rb +114 -0
- data/lib/active_merchant/billing/integrations/ipay88/return.rb +95 -0
- data/lib/active_merchant/billing/integrations/ipay88.rb +19 -0
- data/lib/active_merchant/billing/integrations/liqpay/helper.rb +43 -0
- data/lib/active_merchant/billing/integrations/liqpay/notification.rb +89 -0
- data/lib/active_merchant/billing/integrations/liqpay/return.rb +83 -0
- data/lib/active_merchant/billing/integrations/liqpay.rb +30 -0
- data/lib/active_merchant/billing/integrations/maksuturva/helper.rb +119 -0
- data/lib/active_merchant/billing/integrations/maksuturva/notification.rb +48 -0
- data/lib/active_merchant/billing/integrations/maksuturva.rb +86 -0
- data/lib/active_merchant/billing/integrations/moneybookers/helper.rb +75 -0
- data/lib/active_merchant/billing/integrations/moneybookers/notification.rb +129 -0
- data/lib/active_merchant/billing/integrations/moneybookers.rb +26 -0
- data/lib/active_merchant/billing/integrations/nochex/helper.rb +68 -0
- data/lib/active_merchant/billing/integrations/nochex/notification.rb +94 -0
- data/lib/active_merchant/billing/integrations/nochex/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/nochex.rb +88 -0
- data/lib/active_merchant/billing/integrations/notification.rb +71 -0
- data/lib/active_merchant/billing/integrations/paxum/common.rb +24 -0
- data/lib/active_merchant/billing/integrations/paxum/helper.rb +42 -0
- data/lib/active_merchant/billing/integrations/paxum/notification.rb +33 -0
- data/lib/active_merchant/billing/integrations/paxum.rb +44 -0
- data/lib/active_merchant/billing/integrations/pay_fast/common.rb +42 -0
- data/lib/active_merchant/billing/integrations/pay_fast/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/pay_fast/notification.rb +134 -0
- data/lib/active_merchant/billing/integrations/pay_fast/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/pay_fast.rb +70 -0
- data/lib/active_merchant/billing/integrations/payflow_link/helper.rb +116 -0
- data/lib/active_merchant/billing/integrations/payflow_link/notification.rb +78 -0
- data/lib/active_merchant/billing/integrations/payflow_link.rb +21 -0
- data/lib/active_merchant/billing/integrations/paypal/helper.rb +119 -0
- data/lib/active_merchant/billing/integrations/paypal/notification.rb +227 -0
- data/lib/active_merchant/billing/integrations/paypal/return.rb +10 -0
- data/lib/active_merchant/billing/integrations/paypal.rb +39 -0
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced/helper.rb +15 -0
- data/lib/active_merchant/billing/integrations/paypal_payments_advanced.rb +20 -0
- data/lib/active_merchant/billing/integrations/paysbuy/helper.rb +15 -0
- data/lib/active_merchant/billing/integrations/paysbuy/notification.rb +28 -0
- data/lib/active_merchant/billing/integrations/paysbuy.rb +36 -0
- data/lib/active_merchant/billing/integrations/payu_in/helper.rb +74 -0
- data/lib/active_merchant/billing/integrations/payu_in/notification.rb +165 -0
- data/lib/active_merchant/billing/integrations/payu_in/return.rb +36 -0
- data/lib/active_merchant/billing/integrations/payu_in.rb +43 -0
- data/lib/active_merchant/billing/integrations/platron/helper.rb +32 -0
- data/lib/active_merchant/billing/integrations/platron/notification.rb +113 -0
- data/lib/active_merchant/billing/integrations/platron.rb +28 -0
- data/lib/active_merchant/billing/integrations/pxpay/helper.rb +112 -0
- data/lib/active_merchant/billing/integrations/pxpay/notification.rb +157 -0
- data/lib/active_merchant/billing/integrations/pxpay/return.rb +25 -0
- data/lib/active_merchant/billing/integrations/pxpay.rb +31 -0
- data/lib/active_merchant/billing/integrations/quickpay/helper.rb +74 -0
- data/lib/active_merchant/billing/integrations/quickpay/notification.rb +137 -0
- data/lib/active_merchant/billing/integrations/quickpay.rb +21 -0
- data/lib/active_merchant/billing/integrations/rbkmoney/helper.rb +23 -0
- data/lib/active_merchant/billing/integrations/rbkmoney/notification.rb +91 -0
- data/lib/active_merchant/billing/integrations/rbkmoney.rb +17 -0
- data/lib/active_merchant/billing/integrations/return.rb +42 -0
- data/lib/active_merchant/billing/integrations/robokassa/common.rb +19 -0
- data/lib/active_merchant/billing/integrations/robokassa/helper.rb +50 -0
- data/lib/active_merchant/billing/integrations/robokassa/notification.rb +55 -0
- data/lib/active_merchant/billing/integrations/robokassa/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/robokassa.rb +49 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/encryption.rb +33 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/helper.rb +136 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/notification.rb +210 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form/return.rb +31 -0
- data/lib/active_merchant/billing/integrations/sage_pay_form.rb +37 -0
- data/lib/active_merchant/billing/integrations/two_checkout/helper.rb +91 -0
- data/lib/active_merchant/billing/integrations/two_checkout/notification.rb +139 -0
- data/lib/active_merchant/billing/integrations/two_checkout/return.rb +17 -0
- data/lib/active_merchant/billing/integrations/two_checkout.rb +44 -0
- data/lib/active_merchant/billing/integrations/valitor/helper.rb +86 -0
- data/lib/active_merchant/billing/integrations/valitor/notification.rb +13 -0
- data/lib/active_merchant/billing/integrations/valitor/response_fields.rb +97 -0
- data/lib/active_merchant/billing/integrations/valitor/return.rb +13 -0
- data/lib/active_merchant/billing/integrations/valitor.rb +33 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/helper.rb +88 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut/notification.rb +59 -0
- data/lib/active_merchant/billing/integrations/verkkomaksut.rb +20 -0
- data/lib/active_merchant/billing/integrations/web_pay/common.rb +50 -0
- data/lib/active_merchant/billing/integrations/web_pay/helper.rb +68 -0
- data/lib/active_merchant/billing/integrations/web_pay/notification.rb +51 -0
- data/lib/active_merchant/billing/integrations/web_pay.rb +45 -0
- data/lib/active_merchant/billing/integrations/webmoney/common.rb +17 -0
- data/lib/active_merchant/billing/integrations/webmoney/helper.rb +40 -0
- data/lib/active_merchant/billing/integrations/webmoney/notification.rb +47 -0
- data/lib/active_merchant/billing/integrations/webmoney.rb +43 -0
- data/lib/active_merchant/billing/integrations/world_pay/helper.rb +101 -0
- data/lib/active_merchant/billing/integrations/world_pay/notification.rb +160 -0
- data/lib/active_merchant/billing/integrations/world_pay.rb +34 -0
- data/lib/active_merchant/billing/integrations.rb +17 -0
- data/lib/active_merchant/billing/response.rb +77 -0
- data/lib/active_merchant/billing.rb +9 -0
- data/lib/active_merchant/version.rb +3 -0
- data/lib/active_merchant.rb +63 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/support/gateway_support.rb +65 -0
- data/lib/support/outbound_hosts.rb +25 -0
- data/lib/support/ssl_verify.rb +93 -0
- metadata +506 -0
@@ -0,0 +1,393 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
module BeanstreamCore
|
4
|
+
RECURRING_URL = 'https://www.beanstream.com/scripts/recurring_billing.asp'
|
5
|
+
SECURE_PROFILE_URL = 'https://www.beanstream.com/scripts/payment_profile.asp'
|
6
|
+
|
7
|
+
SP_SERVICE_VERSION = '1.1'
|
8
|
+
|
9
|
+
TRANSACTIONS = {
|
10
|
+
:authorization => 'PA',
|
11
|
+
:purchase => 'P',
|
12
|
+
:capture => 'PAC',
|
13
|
+
:refund => 'R',
|
14
|
+
:void => 'VP',
|
15
|
+
:check_purchase => 'D',
|
16
|
+
:check_refund => 'C',
|
17
|
+
:void_purchase => 'VP',
|
18
|
+
:void_refund => 'VR'
|
19
|
+
}
|
20
|
+
|
21
|
+
PROFILE_OPERATIONS = {
|
22
|
+
:new => 'N',
|
23
|
+
:modify => 'M'
|
24
|
+
}
|
25
|
+
|
26
|
+
CVD_CODES = {
|
27
|
+
'1' => 'M',
|
28
|
+
'2' => 'N',
|
29
|
+
'3' => 'I',
|
30
|
+
'4' => 'S',
|
31
|
+
'5' => 'U',
|
32
|
+
'6' => 'P'
|
33
|
+
}
|
34
|
+
|
35
|
+
AVS_CODES = {
|
36
|
+
'0' => 'R',
|
37
|
+
'5' => 'I',
|
38
|
+
'9' => 'I'
|
39
|
+
}
|
40
|
+
|
41
|
+
PERIODS = {
|
42
|
+
:days => 'D',
|
43
|
+
:weeks => 'W',
|
44
|
+
:months => 'M',
|
45
|
+
:years => 'Y'
|
46
|
+
}
|
47
|
+
|
48
|
+
PERIODICITIES = {
|
49
|
+
:daily => [:days, 1],
|
50
|
+
:weekly => [:weeks, 1],
|
51
|
+
:biweekly => [:weeks, 2],
|
52
|
+
:monthly => [:months, 1],
|
53
|
+
:bimonthly => [:months, 2],
|
54
|
+
:yearly => [:years, 1]
|
55
|
+
}
|
56
|
+
|
57
|
+
RECURRING_OPERATION = {
|
58
|
+
:update => 'M',
|
59
|
+
:cancel => 'C'
|
60
|
+
}
|
61
|
+
|
62
|
+
def self.included(base)
|
63
|
+
base.default_currency = 'CAD'
|
64
|
+
|
65
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
66
|
+
base.supported_countries = ['CA']
|
67
|
+
|
68
|
+
# The card types supported by the payment gateway
|
69
|
+
base.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb]
|
70
|
+
|
71
|
+
# The homepage URL of the gateway
|
72
|
+
base.homepage_url = 'http://www.beanstream.com/'
|
73
|
+
base.live_url = 'https://www.beanstream.com/scripts/process_transaction.asp'
|
74
|
+
|
75
|
+
# The name of the gateway
|
76
|
+
base.display_name = 'Beanstream.com'
|
77
|
+
end
|
78
|
+
|
79
|
+
# Only <tt>:login</tt> is required by default,
|
80
|
+
# which is the merchant's merchant ID. If you'd like to perform void,
|
81
|
+
# capture or refund transactions then you'll also need to add a username
|
82
|
+
# and password to your account under administration -> account settings ->
|
83
|
+
# order settings -> Use username/password validation
|
84
|
+
def initialize(options = {})
|
85
|
+
requires!(options, :login)
|
86
|
+
super
|
87
|
+
end
|
88
|
+
|
89
|
+
def capture(money, authorization, options = {})
|
90
|
+
reference, amount, type = split_auth(authorization)
|
91
|
+
|
92
|
+
post = {}
|
93
|
+
add_amount(post, money)
|
94
|
+
add_reference(post, reference)
|
95
|
+
add_transaction_type(post, :capture)
|
96
|
+
commit(post)
|
97
|
+
end
|
98
|
+
|
99
|
+
def refund(money, source, options = {})
|
100
|
+
post = {}
|
101
|
+
reference, amount, type = split_auth(source)
|
102
|
+
add_reference(post, reference)
|
103
|
+
add_transaction_type(post, refund_action(type))
|
104
|
+
add_amount(post, money)
|
105
|
+
commit(post)
|
106
|
+
end
|
107
|
+
|
108
|
+
def credit(money, source, options = {})
|
109
|
+
deprecated Gateway::CREDIT_DEPRECATION_MESSAGE
|
110
|
+
refund(money, source, options)
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
def purchase_action(source)
|
115
|
+
if source.is_a?(Check)
|
116
|
+
:check_purchase
|
117
|
+
else
|
118
|
+
:purchase
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def add_customer_ip(post, options)
|
123
|
+
post[:customerIP] = options[:ip] if options[:ip]
|
124
|
+
end
|
125
|
+
|
126
|
+
def void_action(original_transaction_type)
|
127
|
+
(original_transaction_type == TRANSACTIONS[:refund]) ? :void_refund : :void_purchase
|
128
|
+
end
|
129
|
+
|
130
|
+
def refund_action(type)
|
131
|
+
(type == TRANSACTIONS[:check_purchase]) ? :check_refund : :refund
|
132
|
+
end
|
133
|
+
|
134
|
+
def secure_profile_action(type)
|
135
|
+
PROFILE_OPERATIONS[type] || PROFILE_OPERATIONS[:new]
|
136
|
+
end
|
137
|
+
|
138
|
+
def split_auth(string)
|
139
|
+
string.split(";")
|
140
|
+
end
|
141
|
+
|
142
|
+
def add_amount(post, money)
|
143
|
+
post[:trnAmount] = amount(money)
|
144
|
+
end
|
145
|
+
|
146
|
+
def add_original_amount(post, amount)
|
147
|
+
post[:trnAmount] = amount
|
148
|
+
end
|
149
|
+
|
150
|
+
def add_reference(post, reference)
|
151
|
+
post[:adjId] = reference
|
152
|
+
end
|
153
|
+
|
154
|
+
def add_address(post, options)
|
155
|
+
prepare_address_for_non_american_countries(options)
|
156
|
+
|
157
|
+
if billing_address = options[:billing_address] || options[:address]
|
158
|
+
post[:ordName] = billing_address[:name]
|
159
|
+
post[:ordEmailAddress] = options[:email]
|
160
|
+
post[:ordPhoneNumber] = billing_address[:phone]
|
161
|
+
post[:ordAddress1] = billing_address[:address1]
|
162
|
+
post[:ordAddress2] = billing_address[:address2]
|
163
|
+
post[:ordCity] = billing_address[:city]
|
164
|
+
post[:ordProvince] = billing_address[:state]
|
165
|
+
post[:ordPostalCode] = billing_address[:zip]
|
166
|
+
post[:ordCountry] = billing_address[:country]
|
167
|
+
end
|
168
|
+
if shipping_address = options[:shipping_address]
|
169
|
+
post[:shipName] = shipping_address[:name]
|
170
|
+
post[:shipEmailAddress] = options[:email]
|
171
|
+
post[:shipPhoneNumber] = shipping_address[:phone]
|
172
|
+
post[:shipAddress1] = shipping_address[:address1]
|
173
|
+
post[:shipAddress2] = shipping_address[:address2]
|
174
|
+
post[:shipCity] = shipping_address[:city]
|
175
|
+
post[:shipProvince] = shipping_address[:state]
|
176
|
+
post[:shipPostalCode] = shipping_address[:zip]
|
177
|
+
post[:shipCountry] = shipping_address[:country]
|
178
|
+
post[:shippingMethod] = shipping_address[:shipping_method]
|
179
|
+
post[:deliveryEstimate] = shipping_address[:delivery_estimate]
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def prepare_address_for_non_american_countries(options)
|
184
|
+
[ options[:billing_address], options[:shipping_address] ].compact.each do |address|
|
185
|
+
unless ['US', 'CA'].include?(address[:country])
|
186
|
+
address[:state] = '--'
|
187
|
+
address[:zip] = '000000' unless address[:zip]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def add_invoice(post, options)
|
193
|
+
post[:trnOrderNumber] = options[:order_id]
|
194
|
+
post[:trnComments] = options[:description]
|
195
|
+
post[:ordItemPrice] = amount(options[:subtotal])
|
196
|
+
post[:ordShippingPrice] = amount(options[:shipping])
|
197
|
+
post[:ordTax1Price] = amount(options[:tax1] || options[:tax])
|
198
|
+
post[:ordTax2Price] = amount(options[:tax2])
|
199
|
+
post[:ref1] = options[:custom]
|
200
|
+
end
|
201
|
+
|
202
|
+
def add_credit_card(post, credit_card)
|
203
|
+
if credit_card
|
204
|
+
post[:trnCardOwner] = credit_card.name
|
205
|
+
post[:trnCardNumber] = credit_card.number
|
206
|
+
post[:trnExpMonth] = format(credit_card.month, :two_digits)
|
207
|
+
post[:trnExpYear] = format(credit_card.year, :two_digits)
|
208
|
+
post[:trnCardCvd] = credit_card.verification_value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def add_check(post, check)
|
213
|
+
# The institution number of the consumer’s financial institution. Required for Canadian dollar EFT transactions.
|
214
|
+
post[:institutionNumber] = check.institution_number
|
215
|
+
|
216
|
+
# The bank transit number of the consumer’s bank account. Required for Canadian dollar EFT transactions.
|
217
|
+
post[:transitNumber] = check.transit_number
|
218
|
+
|
219
|
+
# The routing number of the consumer’s bank account. Required for US dollar EFT transactions.
|
220
|
+
post[:routingNumber] = check.routing_number
|
221
|
+
|
222
|
+
# The account number of the consumer’s bank account. Required for both Canadian and US dollar EFT transactions.
|
223
|
+
post[:accountNumber] = check.account_number
|
224
|
+
end
|
225
|
+
|
226
|
+
def add_secure_profile_variables(post, options = {})
|
227
|
+
post[:serviceVersion] = SP_SERVICE_VERSION
|
228
|
+
post[:responseFormat] = 'QS'
|
229
|
+
post[:cardValidation] = (options[:cardValidation].to_i == 1) || '0'
|
230
|
+
|
231
|
+
post[:operationType] = options[:operationType] || options[:operation] || secure_profile_action(:new)
|
232
|
+
post[:customerCode] = options[:billing_id] || options[:vault_id] || false
|
233
|
+
post[:status] = options[:status]
|
234
|
+
end
|
235
|
+
|
236
|
+
def add_recurring_amount(post, money)
|
237
|
+
post[:amount] = amount(money)
|
238
|
+
end
|
239
|
+
|
240
|
+
def add_recurring_invoice(post, options)
|
241
|
+
post[:rbApplyTax1] = options[:apply_tax1]
|
242
|
+
post[:rbApplyTax2] = options[:apply_tax2]
|
243
|
+
end
|
244
|
+
|
245
|
+
def add_recurring_operation_type(post, operation)
|
246
|
+
post[:operationType] = RECURRING_OPERATION[operation]
|
247
|
+
end
|
248
|
+
|
249
|
+
def add_recurring_service(post, options)
|
250
|
+
post[:serviceVersion] = '1.0'
|
251
|
+
post[:merchantId] = @options[:login]
|
252
|
+
post[:passCode] = @options[:recurring_api_key]
|
253
|
+
post[:rbAccountId] = options[:account_id]
|
254
|
+
end
|
255
|
+
|
256
|
+
def add_recurring_type(post, options)
|
257
|
+
# XXX requires!
|
258
|
+
post[:trnRecurring] = 1
|
259
|
+
period, increment = interval(options)
|
260
|
+
post[:rbBillingPeriod] = PERIODS[period]
|
261
|
+
post[:rbBillingIncrement] = increment
|
262
|
+
|
263
|
+
if options.include? :start_date
|
264
|
+
post[:rbCharge] = 0
|
265
|
+
post[:rbFirstBilling] = options[:start_date].strftime('%m%d%Y')
|
266
|
+
end
|
267
|
+
|
268
|
+
if count = options[:occurrences] || options[:payments]
|
269
|
+
post[:rbExpiry] = (options[:start_date] || Date.current).advance(period => count).strftime('%m%d%Y')
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
def interval(options)
|
274
|
+
if options.include? :periodicity
|
275
|
+
requires!(options, [:periodicity, *PERIODICITIES.keys])
|
276
|
+
PERIODICITIES[options[:periodicity]]
|
277
|
+
elsif options.include? :interval
|
278
|
+
interval = options[:interval]
|
279
|
+
if interval.respond_to? :parts
|
280
|
+
parts = interval.parts
|
281
|
+
raise ArgumentError.new("Cannot recur with mixed interval (#{interval}). Use only one of: days, weeks, months or years") if parts.length > 1
|
282
|
+
parts.first
|
283
|
+
elsif interval.kind_of? Hash
|
284
|
+
requires!(interval, :unit)
|
285
|
+
unit, length = interval.values_at(:unit, :length)
|
286
|
+
length ||= 1
|
287
|
+
[unit, length]
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
def parse(body)
|
293
|
+
results = {}
|
294
|
+
if !body.nil?
|
295
|
+
body.split(/&/).each do |pair|
|
296
|
+
key, val = pair.split(/\=/)
|
297
|
+
results[key.to_sym] = val.nil? ? nil : CGI.unescape(val)
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
# Clean up the message text if there is any
|
302
|
+
if results[:messageText]
|
303
|
+
results[:messageText].gsub!(/<LI>/, "")
|
304
|
+
results[:messageText].gsub!(/(\.)?<br>/, ". ")
|
305
|
+
results[:messageText].strip!
|
306
|
+
end
|
307
|
+
|
308
|
+
results
|
309
|
+
end
|
310
|
+
|
311
|
+
def recurring_parse(data)
|
312
|
+
REXML::Document.new(data).root.elements.to_a.inject({}) do |response, element|
|
313
|
+
response[element.name.to_sym] = element.text
|
314
|
+
response
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
def commit(params, use_profile_api = false)
|
319
|
+
post(post_data(params,use_profile_api),use_profile_api)
|
320
|
+
end
|
321
|
+
|
322
|
+
def recurring_commit(params)
|
323
|
+
recurring_post(post_data(params, false))
|
324
|
+
end
|
325
|
+
|
326
|
+
def post(data, use_profile_api=nil)
|
327
|
+
response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
|
328
|
+
response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
|
329
|
+
build_response(success?(response), message_from(response), response,
|
330
|
+
:test => test? || response[:authCode] == "TEST",
|
331
|
+
:authorization => authorization_from(response),
|
332
|
+
:cvv_result => CVD_CODES[response[:cvdId]],
|
333
|
+
:avs_result => { :code => (AVS_CODES.include? response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
|
334
|
+
)
|
335
|
+
end
|
336
|
+
|
337
|
+
def recurring_post(data)
|
338
|
+
response = recurring_parse(ssl_post(RECURRING_URL, data))
|
339
|
+
build_response(recurring_success?(response), recurring_message_from(response), response)
|
340
|
+
end
|
341
|
+
|
342
|
+
def authorization_from(response)
|
343
|
+
"#{response[:trnId]};#{response[:trnAmount]};#{response[:trnType]}"
|
344
|
+
end
|
345
|
+
|
346
|
+
def message_from(response)
|
347
|
+
response[:messageText] || response[:responseMessage]
|
348
|
+
end
|
349
|
+
|
350
|
+
def recurring_message_from(response)
|
351
|
+
response[:message]
|
352
|
+
end
|
353
|
+
|
354
|
+
def success?(response)
|
355
|
+
response[:responseType] == 'R' || response[:trnApproved] == '1' || response[:responseCode] == '1'
|
356
|
+
end
|
357
|
+
|
358
|
+
def recurring_success?(response)
|
359
|
+
response[:code] == '1'
|
360
|
+
end
|
361
|
+
|
362
|
+
def add_source(post, source)
|
363
|
+
if source.is_a?(String) or source.is_a?(Integer)
|
364
|
+
post[:customerCode] = source
|
365
|
+
else
|
366
|
+
card_brand(source) == "check" ? add_check(post, source) : add_credit_card(post, source)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
def add_transaction_type(post, action)
|
371
|
+
post[:trnType] = TRANSACTIONS[action]
|
372
|
+
end
|
373
|
+
|
374
|
+
def post_data(params, use_profile_api)
|
375
|
+
params[:requestType] = 'BACKEND'
|
376
|
+
if use_profile_api
|
377
|
+
params[:merchantId] = @options[:login]
|
378
|
+
params[:passCode] = @options[:secure_profile_api_key]
|
379
|
+
else
|
380
|
+
params[:username] = @options[:user] if @options[:user]
|
381
|
+
params[:password] = @options[:password] if @options[:password]
|
382
|
+
params[:merchant_id] = @options[:login]
|
383
|
+
end
|
384
|
+
params[:vbvEnabled] = '0'
|
385
|
+
params[:scEnabled] = '0'
|
386
|
+
|
387
|
+
params.reject{|k, v| v.blank?}.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
388
|
+
end
|
389
|
+
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/beanstream/beanstream_core'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
# This class implements the Canadian {Beanstream}[http://www.beanstream.com] payment gateway.
|
6
|
+
# It is also named TD Canada Trust Online Mart payment gateway.
|
7
|
+
# To learn more about the specification of Beanstream gateway, please read the OM_Direct_Interface_API.pdf,
|
8
|
+
# which you can get from your Beanstream account or get from me by email.
|
9
|
+
#
|
10
|
+
# == Supported transaction types by Beanstream:
|
11
|
+
# * +P+ - Purchase
|
12
|
+
# * +PA+ - Pre Authorization
|
13
|
+
# * +PAC+ - Pre Authorization Completion
|
14
|
+
#
|
15
|
+
# == Secure Payment Profiles:
|
16
|
+
# BeanStream supports payment profiles (vaults). This allows you to store cc information with BeanStream and process subsequent transactions with a customer id.
|
17
|
+
# Secure Payment Profiles must be enabled on your account (must be done over the phone).
|
18
|
+
# Your API Access Passcode must be set in Administration => account settings => order settings.
|
19
|
+
# To learn more about storing credit cards with the Beanstream gateway, please read the BEAN_Payment_Profiles.pdf (I had to phone BeanStream to request it.)
|
20
|
+
#
|
21
|
+
# == Notes
|
22
|
+
# * Adding of order products information is not implemented.
|
23
|
+
# * Ensure that country and province data is provided as a code such as "CA", "US", "QC".
|
24
|
+
# * login is the Beanstream merchant ID, username and password should be enabled in your Beanstream account and passed in using the <tt>:user</tt> and <tt>:password</tt> options.
|
25
|
+
# * Test your app with your true merchant id and test credit card information provided in the api pdf document.
|
26
|
+
# * Beanstream does not allow Payment Profiles to be deleted with their API. The accounts are 'closed', but have to be deleted manually.
|
27
|
+
#
|
28
|
+
# Example authorization (Beanstream PA transaction type):
|
29
|
+
#
|
30
|
+
# twenty = 2000
|
31
|
+
# gateway = BeanstreamGateway.new(
|
32
|
+
# :login => '100200000',
|
33
|
+
# :user => 'xiaobozz',
|
34
|
+
# :password => 'password'
|
35
|
+
# )
|
36
|
+
#
|
37
|
+
# credit_card = CreditCard.new(
|
38
|
+
# :number => '4030000010001234',
|
39
|
+
# :month => 8,
|
40
|
+
# :year => 2011,
|
41
|
+
# :first_name => 'xiaobo',
|
42
|
+
# :last_name => 'zzz',
|
43
|
+
# :verification_value => 137
|
44
|
+
# )
|
45
|
+
# response = gateway.authorize(twenty, credit_card,
|
46
|
+
# :order_id => '1234',
|
47
|
+
# :billing_address => {
|
48
|
+
# :name => 'xiaobo zzz',
|
49
|
+
# :phone => '555-555-5555',
|
50
|
+
# :address1 => '1234 Levesque St.',
|
51
|
+
# :address2 => 'Apt B',
|
52
|
+
# :city => 'Montreal',
|
53
|
+
# :state => 'QC',
|
54
|
+
# :country => 'CA',
|
55
|
+
# :zip => 'H2C1X8'
|
56
|
+
# },
|
57
|
+
# :email => 'xiaobozzz@example.com',
|
58
|
+
# :subtotal => 800,
|
59
|
+
# :shipping => 100,
|
60
|
+
# :tax1 => 100,
|
61
|
+
# :tax2 => 100,
|
62
|
+
# :custom => 'reference one'
|
63
|
+
# )
|
64
|
+
class BeanstreamGateway < Gateway
|
65
|
+
include BeanstreamCore
|
66
|
+
|
67
|
+
def authorize(money, source, options = {})
|
68
|
+
post = {}
|
69
|
+
add_amount(post, money)
|
70
|
+
add_invoice(post, options)
|
71
|
+
add_source(post, source)
|
72
|
+
add_address(post, options)
|
73
|
+
add_transaction_type(post, :authorization)
|
74
|
+
add_customer_ip(post, options)
|
75
|
+
commit(post)
|
76
|
+
end
|
77
|
+
|
78
|
+
def purchase(money, source, options = {})
|
79
|
+
post = {}
|
80
|
+
add_amount(post, money)
|
81
|
+
add_invoice(post, options)
|
82
|
+
add_source(post, source)
|
83
|
+
add_address(post, options)
|
84
|
+
add_transaction_type(post, purchase_action(source))
|
85
|
+
add_customer_ip(post, options)
|
86
|
+
commit(post)
|
87
|
+
end
|
88
|
+
|
89
|
+
def void(authorization, options = {})
|
90
|
+
reference, amount, type = split_auth(authorization)
|
91
|
+
|
92
|
+
post = {}
|
93
|
+
add_reference(post, reference)
|
94
|
+
add_original_amount(post, amount)
|
95
|
+
add_transaction_type(post, void_action(type))
|
96
|
+
commit(post)
|
97
|
+
end
|
98
|
+
|
99
|
+
def recurring(money, source, options = {})
|
100
|
+
post = {}
|
101
|
+
add_amount(post, money)
|
102
|
+
add_invoice(post, options)
|
103
|
+
add_credit_card(post, source)
|
104
|
+
add_address(post, options)
|
105
|
+
add_transaction_type(post, purchase_action(source))
|
106
|
+
add_recurring_type(post, options)
|
107
|
+
commit(post)
|
108
|
+
end
|
109
|
+
|
110
|
+
def update_recurring(amount, source, options = {})
|
111
|
+
post = {}
|
112
|
+
add_recurring_amount(post, amount)
|
113
|
+
add_recurring_invoice(post, options)
|
114
|
+
add_credit_card(post, source)
|
115
|
+
add_address(post, options)
|
116
|
+
add_recurring_operation_type(post, :update)
|
117
|
+
add_recurring_service(post, options)
|
118
|
+
recurring_commit(post)
|
119
|
+
end
|
120
|
+
|
121
|
+
def cancel_recurring(options = {})
|
122
|
+
post = {}
|
123
|
+
add_recurring_operation_type(post, :cancel)
|
124
|
+
add_recurring_service(post, options)
|
125
|
+
recurring_commit(post)
|
126
|
+
end
|
127
|
+
|
128
|
+
def interac
|
129
|
+
@interac ||= BeanstreamInteracGateway.new(@options)
|
130
|
+
end
|
131
|
+
|
132
|
+
# To match the other stored-value gateways, like TrustCommerce,
|
133
|
+
# store and unstore need to be defined
|
134
|
+
def store(credit_card, options = {})
|
135
|
+
post = {}
|
136
|
+
add_address(post, options)
|
137
|
+
add_credit_card(post, credit_card)
|
138
|
+
add_secure_profile_variables(post,options)
|
139
|
+
commit(post, true)
|
140
|
+
end
|
141
|
+
|
142
|
+
#can't actually delete a secure profile with the supplicaed API. This function sets the status of the profile to closed (C).
|
143
|
+
#Closed profiles will have to removed manually.
|
144
|
+
def delete(vault_id)
|
145
|
+
update(vault_id, false, {:status => "C"})
|
146
|
+
end
|
147
|
+
|
148
|
+
alias_method :unstore, :delete
|
149
|
+
|
150
|
+
# Update the values (such as CC expiration) stored at
|
151
|
+
# the gateway. The CC number must be supplied in the
|
152
|
+
# CreditCard object.
|
153
|
+
def update(vault_id, credit_card, options = {})
|
154
|
+
post = {}
|
155
|
+
add_address(post, options)
|
156
|
+
add_credit_card(post, credit_card)
|
157
|
+
options.merge!({:vault_id => vault_id, :operation => secure_profile_action(:modify)})
|
158
|
+
add_secure_profile_variables(post,options)
|
159
|
+
commit(post, true)
|
160
|
+
end
|
161
|
+
|
162
|
+
private
|
163
|
+
def build_response(*args)
|
164
|
+
Response.new(*args)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/beanstream/beanstream_core'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class BeanstreamInteracResponse < Response
|
6
|
+
def redirect
|
7
|
+
params['pageContents']
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class BeanstreamInteracGateway < Gateway
|
12
|
+
include BeanstreamCore
|
13
|
+
|
14
|
+
# Confirm a transaction posted back from the bank to Beanstream.
|
15
|
+
# Confirming a transaction does not require any credentials,
|
16
|
+
# and in an application with many merchants sharing a funded
|
17
|
+
# URL the application may not yet know which merchant the
|
18
|
+
# post back is for until the response of the confirmation is
|
19
|
+
# received, which contains the order number.
|
20
|
+
def self.confirm(transaction)
|
21
|
+
gateway = new(:login => '')
|
22
|
+
gateway.confirm(transaction)
|
23
|
+
end
|
24
|
+
|
25
|
+
def purchase(money, options = {})
|
26
|
+
post = {}
|
27
|
+
add_amount(post, money)
|
28
|
+
add_invoice(post, options)
|
29
|
+
add_address(post, options)
|
30
|
+
add_interac_details(post, options)
|
31
|
+
add_transaction_type(post, :purchase)
|
32
|
+
commit(post)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Confirm a transaction posted back from the bank to Beanstream.
|
36
|
+
def confirm(transaction)
|
37
|
+
post(transaction)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def add_interac_details(post, options)
|
43
|
+
address = options[:billing_address] || options[:address] || {}
|
44
|
+
post[:trnCardOwner] = address[:name]
|
45
|
+
post[:paymentMethod] = 'IO'
|
46
|
+
end
|
47
|
+
|
48
|
+
def build_response(*args)
|
49
|
+
BeanstreamInteracResponse.new(*args)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|