swiss-crm-activemerchant 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +4033 -0
- data/CONTRIBUTORS +568 -0
- data/MIT-LICENSE +20 -0
- data/README.md +252 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +95 -0
- data/lib/active_merchant/billing/base.rb +48 -0
- data/lib/active_merchant/billing/check.rb +112 -0
- data/lib/active_merchant/billing/compatibility.rb +118 -0
- data/lib/active_merchant/billing/credit_card.rb +451 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +24 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +512 -0
- data/lib/active_merchant/billing/cvv_result.rb +37 -0
- data/lib/active_merchant/billing/gateway.rb +332 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +774 -0
- data/lib/active_merchant/billing/gateways/airwallex.rb +370 -0
- data/lib/active_merchant/billing/gateways/alelo.rb +256 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +1125 -0
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +424 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +977 -0
- data/lib/active_merchant/billing/gateways/axcessms.rb +242 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +263 -0
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +116 -0
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +474 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +238 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +57 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +644 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +190 -0
- data/lib/active_merchant/billing/gateways/borgun.rb +272 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +28 -0
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +952 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +338 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +21 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +394 -0
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +235 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +198 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +249 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +212 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +587 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +366 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +230 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +526 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1148 -0
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +343 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +302 -0
- data/lib/active_merchant/billing/gateways/decidir.rb +358 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +346 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +215 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +475 -0
- data/lib/active_merchant/billing/gateways/element.rb +406 -0
- data/lib/active_merchant/billing/gateways/epay.rb +296 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +307 -0
- data/lib/active_merchant/billing/gateways/eway.rb +226 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +289 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +578 -0
- data/lib/active_merchant/billing/gateways/exact.rb +219 -0
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +223 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +158 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +182 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +452 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/fluidpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +256 -0
- data/lib/active_merchant/billing/gateways/global_collect.rb +580 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +193 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +205 -0
- data/lib/active_merchant/billing/gateways/hps.rb +472 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +312 -0
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +213 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +159 -0
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +467 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/iveri.rb +290 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +395 -0
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/klarna.rb +317 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +297 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +448 -0
- data/lib/active_merchant/billing/gateways/litle.rb +643 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +286 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +348 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +228 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +110 -0
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +313 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +284 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +248 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +352 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +293 -0
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/migs.rb +329 -0
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +215 -0
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +424 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +488 -0
- data/lib/active_merchant/billing/gateways/money_movers.rb +150 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +366 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +299 -0
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +198 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +180 -0
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +229 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/network_merchants.rb +238 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +396 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +509 -0
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +246 -0
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +331 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +45 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +1267 -0
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +206 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +120 -0
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +277 -0
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +390 -0
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +110 -0
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +224 -0
- data/lib/active_merchant/billing/gateways/payeezy.rb +513 -0
- data/lib/active_merchant/billing/gateways/payex.rb +409 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +235 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +42 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +473 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +220 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +14 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +20 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +373 -0
- data/lib/active_merchant/billing/gateways/paymentez.rb +365 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +369 -0
- data/lib/active_merchant/billing/gateways/paynetworx.rb +228 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +718 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +69 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +136 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +44 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +272 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/paypal_standard.rb +281 -0
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +159 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +204 -0
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +482 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +273 -0
- data/lib/active_merchant/billing/gateways/pixxels.rb +263 -0
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +283 -0
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +295 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +302 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +274 -0
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +24 -0
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +319 -0
- data/lib/active_merchant/billing/gateways/reach.rb +277 -0
- data/lib/active_merchant/billing/gateways/realex.rb +400 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +723 -0
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +446 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +434 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +141 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +260 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +191 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +290 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +103 -0
- data/lib/active_merchant/billing/gateways/securion_pay.rb +305 -0
- data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +450 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +274 -0
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +354 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +866 -0
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +602 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +151 -0
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +23 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +240 -0
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- data/lib/active_merchant/billing/gateways/transax.rb +21 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +9 -0
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +500 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +24 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1612 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +367 -0
- data/lib/active_merchant/billing/gateways/vanco.rb +303 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +224 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +171 -0
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +235 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +430 -0
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +1050 -0
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +14 -0
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +121 -0
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +16 -0
- data/lib/active_merchant/connection.rb +194 -0
- data/lib/active_merchant/country.rb +338 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +38 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +3 -0
- data/lib/active_merchant.rb +63 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +69 -0
- data/lib/support/outbound_hosts.rb +28 -0
- data/lib/support/ssl_verify.rb +88 -0
- data/lib/support/ssl_version.rb +86 -0
- metadata +506 -0
@@ -0,0 +1,193 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class GlobalTransportGateway < Gateway
|
6
|
+
self.test_url = 'https://certapia.globalpay.com/GlobalPay/transact.asmx/ProcessCreditCard'
|
7
|
+
self.live_url = 'https://api.globalpay.com/GlobalPay/transact.asmx/ProcessCreditCard'
|
8
|
+
|
9
|
+
self.supported_countries = %w(CA PR US)
|
10
|
+
self.default_currency = 'USD'
|
11
|
+
self.supported_cardtypes = %i[visa master american_express discover diners_club jcb]
|
12
|
+
|
13
|
+
self.homepage_url = 'https://www.globalpaymentsinc.com'
|
14
|
+
self.display_name = 'Global Transport'
|
15
|
+
|
16
|
+
# Public: Create a new Global Transport gateway.
|
17
|
+
#
|
18
|
+
# options - A hash of options:
|
19
|
+
# :global_user_name - Your Global user name
|
20
|
+
# :global_password - Your Global password
|
21
|
+
# :term_type - 3 character field assigned by Global Transport after
|
22
|
+
# - your application is certified.
|
23
|
+
def initialize(options = {})
|
24
|
+
requires!(options, :global_user_name, :global_password, :term_type)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def purchase(money, payment_method, options = {})
|
29
|
+
post = {}
|
30
|
+
add_invoice(post, money, options)
|
31
|
+
add_payment_method(post, payment_method)
|
32
|
+
add_address(post, options)
|
33
|
+
|
34
|
+
commit('Sale', post, options)
|
35
|
+
end
|
36
|
+
|
37
|
+
def authorize(money, payment_method, options = {})
|
38
|
+
post = {}
|
39
|
+
add_invoice(post, money, options)
|
40
|
+
add_payment_method(post, payment_method)
|
41
|
+
add_address(post, options)
|
42
|
+
|
43
|
+
commit('Auth', post, options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def capture(money, authorization, options = {})
|
47
|
+
post = {}
|
48
|
+
add_invoice(post, money, options)
|
49
|
+
add_auth(post, authorization)
|
50
|
+
|
51
|
+
commit('Force', post, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def refund(money, authorization, options = {})
|
55
|
+
post = {}
|
56
|
+
add_invoice(post, money, options)
|
57
|
+
add_auth(post, authorization)
|
58
|
+
|
59
|
+
commit('Return', post, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def void(authorization, options = {})
|
63
|
+
post = {}
|
64
|
+
add_auth(post, authorization)
|
65
|
+
|
66
|
+
commit('Void', post, options)
|
67
|
+
end
|
68
|
+
|
69
|
+
def verify(payment_method, options = {})
|
70
|
+
post = {}
|
71
|
+
add_payment_method(post, payment_method)
|
72
|
+
add_address(post, options)
|
73
|
+
|
74
|
+
commit('CardVerify', post, options)
|
75
|
+
end
|
76
|
+
|
77
|
+
def supports_scrubbing?
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
81
|
+
def scrub(transcript)
|
82
|
+
transcript.
|
83
|
+
gsub(%r((&?CardNum=)[^&]*)i, '\1[FILTERED]').
|
84
|
+
gsub(%r((&?CVNum=)[^&]*)i, '\1[FILTERED]').
|
85
|
+
gsub(%r((&?GlobalPassword=)[^&]*)i, '\1[FILTERED]')
|
86
|
+
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def add_address(post, options)
|
91
|
+
if address = (options[:billing_address] || options[:address])
|
92
|
+
post[:Street] = address[:address1]
|
93
|
+
post[:Zip] = address[:zip]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def add_auth(post, authorization)
|
98
|
+
post[:PNRef] = authorization
|
99
|
+
end
|
100
|
+
|
101
|
+
def add_invoice(post, money, options)
|
102
|
+
currency = (options[:currency] || currency(money))
|
103
|
+
|
104
|
+
post[:Amount] = localized_amount(money, currency)
|
105
|
+
post[:InvNum] = truncate(options[:order_id], 16)
|
106
|
+
end
|
107
|
+
|
108
|
+
def add_payment_method(post, payment_method)
|
109
|
+
post[:CardNum] = payment_method.number
|
110
|
+
post[:ExpDate] = expdate(payment_method)
|
111
|
+
post[:NameOnCard] = payment_method.name
|
112
|
+
post[:CVNum] = payment_method.verification_value
|
113
|
+
end
|
114
|
+
|
115
|
+
def parse(body)
|
116
|
+
response = {}
|
117
|
+
|
118
|
+
Nokogiri::XML(body).root.xpath('*').each do |node|
|
119
|
+
response[node.name.downcase.to_sym] = node.text
|
120
|
+
end
|
121
|
+
|
122
|
+
ext_data = Nokogiri::HTML.parse(response[:extdata])
|
123
|
+
response[:approved_amount] = ext_data.xpath('//approvedamount').text
|
124
|
+
response[:balance_due] = ext_data.xpath('//balancedue').text
|
125
|
+
|
126
|
+
response
|
127
|
+
end
|
128
|
+
|
129
|
+
def commit(action, parameters, options)
|
130
|
+
raw = parse(ssl_post(url, post_data(action, parameters, options)))
|
131
|
+
Response.new(
|
132
|
+
success_from(raw),
|
133
|
+
message_from(raw),
|
134
|
+
raw,
|
135
|
+
authorization: authorization_from(raw),
|
136
|
+
test: test?,
|
137
|
+
avs_result: avs_from(raw),
|
138
|
+
cvv_result: cvv_from(raw)
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
142
|
+
def post_data(action, params, options)
|
143
|
+
post = default_params
|
144
|
+
post[:GlobalUserName] = @options[:global_user_name]
|
145
|
+
post[:GlobalPassword] = @options[:global_password]
|
146
|
+
post[:TransType] = action
|
147
|
+
post[:ExtData] = "<TermType>#{@options[:term_type]}</TermType>"
|
148
|
+
|
149
|
+
post.merge(params).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
150
|
+
end
|
151
|
+
|
152
|
+
def url
|
153
|
+
(test? ? test_url : live_url)
|
154
|
+
end
|
155
|
+
|
156
|
+
def success_from(response)
|
157
|
+
response[:result] == '0' || response[:result] == '200'
|
158
|
+
end
|
159
|
+
|
160
|
+
def message_from(response)
|
161
|
+
response[:respmsg]
|
162
|
+
end
|
163
|
+
|
164
|
+
def authorization_from(response)
|
165
|
+
response[:pnref]
|
166
|
+
end
|
167
|
+
|
168
|
+
def avs_from(response)
|
169
|
+
{ code: response[:getavsresult] }
|
170
|
+
end
|
171
|
+
|
172
|
+
def cvv_from(response)
|
173
|
+
response[:getcvresult]
|
174
|
+
end
|
175
|
+
|
176
|
+
def default_params
|
177
|
+
{
|
178
|
+
CardNum: '',
|
179
|
+
ExpDate: '',
|
180
|
+
NameOnCard: '',
|
181
|
+
Amount: '',
|
182
|
+
PNRef: '',
|
183
|
+
Zip: '',
|
184
|
+
Street: '',
|
185
|
+
CVNum: '',
|
186
|
+
MagData: '',
|
187
|
+
InvNum: '',
|
188
|
+
ExtData: ''
|
189
|
+
}
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class HdfcGateway < Gateway
|
6
|
+
self.display_name = 'HDFC'
|
7
|
+
self.homepage_url = 'http://www.hdfcbank.com/sme/sme-details/merchant-services/guzh6m0i'
|
8
|
+
|
9
|
+
self.test_url = 'https://securepgtest.fssnet.co.in/pgway/servlet/'
|
10
|
+
self.live_url = 'https://securepg.fssnet.co.in/pgway/servlet/'
|
11
|
+
|
12
|
+
self.supported_countries = ['IN']
|
13
|
+
self.default_currency = 'INR'
|
14
|
+
self.money_format = :dollars
|
15
|
+
self.supported_cardtypes = %i[visa master discover diners_club]
|
16
|
+
|
17
|
+
def initialize(options = {})
|
18
|
+
requires!(options, :login, :password)
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def purchase(amount, payment_method, options = {})
|
23
|
+
post = {}
|
24
|
+
add_invoice(post, amount, options)
|
25
|
+
add_payment_method(post, payment_method)
|
26
|
+
add_customer_data(post, options)
|
27
|
+
|
28
|
+
commit('purchase', post)
|
29
|
+
end
|
30
|
+
|
31
|
+
def authorize(amount, payment_method, options = {})
|
32
|
+
post = {}
|
33
|
+
add_invoice(post, amount, options)
|
34
|
+
add_payment_method(post, payment_method)
|
35
|
+
add_customer_data(post, options)
|
36
|
+
|
37
|
+
commit('authorize', post)
|
38
|
+
end
|
39
|
+
|
40
|
+
def capture(amount, authorization, options = {})
|
41
|
+
post = {}
|
42
|
+
add_invoice(post, amount, options)
|
43
|
+
add_reference(post, authorization)
|
44
|
+
add_customer_data(post, options)
|
45
|
+
|
46
|
+
commit('capture', post)
|
47
|
+
end
|
48
|
+
|
49
|
+
def refund(amount, authorization, options = {})
|
50
|
+
post = {}
|
51
|
+
add_invoice(post, amount, options)
|
52
|
+
add_reference(post, authorization)
|
53
|
+
add_customer_data(post, options)
|
54
|
+
|
55
|
+
commit('refund', post)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency for HDFC: #{k}") }
|
61
|
+
CURRENCY_CODES['AED'] = '784'
|
62
|
+
CURRENCY_CODES['AUD'] = '036'
|
63
|
+
CURRENCY_CODES['CAD'] = '124'
|
64
|
+
CURRENCY_CODES['EUR'] = '978'
|
65
|
+
CURRENCY_CODES['GBP'] = '826'
|
66
|
+
CURRENCY_CODES['INR'] = '356'
|
67
|
+
CURRENCY_CODES['OMR'] = '512'
|
68
|
+
CURRENCY_CODES['QAR'] = '634'
|
69
|
+
CURRENCY_CODES['SGD'] = '702'
|
70
|
+
CURRENCY_CODES['USD'] = '840'
|
71
|
+
|
72
|
+
def add_invoice(post, amount, options)
|
73
|
+
post[:amt] = amount(amount)
|
74
|
+
post[:currencycode] = CURRENCY_CODES[options[:currency] || currency(amount)]
|
75
|
+
post[:trackid] = escape(options[:order_id], 40) if options[:order_id]
|
76
|
+
post[:udf1] = escape(options[:description]) if options[:description]
|
77
|
+
post[:eci] = options[:eci] if options[:eci]
|
78
|
+
end
|
79
|
+
|
80
|
+
def add_customer_data(post, options)
|
81
|
+
post[:udf2] = escape(options[:email]) if options[:email]
|
82
|
+
if address = (options[:billing_address] || options[:address])
|
83
|
+
post[:udf3] = escape(address[:phone]) if address[:phone]
|
84
|
+
post[:udf4] = escape(<<~ADDRESS)
|
85
|
+
#{address[:name]}
|
86
|
+
#{address[:company]}
|
87
|
+
#{address[:address1]}
|
88
|
+
#{address[:address2]}
|
89
|
+
#{address[:city]} #{address[:state]} #{address[:zip]}
|
90
|
+
#{address[:country]}
|
91
|
+
ADDRESS
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def add_payment_method(post, payment_method)
|
96
|
+
post[:member] = escape(payment_method.name, 30)
|
97
|
+
post[:card] = escape(payment_method.number)
|
98
|
+
post[:cvv2] = escape(payment_method.verification_value)
|
99
|
+
post[:expyear] = format(payment_method.year, :four_digits)
|
100
|
+
post[:expmonth] = format(payment_method.month, :two_digits)
|
101
|
+
end
|
102
|
+
|
103
|
+
def add_reference(post, authorization)
|
104
|
+
tranid, member = split_authorization(authorization)
|
105
|
+
post[:transid] = tranid
|
106
|
+
post[:member] = member
|
107
|
+
end
|
108
|
+
|
109
|
+
def parse(xml)
|
110
|
+
response = {}
|
111
|
+
|
112
|
+
doc = Nokogiri::XML.fragment(fix_xml(xml))
|
113
|
+
doc.children.each do |node|
|
114
|
+
if node.text?
|
115
|
+
next
|
116
|
+
elsif node.elements.size == 0
|
117
|
+
response[node.name.downcase.to_sym] = node.text
|
118
|
+
else
|
119
|
+
node.elements.each do |childnode|
|
120
|
+
name = "#{node.name.downcase}_#{childnode.name.downcase}"
|
121
|
+
response[name.to_sym] = childnode.text
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
response
|
127
|
+
end
|
128
|
+
|
129
|
+
def fix_xml(xml)
|
130
|
+
xml.gsub(/&(?!(?:amp|quot|apos|lt|gt);)/, '&')
|
131
|
+
end
|
132
|
+
|
133
|
+
ACTIONS = {
|
134
|
+
'purchase' => '1',
|
135
|
+
'refund' => '2',
|
136
|
+
'authorize' => '4',
|
137
|
+
'capture' => '5'
|
138
|
+
}
|
139
|
+
|
140
|
+
def commit(action, post)
|
141
|
+
post[:id] = @options[:login]
|
142
|
+
post[:password] = @options[:password]
|
143
|
+
post[:action] = ACTIONS[action] if ACTIONS[action]
|
144
|
+
|
145
|
+
raw = parse(ssl_post(url(action), build_request(post)))
|
146
|
+
|
147
|
+
succeeded = success_from(raw[:result])
|
148
|
+
Response.new(
|
149
|
+
succeeded,
|
150
|
+
message_from(succeeded, raw),
|
151
|
+
raw,
|
152
|
+
authorization: authorization_from(post, raw),
|
153
|
+
test: test?
|
154
|
+
)
|
155
|
+
end
|
156
|
+
|
157
|
+
def build_request(post)
|
158
|
+
xml = Builder::XmlMarkup.new indent: 2
|
159
|
+
xml.instruct!
|
160
|
+
post.each do |field, value|
|
161
|
+
xml.tag!(field, value)
|
162
|
+
end
|
163
|
+
xml.target!
|
164
|
+
end
|
165
|
+
|
166
|
+
def url(action)
|
167
|
+
endpoint = 'TranPortalXMLServlet'
|
168
|
+
(test? ? test_url : live_url) + endpoint
|
169
|
+
end
|
170
|
+
|
171
|
+
def success_from(result)
|
172
|
+
case result
|
173
|
+
when 'CAPTURED', 'APPROVED', 'NOT ENROLLED', 'ENROLLED'
|
174
|
+
true
|
175
|
+
else
|
176
|
+
false
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def message_from(succeeded, response)
|
181
|
+
if succeeded
|
182
|
+
'Succeeded'
|
183
|
+
else
|
184
|
+
(response[:error_text] || response[:result] || 'Unable to read error message').split('-').last
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def authorization_from(request, response)
|
189
|
+
[response[:tranid], request[:member]].join('|')
|
190
|
+
end
|
191
|
+
|
192
|
+
def split_authorization(authorization)
|
193
|
+
tranid, member = authorization.split('|')
|
194
|
+
[tranid, member]
|
195
|
+
end
|
196
|
+
|
197
|
+
def escape(string, max_length = 250)
|
198
|
+
return '' unless string
|
199
|
+
|
200
|
+
string = string[0...max_length] if max_length
|
201
|
+
string.gsub(/[^A-Za-z0-9 \-_@\.\n]/, '')
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|