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,155 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CardStreamModernGateway < Gateway
|
4
|
+
self.test_url = self.live_url = 'https://gateway.cardstream.com/direct/'
|
5
|
+
self.money_format = :cents
|
6
|
+
self.default_currency = 'GBP'
|
7
|
+
self.supported_countries = ['GB']
|
8
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro, :solo, :switch]
|
9
|
+
self.homepage_url = 'http://www.cardstream.com/'
|
10
|
+
self.display_name = 'CardStream'
|
11
|
+
|
12
|
+
def initialize(options = {})
|
13
|
+
requires!(options, :login)
|
14
|
+
if(options[:threeDSRequired])
|
15
|
+
@threeDSRequired = options[:threeDSRequired]
|
16
|
+
else
|
17
|
+
@threeDSRequired = 'N'
|
18
|
+
end
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def authorize(money, creditcard, options = {})
|
23
|
+
post = {}
|
24
|
+
add_amount(post, money, options)
|
25
|
+
add_invoice(post, creditcard, money, options)
|
26
|
+
add_creditcard(post, creditcard)
|
27
|
+
add_address(post, creditcard, options)
|
28
|
+
add_customer_data(post, options)
|
29
|
+
commit('PREAUTH', post)
|
30
|
+
end
|
31
|
+
|
32
|
+
def purchase(money, creditcard, options = {})
|
33
|
+
post = {}
|
34
|
+
add_amount(post, money, options)
|
35
|
+
add_invoice(post, creditcard, money, options)
|
36
|
+
add_creditcard(post, creditcard)
|
37
|
+
add_address(post, creditcard, options)
|
38
|
+
add_customer_data(post, options)
|
39
|
+
commit('SALE', post)
|
40
|
+
end
|
41
|
+
|
42
|
+
def capture(money, authorization, options = {})
|
43
|
+
post = {}
|
44
|
+
add_pair(post, :xref, authorization)
|
45
|
+
add_amount(post, money, options)
|
46
|
+
commit('SALE', post)
|
47
|
+
end
|
48
|
+
|
49
|
+
def refund(money, authorization, options = {})
|
50
|
+
post = {}
|
51
|
+
add_pair(post, :xref, authorization)
|
52
|
+
add_amount(post, money, options)
|
53
|
+
commit('REFUND', post)
|
54
|
+
end
|
55
|
+
|
56
|
+
def void(authorization, options = {})
|
57
|
+
post = {}
|
58
|
+
add_pair(post, :xref, authorization)
|
59
|
+
commit('REFUND', post)
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def add_amount(post, money, options)
|
65
|
+
add_pair(post, :amount, amount(money), :required => true)
|
66
|
+
add_pair(post, :currencyCode, options[:currency] || self.default_currency)
|
67
|
+
end
|
68
|
+
|
69
|
+
def add_customer_data(post, options)
|
70
|
+
address = options[:billing_address] || options[:address]
|
71
|
+
add_pair(post, :customerPostCode, address[:zip])
|
72
|
+
add_pair(post, :customerEmail, options[:email])
|
73
|
+
add_pair(post, :customerPhone, options[:phone])
|
74
|
+
end
|
75
|
+
|
76
|
+
def add_address(post, creditcard, options)
|
77
|
+
address = options[:billing_address] || options[:address]
|
78
|
+
|
79
|
+
return if address.nil?
|
80
|
+
|
81
|
+
add_pair(post, :customerAddress, address[:address1] + " " + (address[:address2].nil? ? "" : address[:address2]) )
|
82
|
+
add_pair(post, :customerPostCode, address[:zip])
|
83
|
+
end
|
84
|
+
|
85
|
+
def add_invoice(post, credit_card, money, options)
|
86
|
+
add_pair(post, :transactionUnique, options[:order_id], :required => true)
|
87
|
+
add_pair(post, :orderRef, options[:description] || options[:order_id], :required => true)
|
88
|
+
if [ 'american_express', 'diners_club' ].include?(card_brand(credit_card).to_s)
|
89
|
+
add_pair(post, :item1Quantity, 1)
|
90
|
+
add_pair(post, :item1Description, (options[:description] || options[:order_id]).slice(0, 15))
|
91
|
+
add_pair(post, :item1GrossValue, amount(money))
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def add_creditcard(post, credit_card)
|
96
|
+
add_pair(post, :customerName, credit_card.name, :required => true)
|
97
|
+
add_pair(post, :cardNumber, credit_card.number, :required => true)
|
98
|
+
|
99
|
+
add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), :required => true)
|
100
|
+
add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), :required => true)
|
101
|
+
|
102
|
+
if requires_start_date_or_issue_number?(credit_card)
|
103
|
+
add_pair(post, :cardStartMonth, format(credit_card.start_month, :two_digits))
|
104
|
+
add_pair(post, :cardStartYear, format(credit_card.start_year, :two_digits))
|
105
|
+
|
106
|
+
add_pair(post, :cardIssueNumber, credit_card.issue_number)
|
107
|
+
end
|
108
|
+
|
109
|
+
add_pair(post, :cardCVV, credit_card.verification_value)
|
110
|
+
end
|
111
|
+
|
112
|
+
def parse(body)
|
113
|
+
result = {}
|
114
|
+
pairs = body.split("&")
|
115
|
+
pairs.each do |pair|
|
116
|
+
a = pair.split("=")
|
117
|
+
result[a[0].to_sym] = CGI.unescape(a[1])
|
118
|
+
end
|
119
|
+
result
|
120
|
+
end
|
121
|
+
|
122
|
+
def commit(action, parameters)
|
123
|
+
response = parse( ssl_post(self.live_url, post_data(action, parameters)) )
|
124
|
+
|
125
|
+
Response.new(response[:responseCode] == "0",
|
126
|
+
response[:responseCode] == "0" ? "APPROVED" : response[:responseMessage],
|
127
|
+
response,
|
128
|
+
:test => test?,
|
129
|
+
:authorization => response[:xref],
|
130
|
+
:avs_result => {
|
131
|
+
:street_match => response[:addressCheck],
|
132
|
+
:postal_match => response[:postcodeCheck],
|
133
|
+
},
|
134
|
+
:cvv_result => response[:cv2Check]
|
135
|
+
)
|
136
|
+
end
|
137
|
+
|
138
|
+
def post_data(action, parameters = {})
|
139
|
+
parameters.update(
|
140
|
+
:merchantID => @options[:login],
|
141
|
+
:action => action,
|
142
|
+
:type => '1', #Ecommerce
|
143
|
+
:countryCode => self.supported_countries[0],
|
144
|
+
:threeDSRequired => @threeDSRequired #Disable 3d secure by default
|
145
|
+
)
|
146
|
+
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
|
147
|
+
end
|
148
|
+
|
149
|
+
def add_pair(post, key, value, options = {})
|
150
|
+
post[key] = value if !value.blank? || options[:required]
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
@@ -0,0 +1,156 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
# CC5 API is used by many banks in Turkey. Extend this base class to provide
|
4
|
+
# concrete implementations.
|
5
|
+
class CC5Gateway < Gateway
|
6
|
+
self.default_currency = 'TRY'
|
7
|
+
|
8
|
+
CURRENCY_CODES = {
|
9
|
+
'TRY' => 949,
|
10
|
+
'YTL' => 949,
|
11
|
+
'TRL' => 949,
|
12
|
+
'TL' => 949,
|
13
|
+
'USD' => 840,
|
14
|
+
'EUR' => 978,
|
15
|
+
'GBP' => 826,
|
16
|
+
'JPY' => 392
|
17
|
+
}
|
18
|
+
|
19
|
+
def initialize(options = {})
|
20
|
+
requires!(options, :login, :password, :client_id)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def purchase(money, creditcard, options = {})
|
25
|
+
commit(build_sale_request('Auth', money, creditcard, options))
|
26
|
+
end
|
27
|
+
|
28
|
+
def authorize(money, creditcard, options = {})
|
29
|
+
commit(build_sale_request('PreAuth', money, creditcard, options))
|
30
|
+
end
|
31
|
+
|
32
|
+
def capture(money, authorization, options = {})
|
33
|
+
commit(build_capture_request(money, authorization, options))
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
|
38
|
+
def build_sale_request(type, money, creditcard, options = {})
|
39
|
+
requires!(options, :order_id)
|
40
|
+
|
41
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
42
|
+
|
43
|
+
xml.tag! 'CC5Request' do
|
44
|
+
add_login_tags(xml)
|
45
|
+
xml.tag! 'OrderId', options[:order_id]
|
46
|
+
xml.tag! 'Type', type
|
47
|
+
xml.tag! 'Number', creditcard.number
|
48
|
+
xml.tag! 'Expires', [format(creditcard.month, :two_digits), format(creditcard.year, :two_digits)].join('/')
|
49
|
+
xml.tag! 'Cvv2Val', creditcard.verification_value
|
50
|
+
add_amount_tags(money, options, xml)
|
51
|
+
xml.tag! 'Email', options[:email] if options[:email]
|
52
|
+
|
53
|
+
if(address = (options[:billing_address] || options[:address]))
|
54
|
+
xml.tag! 'BillTo' do
|
55
|
+
add_address(xml, address)
|
56
|
+
end
|
57
|
+
xml.tag! 'ShipTo' do
|
58
|
+
add_address(xml, address)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
xml.target!
|
65
|
+
end
|
66
|
+
|
67
|
+
def build_capture_request(money, authorization, options = {})
|
68
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
69
|
+
|
70
|
+
xml.tag! 'CC5Request' do
|
71
|
+
add_login_tags(xml)
|
72
|
+
xml.tag! 'OrderId', authorization
|
73
|
+
xml.tag! 'Type', 'PostAuth'
|
74
|
+
add_amount_tags(money, options, xml)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def add_address(xml, address)
|
79
|
+
xml.tag! 'Name', normalize(address[:name])
|
80
|
+
xml.tag! 'Street1', normalize(address[:address1])
|
81
|
+
xml.tag! 'Street2', normalize(address[:address2]) if address[:address2]
|
82
|
+
xml.tag! 'City', normalize(address[:city])
|
83
|
+
xml.tag! 'PostalCode', address[:zip]
|
84
|
+
xml.tag! 'Country', normalize(address[:country])
|
85
|
+
xml.tag! 'Company', normalize(address[:company])
|
86
|
+
xml.tag! 'TelVoice', address[:phone].to_s.gsub(/[^0-9]/, '') if address[:phone]
|
87
|
+
end
|
88
|
+
|
89
|
+
def add_login_tags(xml)
|
90
|
+
xml.tag! 'Name', @options[:login]
|
91
|
+
xml.tag! 'Password', @options[:password]
|
92
|
+
xml.tag! 'ClientId', @options[:client_id]
|
93
|
+
xml.tag! 'Mode', (test? ? 'T' : 'P')
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_amount_tags(money, options, xml)
|
97
|
+
xml.tag! 'Total', amount(money)
|
98
|
+
xml.tag! 'Currency', currency_code(options[:currency] || currency(money))
|
99
|
+
end
|
100
|
+
|
101
|
+
def currency_code(currency)
|
102
|
+
(CURRENCY_CODES[currency] || CURRENCY_CODES[default_currency])
|
103
|
+
end
|
104
|
+
|
105
|
+
def commit(request)
|
106
|
+
raw_response = ssl_post((test? ? self.test_url : self.live_url), "DATA=" + request)
|
107
|
+
|
108
|
+
response = parse(raw_response)
|
109
|
+
|
110
|
+
success = success?(response)
|
111
|
+
|
112
|
+
Response.new(
|
113
|
+
success,
|
114
|
+
(success ? 'Approved' : "Declined (Reason: #{response[:proc_return_code]} - #{response[:err_msg]})"),
|
115
|
+
response,
|
116
|
+
:test => test?,
|
117
|
+
:authorization => response[:order_id]
|
118
|
+
)
|
119
|
+
end
|
120
|
+
|
121
|
+
def parse(body)
|
122
|
+
xml = REXML::Document.new(body)
|
123
|
+
|
124
|
+
response = {}
|
125
|
+
xml.root.elements.to_a.each do |node|
|
126
|
+
parse_element(response, node)
|
127
|
+
end
|
128
|
+
response
|
129
|
+
end
|
130
|
+
|
131
|
+
def parse_element(response, node)
|
132
|
+
if node.has_elements?
|
133
|
+
node.elements.each{|element| parse_element(response, element) }
|
134
|
+
else
|
135
|
+
response[node.name.underscore.to_sym] = node.text
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def success?(response)
|
140
|
+
(response[:response] == "Approved")
|
141
|
+
end
|
142
|
+
|
143
|
+
def normalize(text)
|
144
|
+
return unless text
|
145
|
+
|
146
|
+
if ActiveSupport::Inflector.method(:transliterate).arity == -2
|
147
|
+
ActiveSupport::Inflector.transliterate(text,'')
|
148
|
+
elsif RUBY_VERSION >= '1.9'
|
149
|
+
text.gsub(/[^\x00-\x7F]+/, '')
|
150
|
+
else
|
151
|
+
ActiveSupport::Inflector.transliterate(text).to_s
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,277 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CertoDirectGateway < Gateway
|
4
|
+
self.live_url = self.test_url = "https://secure.certodirect.com/gateway/process/v2"
|
5
|
+
|
6
|
+
self.supported_countries = [
|
7
|
+
"BE", "BG", "CZ", "DK", "DE", "EE", "IE", "EL", "ES", "FR",
|
8
|
+
"IT", "CY", "LV", "LT", "LU", "HU", "MT", "NL", "AT", "PL",
|
9
|
+
"PT", "RO", "SI", "SK", "FI", "SE", "GB"
|
10
|
+
]
|
11
|
+
|
12
|
+
self.supported_cardtypes = [:visa, :master, :american_express, :discover]
|
13
|
+
self.homepage_url = 'http://www.certodirect.com/'
|
14
|
+
self.display_name = 'CertoDirect'
|
15
|
+
|
16
|
+
# Creates a new CertoDirectGateway
|
17
|
+
#
|
18
|
+
# The gateway requires that a valid login and password be passed
|
19
|
+
# in the +options+ hash.
|
20
|
+
#
|
21
|
+
# ==== Options
|
22
|
+
#
|
23
|
+
# * <tt>:login</tt> -- The CertoDirect Shop ID (REQUIRED)
|
24
|
+
# * <tt>:password</tt> -- The CertoDirect Shop Password. (REQUIRED)
|
25
|
+
# * <tt>:test</tt> -- +true+ or +false+. If true, perform transactions against the test server.
|
26
|
+
# Otherwise, perform transactions against the production server.
|
27
|
+
def initialize(options = {})
|
28
|
+
requires!(options, :login, :password)
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
# Perform a purchase, which is essentially an authorization and capture in a single operation.
|
33
|
+
#
|
34
|
+
# ==== Parameters
|
35
|
+
#
|
36
|
+
# * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
|
37
|
+
# * <tt>credit_card</tt> -- The CreditCard details for the transaction.
|
38
|
+
# * <tt>options</tt> -- A hash of optional parameters.
|
39
|
+
def purchase(money, credit_card, options = {})
|
40
|
+
requires!(options, :email, :currency, :ip, :description)
|
41
|
+
|
42
|
+
commit(build_sale_request(money, credit_card, options))
|
43
|
+
end
|
44
|
+
|
45
|
+
# Refund a transaction.
|
46
|
+
#
|
47
|
+
# This transaction indicates to the gateway that
|
48
|
+
# money should flow from the merchant to the customer.
|
49
|
+
#
|
50
|
+
# ==== Parameters
|
51
|
+
#
|
52
|
+
# * <tt>money</tt> -- The amount to be credited to the customer as an Integer value in cents.
|
53
|
+
# * <tt>identification</tt> -- The ID of the original order against which the refund is being issued.
|
54
|
+
# * <tt>options</tt> -- A hash of parameters.
|
55
|
+
def refund(money, identification, options = {})
|
56
|
+
requires!(options, :reason)
|
57
|
+
|
58
|
+
commit(build_refund_request(money, identification, options))
|
59
|
+
end
|
60
|
+
|
61
|
+
# Performs an authorization, which reserves the funds on the customer's credit card, but does not
|
62
|
+
# charge the card.
|
63
|
+
#
|
64
|
+
# ==== Parameters
|
65
|
+
#
|
66
|
+
# * <tt>money</tt> -- The amount to be authorized as an Integer value in cents.
|
67
|
+
# * <tt>credit_card</tt> -- The CreditCard details for the transaction.
|
68
|
+
# * <tt>options</tt> -- A hash of optional parameters.
|
69
|
+
def authorize(money, credit_card, options = {})
|
70
|
+
requires!(options, :email, :currency, :ip, :description)
|
71
|
+
|
72
|
+
commit(build_authorize_request(money, credit_card, options))
|
73
|
+
end
|
74
|
+
|
75
|
+
# Captures the funds from an authorized transaction.
|
76
|
+
#
|
77
|
+
# ==== Parameters
|
78
|
+
#
|
79
|
+
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
|
80
|
+
# * <tt>identification</tt> -- The authorization returned from the previous authorize request.
|
81
|
+
def capture(money, identification, options = {})
|
82
|
+
commit(build_capture_request(money, identification))
|
83
|
+
end
|
84
|
+
|
85
|
+
# Void a previous transaction
|
86
|
+
#
|
87
|
+
# ==== Parameters
|
88
|
+
#
|
89
|
+
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
|
90
|
+
# * <tt>identification</tt> - The authorization returned from the previous authorize request.
|
91
|
+
def void(money, identification, options = {})
|
92
|
+
commit(build_void_request(money, identification))
|
93
|
+
end
|
94
|
+
|
95
|
+
# Create a recurring payment.
|
96
|
+
#
|
97
|
+
# ==== Parameters
|
98
|
+
#
|
99
|
+
# * <tt>options</tt> -- A hash of parameters.
|
100
|
+
#
|
101
|
+
# ==== Options
|
102
|
+
#
|
103
|
+
def recurring(identification, options={})
|
104
|
+
commit(build_recurring_request(identification, options))
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def commit(request_xml)
|
111
|
+
begin
|
112
|
+
response = Hash.from_xml(ssl_post(self.live_url, request_xml, headers))
|
113
|
+
Response.new(success?(response),
|
114
|
+
message(response),
|
115
|
+
response,
|
116
|
+
:test => test?,
|
117
|
+
:authorization => authorization(response))
|
118
|
+
rescue ResponseError => e
|
119
|
+
raise e unless e.response.code == '403'
|
120
|
+
response = Hash.from_xml(e.response.body)['response']
|
121
|
+
Response.new(false, message(response), {}, :test => test?)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def build_sale_request(money, credit_card, options)
|
126
|
+
build_request_xml('Sale') do |xml|
|
127
|
+
add_order(xml, money, credit_card, options)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def build_authorize_request(money, credit_card, options)
|
132
|
+
build_request_xml('Authorize') do |xml|
|
133
|
+
add_order(xml, money, credit_card, options)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def build_refund_request(money, identification, options)
|
138
|
+
build_request_xml('Refund') do |xml|
|
139
|
+
add_reference_info(xml, money, identification, options)
|
140
|
+
xml.tag! 'reason', options[:reason]
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def build_capture_request(money, identification)
|
145
|
+
build_request_xml('Capture') do |xml|
|
146
|
+
add_reference_info(xml, money, identification, options)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def build_void_request(money, identification)
|
151
|
+
build_request_xml('Void') do |xml|
|
152
|
+
add_reference_info(xml, money, identification, options)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def build_recurring_request(identification, options)
|
157
|
+
build_request_xml('Sale') do |xml|
|
158
|
+
xml.tag! 'order' do |xml|
|
159
|
+
xml.tag!('test', 'true') if test?
|
160
|
+
xml.tag! 'initial_order_id', identification, :type => 'integer'
|
161
|
+
|
162
|
+
add_order_details(xml, options[:amount], options) if has_any_order_details_key?(options)
|
163
|
+
add_address(xml, 'billing_address', options[:billing_address]) if options[:billing_address]
|
164
|
+
add_address(xml, 'shipping_address', options[:shipping_address]) if options[:shipping_address]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def build_request_xml(type, &block)
|
170
|
+
xml = Builder::XmlMarkup.new(:indent => 2)
|
171
|
+
xml.tag! 'transaction' do
|
172
|
+
xml.tag! 'type', type
|
173
|
+
yield(xml)
|
174
|
+
end
|
175
|
+
xml.target!
|
176
|
+
end
|
177
|
+
|
178
|
+
def add_order(xml, money, credit_card, options)
|
179
|
+
xml.tag! 'order' do
|
180
|
+
xml.tag!('test', 'true') if test?
|
181
|
+
|
182
|
+
xml.tag!('return_url', options[:return_url]) if options[:return_url]
|
183
|
+
xml.tag!('cancel_url', options[:cancel_url]) if options[:cancel_url]
|
184
|
+
|
185
|
+
xml.tag! 'payment_method_type', 'CreditCard'
|
186
|
+
xml.tag! 'payment_method' do
|
187
|
+
xml.tag! 'number', credit_card.number
|
188
|
+
xml.tag! 'exp_month', "%02i" % credit_card.month
|
189
|
+
xml.tag! 'exp_year', credit_card.year
|
190
|
+
xml.tag! 'holder', credit_card.name
|
191
|
+
xml.tag! 'verification_value', credit_card.verification_value
|
192
|
+
end
|
193
|
+
|
194
|
+
add_order_details(xml, money, options)
|
195
|
+
add_address(xml, 'billing_address', options[:billing_address]) if options[:billing_address]
|
196
|
+
add_address(xml, 'shipping_address', options[:shipping_address]) if options[:shipping_address]
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def add_order_details(xml, money, options)
|
201
|
+
xml.tag! 'details' do
|
202
|
+
xml.tag!('amount', localized_amount(money, options[:currency]), :type => 'decimal') if money
|
203
|
+
xml.tag!('currency', options[:currency]) if options[:currency]
|
204
|
+
xml.tag!('email', options[:email]) if options[:email]
|
205
|
+
xml.tag!('ip', options[:ip]) if options[:ip]
|
206
|
+
xml.tag!('shipping', options[:shipping], :type => 'decimal') if options[:shipping]
|
207
|
+
xml.tag!('description', options[:description]) if options[:description]
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
def add_reference_info(xml, money, identification, options)
|
212
|
+
xml.tag! 'order_id', identification, :type => 'integer'
|
213
|
+
xml.tag! 'amount', localized_amount(money, options[:currency]), :type => 'decimal'
|
214
|
+
end
|
215
|
+
|
216
|
+
def add_address(xml, address_type, address)
|
217
|
+
xml.tag! address_type do
|
218
|
+
xml.tag! 'address', address[:address1]
|
219
|
+
xml.tag! 'city', address[:city]
|
220
|
+
xml.tag! 'country', address[:country]
|
221
|
+
xml.tag! 'first_name', address[:first_name]
|
222
|
+
xml.tag! 'last_name', address[:last_name]
|
223
|
+
xml.tag! 'state', address[:state]
|
224
|
+
xml.tag! 'phone', address[:phone]
|
225
|
+
xml.tag! 'zip', address[:zip]
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
def has_any_order_details_key?(options)
|
230
|
+
[ :currency, :amount, :email, :ip, :shipping, :description ].any? do |key|
|
231
|
+
options.has_key?(key)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def success?(response)
|
236
|
+
%w(completed forwarding).include?(state(response)) and
|
237
|
+
status(response) == 'success'
|
238
|
+
end
|
239
|
+
|
240
|
+
def error?(response)
|
241
|
+
response['errors']
|
242
|
+
end
|
243
|
+
|
244
|
+
def state(response)
|
245
|
+
response["transaction"].try(:[], "state")
|
246
|
+
end
|
247
|
+
|
248
|
+
def status(response)
|
249
|
+
response['transaction'].try(:[], 'response').try(:[], 'status')
|
250
|
+
end
|
251
|
+
|
252
|
+
def authorization(response)
|
253
|
+
error?(response) ? nil : response["transaction"]["order"]['id'].to_s
|
254
|
+
end
|
255
|
+
|
256
|
+
def message(response)
|
257
|
+
return response['errors'].join('; ') if error?(response)
|
258
|
+
|
259
|
+
if state(response) == 'completed'
|
260
|
+
response["transaction"]["response"]["message"]
|
261
|
+
else
|
262
|
+
response['transaction']['message']
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
def headers
|
267
|
+
{ 'authorization' => basic_auth,
|
268
|
+
'Accept' => 'application/xml',
|
269
|
+
'Content-Type' => 'application/xml' }
|
270
|
+
end
|
271
|
+
|
272
|
+
def basic_auth
|
273
|
+
'Basic ' + ["#{@options[:login]}:#{@options[:password]}"].pack('m').delete("\r\n")
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|