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,394 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CardStreamGateway < Gateway
|
4
|
+
THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE = 'Specifying the :threeDSRequired initialization option is deprecated. Please use the `:threeds_required => true` *transaction* option instead.'
|
5
|
+
|
6
|
+
self.test_url = self.live_url = 'https://gateway.cardstream.com/direct/'
|
7
|
+
self.money_format = :cents
|
8
|
+
self.default_currency = 'GBP'
|
9
|
+
self.currencies_without_fractions = %w(CVE ISK JPY UGX)
|
10
|
+
self.supported_countries = %w[GB US CH SE SG NO JP IS HK NL CZ CA AU]
|
11
|
+
self.supported_cardtypes = %i[visa master american_express diners_club discover jcb maestro]
|
12
|
+
self.homepage_url = 'http://www.cardstream.com/'
|
13
|
+
self.display_name = 'CardStream'
|
14
|
+
|
15
|
+
CURRENCY_CODES = {
|
16
|
+
'AED' => '784',
|
17
|
+
'ALL' => '008',
|
18
|
+
'AMD' => '051',
|
19
|
+
'ANG' => '532',
|
20
|
+
'ARS' => '032',
|
21
|
+
'AUD' => '036',
|
22
|
+
'AWG' => '533',
|
23
|
+
'BAM' => '977',
|
24
|
+
'BBD' => '052',
|
25
|
+
'BGN' => '975',
|
26
|
+
'BMD' => '060',
|
27
|
+
'BOB' => '068',
|
28
|
+
'BRL' => '986',
|
29
|
+
'BSD' => '044',
|
30
|
+
'BWP' => '072',
|
31
|
+
'BZD' => '084',
|
32
|
+
'CAD' => '124',
|
33
|
+
'CHF' => '756',
|
34
|
+
'CLP' => '152',
|
35
|
+
'CNY' => '156',
|
36
|
+
'COP' => '170',
|
37
|
+
'CRC' => '188',
|
38
|
+
'CZK' => '203',
|
39
|
+
'DKK' => '208',
|
40
|
+
'DOP' => '214',
|
41
|
+
'EGP' => '818',
|
42
|
+
'EUR' => '978',
|
43
|
+
'GBP' => '826',
|
44
|
+
'GEL' => '981',
|
45
|
+
'GIP' => '292',
|
46
|
+
'GTQ' => '320',
|
47
|
+
'GYD' => '328',
|
48
|
+
'HKD' => '344',
|
49
|
+
'HNL' => '340',
|
50
|
+
'HRK' => '191',
|
51
|
+
'HUF' => '348',
|
52
|
+
'ISK' => '352',
|
53
|
+
'IDR' => '360',
|
54
|
+
'ILS' => '376',
|
55
|
+
'INR' => '356',
|
56
|
+
'JPY' => '392',
|
57
|
+
'JMD' => '388',
|
58
|
+
'KES' => '404',
|
59
|
+
'KRW' => '410',
|
60
|
+
'KYD' => '136',
|
61
|
+
'LBP' => '422',
|
62
|
+
'LKR' => '144',
|
63
|
+
'MAD' => '504',
|
64
|
+
'MVR' => '462',
|
65
|
+
'MWK' => '454',
|
66
|
+
'MXN' => '484',
|
67
|
+
'MYR' => '458',
|
68
|
+
'NAD' => '516',
|
69
|
+
'NGN' => '566',
|
70
|
+
'NIO' => '558',
|
71
|
+
'NOK' => '578',
|
72
|
+
'NPR' => '524',
|
73
|
+
'NZD' => '554',
|
74
|
+
'PAB' => '590',
|
75
|
+
'PEN' => '604',
|
76
|
+
'PGK' => '598',
|
77
|
+
'PHP' => '608',
|
78
|
+
'PKR' => '586',
|
79
|
+
'PLN' => '985',
|
80
|
+
'PYG' => '600',
|
81
|
+
'QAR' => '634',
|
82
|
+
'RON' => '946',
|
83
|
+
'RSD' => '941',
|
84
|
+
'RUB' => '643',
|
85
|
+
'RWF' => '646',
|
86
|
+
'SAR' => '682',
|
87
|
+
'SEK' => '752',
|
88
|
+
'SGD' => '702',
|
89
|
+
'SRD' => '968',
|
90
|
+
'THB' => '764',
|
91
|
+
'TND' => '788',
|
92
|
+
'TRY' => '949',
|
93
|
+
'TTD' => '780',
|
94
|
+
'TWD' => '901',
|
95
|
+
'TZS' => '834',
|
96
|
+
'UAH' => '980',
|
97
|
+
'UGX' => '800',
|
98
|
+
'USD' => '840',
|
99
|
+
'UYU' => '858',
|
100
|
+
'VND' => '704',
|
101
|
+
'WST' => '882',
|
102
|
+
'XAF' => '950',
|
103
|
+
'XCD' => '951',
|
104
|
+
'XOF' => '952',
|
105
|
+
'ZAR' => '710'
|
106
|
+
}
|
107
|
+
|
108
|
+
CVV_CODE = {
|
109
|
+
'0' => 'U',
|
110
|
+
'1' => 'P',
|
111
|
+
'2' => 'M',
|
112
|
+
'4' => 'N'
|
113
|
+
}
|
114
|
+
|
115
|
+
# 0 - No additional information available.
|
116
|
+
# 1 - Postcode not checked.
|
117
|
+
# 2 - Postcode matched.
|
118
|
+
# 4 - Postcode not matched.
|
119
|
+
# 8 - Postcode partially matched.
|
120
|
+
AVS_POSTAL_MATCH = {
|
121
|
+
'0' => nil,
|
122
|
+
'1' => nil,
|
123
|
+
'2' => 'Y',
|
124
|
+
'4' => 'N',
|
125
|
+
'8' => 'N'
|
126
|
+
}
|
127
|
+
|
128
|
+
# 0 - No additional information available.
|
129
|
+
# 1 - Address numeric not checked.
|
130
|
+
# 2 - Address numeric matched.
|
131
|
+
# 4 - Address numeric not matched.
|
132
|
+
# 8 - Address numeric partially matched.
|
133
|
+
AVS_STREET_MATCH = {
|
134
|
+
'0' => nil,
|
135
|
+
'1' => nil,
|
136
|
+
'2' => 'Y',
|
137
|
+
'4' => 'N',
|
138
|
+
'8' => 'N'
|
139
|
+
}
|
140
|
+
|
141
|
+
def initialize(options = {})
|
142
|
+
requires!(options, :login, :shared_secret)
|
143
|
+
@threeds_required = false
|
144
|
+
if options[:threeDSRequired]
|
145
|
+
ActiveMerchant.deprecated(THREEDSECURE_REQUIRED_DEPRECATION_MESSAGE)
|
146
|
+
@threeds_required = options[:threeDSRequired]
|
147
|
+
end
|
148
|
+
super
|
149
|
+
end
|
150
|
+
|
151
|
+
def authorize(money, credit_card_or_reference, options = {})
|
152
|
+
post = {}
|
153
|
+
add_auth_purchase(post, -1, money, credit_card_or_reference, options)
|
154
|
+
commit('SALE', post)
|
155
|
+
end
|
156
|
+
|
157
|
+
def purchase(money, credit_card_or_reference, options = {})
|
158
|
+
post = {}
|
159
|
+
add_auth_purchase(post, 0, money, credit_card_or_reference, options)
|
160
|
+
commit('SALE', post)
|
161
|
+
end
|
162
|
+
|
163
|
+
def capture(money, authorization, options = {})
|
164
|
+
post = {}
|
165
|
+
add_pair(post, :xref, authorization)
|
166
|
+
add_pair(post, :amount, localized_amount(money, options[:currency] || currency(money)), required: true)
|
167
|
+
add_remote_address(post, options)
|
168
|
+
|
169
|
+
commit('CAPTURE', post)
|
170
|
+
end
|
171
|
+
|
172
|
+
def refund(money, authorization, options = {})
|
173
|
+
post = {}
|
174
|
+
add_pair(post, :xref, authorization)
|
175
|
+
add_amount(post, money, options)
|
176
|
+
add_remote_address(post, options)
|
177
|
+
add_country_code(post, options)
|
178
|
+
response = commit('REFUND_SALE', post)
|
179
|
+
|
180
|
+
return response if response.success?
|
181
|
+
return response unless options[:force_full_refund_if_unsettled]
|
182
|
+
|
183
|
+
if response.params['responseCode'] == '65541'
|
184
|
+
void(authorization, options)
|
185
|
+
else
|
186
|
+
response
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def void(authorization, options = {})
|
191
|
+
post = {}
|
192
|
+
add_pair(post, :xref, authorization)
|
193
|
+
add_remote_address(post, options)
|
194
|
+
commit('CANCEL', post)
|
195
|
+
end
|
196
|
+
|
197
|
+
def verify(creditcard, options = {})
|
198
|
+
MultiResponse.run(:use_first_response) do |r|
|
199
|
+
r.process { authorize(100, creditcard, options) }
|
200
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def supports_scrubbing?
|
205
|
+
true
|
206
|
+
end
|
207
|
+
|
208
|
+
def scrub(transcript)
|
209
|
+
transcript.
|
210
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
211
|
+
gsub(%r((cardNumber=)\d+), '\1[FILTERED]').
|
212
|
+
gsub(%r((CVV=)\d+), '\1[FILTERED]')
|
213
|
+
end
|
214
|
+
|
215
|
+
private
|
216
|
+
|
217
|
+
def add_auth_purchase(post, pair_value, money, credit_card_or_reference, options)
|
218
|
+
add_pair(post, :captureDelay, pair_value)
|
219
|
+
add_amount(post, money, options)
|
220
|
+
add_invoice(post, credit_card_or_reference, money, options)
|
221
|
+
add_credit_card_or_reference(post, credit_card_or_reference)
|
222
|
+
add_customer_data(post, options)
|
223
|
+
add_remote_address(post, options)
|
224
|
+
add_country_code(post, options)
|
225
|
+
add_threeds_fields(post, options)
|
226
|
+
end
|
227
|
+
|
228
|
+
def add_amount(post, money, options)
|
229
|
+
currency = options[:currency] || currency(money)
|
230
|
+
add_pair(post, :amount, localized_amount(money, currency), required: true)
|
231
|
+
add_pair(post, :currencyCode, currency_code(currency))
|
232
|
+
end
|
233
|
+
|
234
|
+
def add_customer_data(post, options)
|
235
|
+
add_pair(post, :customerEmail, options[:email])
|
236
|
+
if (address = options[:billing_address] || options[:address])
|
237
|
+
add_pair(post, :customerAddress, "#{address[:address1]} #{address[:address2]}".strip)
|
238
|
+
add_pair(post, :customerPostCode, address[:zip])
|
239
|
+
add_pair(post, :customerPhone, options[:phone])
|
240
|
+
add_pair(post, :customerCountryCode, address[:country] || 'GB')
|
241
|
+
else
|
242
|
+
add_pair(post, :customerCountryCode, 'GB')
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
def add_invoice(post, credit_card_or_reference, money, options)
|
247
|
+
add_pair(post, :transactionUnique, options[:order_id], required: true)
|
248
|
+
add_pair(post, :orderRef, options[:description] || options[:order_id], required: true)
|
249
|
+
add_pair(post, :statementNarrative1, options[:merchant_name]) if options[:merchant_name]
|
250
|
+
add_pair(post, :statementNarrative2, options[:dynamic_descriptor]) if options[:dynamic_descriptor]
|
251
|
+
if credit_card_or_reference.respond_to?(:number)
|
252
|
+
if %w[american_express diners_club].include?(card_brand(credit_card_or_reference).to_s)
|
253
|
+
add_pair(post, :item1Quantity, 1)
|
254
|
+
add_pair(post, :item1Description, (options[:description] || options[:order_id]).slice(0, 15))
|
255
|
+
add_pair(post, :item1GrossValue, localized_amount(money, options[:currency] || currency(money)))
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
add_pair(post, :type, options[:type] || '1')
|
260
|
+
add_threeds_required(post, options)
|
261
|
+
end
|
262
|
+
|
263
|
+
def add_credit_card_or_reference(post, credit_card_or_reference)
|
264
|
+
if credit_card_or_reference.respond_to?(:number)
|
265
|
+
add_credit_card(post, credit_card_or_reference)
|
266
|
+
else
|
267
|
+
add_reference(post, credit_card_or_reference.to_s)
|
268
|
+
end
|
269
|
+
end
|
270
|
+
|
271
|
+
def add_reference(post, reference)
|
272
|
+
add_pair(post, :xref, reference, required: true)
|
273
|
+
end
|
274
|
+
|
275
|
+
def add_credit_card(post, credit_card)
|
276
|
+
add_pair(post, :customerName, credit_card.name, required: true)
|
277
|
+
add_pair(post, :cardNumber, credit_card.number, required: true)
|
278
|
+
add_pair(post, :cardExpiryMonth, format(credit_card.month, :two_digits), required: true)
|
279
|
+
add_pair(post, :cardExpiryYear, format(credit_card.year, :two_digits), required: true)
|
280
|
+
add_pair(post, :cardCVV, credit_card.verification_value)
|
281
|
+
end
|
282
|
+
|
283
|
+
def add_threeds_required(post, options)
|
284
|
+
add_pair(post, :threeDSRequired, options[:threeds_required] || @threeds_required ? 'Y' : 'N')
|
285
|
+
end
|
286
|
+
|
287
|
+
def add_threeds_fields(post, options)
|
288
|
+
return unless three_d_secure = options[:three_d_secure]
|
289
|
+
|
290
|
+
add_pair(post, :threeDSEnrolled, formatted_enrollment(three_d_secure[:enrolled]))
|
291
|
+
if three_d_secure[:enrolled] == 'true'
|
292
|
+
add_pair(post, :threeDSAuthenticated, three_d_secure[:authentication_response_status])
|
293
|
+
if three_d_secure[:authentication_response_status] == 'Y'
|
294
|
+
post[:threeDSECI] = three_d_secure[:eci]
|
295
|
+
post[:threeDSCAVV] = three_d_secure[:cavv]
|
296
|
+
post[:threeDSXID] = three_d_secure[:xid] || three_d_secure[:ds_transaction_id]
|
297
|
+
end
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
def add_remote_address(post, options = {})
|
302
|
+
add_pair(post, :remoteAddress, options[:ip] || '1.1.1.1')
|
303
|
+
end
|
304
|
+
|
305
|
+
def add_country_code(post, options)
|
306
|
+
post[:countryCode] = options[:country_code] || self.supported_countries[0]
|
307
|
+
end
|
308
|
+
|
309
|
+
def normalize_line_endings(str)
|
310
|
+
str.gsub(/%0D%0A|%0A%0D|%0D/, '%0A')
|
311
|
+
end
|
312
|
+
|
313
|
+
def add_hmac(post)
|
314
|
+
result = post.sort.collect { |key, value| "#{key}=#{normalize_line_endings(CGI.escape(value.to_s))}" }.join('&')
|
315
|
+
result = Digest::SHA512.hexdigest("#{result}#{@options[:shared_secret]}")
|
316
|
+
|
317
|
+
add_pair(post, :signature, result)
|
318
|
+
end
|
319
|
+
|
320
|
+
def parse(body)
|
321
|
+
result = {}
|
322
|
+
pairs = body.split('&')
|
323
|
+
pairs.each do |pair|
|
324
|
+
a = pair.split('=')
|
325
|
+
# because some value pairs don't have a value
|
326
|
+
result[a[0].to_sym] = a[1] == nil ? '' : CGI.unescape(a[1])
|
327
|
+
end
|
328
|
+
result
|
329
|
+
end
|
330
|
+
|
331
|
+
def commit(action, parameters)
|
332
|
+
parameters.update(
|
333
|
+
merchantID: @options[:login],
|
334
|
+
action: action
|
335
|
+
)
|
336
|
+
# adds a signature to the post hash/array
|
337
|
+
add_hmac(parameters)
|
338
|
+
|
339
|
+
response = parse(ssl_post(self.live_url, post_data(action, parameters)))
|
340
|
+
|
341
|
+
Response.new(
|
342
|
+
response[:responseCode] == '0',
|
343
|
+
response[:responseCode] == '0' ? 'APPROVED' : response[:responseMessage],
|
344
|
+
response,
|
345
|
+
test: test?,
|
346
|
+
authorization: response[:xref],
|
347
|
+
cvv_result: CVV_CODE[response[:avscv2ResponseCode].to_s[0, 1]],
|
348
|
+
avs_result: avs_from(response)
|
349
|
+
)
|
350
|
+
end
|
351
|
+
|
352
|
+
def avs_from(response)
|
353
|
+
postal_match = AVS_POSTAL_MATCH[response[:avscv2ResponseCode].to_s[1, 1]]
|
354
|
+
street_match = AVS_STREET_MATCH[response[:avscv2ResponseCode].to_s[2, 1]]
|
355
|
+
|
356
|
+
code = if postal_match == 'Y' && street_match == 'Y'
|
357
|
+
'M'
|
358
|
+
elsif postal_match == 'Y'
|
359
|
+
'P'
|
360
|
+
elsif street_match == 'Y'
|
361
|
+
'A'
|
362
|
+
else
|
363
|
+
'I'
|
364
|
+
end
|
365
|
+
|
366
|
+
AVSResult.new({
|
367
|
+
code: code,
|
368
|
+
postal_match: postal_match,
|
369
|
+
street_match: street_match
|
370
|
+
})
|
371
|
+
end
|
372
|
+
|
373
|
+
def currency_code(currency)
|
374
|
+
CURRENCY_CODES[currency]
|
375
|
+
end
|
376
|
+
|
377
|
+
def post_data(action, parameters = {})
|
378
|
+
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
379
|
+
end
|
380
|
+
|
381
|
+
def add_pair(post, key, value, options = {})
|
382
|
+
post[key] = value if !value.blank? || options[:required]
|
383
|
+
end
|
384
|
+
|
385
|
+
def formatted_enrollment(val)
|
386
|
+
case val
|
387
|
+
when 'Y', 'N', 'U' then val
|
388
|
+
when true, 'true' then 'Y'
|
389
|
+
when false, 'false' then 'N'
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
end
|