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,239 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/paypal/paypal_common_api'
|
2
|
+
require File.dirname(__FILE__) + '/paypal/paypal_express_response'
|
3
|
+
require File.dirname(__FILE__) + '/paypal/paypal_recurring_api'
|
4
|
+
require File.dirname(__FILE__) + '/paypal_express_common'
|
5
|
+
|
6
|
+
module ActiveMerchant #:nodoc:
|
7
|
+
module Billing #:nodoc:
|
8
|
+
class PaypalExpressGateway < Gateway
|
9
|
+
include PaypalCommonAPI
|
10
|
+
include PaypalExpressCommon
|
11
|
+
include PaypalRecurringApi
|
12
|
+
|
13
|
+
NON_STANDARD_LOCALE_CODES = {
|
14
|
+
'DK' => 'da_DK',
|
15
|
+
'IL' => 'he_IL',
|
16
|
+
'ID' => 'id_ID',
|
17
|
+
'JP' => 'jp_JP',
|
18
|
+
'NO' => 'no_NO',
|
19
|
+
'BR' => 'pt_BR',
|
20
|
+
'RU' => 'ru_RU',
|
21
|
+
'SE' => 'sv_SE',
|
22
|
+
'TH' => 'th_TH',
|
23
|
+
'TR' => 'tr_TR',
|
24
|
+
'CN' => 'zh_CN',
|
25
|
+
'HK' => 'zh_HK',
|
26
|
+
'TW' => 'zh_TW'
|
27
|
+
}
|
28
|
+
|
29
|
+
self.test_redirect_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'
|
30
|
+
self.supported_countries = ['US']
|
31
|
+
self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=xpt/merchant/ExpressCheckoutIntro-outside'
|
32
|
+
self.display_name = 'PayPal Express Checkout'
|
33
|
+
|
34
|
+
def setup_authorization(money, options = {})
|
35
|
+
requires!(options, :return_url, :cancel_return_url)
|
36
|
+
|
37
|
+
commit 'SetExpressCheckout', build_setup_request('Authorization', money, options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def setup_purchase(money, options = {})
|
41
|
+
requires!(options, :return_url, :cancel_return_url)
|
42
|
+
|
43
|
+
commit 'SetExpressCheckout', build_setup_request('Sale', money, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def details_for(token)
|
47
|
+
commit 'GetExpressCheckoutDetails', build_get_details_request(token)
|
48
|
+
end
|
49
|
+
|
50
|
+
def authorize(money, options = {})
|
51
|
+
requires!(options, :token, :payer_id)
|
52
|
+
|
53
|
+
commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Authorization', money, options)
|
54
|
+
end
|
55
|
+
|
56
|
+
def purchase(money, options = {})
|
57
|
+
requires!(options, :token, :payer_id)
|
58
|
+
|
59
|
+
commit 'DoExpressCheckoutPayment', build_sale_or_authorization_request('Sale', money, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def store(token, options = {})
|
63
|
+
commit 'CreateBillingAgreement', build_create_billing_agreement_request(token, options)
|
64
|
+
end
|
65
|
+
|
66
|
+
def unstore(token, options = {})
|
67
|
+
commit 'BAUpdate', build_cancel_billing_agreement_request(token)
|
68
|
+
end
|
69
|
+
|
70
|
+
def authorize_reference_transaction(money, options = {})
|
71
|
+
requires!(options, :reference_id, :payment_type, :invoice_id, :description, :ip)
|
72
|
+
|
73
|
+
commit 'DoReferenceTransaction', build_reference_transaction_request('Authorization', money, options)
|
74
|
+
end
|
75
|
+
|
76
|
+
def reference_transaction(money, options = {})
|
77
|
+
requires!(options, :reference_id)
|
78
|
+
|
79
|
+
commit 'DoReferenceTransaction', build_reference_transaction_request('Sale', money, options)
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
def build_get_details_request(token)
|
84
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
85
|
+
xml.tag! 'GetExpressCheckoutDetailsReq', 'xmlns' => PAYPAL_NAMESPACE do
|
86
|
+
xml.tag! 'GetExpressCheckoutDetailsRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
87
|
+
xml.tag! 'n2:Version', API_VERSION
|
88
|
+
xml.tag! 'Token', token
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
xml.target!
|
93
|
+
end
|
94
|
+
|
95
|
+
def build_sale_or_authorization_request(action, money, options)
|
96
|
+
currency_code = options[:currency] || currency(money)
|
97
|
+
|
98
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
99
|
+
xml.tag! 'DoExpressCheckoutPaymentReq', 'xmlns' => PAYPAL_NAMESPACE do
|
100
|
+
xml.tag! 'DoExpressCheckoutPaymentRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
101
|
+
xml.tag! 'n2:Version', API_VERSION
|
102
|
+
xml.tag! 'n2:DoExpressCheckoutPaymentRequestDetails' do
|
103
|
+
xml.tag! 'n2:PaymentAction', action
|
104
|
+
xml.tag! 'n2:Token', options[:token]
|
105
|
+
xml.tag! 'n2:PayerID', options[:payer_id]
|
106
|
+
add_payment_details(xml, money, currency_code, options)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
xml.target!
|
112
|
+
end
|
113
|
+
|
114
|
+
def build_setup_request(action, money, options)
|
115
|
+
currency_code = options[:currency] || currency(money)
|
116
|
+
options[:payment_action] = action
|
117
|
+
options[:express_request] = true
|
118
|
+
options[:shipping_address] ||= options[:address]
|
119
|
+
|
120
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
121
|
+
xml.tag! 'SetExpressCheckoutReq', 'xmlns' => PAYPAL_NAMESPACE do
|
122
|
+
xml.tag! 'SetExpressCheckoutRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
123
|
+
xml.tag! 'n2:Version', API_VERSION
|
124
|
+
xml.tag! 'n2:SetExpressCheckoutRequestDetails' do
|
125
|
+
xml.tag! 'n2:ReturnURL', options[:return_url]
|
126
|
+
xml.tag! 'n2:CancelURL', options[:cancel_return_url]
|
127
|
+
if options[:max_amount]
|
128
|
+
xml.tag! 'n2:MaxAmount', localized_amount(options[:max_amount], currency_code), 'currencyID' => currency_code
|
129
|
+
end
|
130
|
+
xml.tag! 'n2:NoShipping', options[:no_shipping] ? '1' : '0'
|
131
|
+
xml.tag! 'n2:AddressOverride', options[:address_override] ? '1' : '0'
|
132
|
+
xml.tag! 'n2:LocaleCode', locale_code(options[:locale]) unless options[:locale].blank?
|
133
|
+
xml.tag! 'n2:BrandName', options[:brand_name] unless options[:brand_name].blank?
|
134
|
+
# Customization of the payment page
|
135
|
+
xml.tag! 'n2:PageStyle', options[:page_style] unless options[:page_style].blank?
|
136
|
+
xml.tag! 'n2:cpp-header-image', options[:header_image] unless options[:header_image].blank?
|
137
|
+
xml.tag! 'n2:cpp-header-border-color', options[:header_border_color] unless options[:header_border_color].blank?
|
138
|
+
xml.tag! 'n2:cpp-header-back-color', options[:header_background_color] unless options[:header_background_color].blank?
|
139
|
+
xml.tag! 'n2:cpp-payflow-color', options[:background_color] unless options[:background_color].blank?
|
140
|
+
if options[:allow_guest_checkout]
|
141
|
+
xml.tag! 'n2:SolutionType', 'Sole'
|
142
|
+
xml.tag! 'n2:LandingPage', options[:landing_page] || 'Billing'
|
143
|
+
end
|
144
|
+
xml.tag! 'n2:BuyerEmail', options[:email] unless options[:email].blank?
|
145
|
+
|
146
|
+
if options[:billing_agreement]
|
147
|
+
xml.tag! 'n2:BillingAgreementDetails' do
|
148
|
+
xml.tag! 'n2:BillingType', options[:billing_agreement][:type]
|
149
|
+
xml.tag! 'n2:BillingAgreementDescription', options[:billing_agreement][:description]
|
150
|
+
xml.tag! 'n2:PaymentType', options[:billing_agreement][:payment_type] || 'InstantOnly'
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
if !options[:allow_note].nil?
|
155
|
+
xml.tag! 'n2:AllowNote', options[:allow_note] ? '1' : '0'
|
156
|
+
end
|
157
|
+
xml.tag! 'n2:CallbackURL', options[:callback_url] unless options[:callback_url].blank?
|
158
|
+
|
159
|
+
add_payment_details(xml, money, currency_code, options)
|
160
|
+
if options[:shipping_options]
|
161
|
+
options[:shipping_options].each do |shipping_option|
|
162
|
+
xml.tag! 'n2:FlatRateShippingOptions' do
|
163
|
+
xml.tag! 'n2:ShippingOptionIsDefault', shipping_option[:default]
|
164
|
+
xml.tag! 'n2:ShippingOptionAmount', localized_amount(shipping_option[:amount], currency_code), 'currencyID' => currency_code
|
165
|
+
xml.tag! 'n2:ShippingOptionName', shipping_option[:name]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
xml.tag! 'n2:CallbackTimeout', options[:callback_timeout] unless options[:callback_timeout].blank?
|
171
|
+
xml.tag! 'n2:CallbackVersion', options[:callback_version] unless options[:callback_version].blank?
|
172
|
+
|
173
|
+
if options.has_key?(:allow_buyer_optin)
|
174
|
+
xml.tag! 'n2:BuyerEmailOptInEnable', (options[:allow_buyer_optin] ? '1' : '0')
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
xml.target!
|
181
|
+
end
|
182
|
+
|
183
|
+
def build_create_billing_agreement_request(token, options = {})
|
184
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
185
|
+
xml.tag! 'CreateBillingAgreementReq', 'xmlns' => PAYPAL_NAMESPACE do
|
186
|
+
xml.tag! 'CreateBillingAgreementRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
187
|
+
xml.tag! 'n2:Version', API_VERSION
|
188
|
+
xml.tag! 'Token', token
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
xml.target!
|
193
|
+
end
|
194
|
+
|
195
|
+
def build_cancel_billing_agreement_request(token)
|
196
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
197
|
+
xml.tag! 'BillAgreementUpdateReq', 'xmlns' => PAYPAL_NAMESPACE do
|
198
|
+
xml.tag! 'BAUpdateRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
199
|
+
xml.tag! 'n2:Version', API_VERSION
|
200
|
+
xml.tag! 'ReferenceID', token
|
201
|
+
xml.tag! 'BillingAgreementStatus', "Canceled"
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
xml.target!
|
206
|
+
end
|
207
|
+
|
208
|
+
def build_reference_transaction_request(action, money, options)
|
209
|
+
currency_code = options[:currency] || currency(money)
|
210
|
+
|
211
|
+
# I am not sure why it's set like this for express gateway
|
212
|
+
# but I don't want to break the existing behavior
|
213
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
214
|
+
xml.tag! 'DoReferenceTransactionReq', 'xmlns' => PAYPAL_NAMESPACE do
|
215
|
+
xml.tag! 'DoReferenceTransactionRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
216
|
+
xml.tag! 'n2:Version', API_VERSION
|
217
|
+
xml.tag! 'n2:DoReferenceTransactionRequestDetails' do
|
218
|
+
xml.tag! 'n2:ReferenceID', options[:reference_id]
|
219
|
+
xml.tag! 'n2:PaymentAction', action
|
220
|
+
xml.tag! 'n2:PaymentType', options[:payment_type] || 'Any'
|
221
|
+
add_payment_details(xml, money, currency_code, options)
|
222
|
+
xml.tag! 'n2:IPAddress', options[:ip]
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
xml.target!
|
228
|
+
end
|
229
|
+
|
230
|
+
def build_response(success, message, response, options = {})
|
231
|
+
PaypalExpressResponse.new(success, message, response, options)
|
232
|
+
end
|
233
|
+
|
234
|
+
def locale_code(country_code)
|
235
|
+
NON_STANDARD_LOCALE_CODES[country_code] || country_code
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
module PaypalExpressCommon
|
4
|
+
def self.included(base)
|
5
|
+
if base.respond_to?(:class_attribute)
|
6
|
+
base.class_attribute :test_redirect_url
|
7
|
+
base.class_attribute :live_redirect_url
|
8
|
+
else
|
9
|
+
base.class_inheritable_accessor :test_redirect_url
|
10
|
+
base.class_inheritable_accessor :live_redirect_url
|
11
|
+
end
|
12
|
+
base.live_redirect_url = 'https://www.paypal.com/cgibin/webscr'
|
13
|
+
end
|
14
|
+
|
15
|
+
def redirect_url
|
16
|
+
test? ? test_redirect_url : live_redirect_url
|
17
|
+
end
|
18
|
+
|
19
|
+
def redirect_url_for(token, options = {})
|
20
|
+
options = {:review => true, :mobile => false}.update(options)
|
21
|
+
|
22
|
+
cmd = options[:mobile] ? '_express-checkout-mobile' : '_express-checkout'
|
23
|
+
url = "#{redirect_url}?cmd=#{cmd}&token=#{token}"
|
24
|
+
url += '&useraction=commit' unless options[:review]
|
25
|
+
|
26
|
+
url
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PaystationGateway < Gateway
|
4
|
+
|
5
|
+
self.live_url = self.test_url = "https://www.paystation.co.nz/direct/paystation.dll"
|
6
|
+
|
7
|
+
# an "error code" of "0" means "No error - transaction successful"
|
8
|
+
SUCCESSFUL_RESPONSE_CODE = '0'
|
9
|
+
|
10
|
+
# an "error code" of "34" means "Future Payment Stored OK"
|
11
|
+
SUCCESSFUL_FUTURE_PAYMENT = '34'
|
12
|
+
|
13
|
+
# TODO: check this with paystation
|
14
|
+
self.supported_countries = ['NZ']
|
15
|
+
|
16
|
+
# TODO: check this with paystation (amex and diners need to be enabled)
|
17
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club ]
|
18
|
+
|
19
|
+
self.homepage_url = 'http://paystation.co.nz'
|
20
|
+
self.display_name = 'Paystation'
|
21
|
+
|
22
|
+
self.default_currency = 'NZD'
|
23
|
+
self.money_format = :cents
|
24
|
+
|
25
|
+
def initialize(options = {})
|
26
|
+
requires!(options, :paystation_id, :gateway_id)
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def authorize(money, credit_card, options = {})
|
31
|
+
post = new_request
|
32
|
+
|
33
|
+
add_invoice(post, options)
|
34
|
+
add_amount(post, money, options)
|
35
|
+
|
36
|
+
add_credit_card(post, credit_card)
|
37
|
+
|
38
|
+
add_authorize_flag(post, options)
|
39
|
+
|
40
|
+
commit(post)
|
41
|
+
end
|
42
|
+
|
43
|
+
def capture(money, authorization_token, options = {})
|
44
|
+
post = new_request
|
45
|
+
|
46
|
+
add_invoice(post, options)
|
47
|
+
add_amount(post, money, options)
|
48
|
+
|
49
|
+
add_authorization_token(post, authorization_token, options[:credit_card_verification])
|
50
|
+
|
51
|
+
commit(post)
|
52
|
+
end
|
53
|
+
|
54
|
+
def purchase(money, payment_source, options = {})
|
55
|
+
post = new_request
|
56
|
+
|
57
|
+
add_invoice(post, options)
|
58
|
+
add_amount(post, money, options)
|
59
|
+
|
60
|
+
if payment_source.is_a?(String)
|
61
|
+
add_token(post, payment_source)
|
62
|
+
else
|
63
|
+
add_credit_card(post, payment_source)
|
64
|
+
end
|
65
|
+
|
66
|
+
add_customer_data(post, options) if options.has_key?(:customer)
|
67
|
+
|
68
|
+
commit(post)
|
69
|
+
end
|
70
|
+
|
71
|
+
def store(credit_card, options = {})
|
72
|
+
post = new_request
|
73
|
+
|
74
|
+
add_invoice(post, options)
|
75
|
+
add_credit_card(post, credit_card)
|
76
|
+
store_credit_card(post, options)
|
77
|
+
|
78
|
+
commit(post)
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def new_request
|
84
|
+
{
|
85
|
+
:pi => @options[:paystation_id], # paystation account id
|
86
|
+
:gi => @options[:gateway_id], # paystation gateway id
|
87
|
+
"2p" => "t", # two-party transaction type
|
88
|
+
:nr => "t", # -- redirect??
|
89
|
+
:df => "yymm" # date format: optional sometimes, required others
|
90
|
+
}
|
91
|
+
end
|
92
|
+
|
93
|
+
def add_customer_data(post, options)
|
94
|
+
post[:mc] = options[:customer]
|
95
|
+
end
|
96
|
+
|
97
|
+
def add_invoice(post, options)
|
98
|
+
requires!(options, :order_id)
|
99
|
+
|
100
|
+
post[:ms] = options[:order_id] # "Merchant Session", must be unique per request
|
101
|
+
post[:mo] = options[:invoice] # "Order Details", displayed in Paystation Admin
|
102
|
+
post[:mr] = options[:description] # "Merchant Reference Code", seen from Paystation Admin
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_credit_card(post, credit_card)
|
106
|
+
|
107
|
+
post[:cn] = credit_card.number
|
108
|
+
post[:ct] = credit_card.brand
|
109
|
+
post[:ex] = format_date(credit_card.month, credit_card.year)
|
110
|
+
post[:cc] = credit_card.verification_value if credit_card.verification_value?
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
# bill a token (stored via "store") rather than a Credit Card
|
115
|
+
def add_token(post, token)
|
116
|
+
post[:fp] = "t" # turn on "future payments" - what paystation calls Token Billing
|
117
|
+
post[:ft] = token
|
118
|
+
end
|
119
|
+
|
120
|
+
def store_credit_card(post, options)
|
121
|
+
|
122
|
+
post[:fp] = "t" # turn on "future payments" - what paystation calls Token Billing
|
123
|
+
post[:fs] = "t" # tells paystation to store right now, not bill
|
124
|
+
post[:ft] = options[:token] if options[:token] # specify a token to use that, or let Paystation generate one
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
def add_authorize_flag(post, options)
|
129
|
+
post[:pa] = "t" # tells Paystation that this is a pre-auth authorisation payment (account must be in pre-auth mode)
|
130
|
+
end
|
131
|
+
|
132
|
+
def add_authorization_token(post, auth_token, verification_value = nil)
|
133
|
+
post[:cp] = "t" # Capture Payment flag – tells Paystation this transaction should be treated as a capture payment
|
134
|
+
post[:cx] = auth_token
|
135
|
+
post[:cc] = verification_value
|
136
|
+
end
|
137
|
+
|
138
|
+
def add_amount(post, money, options)
|
139
|
+
|
140
|
+
post[:am] = amount(money)
|
141
|
+
post[:cu] = options[:currency] || currency(money)
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
def parse(xml_response)
|
146
|
+
response = {}
|
147
|
+
|
148
|
+
xml = REXML::Document.new(xml_response)
|
149
|
+
|
150
|
+
# for normal payments, the root node is <Response>
|
151
|
+
# for "future payments", it's <PaystationFuturePaymentResponse>
|
152
|
+
xml.elements.each("#{xml.root.name}/*") do |element|
|
153
|
+
response[element.name.underscore.to_sym] = element.text
|
154
|
+
end
|
155
|
+
|
156
|
+
response
|
157
|
+
end
|
158
|
+
|
159
|
+
def commit(post)
|
160
|
+
|
161
|
+
post[:tm] = "T" if test? # test mode
|
162
|
+
|
163
|
+
pstn_prefix_params = post.collect { |key, value| "pstn_#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
164
|
+
|
165
|
+
# need include paystation param as "initiator flag for payment engine"
|
166
|
+
data = ssl_post(self.live_url, "#{pstn_prefix_params}&paystation=_empty")
|
167
|
+
response = parse(data)
|
168
|
+
message = message_from(response)
|
169
|
+
|
170
|
+
PaystationResponse.new(success?(response), message, response,
|
171
|
+
:test => (response[:tm] && response[:tm].downcase == "t"),
|
172
|
+
:authorization => response[:paystation_transaction_id]
|
173
|
+
)
|
174
|
+
end
|
175
|
+
|
176
|
+
def success?(response)
|
177
|
+
(response[:ec] == SUCCESSFUL_RESPONSE_CODE) || (response[:ec] == SUCCESSFUL_FUTURE_PAYMENT)
|
178
|
+
end
|
179
|
+
|
180
|
+
def message_from(response)
|
181
|
+
response[:em]
|
182
|
+
end
|
183
|
+
|
184
|
+
def format_date(month, year)
|
185
|
+
"#{format(year, :two_digits)}#{format(month, :two_digits)}"
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
class PaystationResponse < Response
|
191
|
+
# add a method to response so we can easily get the token
|
192
|
+
# for Validate transactions
|
193
|
+
def token
|
194
|
+
@params["future_payment_token"]
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
@@ -0,0 +1,207 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
class PaywayGateway < Gateway
|
4
|
+
self.live_url = self.test_url = 'https://ccapi.client.qvalent.com/payway/ccapi'
|
5
|
+
|
6
|
+
self.supported_countries = [ 'AU' ]
|
7
|
+
self.supported_cardtypes = [ :visa, :master, :diners_club, :american_express, :bankcard ]
|
8
|
+
self.display_name = 'Pay Way'
|
9
|
+
self.homepage_url = 'http://www.payway.com.au'
|
10
|
+
self.default_currency = 'AUD'
|
11
|
+
self.money_format = :cents
|
12
|
+
|
13
|
+
SUMMARY_CODES = {
|
14
|
+
'0' => 'Approved',
|
15
|
+
'1' => 'Declined',
|
16
|
+
'2' => 'Erred',
|
17
|
+
'3' => 'Rejected'
|
18
|
+
}
|
19
|
+
|
20
|
+
RESPONSE_CODES= {
|
21
|
+
'00' => 'Completed Successfully',
|
22
|
+
'01' => 'Refer to card issuer',
|
23
|
+
'03' => 'Invalid merchant',
|
24
|
+
'04' => 'Pick-up card',
|
25
|
+
'05' => 'Do not honour',
|
26
|
+
'08' => 'Honour only with identification',
|
27
|
+
'12' => 'Invalid transaction',
|
28
|
+
'13' => 'Invalid amount',
|
29
|
+
'14' => 'Invalid card number (no such number)',
|
30
|
+
'30' => 'Format error',
|
31
|
+
'36' => 'Restricted card',
|
32
|
+
'41' => 'Lost card',
|
33
|
+
'42' => 'No universal card',
|
34
|
+
'43' => 'Stolen card',
|
35
|
+
'51' => 'Not sufficient funds',
|
36
|
+
'54' => 'Expired card',
|
37
|
+
'61' => 'Exceeds withdrawal amount limits',
|
38
|
+
'62' => 'Restricted card',
|
39
|
+
'65' => 'Exceeds withdrawal frequency limit',
|
40
|
+
'91' => 'Issuer or switch is inoperative',
|
41
|
+
'92' => 'Financial institution or intermediate network facility cannot be found for routing',
|
42
|
+
'94' => 'Duplicate transmission',
|
43
|
+
'Q1' => 'Unknown Buyer',
|
44
|
+
'Q2' => 'Transaction Pending',
|
45
|
+
'Q3' => 'Payment Gateway Connection Error',
|
46
|
+
'Q4' => 'Payment Gateway Unavailable',
|
47
|
+
'Q5' => 'Invalid Transaction',
|
48
|
+
'Q6' => 'Duplicate Transaction - requery to determine status',
|
49
|
+
'QA' => 'Invalid parameters or Initialisation failed',
|
50
|
+
'QB' => 'Order type not currently supported',
|
51
|
+
'QC' => 'Invalid Order Type',
|
52
|
+
'QD' => 'Invalid Payment Amount - Payment amount less than minimum/exceeds maximum allowed limit',
|
53
|
+
'QE' => 'Internal Error',
|
54
|
+
'QF' => 'Transaction Failed',
|
55
|
+
'QG' => 'Unknown Customer Order Number',
|
56
|
+
'QH' => 'Unknown Customer Username or Password',
|
57
|
+
'QI' => 'Transaction incomplete - contact Westpac to confirm reconciliation',
|
58
|
+
'QJ' => 'Invalid Client Certificate',
|
59
|
+
'QK' => 'Unknown Customer Merchant',
|
60
|
+
'QL' => 'Business Group not configured for customer',
|
61
|
+
'QM' => 'Payment Instrument not configured for customer',
|
62
|
+
'QN' => 'Configuration Error',
|
63
|
+
'QO' => 'Missing Payment Instrument',
|
64
|
+
'QP' => 'Missing Supplier Account',
|
65
|
+
'QQ' => 'Invalid Credit Card Verification Number',
|
66
|
+
'QR' => 'Transaction Retry',
|
67
|
+
'QS' => 'Transaction Successful',
|
68
|
+
'QT' => 'Invalid currency',
|
69
|
+
'QU' => 'Unknown Customer IP Address',
|
70
|
+
'QV' => 'Invalid Original Order Number specified for Refund, Refund amount exceeds capture amount, or Previous capture was not approved',
|
71
|
+
'QW' => 'Invalid Reference Number',
|
72
|
+
'QX' => 'Network Error has occurred',
|
73
|
+
'QY' => 'Card Type Not Accepted',
|
74
|
+
'QZ' => 'Zero value transaction'
|
75
|
+
}
|
76
|
+
|
77
|
+
TRANSACTIONS = {
|
78
|
+
:authorize => 'preauth',
|
79
|
+
:purchase => 'capture',
|
80
|
+
:capture => 'captureWithoutAuth',
|
81
|
+
:status => 'query',
|
82
|
+
:refund => 'refund',
|
83
|
+
:store => 'registerAccount'
|
84
|
+
}
|
85
|
+
|
86
|
+
def initialize(options={})
|
87
|
+
@options = options
|
88
|
+
|
89
|
+
@options[:merchant] ||= 'TEST' if test?
|
90
|
+
requires!(options, :username, :password, :merchant, :pem)
|
91
|
+
|
92
|
+
@options[:eci] ||= 'SSL'
|
93
|
+
end
|
94
|
+
|
95
|
+
def authorize(amount, payment_method, options={})
|
96
|
+
requires!(options, :order_id)
|
97
|
+
|
98
|
+
post = {}
|
99
|
+
add_payment_method(post, payment_method)
|
100
|
+
add_order(post, amount, options)
|
101
|
+
commit(:authorize, post)
|
102
|
+
end
|
103
|
+
|
104
|
+
def capture(amount, authorization, options={})
|
105
|
+
requires!(options, :order_id)
|
106
|
+
|
107
|
+
post = {}
|
108
|
+
add_reference(post, authorization)
|
109
|
+
add_order(post, amount, options)
|
110
|
+
commit(:capture, post)
|
111
|
+
end
|
112
|
+
|
113
|
+
def purchase(amount, payment_method, options={})
|
114
|
+
requires!(options, :order_id)
|
115
|
+
|
116
|
+
post = {}
|
117
|
+
add_payment_method(post, payment_method)
|
118
|
+
add_order(post, amount, options)
|
119
|
+
commit(:purchase, post)
|
120
|
+
end
|
121
|
+
|
122
|
+
def refund(amount, authorization, options={})
|
123
|
+
requires!(options, :order_id)
|
124
|
+
|
125
|
+
post = {}
|
126
|
+
add_reference(post, authorization)
|
127
|
+
add_order(post, amount, options)
|
128
|
+
commit(:refund, post)
|
129
|
+
end
|
130
|
+
|
131
|
+
def store(credit_card, options={})
|
132
|
+
requires!(options, :billing_id)
|
133
|
+
|
134
|
+
post = {}
|
135
|
+
add_payment_method(post, credit_card)
|
136
|
+
add_payment_method(post, options[:billing_id])
|
137
|
+
commit(:store, post)
|
138
|
+
end
|
139
|
+
|
140
|
+
def status(options={})
|
141
|
+
requires!(options, :order_id)
|
142
|
+
|
143
|
+
commit(:status, 'customer.orderNumber' => options[:order_id])
|
144
|
+
end
|
145
|
+
|
146
|
+
private
|
147
|
+
|
148
|
+
def add_payment_method(post, payment_method)
|
149
|
+
if payment_method.respond_to?(:number)
|
150
|
+
post['card.cardHolderName'] = "#{payment_method.first_name} #{payment_method.last_name}"
|
151
|
+
post['card.PAN'] = payment_method.number
|
152
|
+
post['card.CVN'] = payment_method.verification_value
|
153
|
+
post['card.expiryYear'] = payment_method.year.to_s[-2,2]
|
154
|
+
post['card.expiryMonth'] = sprintf('%02d', payment_method.month)
|
155
|
+
else
|
156
|
+
post['customer.customerReferenceNumber'] = payment_method
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def add_reference(post, reference)
|
161
|
+
post['customer.originalOrderNumber'] = reference
|
162
|
+
end
|
163
|
+
|
164
|
+
def add_order(post, amount, options)
|
165
|
+
post['order.ECI'] = @options[:eci]
|
166
|
+
post['order.amount'] = amount
|
167
|
+
post['card.currency'] = (options[:currency] || currency(amount))
|
168
|
+
post['customer.orderNumber'] = options[:order_id][0...20]
|
169
|
+
end
|
170
|
+
|
171
|
+
def add_auth(post)
|
172
|
+
post['customer.username'] = @options[:username]
|
173
|
+
post['customer.password'] = @options[:password]
|
174
|
+
post['customer.merchant'] = @options[:merchant]
|
175
|
+
end
|
176
|
+
|
177
|
+
# Creates the request and returns the summarized result
|
178
|
+
def commit(action, post)
|
179
|
+
add_auth(post)
|
180
|
+
post.merge!('order.type' => TRANSACTIONS[action])
|
181
|
+
|
182
|
+
request = post.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join("&")
|
183
|
+
response = ssl_post(self.live_url, request)
|
184
|
+
|
185
|
+
params = {}
|
186
|
+
CGI.parse(response).each_pair do |key, value|
|
187
|
+
actual_key = key.split(".").last
|
188
|
+
params[actual_key.underscore.to_sym] = value[0]
|
189
|
+
end
|
190
|
+
|
191
|
+
message = "#{SUMMARY_CODES[params[:summary_code]]} - #{RESPONSE_CODES[params[:response_code]]}"
|
192
|
+
|
193
|
+
success = (params[:summary_code] ? (params[:summary_code] == "0") : (params[:response_code] == "00"))
|
194
|
+
|
195
|
+
Response.new(success, message, params,
|
196
|
+
:test => (@options[:merchant].to_s == "TEST"),
|
197
|
+
:authorization => post[:order_number]
|
198
|
+
)
|
199
|
+
rescue ActiveMerchant::ResponseError => e
|
200
|
+
raise unless e.response.code == '403'
|
201
|
+
return Response.new(false, "Invalid credentials", {}, :test => test?)
|
202
|
+
rescue ActiveMerchant::ClientCertificateError
|
203
|
+
return Response.new(false, "Invalid certificate", {}, :test => test?)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|