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,368 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class SimetrikGateway < Gateway
|
4
|
+
self.test_url = 'https://payments.sta.simetrik.com/v1'
|
5
|
+
self.live_url = 'https://payments.simetrik.com/v1'
|
6
|
+
|
7
|
+
class_attribute :test_auth_url, :live_auth_url, :test_audience, :live_audience
|
8
|
+
self.test_auth_url = 'https://tenant-payments-dev.us.auth0.com/oauth/token'
|
9
|
+
self.live_auth_url = 'https://tenant-payments-prod.us.auth0.com/oauth/token'
|
10
|
+
|
11
|
+
self.test_audience = 'https://tenant-payments-dev.us.auth0.com/api/v2/'
|
12
|
+
self.live_audience = 'https://tenant-payments-prod.us.auth0.com/api/v2/'
|
13
|
+
|
14
|
+
self.supported_countries = %w(PE AR)
|
15
|
+
self.default_currency = 'USD'
|
16
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
17
|
+
|
18
|
+
self.homepage_url = 'https://www.simetrik.com'
|
19
|
+
self.display_name = 'Simetrik'
|
20
|
+
|
21
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
22
|
+
'R101' => STANDARD_ERROR_CODE[:incorrect_number],
|
23
|
+
'R102' => STANDARD_ERROR_CODE[:invalid_number],
|
24
|
+
'R103' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
25
|
+
'R104' => STANDARD_ERROR_CODE[:invalid_cvc],
|
26
|
+
'R105' => STANDARD_ERROR_CODE[:expired_card],
|
27
|
+
'R106' => STANDARD_ERROR_CODE[:incorrect_cvc],
|
28
|
+
'R107' => STANDARD_ERROR_CODE[:incorrect_pin],
|
29
|
+
'R201' => STANDARD_ERROR_CODE[:incorrect_zip],
|
30
|
+
'R202' => STANDARD_ERROR_CODE[:incorrect_address],
|
31
|
+
'R301' => STANDARD_ERROR_CODE[:card_declined],
|
32
|
+
'R302' => STANDARD_ERROR_CODE[:processing_error],
|
33
|
+
'R303' => STANDARD_ERROR_CODE[:call_issuer],
|
34
|
+
'R304' => STANDARD_ERROR_CODE[:pick_up_card],
|
35
|
+
'R305' => STANDARD_ERROR_CODE[:processing_error],
|
36
|
+
'R306' => STANDARD_ERROR_CODE[:processing_error],
|
37
|
+
'R307' => STANDARD_ERROR_CODE[:processing_error],
|
38
|
+
'R401' => STANDARD_ERROR_CODE[:config_error],
|
39
|
+
'R402' => STANDARD_ERROR_CODE[:test_mode_live_card],
|
40
|
+
'R403' => STANDARD_ERROR_CODE[:unsupported_feature]
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
def initialize(options = {})
|
45
|
+
requires!(options, :client_id, :client_secret)
|
46
|
+
super
|
47
|
+
@access_token = {}
|
48
|
+
sign_access_token()
|
49
|
+
end
|
50
|
+
|
51
|
+
def authorize(money, payment, options = {})
|
52
|
+
requires!(options, :token_acquirer)
|
53
|
+
|
54
|
+
post = {}
|
55
|
+
add_forward_route(post, options)
|
56
|
+
add_forward_payload(post, money, payment, options)
|
57
|
+
add_stored_credential(post, options)
|
58
|
+
commit('authorize', post, { token_acquirer: options[:token_acquirer] })
|
59
|
+
end
|
60
|
+
|
61
|
+
def capture(money, authorization, options = {})
|
62
|
+
requires!(options, :token_acquirer)
|
63
|
+
post = {
|
64
|
+
forward_payload: {
|
65
|
+
amount: {
|
66
|
+
total_amount: amount(money).to_f,
|
67
|
+
currency: (options[:currency] || currency(money))
|
68
|
+
},
|
69
|
+
transaction: {
|
70
|
+
id: authorization
|
71
|
+
},
|
72
|
+
acquire_extra_options: options[:acquire_extra_options] || {}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
post[:forward_payload][:amount][:vat] = options[:vat].to_f / 100 if options[:vat]
|
76
|
+
|
77
|
+
add_forward_route(post, options)
|
78
|
+
commit('capture', post, { token_acquirer: options[:token_acquirer] })
|
79
|
+
end
|
80
|
+
|
81
|
+
def refund(money, authorization, options = {})
|
82
|
+
requires!(options, :token_acquirer)
|
83
|
+
post = {
|
84
|
+
forward_payload: {
|
85
|
+
amount: {
|
86
|
+
total_amount: amount(money).to_f,
|
87
|
+
currency: (options[:currency] || currency(money))
|
88
|
+
},
|
89
|
+
transaction: {
|
90
|
+
id: authorization
|
91
|
+
},
|
92
|
+
acquire_extra_options: options[:acquire_extra_options] || {}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
post[:forward_payload][:transaction][:comment] = options[:comment] if options[:comment]
|
96
|
+
|
97
|
+
add_forward_route(post, options)
|
98
|
+
commit('refund', post, { token_acquirer: options[:token_acquirer] })
|
99
|
+
end
|
100
|
+
|
101
|
+
def void(authorization, options = {})
|
102
|
+
requires!(options, :token_acquirer)
|
103
|
+
post = {
|
104
|
+
forward_payload: {
|
105
|
+
transaction: {
|
106
|
+
id: authorization
|
107
|
+
},
|
108
|
+
acquire_extra_options: options[:acquire_extra_options] || {}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
add_forward_route(post, options)
|
112
|
+
commit('void', post, { token_acquirer: options[:token_acquirer] })
|
113
|
+
end
|
114
|
+
|
115
|
+
def purchase(money, payment, options = {})
|
116
|
+
requires!(options, :token_acquirer)
|
117
|
+
|
118
|
+
post = {}
|
119
|
+
add_forward_route(post, options)
|
120
|
+
add_forward_payload(post, money, payment, options)
|
121
|
+
|
122
|
+
add_stored_credential(post, options)
|
123
|
+
commit('charge', post, { token_acquirer: options[:token_acquirer] })
|
124
|
+
end
|
125
|
+
|
126
|
+
def supports_scrubbing?
|
127
|
+
true
|
128
|
+
end
|
129
|
+
|
130
|
+
def scrub(transcript)
|
131
|
+
transcript.
|
132
|
+
gsub(%r((Authorization: Bearer ).+), '\1[FILTERED]').
|
133
|
+
gsub(%r(("client_secret\\?":\\?")\w+), '\1[FILTERED]').
|
134
|
+
gsub(%r(("number\\?":\\?")\d+), '\1[FILTERED]').
|
135
|
+
gsub(%r(("security_code\\?":\\?")\d+), '\1[FILTERED]')
|
136
|
+
end
|
137
|
+
|
138
|
+
private
|
139
|
+
|
140
|
+
def add_forward_route(post, options)
|
141
|
+
forward_route = {}
|
142
|
+
forward_route[:trace_id] = options[:trace_id] if options[:trace_id]
|
143
|
+
|
144
|
+
forward_route[:psp_extra_fields] = options[:psp_extra_fields] || {}
|
145
|
+
post[:forward_route] = forward_route
|
146
|
+
end
|
147
|
+
|
148
|
+
def add_forward_payload(post, money, payment, options)
|
149
|
+
forward_payload = {}
|
150
|
+
add_user(forward_payload, options[:user]) if options[:user]
|
151
|
+
add_order(forward_payload, money, options)
|
152
|
+
add_payment_method(forward_payload, payment, options[:payment_method]) if options[:payment_method] || payment
|
153
|
+
|
154
|
+
forward_payload[:payment_method] = {} unless forward_payload[:payment_method]
|
155
|
+
forward_payload[:payment_method][:card] = {} unless forward_payload[:payment_method][:card]
|
156
|
+
add_address('billing_address', forward_payload[:payment_method][:card], options[:billing_address]) if options[:billing_address]
|
157
|
+
|
158
|
+
add_three_ds_fields(forward_payload[:authentication] = {}, options[:three_ds_fields]) if options[:three_ds_fields]
|
159
|
+
add_sub_merchant(forward_payload, options[:sub_merchant]) if options[:sub_merchant]
|
160
|
+
forward_payload[:acquire_extra_options] = options[:acquire_extra_options] || {}
|
161
|
+
post[:forward_payload] = forward_payload
|
162
|
+
end
|
163
|
+
|
164
|
+
def add_sub_merchant(post, sub_merchant_options)
|
165
|
+
sub_merchant = {}
|
166
|
+
sub_merchant[:merchant_id] = sub_merchant_options[:merchant_id] if sub_merchant_options[:merchant_id]
|
167
|
+
sub_merchant[:extra_params] = sub_merchant_options[:extra_params] if sub_merchant_options[:extra_params]
|
168
|
+
sub_merchant[:mcc] = sub_merchant_options[:mcc] if sub_merchant_options[:mcc]
|
169
|
+
sub_merchant[:name] = sub_merchant_options[:name] if sub_merchant_options[:name]
|
170
|
+
sub_merchant[:address] = sub_merchant_options[:address] if sub_merchant_options[:address]
|
171
|
+
sub_merchant[:postal_code] = sub_merchant_options[:postal_code] if sub_merchant_options[:postal_code]
|
172
|
+
sub_merchant[:url] = sub_merchant_options[:url] if sub_merchant_options[:url]
|
173
|
+
sub_merchant[:phone_number] = sub_merchant_options[:phone_number] if sub_merchant_options[:phone_number]
|
174
|
+
|
175
|
+
post[:sub_merchant] = sub_merchant
|
176
|
+
end
|
177
|
+
|
178
|
+
def add_payment_method(post, payment, payment_method_options)
|
179
|
+
payment_method = {}
|
180
|
+
opts = nil
|
181
|
+
opts = payment_method_options[:card] if payment_method_options
|
182
|
+
add_card(payment_method, payment, opts) if opts || payment
|
183
|
+
|
184
|
+
post[:payment_method] = payment_method
|
185
|
+
end
|
186
|
+
|
187
|
+
def add_three_ds_fields(post, three_ds_options)
|
188
|
+
three_ds = {}
|
189
|
+
three_ds[:version] = three_ds_options[:version] if three_ds_options[:version]
|
190
|
+
three_ds[:eci] = three_ds_options[:eci] if three_ds_options[:eci]
|
191
|
+
three_ds[:cavv] = three_ds_options[:cavv] if three_ds_options[:cavv]
|
192
|
+
three_ds[:ds_transaction_id] = three_ds_options[:ds_transaction_id] if three_ds_options[:ds_transaction_id]
|
193
|
+
three_ds[:acs_transaction_id] = three_ds_options[:acs_transaction_id] if three_ds_options[:acs_transaction_id]
|
194
|
+
three_ds[:xid] = three_ds_options[:xid] if three_ds_options[:xid]
|
195
|
+
three_ds[:enrolled] = three_ds_options[:enrolled] if three_ds_options[:enrolled]
|
196
|
+
three_ds[:cavv_algorithm] = three_ds_options[:cavv_algorithm] if three_ds_options[:cavv_algorithm]
|
197
|
+
three_ds[:directory_response_status] = three_ds_options[:directory_response_status] if three_ds_options[:directory_response_status]
|
198
|
+
three_ds[:authentication_response_status] = three_ds_options[:authentication_response_status] if three_ds_options[:authentication_response_status]
|
199
|
+
three_ds[:three_ds_server_trans_id] = three_ds_options[:three_ds_server_trans_id] if three_ds_options[:three_ds_server_trans_id]
|
200
|
+
|
201
|
+
post[:three_ds_fields] = three_ds
|
202
|
+
end
|
203
|
+
|
204
|
+
def add_card(post, card, card_options = {})
|
205
|
+
card_hash = {}
|
206
|
+
card_hash[:number] = card.number
|
207
|
+
card_hash[:exp_month] = card.month
|
208
|
+
card_hash[:exp_year] = card.year
|
209
|
+
card_hash[:security_code] = card.verification_value
|
210
|
+
card_hash[:type] = card.brand
|
211
|
+
card_hash[:holder_first_name] = card.first_name
|
212
|
+
card_hash[:holder_last_name] = card.last_name
|
213
|
+
post[:card] = card_hash
|
214
|
+
end
|
215
|
+
|
216
|
+
def add_user(post, user_options)
|
217
|
+
user = {}
|
218
|
+
user[:id] = user_options[:id] if user_options[:id]
|
219
|
+
user[:email] = user_options[:email] if user_options[:email]
|
220
|
+
|
221
|
+
post[:user] = user
|
222
|
+
end
|
223
|
+
|
224
|
+
def add_stored_credential(post, options)
|
225
|
+
return unless options[:stored_credential]
|
226
|
+
|
227
|
+
check_initiator = %w[merchant cardholder].any? { |item| item == options[:stored_credential][:initiator] }
|
228
|
+
check_reason_type = %w[recurring installment unscheduled].any? { |item| item == options[:stored_credential][:reason_type] }
|
229
|
+
post[:forward_payload][:authentication] = {} unless post[:forward_payload].key?(:authentication)
|
230
|
+
post[:forward_payload][:authentication][:stored_credential] = options[:stored_credential] if check_initiator && check_reason_type
|
231
|
+
end
|
232
|
+
|
233
|
+
def add_order(post, money, options)
|
234
|
+
return unless options[:order] || money
|
235
|
+
|
236
|
+
order = {}
|
237
|
+
order_options = options[:order] || {}
|
238
|
+
order[:id] = options[:order_id] if options[:order_id]
|
239
|
+
order[:description] = options[:description] if options[:description]
|
240
|
+
order[:installments] = order_options[:installments].to_i if order_options[:installments]
|
241
|
+
order[:datetime_local_transaction] = order_options[:datetime_local_transaction] if order_options[:datetime_local_transaction]
|
242
|
+
|
243
|
+
add_amount(order, money, options)
|
244
|
+
add_address('shipping_address', order, options)
|
245
|
+
|
246
|
+
post[:order] = order
|
247
|
+
end
|
248
|
+
|
249
|
+
def add_amount(post, money, options)
|
250
|
+
amount_obj = {}
|
251
|
+
amount_obj[:total_amount] = amount(money).to_f
|
252
|
+
amount_obj[:currency] = (options[:currency] || currency(money))
|
253
|
+
amount_obj[:vat] = options[:vat].to_f / 100 if options[:vat]
|
254
|
+
|
255
|
+
post[:amount] = amount_obj
|
256
|
+
end
|
257
|
+
|
258
|
+
def add_address(tag, post, options)
|
259
|
+
return unless address_options = options[:shipping_address]
|
260
|
+
|
261
|
+
address = {}
|
262
|
+
address[:name] = address_options[:name] if address_options[:name]
|
263
|
+
address[:address1] = address_options[:address1] if address_options[:address1]
|
264
|
+
address[:address2] = address_options[:address2] if address_options[:address2]
|
265
|
+
address[:company] = address_options[:company] if address_options[:company]
|
266
|
+
address[:city] = address_options[:city] if address_options[:city]
|
267
|
+
address[:state] = address_options[:state] if address_options[:state]
|
268
|
+
address[:zip] = address_options[:zip] if address_options[:zip]
|
269
|
+
address[:country] = address_options[:country] if address_options[:country]
|
270
|
+
address[:phone] = address_options[:phone] if address_options[:phone]
|
271
|
+
address[:fax] = address_options[:fax] if address_options[:fax]
|
272
|
+
|
273
|
+
post[tag] = address
|
274
|
+
end
|
275
|
+
|
276
|
+
def parse(body)
|
277
|
+
JSON.parse(body)
|
278
|
+
end
|
279
|
+
|
280
|
+
def commit(action, parameters, url_params = {})
|
281
|
+
begin
|
282
|
+
response = JSON.parse ssl_post(url(action, url_params), post_data(parameters), authorized_headers())
|
283
|
+
rescue ResponseError => exception
|
284
|
+
case exception.response.code.to_i
|
285
|
+
when 400...499
|
286
|
+
response = JSON.parse exception.response.body
|
287
|
+
else
|
288
|
+
raise exception
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
Response.new(
|
293
|
+
success_from(response['code']),
|
294
|
+
message_from(response),
|
295
|
+
response,
|
296
|
+
authorization: authorization_from(response),
|
297
|
+
avs_result: AVSResult.new(code: avs_code_from(response)),
|
298
|
+
cvv_result: CVVResult.new(cvv_code_from(response)),
|
299
|
+
test: test?,
|
300
|
+
error_code: error_code_from(response)
|
301
|
+
)
|
302
|
+
end
|
303
|
+
|
304
|
+
def avs_code_from(response)
|
305
|
+
response['avs_result']
|
306
|
+
end
|
307
|
+
|
308
|
+
def cvv_code_from(response)
|
309
|
+
response['cvv_result']
|
310
|
+
end
|
311
|
+
|
312
|
+
def success_from(code)
|
313
|
+
code == 'S001'
|
314
|
+
end
|
315
|
+
|
316
|
+
def message_from(response)
|
317
|
+
response['message']
|
318
|
+
end
|
319
|
+
|
320
|
+
def url(action, url_params)
|
321
|
+
"#{(test? ? test_url : live_url)}/#{url_params[:token_acquirer]}/#{action}"
|
322
|
+
end
|
323
|
+
|
324
|
+
def post_data(data = {})
|
325
|
+
data.to_json
|
326
|
+
end
|
327
|
+
|
328
|
+
def authorization_from(response)
|
329
|
+
response['simetrik_authorization_id']
|
330
|
+
end
|
331
|
+
|
332
|
+
def error_code_from(response)
|
333
|
+
STANDARD_ERROR_CODE_MAPPING[response['code']] unless success_from(response['code'])
|
334
|
+
end
|
335
|
+
|
336
|
+
def authorized_headers
|
337
|
+
{
|
338
|
+
'content-Type' => 'application/json',
|
339
|
+
'Authorization' => "Bearer #{sign_access_token()}"
|
340
|
+
}
|
341
|
+
end
|
342
|
+
|
343
|
+
# if this method is refactored, ensure that the client_secret is properly scrubbed
|
344
|
+
def sign_access_token
|
345
|
+
fetch_access_token() if Time.new.to_i > (@access_token[:expires_at] || 0) + 10
|
346
|
+
@access_token[:access_token]
|
347
|
+
end
|
348
|
+
|
349
|
+
def auth_url
|
350
|
+
(test? ? test_auth_url : live_auth_url)
|
351
|
+
end
|
352
|
+
|
353
|
+
def fetch_access_token
|
354
|
+
login_info = {}
|
355
|
+
login_info[:client_id] = @options[:client_id]
|
356
|
+
login_info[:client_secret] = @options[:client_secret]
|
357
|
+
login_info[:audience] = test? ? test_audience : live_audience
|
358
|
+
login_info[:grant_type] = 'client_credentials'
|
359
|
+
response = parse(ssl_post(auth_url(), login_info.to_json, {
|
360
|
+
'content-Type' => 'application/json'
|
361
|
+
}))
|
362
|
+
|
363
|
+
@access_token[:access_token] = response['access_token']
|
364
|
+
@access_token[:expires_at] = Time.new.to_i + response['expires_in']
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|