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,284 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class MerchantWareVersionFourGateway < Gateway
|
4
|
+
self.live_url = 'https://ps1.merchantware.net/Merchantware/ws/RetailTransaction/v4/Credit.asmx'
|
5
|
+
self.test_url = 'https://ps1.merchantware.net/Merchantware/ws/RetailTransaction/v4/Credit.asmx'
|
6
|
+
|
7
|
+
self.supported_countries = ['US']
|
8
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
9
|
+
self.homepage_url = 'http://merchantwarehouse.com/merchantware'
|
10
|
+
self.display_name = 'MerchantWARE'
|
11
|
+
|
12
|
+
ENV_NAMESPACES = { 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
13
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
14
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' }
|
15
|
+
|
16
|
+
TX_NAMESPACE = 'http://schemas.merchantwarehouse.com/merchantware/40/Credit/'
|
17
|
+
|
18
|
+
ACTIONS = {
|
19
|
+
purchase: 'SaleKeyed',
|
20
|
+
reference_purchase: 'RepeatSale',
|
21
|
+
authorize: 'PreAuthorizationKeyed',
|
22
|
+
capture: 'PostAuthorization',
|
23
|
+
void: 'Void',
|
24
|
+
refund: 'Refund'
|
25
|
+
}
|
26
|
+
|
27
|
+
# Creates a new MerchantWareVersionFourGateway
|
28
|
+
#
|
29
|
+
# The gateway requires that a valid login, password, and name be passed
|
30
|
+
# in the +options+ hash.
|
31
|
+
#
|
32
|
+
# ==== Options
|
33
|
+
#
|
34
|
+
# * <tt>:login</tt> - The MerchantWARE SiteID.
|
35
|
+
# * <tt>:password</tt> - The MerchantWARE Key.
|
36
|
+
# * <tt>:name</tt> - The MerchantWARE Name.
|
37
|
+
def initialize(options = {})
|
38
|
+
requires!(options, :login, :password, :name)
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
42
|
+
# Authorize a credit card for a given amount.
|
43
|
+
#
|
44
|
+
# ==== Parameters
|
45
|
+
# * <tt>money</tt> - The amount to be authorized as an Integer value in cents.
|
46
|
+
# * <tt>credit_card</tt> - The CreditCard details for the transaction.
|
47
|
+
# * <tt>options</tt>
|
48
|
+
# * <tt>:order_id</tt> - A unique reference for this order (required).
|
49
|
+
# * <tt>:billing_address</tt> - The billing address for the cardholder.
|
50
|
+
def authorize(money, credit_card, options = {})
|
51
|
+
request = build_purchase_request(:authorize, money, credit_card, options)
|
52
|
+
commit(:authorize, request)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Authorize and immediately capture funds from a credit card.
|
56
|
+
#
|
57
|
+
# ==== Parameters
|
58
|
+
# * <tt>money</tt> - The amount to be authorized as anInteger value in cents.
|
59
|
+
# * <tt>payment_source</tt> - The CreditCard details or 'token' from prior transaction
|
60
|
+
# * <tt>options</tt>
|
61
|
+
# * <tt>:order_id</tt> - A unique reference for this order (required).
|
62
|
+
# * <tt>:billing_address</tt> - The billing address for the cardholder.
|
63
|
+
def purchase(money, payment_source, options = {})
|
64
|
+
action = payment_source.is_a?(String) ? :reference_purchase : :purchase
|
65
|
+
request = build_purchase_request(action, money, payment_source, options)
|
66
|
+
commit(action, request)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Capture authorized funds from a credit card.
|
70
|
+
#
|
71
|
+
# ==== Parameters
|
72
|
+
# * <tt>money</tt> - The amount to be captured as anInteger value in cents.
|
73
|
+
# * <tt>authorization</tt> - The authorization string returned from the initial authorization.
|
74
|
+
def capture(money, authorization, options = {})
|
75
|
+
request = build_capture_request(:capture, money, authorization, options)
|
76
|
+
commit(:capture, request)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Void a transaction.
|
80
|
+
#
|
81
|
+
# ==== Parameters
|
82
|
+
# * <tt>authorization</tt> - The authorization string returned from the initial authorization or purchase.
|
83
|
+
def void(authorization, options = {})
|
84
|
+
reference, options[:order_id] = split_reference(authorization)
|
85
|
+
request = soap_request(:void) do |xml|
|
86
|
+
add_reference_token(xml, reference)
|
87
|
+
end
|
88
|
+
commit(:void, request)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Refund an amount back a cardholder
|
92
|
+
#
|
93
|
+
# ==== Parameters
|
94
|
+
#
|
95
|
+
# * <tt>money</tt> - The amount to be refunded as an Integer value in cents.
|
96
|
+
# * <tt>identification</tt> - The credit card you want to refund or the authorization for the existing transaction you are refunding.
|
97
|
+
# * <tt>options</tt>
|
98
|
+
# * <tt>:order_id</tt> - A unique reference for this order (required when performing a non-referenced credit)
|
99
|
+
def refund(money, identification, options = {})
|
100
|
+
reference, options[:order_id] = split_reference(identification)
|
101
|
+
|
102
|
+
request = soap_request(:refund) do |xml|
|
103
|
+
add_reference_token(xml, reference)
|
104
|
+
add_invoice(xml, options)
|
105
|
+
add_amount(xml, money, 'overrideAmount')
|
106
|
+
end
|
107
|
+
|
108
|
+
commit(:refund, request)
|
109
|
+
end
|
110
|
+
|
111
|
+
def verify(credit_card, options = {})
|
112
|
+
MultiResponse.run(:use_first_response) do |r|
|
113
|
+
r.process { authorize(100, credit_card, options) }
|
114
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def supports_scrubbing?
|
119
|
+
true
|
120
|
+
end
|
121
|
+
|
122
|
+
def scrub(transcript)
|
123
|
+
transcript.
|
124
|
+
gsub(%r((<merchantKey>).+?(</merchantKey>))i, '\1[FILTERED]\2').
|
125
|
+
gsub(%r((<cardNumber>).+?(</cardNumber>))i, '\1[FILTERED]\2').
|
126
|
+
gsub(%r((<cardSecurityCode>).+?(</cardSecurityCode>))i, '\1[FILTERED]\2')
|
127
|
+
end
|
128
|
+
|
129
|
+
private
|
130
|
+
|
131
|
+
def soap_request(action)
|
132
|
+
xml = Builder::XmlMarkup.new indent: 2
|
133
|
+
xml.instruct!
|
134
|
+
xml.tag! 'soap:Envelope', ENV_NAMESPACES do
|
135
|
+
xml.tag! 'soap:Body' do
|
136
|
+
xml.tag! ACTIONS[action], 'xmlns' => TX_NAMESPACE do
|
137
|
+
xml.tag! 'merchantName', @options[:name]
|
138
|
+
xml.tag! 'merchantSiteId', @options[:login]
|
139
|
+
xml.tag! 'merchantKey', @options[:password]
|
140
|
+
yield xml
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
xml.target!
|
145
|
+
end
|
146
|
+
|
147
|
+
def build_purchase_request(action, money, payment_source, options)
|
148
|
+
requires!(options, :order_id)
|
149
|
+
|
150
|
+
soap_request(action) do |xml|
|
151
|
+
add_invoice(xml, options)
|
152
|
+
add_amount(xml, money)
|
153
|
+
add_payment_source(xml, payment_source)
|
154
|
+
add_address(xml, options)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def build_capture_request(action, money, identification, options)
|
159
|
+
reference, options[:order_id] = split_reference(identification)
|
160
|
+
|
161
|
+
soap_request(action) do |xml|
|
162
|
+
add_reference_token(xml, reference)
|
163
|
+
add_invoice(xml, options)
|
164
|
+
add_amount(xml, money)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def add_invoice(xml, options)
|
169
|
+
xml.tag! 'invoiceNumber', truncate(options[:order_id].to_s.gsub(/[^\w]/, ''), 8)
|
170
|
+
end
|
171
|
+
|
172
|
+
def add_amount(xml, money, tag = 'amount')
|
173
|
+
xml.tag! tag, amount(money)
|
174
|
+
end
|
175
|
+
|
176
|
+
def add_reference_token(xml, reference)
|
177
|
+
xml.tag! 'token', reference
|
178
|
+
end
|
179
|
+
|
180
|
+
def add_address(xml, options)
|
181
|
+
address = options[:billing_address] || options[:address] || {}
|
182
|
+
xml.tag! 'avsStreetAddress', address[:address1]
|
183
|
+
xml.tag! 'avsStreetZipCode', address[:zip]
|
184
|
+
end
|
185
|
+
|
186
|
+
def add_payment_source(xml, source)
|
187
|
+
if source.is_a?(String)
|
188
|
+
add_reference_token(xml, source)
|
189
|
+
else
|
190
|
+
add_credit_card(xml, source)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def add_credit_card(xml, credit_card)
|
195
|
+
xml.tag! 'cardNumber', credit_card.number
|
196
|
+
xml.tag! 'expirationDate', expdate(credit_card)
|
197
|
+
xml.tag! 'cardholder', credit_card.name
|
198
|
+
xml.tag! 'cardSecurityCode', credit_card.verification_value if credit_card.verification_value?
|
199
|
+
end
|
200
|
+
|
201
|
+
def split_reference(reference)
|
202
|
+
reference.to_s.split(';')
|
203
|
+
end
|
204
|
+
|
205
|
+
def parse(action, data)
|
206
|
+
response = {}
|
207
|
+
xml = REXML::Document.new(data)
|
208
|
+
|
209
|
+
root = REXML::XPath.first(xml, "//#{ACTIONS[action]}Response/#{ACTIONS[action]}Result")
|
210
|
+
|
211
|
+
root.elements.each do |element|
|
212
|
+
response[element.name] = element.text
|
213
|
+
end
|
214
|
+
|
215
|
+
if response['ErrorMessage'].present?
|
216
|
+
response[:message] = response['ErrorMessage']
|
217
|
+
response[:success] = false
|
218
|
+
else
|
219
|
+
status, code, message = response['ApprovalStatus'].split(';')
|
220
|
+
response[:status] = status
|
221
|
+
|
222
|
+
if response[:success] = status == 'APPROVED'
|
223
|
+
response[:message] = status
|
224
|
+
else
|
225
|
+
response[:message] = message
|
226
|
+
response[:failure_code] = code
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
response
|
231
|
+
end
|
232
|
+
|
233
|
+
def parse_error(http_response, action)
|
234
|
+
response = {}
|
235
|
+
response[:http_code] = http_response.code
|
236
|
+
response[:http_message] = http_response.message
|
237
|
+
response[:success] = false
|
238
|
+
|
239
|
+
document = REXML::Document.new(http_response.body)
|
240
|
+
node = REXML::XPath.first(document, "//#{ACTIONS[action]}Response/#{ACTIONS[action]}Result")
|
241
|
+
|
242
|
+
node.elements.each do |element|
|
243
|
+
response[element.name] = element.text
|
244
|
+
end
|
245
|
+
|
246
|
+
response[:message] = response['ErrorMessage'].to_s.tr("\n", ' ')
|
247
|
+
response
|
248
|
+
rescue REXML::ParseException
|
249
|
+
response[:http_body] = http_response.body
|
250
|
+
response[:message] = 'Failed to parse the failed response'
|
251
|
+
response
|
252
|
+
end
|
253
|
+
|
254
|
+
def soap_action(action)
|
255
|
+
"#{TX_NAMESPACE}#{ACTIONS[action]}"
|
256
|
+
end
|
257
|
+
|
258
|
+
def url
|
259
|
+
test? ? test_url : live_url
|
260
|
+
end
|
261
|
+
|
262
|
+
def commit(action, request)
|
263
|
+
begin
|
264
|
+
data = ssl_post(url, request,
|
265
|
+
'Content-Type' => 'text/xml; charset=utf-8',
|
266
|
+
'SOAPAction' => soap_action(action))
|
267
|
+
response = parse(action, data)
|
268
|
+
rescue ActiveMerchant::ResponseError => e
|
269
|
+
response = parse_error(e.response, action)
|
270
|
+
end
|
271
|
+
|
272
|
+
Response.new(response[:success], response[:message], response,
|
273
|
+
test: test?,
|
274
|
+
authorization: authorization_from(response),
|
275
|
+
avs_result: { code: response['AvsResponse'] },
|
276
|
+
cvv_result: response['CvResponse'])
|
277
|
+
end
|
278
|
+
|
279
|
+
def authorization_from(response)
|
280
|
+
response['Token']
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
284
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
require 'rexml/document'
|
3
|
+
|
4
|
+
module ActiveMerchant #:nodoc:
|
5
|
+
module Billing #:nodoc:
|
6
|
+
class MerchantWarriorGateway < Gateway
|
7
|
+
TOKEN_TEST_URL = 'https://base.merchantwarrior.com/token/'
|
8
|
+
TOKEN_LIVE_URL = 'https://api.merchantwarrior.com/token/'
|
9
|
+
|
10
|
+
POST_TEST_URL = 'https://base.merchantwarrior.com/post/'
|
11
|
+
POST_LIVE_URL = 'https://api.merchantwarrior.com/post/'
|
12
|
+
|
13
|
+
self.supported_countries = ['AU']
|
14
|
+
self.supported_cardtypes = %i[visa master american_express
|
15
|
+
diners_club discover jcb]
|
16
|
+
self.homepage_url = 'https://www.merchantwarrior.com/'
|
17
|
+
self.display_name = 'Merchant Warrior'
|
18
|
+
|
19
|
+
self.money_format = :dollars
|
20
|
+
self.default_currency = 'AUD'
|
21
|
+
|
22
|
+
def initialize(options = {})
|
23
|
+
requires!(options, :merchant_uuid, :api_key, :api_passphrase)
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def authorize(money, payment_method, options = {})
|
28
|
+
post = {}
|
29
|
+
add_amount(post, money, options)
|
30
|
+
add_order_id(post, options)
|
31
|
+
add_address(post, options)
|
32
|
+
add_payment_method(post, payment_method)
|
33
|
+
add_recurring_flag(post, options)
|
34
|
+
add_soft_descriptors(post, options)
|
35
|
+
commit('processAuth', post)
|
36
|
+
end
|
37
|
+
|
38
|
+
def purchase(money, payment_method, options = {})
|
39
|
+
post = {}
|
40
|
+
add_amount(post, money, options)
|
41
|
+
add_order_id(post, options)
|
42
|
+
add_address(post, options)
|
43
|
+
add_payment_method(post, payment_method)
|
44
|
+
add_recurring_flag(post, options)
|
45
|
+
add_soft_descriptors(post, options)
|
46
|
+
commit('processCard', post)
|
47
|
+
end
|
48
|
+
|
49
|
+
def capture(money, identification, options = {})
|
50
|
+
post = {}
|
51
|
+
add_amount(post, money, options)
|
52
|
+
add_transaction(post, identification)
|
53
|
+
add_soft_descriptors(post, options)
|
54
|
+
post['captureAmount'] = amount(money)
|
55
|
+
commit('processCapture', post)
|
56
|
+
end
|
57
|
+
|
58
|
+
def refund(money, identification, options = {})
|
59
|
+
post = {}
|
60
|
+
add_amount(post, money, options)
|
61
|
+
add_transaction(post, identification)
|
62
|
+
add_soft_descriptors(post, options)
|
63
|
+
post['refundAmount'] = amount(money)
|
64
|
+
commit('refundCard', post)
|
65
|
+
end
|
66
|
+
|
67
|
+
def void(identification, options = {})
|
68
|
+
post = {}
|
69
|
+
# The amount parameter is required for void transactions
|
70
|
+
# on the Merchant Warrior gateway.
|
71
|
+
post['transactionAmount'] = options[:amount]
|
72
|
+
post['hash'] = void_verification_hash(identification)
|
73
|
+
add_transaction(post, identification)
|
74
|
+
commit('processVoid', post)
|
75
|
+
end
|
76
|
+
|
77
|
+
def store(creditcard, options = {})
|
78
|
+
post = {
|
79
|
+
'cardName' => scrub_name(creditcard.name),
|
80
|
+
'cardNumber' => creditcard.number,
|
81
|
+
'cardExpiryMonth' => format(creditcard.month, :two_digits),
|
82
|
+
'cardExpiryYear' => format(creditcard.year, :two_digits)
|
83
|
+
}
|
84
|
+
commit('addCard', post)
|
85
|
+
end
|
86
|
+
|
87
|
+
def supports_scrubbing?
|
88
|
+
true
|
89
|
+
end
|
90
|
+
|
91
|
+
def scrub(transcript)
|
92
|
+
transcript.
|
93
|
+
gsub(%r((&?paymentCardNumber=)[^&]*)i, '\1[FILTERED]').
|
94
|
+
gsub(%r((CardNumber=)[^&]*)i, '\1[FILTERED]').
|
95
|
+
gsub(%r((&?paymentCardCSC=)[^&]*)i, '\1[FILTERED]').
|
96
|
+
gsub(%r((&?apiKey=)[^&]*)i, '\1[FILTERED]')
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
|
101
|
+
def add_transaction(post, identification)
|
102
|
+
post['transactionID'] = identification
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_address(post, options)
|
106
|
+
return unless (address = (options[:billing_address] || options[:address]))
|
107
|
+
|
108
|
+
post['customerName'] = scrub_name(address[:name])
|
109
|
+
post['customerCountry'] = address[:country]
|
110
|
+
post['customerState'] = address[:state] || 'N/A'
|
111
|
+
post['customerCity'] = address[:city]
|
112
|
+
post['customerAddress'] = address[:address1]
|
113
|
+
post['customerPostCode'] = address[:zip]
|
114
|
+
post['customerIP'] = address[:ip]
|
115
|
+
post['customerPhone'] = address[:phone]
|
116
|
+
post['customerEmail'] = address[:email]
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_order_id(post, options)
|
120
|
+
post['transactionProduct'] = truncate(options[:order_id], 34) || SecureRandom.hex(15)
|
121
|
+
end
|
122
|
+
|
123
|
+
def add_payment_method(post, payment_method)
|
124
|
+
if payment_method.respond_to?(:number)
|
125
|
+
add_creditcard(post, payment_method)
|
126
|
+
else
|
127
|
+
add_token(post, payment_method)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def add_token(post, token)
|
132
|
+
post['cardID'] = token
|
133
|
+
end
|
134
|
+
|
135
|
+
def add_creditcard(post, creditcard)
|
136
|
+
post['paymentCardNumber'] = creditcard.number
|
137
|
+
post['paymentCardName'] = scrub_name(creditcard.name)
|
138
|
+
post['paymentCardExpiry'] = creditcard.expiry_date.expiration.strftime('%m%y')
|
139
|
+
post['paymentCardCSC'] = creditcard.verification_value if creditcard.verification_value?
|
140
|
+
end
|
141
|
+
|
142
|
+
def scrub_name(name)
|
143
|
+
name.gsub(/[^a-zA-Z\. -]/, '')
|
144
|
+
end
|
145
|
+
|
146
|
+
def add_amount(post, money, options)
|
147
|
+
currency = (options[:currency] || currency(money))
|
148
|
+
|
149
|
+
post['transactionAmount'] = amount(money)
|
150
|
+
post['transactionCurrency'] = currency
|
151
|
+
post['hash'] = verification_hash(amount(money), currency)
|
152
|
+
end
|
153
|
+
|
154
|
+
def add_recurring_flag(post, options)
|
155
|
+
return if options[:recurring_flag].nil?
|
156
|
+
|
157
|
+
post['recurringFlag'] = options[:recurring_flag]
|
158
|
+
end
|
159
|
+
|
160
|
+
def add_soft_descriptors(post, options)
|
161
|
+
post['descriptorName'] = options[:descriptor_name] if options[:descriptor_name]
|
162
|
+
post['descriptorCity'] = options[:descriptor_city] if options[:descriptor_city]
|
163
|
+
post['descriptorState'] = options[:descriptor_state] if options[:descriptor_state]
|
164
|
+
end
|
165
|
+
|
166
|
+
def verification_hash(money, currency)
|
167
|
+
Digest::MD5.hexdigest(
|
168
|
+
(
|
169
|
+
@options[:api_passphrase].to_s +
|
170
|
+
@options[:merchant_uuid].to_s +
|
171
|
+
money.to_s +
|
172
|
+
currency
|
173
|
+
).downcase
|
174
|
+
)
|
175
|
+
end
|
176
|
+
|
177
|
+
def void_verification_hash(transaction_id)
|
178
|
+
Digest::MD5.hexdigest(
|
179
|
+
(
|
180
|
+
@options[:api_passphrase].to_s +
|
181
|
+
@options[:merchant_uuid].to_s +
|
182
|
+
transaction_id
|
183
|
+
).downcase
|
184
|
+
)
|
185
|
+
end
|
186
|
+
|
187
|
+
def parse(body)
|
188
|
+
xml = REXML::Document.new(body)
|
189
|
+
|
190
|
+
return { response_message: 'Invalid gateway response' } unless xml.root.present?
|
191
|
+
|
192
|
+
response = {}
|
193
|
+
xml.root.elements.to_a.each do |node|
|
194
|
+
parse_element(response, node)
|
195
|
+
end
|
196
|
+
response
|
197
|
+
end
|
198
|
+
|
199
|
+
def parse_element(response, node)
|
200
|
+
if node.has_elements?
|
201
|
+
node.elements.each { |element| parse_element(response, element) }
|
202
|
+
else
|
203
|
+
response[node.name.underscore.to_sym] = node.text
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def commit(action, post)
|
208
|
+
add_auth(action, post)
|
209
|
+
|
210
|
+
response = parse(ssl_post(url_for(action, post), post_data(post)))
|
211
|
+
|
212
|
+
Response.new(
|
213
|
+
success?(response),
|
214
|
+
response[:response_message],
|
215
|
+
response,
|
216
|
+
test: test?,
|
217
|
+
authorization: (response[:card_id] || response[:transaction_id])
|
218
|
+
)
|
219
|
+
end
|
220
|
+
|
221
|
+
def add_auth(action, post)
|
222
|
+
post['merchantUUID'] = @options[:merchant_uuid]
|
223
|
+
post['apiKey'] = @options[:api_key]
|
224
|
+
post['method'] = action unless token?(post)
|
225
|
+
end
|
226
|
+
|
227
|
+
def url_for(action, post)
|
228
|
+
if token?(post)
|
229
|
+
[(test? ? TOKEN_TEST_URL : TOKEN_LIVE_URL), action].join('/')
|
230
|
+
else
|
231
|
+
(test? ? POST_TEST_URL : POST_LIVE_URL)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def token?(post)
|
236
|
+
(post['cardID'] || post['cardName'])
|
237
|
+
end
|
238
|
+
|
239
|
+
def success?(response)
|
240
|
+
(response[:response_code] == '0')
|
241
|
+
end
|
242
|
+
|
243
|
+
def post_data(post)
|
244
|
+
post.collect { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|