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,639 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
# See the remote and mocked unit test files for example usage. Pay special
|
4
|
+
# attention to the contents of the options hash.
|
5
|
+
#
|
6
|
+
# Initial setup instructions can be found in
|
7
|
+
# http://cybersource.com/support_center/implementation/downloads/soap_api/SOAP_toolkits.pdf
|
8
|
+
#
|
9
|
+
# Debugging
|
10
|
+
# If you experience an issue with this gateway be sure to examine the
|
11
|
+
# transaction information from a general transaction search inside the
|
12
|
+
# CyberSource Business Center for the full error messages including field
|
13
|
+
# names.
|
14
|
+
#
|
15
|
+
# Important Notes
|
16
|
+
# * For checks you can purchase and store.
|
17
|
+
# * AVS and CVV only work against the production server. You will always
|
18
|
+
# get back X for AVS and no response for CVV against the test server.
|
19
|
+
# * Nexus is the list of states or provinces where you have a physical
|
20
|
+
# presence. Nexus is used to calculate tax. Leave blank to tax everyone.
|
21
|
+
# * If you want to calculate VAT for overseas customers you must supply a
|
22
|
+
# registration number in the options hash as vat_reg_number.
|
23
|
+
# * productCode is a value in the line_items hash that is used to tell
|
24
|
+
# CyberSource what kind of item you are selling. It is used when
|
25
|
+
# calculating tax/VAT.
|
26
|
+
# * All transactions use dollar values.
|
27
|
+
# * To process pinless debit cards throught the pinless debit card
|
28
|
+
# network, your Cybersource merchant account must accept pinless
|
29
|
+
# debit card payments.
|
30
|
+
class CyberSourceGateway < Gateway
|
31
|
+
self.test_url = 'https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor'
|
32
|
+
self.live_url = 'https://ics2ws.ic3.com/commerce/1.x/transactionProcessor'
|
33
|
+
|
34
|
+
XSD_VERSION = "1.69"
|
35
|
+
|
36
|
+
# visa, master, american_express, discover
|
37
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
38
|
+
self.supported_countries = ['US']
|
39
|
+
self.default_currency = 'USD'
|
40
|
+
self.homepage_url = 'http://www.cybersource.com'
|
41
|
+
self.display_name = 'CyberSource'
|
42
|
+
|
43
|
+
# map credit card to the CyberSource expected representation
|
44
|
+
@@credit_card_codes = {
|
45
|
+
:visa => '001',
|
46
|
+
:master => '002',
|
47
|
+
:american_express => '003',
|
48
|
+
:discover => '004'
|
49
|
+
}
|
50
|
+
|
51
|
+
# map response codes to something humans can read
|
52
|
+
@@response_codes = {
|
53
|
+
:r100 => "Successful transaction",
|
54
|
+
:r101 => "Request is missing one or more required fields" ,
|
55
|
+
:r102 => "One or more fields contains invalid data",
|
56
|
+
:r150 => "General failure",
|
57
|
+
:r151 => "The request was received but a server time-out occurred",
|
58
|
+
:r152 => "The request was received, but a service timed out",
|
59
|
+
:r200 => "The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the AVS check",
|
60
|
+
:r201 => "The issuing bank has questions about the request",
|
61
|
+
:r202 => "Expired card",
|
62
|
+
:r203 => "General decline of the card",
|
63
|
+
:r204 => "Insufficient funds in the account",
|
64
|
+
:r205 => "Stolen or lost card",
|
65
|
+
:r207 => "Issuing bank unavailable",
|
66
|
+
:r208 => "Inactive card or card not authorized for card-not-present transactions",
|
67
|
+
:r209 => "American Express Card Identifiction Digits (CID) did not match",
|
68
|
+
:r210 => "The card has reached the credit limit",
|
69
|
+
:r211 => "Invalid card verification number",
|
70
|
+
:r221 => "The customer matched an entry on the processor's negative file",
|
71
|
+
:r230 => "The authorization request was approved by the issuing bank but declined by CyberSource because it did not pass the card verification check",
|
72
|
+
:r231 => "Invalid account number",
|
73
|
+
:r232 => "The card type is not accepted by the payment processor",
|
74
|
+
:r233 => "General decline by the processor",
|
75
|
+
:r234 => "A problem exists with your CyberSource merchant configuration",
|
76
|
+
:r235 => "The requested amount exceeds the originally authorized amount",
|
77
|
+
:r236 => "Processor failure",
|
78
|
+
:r237 => "The authorization has already been reversed",
|
79
|
+
:r238 => "The authorization has already been captured",
|
80
|
+
:r239 => "The requested transaction amount must match the previous transaction amount",
|
81
|
+
:r240 => "The card type sent is invalid or does not correlate with the credit card number",
|
82
|
+
:r241 => "The request ID is invalid",
|
83
|
+
:r242 => "You requested a capture, but there is no corresponding, unused authorization record.",
|
84
|
+
:r243 => "The transaction has already been settled or reversed",
|
85
|
+
:r244 => "The bank account number failed the validation check",
|
86
|
+
:r246 => "The capture or credit is not voidable because the capture or credit information has already been submitted to your processor",
|
87
|
+
:r247 => "You requested a credit for a capture that was previously voided",
|
88
|
+
:r250 => "The request was received, but a time-out occurred with the payment processor",
|
89
|
+
:r254 => "Your CyberSource account is prohibited from processing stand-alone refunds",
|
90
|
+
:r255 => "Your CyberSource account is not configured to process the service in the country you specified"
|
91
|
+
}
|
92
|
+
|
93
|
+
# These are the options that can be used when creating a new CyberSource
|
94
|
+
# Gateway object.
|
95
|
+
#
|
96
|
+
# :login => your username
|
97
|
+
#
|
98
|
+
# :password => the transaction key you generated in the Business Center
|
99
|
+
#
|
100
|
+
# :test => true sets the gateway to test mode
|
101
|
+
#
|
102
|
+
# :vat_reg_number => your VAT registration number
|
103
|
+
#
|
104
|
+
# :nexus => "WI CA QC" sets the states/provinces where you have a physical
|
105
|
+
# presense for tax purposes
|
106
|
+
#
|
107
|
+
# :ignore_avs => true don't want to use AVS so continue processing even
|
108
|
+
# if AVS would have failed
|
109
|
+
#
|
110
|
+
# :ignore_cvv => true don't want to use CVV so continue processing even
|
111
|
+
# if CVV would have failed
|
112
|
+
def initialize(options = {})
|
113
|
+
requires!(options, :login, :password)
|
114
|
+
super
|
115
|
+
end
|
116
|
+
|
117
|
+
# Request an authorization for an amount from CyberSource
|
118
|
+
#
|
119
|
+
# You must supply an :order_id in the options hash
|
120
|
+
def authorize(money, creditcard_or_reference, options = {})
|
121
|
+
requires!(options, :order_id)
|
122
|
+
setup_address_hash(options)
|
123
|
+
commit(build_auth_request(money, creditcard_or_reference, options), options )
|
124
|
+
end
|
125
|
+
|
126
|
+
def auth_reversal(money, identification, options = {})
|
127
|
+
commit(build_auth_reversal_request(money, identification, options), options)
|
128
|
+
end
|
129
|
+
|
130
|
+
# Capture an authorization that has previously been requested
|
131
|
+
def capture(money, authorization, options = {})
|
132
|
+
setup_address_hash(options)
|
133
|
+
commit(build_capture_request(money, authorization, options), options)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Purchase is an auth followed by a capture
|
137
|
+
# You must supply an order_id in the options hash
|
138
|
+
# options[:pinless_debit_card] => true # attempts to process as pinless debit card
|
139
|
+
def purchase(money, payment_method_or_reference, options = {})
|
140
|
+
requires!(options, :order_id)
|
141
|
+
setup_address_hash(options)
|
142
|
+
commit(build_purchase_request(money, payment_method_or_reference, options), options)
|
143
|
+
end
|
144
|
+
|
145
|
+
def void(identification, options = {})
|
146
|
+
commit(build_void_request(identification, options), options)
|
147
|
+
end
|
148
|
+
|
149
|
+
def refund(money, identification, options = {})
|
150
|
+
commit(build_refund_request(money, identification, options), options)
|
151
|
+
end
|
152
|
+
|
153
|
+
# Adds credit to a subscription (stand alone credit).
|
154
|
+
def credit(money, reference, options = {})
|
155
|
+
requires!(options, :order_id)
|
156
|
+
commit(build_credit_request(money, reference, options), options)
|
157
|
+
end
|
158
|
+
|
159
|
+
# Stores a customer subscription/profile with type "on-demand".
|
160
|
+
# To charge the card while creating a profile, pass
|
161
|
+
# options[:setup_fee] => money
|
162
|
+
def store(payment_method, options = {})
|
163
|
+
requires!(options, :order_id)
|
164
|
+
setup_address_hash(options)
|
165
|
+
commit(build_create_subscription_request(payment_method, options), options)
|
166
|
+
end
|
167
|
+
|
168
|
+
# Updates a customer subscription/profile
|
169
|
+
def update(reference, creditcard, options = {})
|
170
|
+
requires!(options, :order_id)
|
171
|
+
setup_address_hash(options)
|
172
|
+
commit(build_update_subscription_request(reference, creditcard, options), options)
|
173
|
+
end
|
174
|
+
|
175
|
+
# Removes a customer subscription/profile
|
176
|
+
def unstore(reference, options = {})
|
177
|
+
requires!(options, :order_id)
|
178
|
+
commit(build_delete_subscription_request(reference, options), options)
|
179
|
+
end
|
180
|
+
|
181
|
+
# Retrieves a customer subscription/profile
|
182
|
+
def retrieve(reference, options = {})
|
183
|
+
requires!(options, :order_id)
|
184
|
+
commit(build_retrieve_subscription_request(reference, options), options)
|
185
|
+
end
|
186
|
+
|
187
|
+
# CyberSource requires that you provide line item information for tax
|
188
|
+
# calculations. If you do not have prices for each item or want to
|
189
|
+
# simplify the situation then pass in one fake line item that costs the
|
190
|
+
# subtotal of the order
|
191
|
+
#
|
192
|
+
# The line_item hash goes in the options hash and should look like
|
193
|
+
#
|
194
|
+
# :line_items => [
|
195
|
+
# {
|
196
|
+
# :declared_value => '1',
|
197
|
+
# :quantity => '2',
|
198
|
+
# :code => 'default',
|
199
|
+
# :description => 'Giant Walrus',
|
200
|
+
# :sku => 'WA323232323232323'
|
201
|
+
# },
|
202
|
+
# {
|
203
|
+
# :declared_value => '6',
|
204
|
+
# :quantity => '1',
|
205
|
+
# :code => 'default',
|
206
|
+
# :description => 'Marble Snowcone',
|
207
|
+
# :sku => 'FAKE1232132113123'
|
208
|
+
# }
|
209
|
+
# ]
|
210
|
+
#
|
211
|
+
# This functionality is only supported by this particular gateway may
|
212
|
+
# be changed at any time
|
213
|
+
def calculate_tax(creditcard, options)
|
214
|
+
requires!(options, :line_items)
|
215
|
+
setup_address_hash(options)
|
216
|
+
commit(build_tax_calculation_request(creditcard, options), options)
|
217
|
+
end
|
218
|
+
|
219
|
+
# Determines if a card can be used for Pinless Debit Card transactions
|
220
|
+
def validate_pinless_debit_card(creditcard, options = {})
|
221
|
+
requires!(options, :order_id)
|
222
|
+
commit(build_validate_pinless_debit_request(creditcard,options), options)
|
223
|
+
end
|
224
|
+
|
225
|
+
private
|
226
|
+
|
227
|
+
# Create all address hash key value pairs so that we still function if we
|
228
|
+
# were only provided with one or two of them
|
229
|
+
def setup_address_hash(options)
|
230
|
+
options[:billing_address] = options[:billing_address] || options[:address] || {}
|
231
|
+
options[:shipping_address] = options[:shipping_address] || {}
|
232
|
+
end
|
233
|
+
|
234
|
+
def build_auth_request(money, creditcard_or_reference, options)
|
235
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
236
|
+
add_payment_method_or_subscription(xml, money, creditcard_or_reference, options)
|
237
|
+
add_auth_service(xml)
|
238
|
+
add_business_rules_data(xml)
|
239
|
+
xml.target!
|
240
|
+
end
|
241
|
+
|
242
|
+
def build_tax_calculation_request(creditcard, options)
|
243
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
244
|
+
add_address(xml, creditcard, options[:billing_address], options, false)
|
245
|
+
add_address(xml, creditcard, options[:shipping_address], options, true)
|
246
|
+
add_line_item_data(xml, options)
|
247
|
+
add_purchase_data(xml, 0, false, options)
|
248
|
+
add_tax_service(xml)
|
249
|
+
add_business_rules_data(xml)
|
250
|
+
xml.target!
|
251
|
+
end
|
252
|
+
|
253
|
+
def build_capture_request(money, authorization, options)
|
254
|
+
order_id, request_id, request_token = authorization.split(";")
|
255
|
+
options[:order_id] = order_id
|
256
|
+
|
257
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
258
|
+
add_purchase_data(xml, money, true, options)
|
259
|
+
add_capture_service(xml, request_id, request_token)
|
260
|
+
add_business_rules_data(xml)
|
261
|
+
xml.target!
|
262
|
+
end
|
263
|
+
|
264
|
+
def build_purchase_request(money, payment_method_or_reference, options)
|
265
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
266
|
+
add_payment_method_or_subscription(xml, money, payment_method_or_reference, options)
|
267
|
+
if !payment_method_or_reference.is_a?(String) && card_brand(payment_method_or_reference) == 'check'
|
268
|
+
add_check_service(xml)
|
269
|
+
else
|
270
|
+
add_purchase_service(xml, options)
|
271
|
+
add_business_rules_data(xml) unless options[:pinless_debit_card]
|
272
|
+
end
|
273
|
+
xml.target!
|
274
|
+
end
|
275
|
+
|
276
|
+
def build_void_request(identification, options)
|
277
|
+
order_id, request_id, request_token = identification.split(";")
|
278
|
+
options[:order_id] = order_id
|
279
|
+
|
280
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
281
|
+
add_void_service(xml, request_id, request_token)
|
282
|
+
xml.target!
|
283
|
+
end
|
284
|
+
|
285
|
+
def build_auth_reversal_request(money, identification, options)
|
286
|
+
order_id, request_id, request_token = identification.split(";")
|
287
|
+
options[:order_id] = order_id
|
288
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
289
|
+
add_purchase_data(xml, money, true, options)
|
290
|
+
add_auth_reversal_service(xml, request_id, request_token)
|
291
|
+
xml.target!
|
292
|
+
end
|
293
|
+
|
294
|
+
def build_refund_request(money, identification, options)
|
295
|
+
order_id, request_id, request_token = identification.split(";")
|
296
|
+
options[:order_id] = order_id
|
297
|
+
|
298
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
299
|
+
add_purchase_data(xml, money, true, options)
|
300
|
+
add_credit_service(xml, request_id, request_token)
|
301
|
+
|
302
|
+
xml.target!
|
303
|
+
end
|
304
|
+
|
305
|
+
def build_credit_request(money, reference, options)
|
306
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
307
|
+
|
308
|
+
add_purchase_data(xml, money, true, options)
|
309
|
+
add_subscription(xml, options, reference)
|
310
|
+
add_credit_service(xml)
|
311
|
+
|
312
|
+
xml.target!
|
313
|
+
end
|
314
|
+
|
315
|
+
def build_create_subscription_request(payment_method, options)
|
316
|
+
options[:subscription] = (options[:subscription] || {}).merge(:frequency => "on-demand", :amount => 0, :automatic_renew => false)
|
317
|
+
|
318
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
319
|
+
add_address(xml, payment_method, options[:billing_address], options)
|
320
|
+
add_purchase_data(xml, options[:setup_fee] || 0, true, options)
|
321
|
+
if card_brand(payment_method) == 'check'
|
322
|
+
add_check(xml, payment_method)
|
323
|
+
add_check_payment_method(xml)
|
324
|
+
add_check_service(xml, options) if options[:setup_fee]
|
325
|
+
else
|
326
|
+
add_creditcard(xml, payment_method)
|
327
|
+
add_creditcard_payment_method(xml)
|
328
|
+
add_purchase_service(xml, options) if options[:setup_fee]
|
329
|
+
end
|
330
|
+
add_subscription(xml, options)
|
331
|
+
add_subscription_create_service(xml, options)
|
332
|
+
add_business_rules_data(xml)
|
333
|
+
xml.target!
|
334
|
+
end
|
335
|
+
|
336
|
+
def build_update_subscription_request(reference, creditcard, options)
|
337
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
338
|
+
add_address(xml, creditcard, options[:billing_address], options) unless options[:billing_address].blank?
|
339
|
+
add_purchase_data(xml, options[:setup_fee], true, options) unless options[:setup_fee].blank?
|
340
|
+
add_creditcard(xml, creditcard) if creditcard
|
341
|
+
add_creditcard_payment_method(xml) if creditcard
|
342
|
+
add_subscription(xml, options, reference)
|
343
|
+
add_subscription_update_service(xml, options)
|
344
|
+
add_business_rules_data(xml)
|
345
|
+
xml.target!
|
346
|
+
end
|
347
|
+
|
348
|
+
def build_delete_subscription_request(reference, options)
|
349
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
350
|
+
add_subscription(xml, options, reference)
|
351
|
+
add_subscription_delete_service(xml, options)
|
352
|
+
xml.target!
|
353
|
+
end
|
354
|
+
|
355
|
+
def build_retrieve_subscription_request(reference, options)
|
356
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
357
|
+
add_subscription(xml, options, reference)
|
358
|
+
add_subscription_retrieve_service(xml, options)
|
359
|
+
xml.target!
|
360
|
+
end
|
361
|
+
|
362
|
+
def build_validate_pinless_debit_request(creditcard,options)
|
363
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
364
|
+
add_creditcard(xml, creditcard)
|
365
|
+
add_validate_pinless_debit_service(xml)
|
366
|
+
xml.target!
|
367
|
+
end
|
368
|
+
|
369
|
+
def add_business_rules_data(xml)
|
370
|
+
xml.tag! 'businessRules' do
|
371
|
+
xml.tag!('ignoreAVSResult', 'true') if @options[:ignore_avs]
|
372
|
+
xml.tag!('ignoreCVResult', 'true') if @options[:ignore_cvv]
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
def add_line_item_data(xml, options)
|
377
|
+
options[:line_items].each_with_index do |value, index|
|
378
|
+
xml.tag! 'item', {'id' => index} do
|
379
|
+
xml.tag! 'unitPrice', amount(value[:declared_value])
|
380
|
+
xml.tag! 'quantity', value[:quantity]
|
381
|
+
xml.tag! 'productCode', value[:code] || 'shipping_only'
|
382
|
+
xml.tag! 'productName', value[:description]
|
383
|
+
xml.tag! 'productSKU', value[:sku]
|
384
|
+
end
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
def add_merchant_data(xml, options)
|
389
|
+
xml.tag! 'merchantID', @options[:login]
|
390
|
+
xml.tag! 'merchantReferenceCode', options[:order_id]
|
391
|
+
xml.tag! 'clientLibrary' ,'Ruby Active Merchant'
|
392
|
+
xml.tag! 'clientLibraryVersion', VERSION
|
393
|
+
xml.tag! 'clientEnvironment' , RUBY_PLATFORM
|
394
|
+
end
|
395
|
+
|
396
|
+
def add_purchase_data(xml, money = 0, include_grand_total = false, options={})
|
397
|
+
xml.tag! 'purchaseTotals' do
|
398
|
+
xml.tag! 'currency', options[:currency] || currency(money)
|
399
|
+
xml.tag!('grandTotalAmount', amount(money)) if include_grand_total
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
def add_address(xml, payment_method, address, options, shipTo = false)
|
404
|
+
requires!(options, :email)
|
405
|
+
|
406
|
+
xml.tag! shipTo ? 'shipTo' : 'billTo' do
|
407
|
+
xml.tag! 'firstName', payment_method.first_name if payment_method
|
408
|
+
xml.tag! 'lastName', payment_method.last_name if payment_method
|
409
|
+
xml.tag! 'street1', address[:address1]
|
410
|
+
xml.tag! 'street2', address[:address2] unless address[:address2].blank?
|
411
|
+
xml.tag! 'city', address[:city]
|
412
|
+
xml.tag! 'state', address[:state]
|
413
|
+
xml.tag! 'postalCode', address[:zip]
|
414
|
+
xml.tag! 'country', address[:country]
|
415
|
+
xml.tag! 'company', address[:company] unless address[:company].blank?
|
416
|
+
xml.tag! 'companyTaxID', address[:companyTaxID] unless address[:company_tax_id].blank?
|
417
|
+
xml.tag! 'phoneNumber', address[:phone_number] unless address[:phone_number].blank?
|
418
|
+
xml.tag! 'email', options[:email]
|
419
|
+
xml.tag! 'driversLicenseNumber', options[:drivers_license_number] unless options[:drivers_license_number].blank?
|
420
|
+
xml.tag! 'driversLicenseState', options[:drivers_license_state] unless options[:drivers_license_state].blank?
|
421
|
+
end
|
422
|
+
end
|
423
|
+
|
424
|
+
def add_creditcard(xml, creditcard)
|
425
|
+
xml.tag! 'card' do
|
426
|
+
xml.tag! 'accountNumber', creditcard.number
|
427
|
+
xml.tag! 'expirationMonth', format(creditcard.month, :two_digits)
|
428
|
+
xml.tag! 'expirationYear', format(creditcard.year, :four_digits)
|
429
|
+
xml.tag!('cvNumber', creditcard.verification_value) unless (@options[:ignore_cvv] || creditcard.verification_value.blank? )
|
430
|
+
xml.tag! 'cardType', @@credit_card_codes[card_brand(creditcard).to_sym]
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
def add_check(xml, check)
|
435
|
+
xml.tag! 'check' do
|
436
|
+
xml.tag! 'accountNumber', check.account_number
|
437
|
+
xml.tag! 'accountType', check.account_type[0]
|
438
|
+
xml.tag! 'bankTransitNumber', check.routing_number
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
def add_tax_service(xml)
|
443
|
+
xml.tag! 'taxService', {'run' => 'true'} do
|
444
|
+
xml.tag!('nexus', @options[:nexus]) unless @options[:nexus].blank?
|
445
|
+
xml.tag!('sellerRegistration', @options[:vat_reg_number]) unless @options[:vat_reg_number].blank?
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
def add_auth_service(xml)
|
450
|
+
xml.tag! 'ccAuthService', {'run' => 'true'}
|
451
|
+
end
|
452
|
+
|
453
|
+
def add_capture_service(xml, request_id, request_token)
|
454
|
+
xml.tag! 'ccCaptureService', {'run' => 'true'} do
|
455
|
+
xml.tag! 'authRequestID', request_id
|
456
|
+
xml.tag! 'authRequestToken', request_token
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
def add_purchase_service(xml, options)
|
461
|
+
if options[:pinless_debit_card]
|
462
|
+
xml.tag! 'pinlessDebitService', {'run' => 'true'}
|
463
|
+
else
|
464
|
+
xml.tag! 'ccAuthService', {'run' => 'true'}
|
465
|
+
xml.tag! 'ccCaptureService', {'run' => 'true'}
|
466
|
+
end
|
467
|
+
end
|
468
|
+
|
469
|
+
def add_void_service(xml, request_id, request_token)
|
470
|
+
xml.tag! 'voidService', {'run' => 'true'} do
|
471
|
+
xml.tag! 'voidRequestID', request_id
|
472
|
+
xml.tag! 'voidRequestToken', request_token
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
def add_auth_reversal_service(xml, request_id, request_token)
|
477
|
+
xml.tag! 'ccAuthReversalService', {'run' => 'true'} do
|
478
|
+
xml.tag! 'authRequestID', request_id
|
479
|
+
xml.tag! 'authRequestToken', request_token
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
def add_credit_service(xml, request_id = nil, request_token = nil)
|
484
|
+
xml.tag! 'ccCreditService', {'run' => 'true'} do
|
485
|
+
xml.tag! 'captureRequestID', request_id if request_id
|
486
|
+
xml.tag! 'captureRequestToken', request_token if request_token
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
def add_check_service(xml)
|
491
|
+
xml.tag! 'ecDebitService', {'run' => 'true'}
|
492
|
+
end
|
493
|
+
|
494
|
+
def add_subscription_create_service(xml, options)
|
495
|
+
xml.tag! 'paySubscriptionCreateService', {'run' => 'true'}
|
496
|
+
end
|
497
|
+
|
498
|
+
def add_subscription_update_service(xml, options)
|
499
|
+
xml.tag! 'paySubscriptionUpdateService', {'run' => 'true'}
|
500
|
+
end
|
501
|
+
|
502
|
+
def add_subscription_delete_service(xml, options)
|
503
|
+
xml.tag! 'paySubscriptionDeleteService', {'run' => 'true'}
|
504
|
+
end
|
505
|
+
|
506
|
+
def add_subscription_retrieve_service(xml, options)
|
507
|
+
xml.tag! 'paySubscriptionRetrieveService', {'run' => 'true'}
|
508
|
+
end
|
509
|
+
|
510
|
+
def add_subscription(xml, options, reference = nil)
|
511
|
+
options[:subscription] ||= {}
|
512
|
+
|
513
|
+
xml.tag! 'recurringSubscriptionInfo' do
|
514
|
+
if reference
|
515
|
+
_, subscription_id, _ = reference.split(";")
|
516
|
+
xml.tag! 'subscriptionID', subscription_id
|
517
|
+
end
|
518
|
+
|
519
|
+
xml.tag! 'status', options[:subscription][:status] if options[:subscription][:status]
|
520
|
+
xml.tag! 'amount', options[:subscription][:amount] if options[:subscription][:amount]
|
521
|
+
xml.tag! 'numberOfPayments', options[:subscription][:occurrences] if options[:subscription][:occurrences]
|
522
|
+
xml.tag! 'automaticRenew', options[:subscription][:automatic_renew] if options[:subscription][:automatic_renew]
|
523
|
+
xml.tag! 'frequency', options[:subscription][:frequency] if options[:subscription][:frequency]
|
524
|
+
xml.tag! 'startDate', options[:subscription][:start_date].strftime("%Y%m%d") if options[:subscription][:start_date]
|
525
|
+
xml.tag! 'endDate', options[:subscription][:end_date].strftime("%Y%m%d") if options[:subscription][:end_date]
|
526
|
+
xml.tag! 'approvalRequired', options[:subscription][:approval_required] || false
|
527
|
+
xml.tag! 'event', options[:subscription][:event] if options[:subscription][:event]
|
528
|
+
xml.tag! 'billPayment', options[:subscription][:bill_payment] if options[:subscription][:bill_payment]
|
529
|
+
end
|
530
|
+
end
|
531
|
+
|
532
|
+
def add_creditcard_payment_method(xml)
|
533
|
+
xml.tag! 'subscription' do
|
534
|
+
xml.tag! 'paymentMethod', "credit card"
|
535
|
+
end
|
536
|
+
end
|
537
|
+
|
538
|
+
def add_check_payment_method(xml)
|
539
|
+
xml.tag! 'subscription' do
|
540
|
+
xml.tag! 'paymentMethod', "check"
|
541
|
+
end
|
542
|
+
end
|
543
|
+
|
544
|
+
def add_payment_method_or_subscription(xml, money, payment_method_or_reference, options)
|
545
|
+
if payment_method_or_reference.is_a?(String)
|
546
|
+
add_purchase_data(xml, money, true, options)
|
547
|
+
add_subscription(xml, options, payment_method_or_reference)
|
548
|
+
elsif card_brand(payment_method_or_reference) == 'check'
|
549
|
+
add_address(xml, payment_method_or_reference, options[:billing_address], options)
|
550
|
+
add_purchase_data(xml, money, true, options)
|
551
|
+
add_check(xml, payment_method_or_reference)
|
552
|
+
else
|
553
|
+
add_address(xml, payment_method_or_reference, options[:billing_address], options)
|
554
|
+
add_purchase_data(xml, money, true, options)
|
555
|
+
add_creditcard(xml, payment_method_or_reference)
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
def add_validate_pinless_debit_service(xml)
|
560
|
+
xml.tag!'pinlessDebitValidateService', {'run' => 'true'}
|
561
|
+
end
|
562
|
+
|
563
|
+
# Where we actually build the full SOAP request using builder
|
564
|
+
def build_request(body, options)
|
565
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
566
|
+
xml.instruct!
|
567
|
+
xml.tag! 's:Envelope', {'xmlns:s' => 'http://schemas.xmlsoap.org/soap/envelope/'} do
|
568
|
+
xml.tag! 's:Header' do
|
569
|
+
xml.tag! 'wsse:Security', {'s:mustUnderstand' => '1', 'xmlns:wsse' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'} do
|
570
|
+
xml.tag! 'wsse:UsernameToken' do
|
571
|
+
xml.tag! 'wsse:Username', @options[:login]
|
572
|
+
xml.tag! 'wsse:Password', @options[:password], 'Type' => 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
576
|
+
xml.tag! 's:Body', {'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema'} do
|
577
|
+
xml.tag! 'requestMessage', {'xmlns' => "urn:schemas-cybersource-com:transaction-data-#{XSD_VERSION}"} do
|
578
|
+
add_merchant_data(xml, options)
|
579
|
+
xml << body
|
580
|
+
end
|
581
|
+
end
|
582
|
+
end
|
583
|
+
xml.target!
|
584
|
+
end
|
585
|
+
|
586
|
+
# Contact CyberSource, make the SOAP request, and parse the reply into a
|
587
|
+
# Response object
|
588
|
+
def commit(request, options)
|
589
|
+
response = parse(ssl_post(test? ? self.test_url : self.live_url, build_request(request, options)))
|
590
|
+
|
591
|
+
success = response[:decision] == "ACCEPT"
|
592
|
+
message = @@response_codes[('r' + response[:reasonCode]).to_sym] rescue response[:message]
|
593
|
+
authorization = success ? [ options[:order_id], response[:requestID], response[:requestToken] ].compact.join(";") : nil
|
594
|
+
|
595
|
+
Response.new(success, message, response,
|
596
|
+
:test => test?,
|
597
|
+
:authorization => authorization,
|
598
|
+
:avs_result => { :code => response[:avsCode] },
|
599
|
+
:cvv_result => response[:cvCode]
|
600
|
+
)
|
601
|
+
end
|
602
|
+
|
603
|
+
# Parse the SOAP response
|
604
|
+
# Technique inspired by the Paypal Gateway
|
605
|
+
def parse(xml)
|
606
|
+
reply = {}
|
607
|
+
xml = REXML::Document.new(xml)
|
608
|
+
if root = REXML::XPath.first(xml, "//c:replyMessage")
|
609
|
+
root.elements.to_a.each do |node|
|
610
|
+
case node.name
|
611
|
+
when 'c:reasonCode'
|
612
|
+
reply[:message] = reply(node.text)
|
613
|
+
else
|
614
|
+
parse_element(reply, node)
|
615
|
+
end
|
616
|
+
end
|
617
|
+
elsif root = REXML::XPath.first(xml, "//soap:Fault")
|
618
|
+
parse_element(reply, root)
|
619
|
+
reply[:message] = "#{reply[:faultcode]}: #{reply[:faultstring]}"
|
620
|
+
end
|
621
|
+
return reply
|
622
|
+
end
|
623
|
+
|
624
|
+
def parse_element(reply, node)
|
625
|
+
if node.has_elements?
|
626
|
+
node.elements.each{|e| parse_element(reply, e) }
|
627
|
+
else
|
628
|
+
if node.parent.name =~ /item/
|
629
|
+
parent = node.parent.name + (node.parent.attributes["id"] ? "_" + node.parent.attributes["id"] : '')
|
630
|
+
reply[(parent + '_' + node.name).to_sym] = node.text
|
631
|
+
else
|
632
|
+
reply[node.name.to_sym] = node.text
|
633
|
+
end
|
634
|
+
end
|
635
|
+
return reply
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|
639
|
+
end
|