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,369 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PaymillGateway < Gateway
|
4
|
+
self.supported_countries = %w(AD AT BE BG CH CY CZ DE DK EE ES FI FO FR GB
|
5
|
+
GI GR HR HU IE IL IM IS IT LI LT LU LV MC MT
|
6
|
+
NL NO PL PT RO SE SI SK TR VA)
|
7
|
+
|
8
|
+
self.supported_cardtypes = %i[visa master american_express diners_club discover union_pay jcb]
|
9
|
+
self.homepage_url = 'https://paymill.com'
|
10
|
+
self.display_name = 'PAYMILL'
|
11
|
+
self.money_format = :cents
|
12
|
+
self.default_currency = 'EUR'
|
13
|
+
self.live_url = 'https://api.paymill.com/v2/'
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
requires!(options, :public_key, :private_key)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def purchase(money, payment_method, options = {})
|
21
|
+
action_with_token(:purchase, money, payment_method, options)
|
22
|
+
end
|
23
|
+
|
24
|
+
def authorize(money, payment_method, options = {})
|
25
|
+
action_with_token(:authorize, money, payment_method, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
def capture(money, authorization, options = {})
|
29
|
+
post = {}
|
30
|
+
|
31
|
+
add_amount(post, money, options)
|
32
|
+
post[:preauthorization] = preauth(authorization)
|
33
|
+
post[:description] = options[:order_id]
|
34
|
+
post[:source] = 'active_merchant'
|
35
|
+
commit(:post, 'transactions', post)
|
36
|
+
end
|
37
|
+
|
38
|
+
def refund(money, authorization, options = {})
|
39
|
+
post = {}
|
40
|
+
|
41
|
+
post[:amount] = amount(money)
|
42
|
+
post[:description] = options[:order_id]
|
43
|
+
commit(:post, "refunds/#{transaction_id(authorization)}", post)
|
44
|
+
end
|
45
|
+
|
46
|
+
def void(authorization, options = {})
|
47
|
+
commit(:delete, "preauthorizations/#{preauth(authorization)}")
|
48
|
+
end
|
49
|
+
|
50
|
+
def store(credit_card, options = {})
|
51
|
+
# The store request requires a currency and amount of at least $1 USD.
|
52
|
+
# This is used for an authorization that is handled internally by Paymill.
|
53
|
+
options[:currency] = 'USD'
|
54
|
+
options[:money] = 100
|
55
|
+
|
56
|
+
save_card(credit_card, options)
|
57
|
+
end
|
58
|
+
|
59
|
+
def supports_scrubbing
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
63
|
+
def scrub(transcript)
|
64
|
+
transcript.
|
65
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
66
|
+
gsub(/(account.number=)(\d*)/, '\1[FILTERED]').
|
67
|
+
gsub(/(account.verification=)(\d*)/, '\1[FILTERED]')
|
68
|
+
end
|
69
|
+
|
70
|
+
def verify_credentials
|
71
|
+
begin
|
72
|
+
ssl_get(live_url + 'transactions/nonexistent', headers)
|
73
|
+
rescue ResponseError => e
|
74
|
+
return false if e.response.code.to_i == 401
|
75
|
+
end
|
76
|
+
|
77
|
+
true
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def add_credit_card(post, credit_card, options)
|
83
|
+
post['account.holder'] = (credit_card.try(:name) || '')
|
84
|
+
post['account.number'] = credit_card.number
|
85
|
+
post['account.expiry.month'] = sprintf('%.2i', credit_card.month)
|
86
|
+
post['account.expiry.year'] = sprintf('%.4i', credit_card.year)
|
87
|
+
post['account.verification'] = credit_card.verification_value
|
88
|
+
post['account.email'] = (options[:email] || nil)
|
89
|
+
post['presentation.amount3D'] = (options[:money] || nil)
|
90
|
+
post['presentation.currency3D'] = (options[:currency] || currency(options[:money]))
|
91
|
+
end
|
92
|
+
|
93
|
+
def headers
|
94
|
+
{ 'Authorization' => ('Basic ' + Base64.strict_encode64("#{@options[:private_key]}:X").chomp) }
|
95
|
+
end
|
96
|
+
|
97
|
+
def commit(method, action, parameters = nil)
|
98
|
+
begin
|
99
|
+
raw_response = ssl_request(method, live_url + action, post_data(parameters), headers)
|
100
|
+
rescue ResponseError => e
|
101
|
+
begin
|
102
|
+
parsed = JSON.parse(e.response.body)
|
103
|
+
rescue JSON::ParserError
|
104
|
+
return Response.new(false, "Unable to parse error response: '#{e.response.body}'")
|
105
|
+
end
|
106
|
+
return Response.new(false, response_message(parsed), parsed, {})
|
107
|
+
end
|
108
|
+
|
109
|
+
response_from(raw_response)
|
110
|
+
end
|
111
|
+
|
112
|
+
def response_from(raw_response)
|
113
|
+
parsed = JSON.parse(raw_response)
|
114
|
+
options = {
|
115
|
+
authorization: authorization_from(parsed),
|
116
|
+
test: (parsed['mode'] == 'test')
|
117
|
+
}
|
118
|
+
|
119
|
+
succeeded = (parsed['data'] == []) || (parsed['data']['response_code'].to_i == 20000)
|
120
|
+
Response.new(succeeded, response_message(parsed), parsed, options)
|
121
|
+
end
|
122
|
+
|
123
|
+
def authorization_from(parsed_response)
|
124
|
+
parsed_data = parsed_response['data']
|
125
|
+
return '' unless parsed_data.kind_of?(Hash)
|
126
|
+
|
127
|
+
[
|
128
|
+
parsed_data['id'],
|
129
|
+
parsed_data['preauthorization'].try(:[], 'id')
|
130
|
+
].join(';')
|
131
|
+
end
|
132
|
+
|
133
|
+
def action_with_token(action, money, payment_method, options)
|
134
|
+
options[:money] = money
|
135
|
+
case payment_method
|
136
|
+
when String
|
137
|
+
self.send("#{action}_with_token", money, payment_method, options)
|
138
|
+
else
|
139
|
+
MultiResponse.run do |r|
|
140
|
+
r.process { save_card(payment_method, options) }
|
141
|
+
r.process { self.send("#{action}_with_token", money, r.authorization, options) }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def purchase_with_token(money, card_token, options)
|
147
|
+
post = {}
|
148
|
+
|
149
|
+
add_amount(post, money, options)
|
150
|
+
post[:token] = card_token
|
151
|
+
post[:description] = options[:order_id]
|
152
|
+
post[:source] = 'active_merchant'
|
153
|
+
commit(:post, 'transactions', post)
|
154
|
+
end
|
155
|
+
|
156
|
+
def authorize_with_token(money, card_token, options)
|
157
|
+
post = {}
|
158
|
+
|
159
|
+
add_amount(post, money, options)
|
160
|
+
post[:token] = card_token
|
161
|
+
post[:description] = options[:order_id]
|
162
|
+
post[:source] = 'active_merchant'
|
163
|
+
commit(:post, 'preauthorizations', post)
|
164
|
+
end
|
165
|
+
|
166
|
+
def save_card(credit_card, options)
|
167
|
+
post = {}
|
168
|
+
|
169
|
+
add_credit_card(post, credit_card, options)
|
170
|
+
post['channel.id'] = @options[:public_key]
|
171
|
+
post['jsonPFunction'] = 'jsonPFunction'
|
172
|
+
post['transaction.mode'] = (test? ? 'CONNECTOR_TEST' : 'LIVE')
|
173
|
+
|
174
|
+
begin
|
175
|
+
raw_response = ssl_request(:get, "#{save_card_url}?#{post_data(post)}", nil, {})
|
176
|
+
rescue ResponseError => e
|
177
|
+
return Response.new(false, e.response.body)
|
178
|
+
end
|
179
|
+
|
180
|
+
response_for_save_from(raw_response)
|
181
|
+
end
|
182
|
+
|
183
|
+
def response_for_save_from(raw_response)
|
184
|
+
options = { test: test? }
|
185
|
+
|
186
|
+
parser = ResponseParser.new(raw_response, options)
|
187
|
+
parser.generate_response
|
188
|
+
end
|
189
|
+
|
190
|
+
def parse_reponse(response)
|
191
|
+
JSON.parse(response.sub(/jsonPFunction\(/, '').sub(/\)\z/, ''))
|
192
|
+
end
|
193
|
+
|
194
|
+
def save_card_url
|
195
|
+
(test? ? 'https://test-token.paymill.com' : 'https://token-v2.paymill.de')
|
196
|
+
end
|
197
|
+
|
198
|
+
def post_data(params)
|
199
|
+
return nil unless params
|
200
|
+
|
201
|
+
no_blanks = params.reject { |_key, value| value.blank? }
|
202
|
+
no_blanks.map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
203
|
+
end
|
204
|
+
|
205
|
+
def add_amount(post, money, options)
|
206
|
+
post[:amount] = amount(money)
|
207
|
+
post[:currency] = (options[:currency] || currency(money))
|
208
|
+
end
|
209
|
+
|
210
|
+
def preauth(authorization)
|
211
|
+
authorization.split(';').last
|
212
|
+
end
|
213
|
+
|
214
|
+
def transaction_id(authorization)
|
215
|
+
authorization.split(';').first
|
216
|
+
end
|
217
|
+
|
218
|
+
RESPONSE_CODES = {
|
219
|
+
10001 => 'Undefined response',
|
220
|
+
10002 => 'Waiting for something',
|
221
|
+
11000 => 'Retry request at a later time',
|
222
|
+
|
223
|
+
20000 => 'Operation successful',
|
224
|
+
20100 => 'Funds held by acquirer',
|
225
|
+
20101 => 'Funds held by acquirer because merchant is new',
|
226
|
+
20200 => 'Transaction reversed',
|
227
|
+
20201 => 'Reversed due to chargeback',
|
228
|
+
20202 => 'Reversed due to money-back guarantee',
|
229
|
+
20203 => 'Reversed due to complaint by buyer',
|
230
|
+
20204 => 'Payment has been refunded',
|
231
|
+
20300 => 'Reversal has been canceled',
|
232
|
+
22000 => 'Initiation of transaction successful',
|
233
|
+
|
234
|
+
30000 => 'Transaction still in progress',
|
235
|
+
30100 => 'Transaction has been accepted',
|
236
|
+
31000 => 'Transaction pending',
|
237
|
+
31100 => 'Pending due to address',
|
238
|
+
31101 => 'Pending due to uncleared eCheck',
|
239
|
+
31102 => 'Pending due to risk review',
|
240
|
+
31103 => 'Pending due regulatory review',
|
241
|
+
31104 => 'Pending due to unregistered/unconfirmed receiver',
|
242
|
+
31200 => 'Pending due to unverified account',
|
243
|
+
31201 => 'Pending due to non-captured funds',
|
244
|
+
31202 => 'Pending due to international account (accept manually)',
|
245
|
+
31203 => 'Pending due to currency conflict (accept manually)',
|
246
|
+
31204 => 'Pending due to fraud filters (accept manually)',
|
247
|
+
|
248
|
+
40000 => 'Problem with transaction data',
|
249
|
+
40001 => 'Problem with payment data',
|
250
|
+
40002 => 'Invalid checksum',
|
251
|
+
40100 => 'Problem with credit card data',
|
252
|
+
40101 => 'Problem with CVV',
|
253
|
+
40102 => 'Card expired or not yet valid',
|
254
|
+
40103 => 'Card limit exceeded',
|
255
|
+
40104 => 'Card is not valid',
|
256
|
+
40105 => 'Expiry date not valid',
|
257
|
+
40106 => 'Credit card brand required',
|
258
|
+
40200 => 'Problem with bank account data',
|
259
|
+
40201 => 'Bank account data combination mismatch',
|
260
|
+
40202 => 'User authentication failed',
|
261
|
+
40300 => 'Problem with 3-D Secure data',
|
262
|
+
40301 => 'Currency/amount mismatch',
|
263
|
+
40400 => 'Problem with input data',
|
264
|
+
40401 => 'Amount too low or zero',
|
265
|
+
40402 => 'Usage field too long',
|
266
|
+
40403 => 'Currency not allowed',
|
267
|
+
40410 => 'Problem with shopping cart data',
|
268
|
+
40420 => 'Problem with address data',
|
269
|
+
40500 => 'Permission error with acquirer API',
|
270
|
+
40510 => 'Rate limit reached for acquirer API',
|
271
|
+
42000 => 'Initiation of transaction failed',
|
272
|
+
42410 => 'Initiation of transaction expired',
|
273
|
+
|
274
|
+
50000 => 'Problem with back end',
|
275
|
+
50001 => 'Country blacklisted',
|
276
|
+
50002 => 'IP address blacklisted',
|
277
|
+
50004 => 'Live mode not allowed',
|
278
|
+
50005 => 'Insufficient permissions (API key)',
|
279
|
+
50100 => 'Technical error with credit card',
|
280
|
+
50101 => 'Error limit exceeded',
|
281
|
+
50102 => 'Card declined',
|
282
|
+
50103 => 'Manipulation or stolen card',
|
283
|
+
50104 => 'Card restricted',
|
284
|
+
50105 => 'Invalid configuration data',
|
285
|
+
50200 => 'Technical error with bank account',
|
286
|
+
50201 => 'Account blacklisted',
|
287
|
+
50300 => 'Technical error with 3-D Secure',
|
288
|
+
50400 => 'Declined because of risk issues',
|
289
|
+
50401 => 'Checksum was wrong',
|
290
|
+
50402 => 'Bank account number was invalid (formal check)',
|
291
|
+
50403 => 'Technical error with risk check',
|
292
|
+
50404 => 'Unknown error with risk check',
|
293
|
+
50405 => 'Unknown bank code',
|
294
|
+
50406 => 'Open chargeback',
|
295
|
+
50407 => 'Historical chargeback',
|
296
|
+
50408 => 'Institution / public bank account (NCA)',
|
297
|
+
50409 => 'KUNO/Fraud',
|
298
|
+
50410 => 'Personal Account Protection (PAP)',
|
299
|
+
50420 => 'Rejected due to acquirer fraud settings',
|
300
|
+
50430 => 'Rejected due to acquirer risk settings',
|
301
|
+
50440 => 'Failed due to restrictions with acquirer account',
|
302
|
+
50450 => 'Failed due to restrictions with user account',
|
303
|
+
50500 => 'General timeout',
|
304
|
+
50501 => 'Timeout on side of the acquirer',
|
305
|
+
50502 => 'Risk management transaction timeout',
|
306
|
+
50600 => 'Duplicate operation',
|
307
|
+
50700 => 'Cancelled by user',
|
308
|
+
50710 => 'Failed due to funding source',
|
309
|
+
50711 => 'Payment method not usable, use other payment method',
|
310
|
+
50712 => 'Limit of funding source was exceeded',
|
311
|
+
50713 => 'Means of payment not reusable (canceled by user)',
|
312
|
+
50714 => 'Means of payment not reusable (expired)',
|
313
|
+
50720 => 'Rejected by acquirer',
|
314
|
+
50730 => 'Transaction denied by merchant',
|
315
|
+
50800 => 'Preauthorisation failed',
|
316
|
+
50810 => 'Authorisation has been voided',
|
317
|
+
50820 => 'Authorisation period expired'
|
318
|
+
}
|
319
|
+
|
320
|
+
def response_message(parsed_response)
|
321
|
+
return parsed_response['error'] if parsed_response['error']
|
322
|
+
return 'Transaction approved.' if parsed_response['data'] == []
|
323
|
+
|
324
|
+
code = parsed_response['data']['response_code'].to_i
|
325
|
+
RESPONSE_CODES[code] || code.to_s
|
326
|
+
end
|
327
|
+
|
328
|
+
class ResponseParser
|
329
|
+
attr_reader :raw_response, :parsed, :succeeded, :message, :options
|
330
|
+
|
331
|
+
def initialize(raw_response = '', options = {})
|
332
|
+
@raw_response = raw_response
|
333
|
+
@options = options
|
334
|
+
end
|
335
|
+
|
336
|
+
def generate_response
|
337
|
+
parse_response
|
338
|
+
if parsed['error']
|
339
|
+
handle_response_parse_error
|
340
|
+
else
|
341
|
+
handle_response_correct_parsing
|
342
|
+
end
|
343
|
+
|
344
|
+
Response.new(succeeded, message, parsed, options)
|
345
|
+
end
|
346
|
+
|
347
|
+
private
|
348
|
+
|
349
|
+
def parse_response
|
350
|
+
@parsed = JSON.parse(raw_response.sub(/jsonPFunction\(/, '').sub(/\)\z/, ''))
|
351
|
+
end
|
352
|
+
|
353
|
+
def handle_response_parse_error
|
354
|
+
@succeeded = false
|
355
|
+
@message = parsed['error']['message']
|
356
|
+
end
|
357
|
+
|
358
|
+
def handle_response_correct_parsing
|
359
|
+
@message = parsed['transaction']['processing']['return']['message']
|
360
|
+
@options[:authorization] = parsed['transaction']['identification']['uniqueId'] if @succeeded = ack?
|
361
|
+
end
|
362
|
+
|
363
|
+
def ack?
|
364
|
+
parsed['transaction']['processing']['result'] == 'ACK'
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
module ActiveMerchant
|
2
|
+
module Billing
|
3
|
+
class PaynetworxGateway < Gateway
|
4
|
+
include Empty
|
5
|
+
|
6
|
+
API_VERSION = '1.0'
|
7
|
+
SUCCESS_CODE = %w[00 000 001 002 003 092]
|
8
|
+
SOFT_DECLINE_CODES = %w[5 61 65 36 62 75 89 85 80]
|
9
|
+
|
10
|
+
self.test_url = 'https://api.qa.paynetworx.net/v0/transaction/'
|
11
|
+
self.live_url = 'https://api.prod.paynetworx.net/v0/transaction/'
|
12
|
+
self.default_currency = 'USD'
|
13
|
+
self.supported_countries = ['US']
|
14
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
15
|
+
self.homepage_url = 'https://www.paynetworx.com/'
|
16
|
+
self.display_name = 'Paynetworx'
|
17
|
+
|
18
|
+
def initialize(options = {})
|
19
|
+
requires!(options, :login, :password, :request_id)
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
def authorize(amount, payment_method, options = {})
|
24
|
+
post = {}
|
25
|
+
add_invoice(post, amount, options)
|
26
|
+
add_payment_method(post, payment_method, options)
|
27
|
+
add_customer_data(post, options)
|
28
|
+
add_transaction_descriptor(post, options)
|
29
|
+
add_point_of_sale(post, options) if payment_method.is_a?(String)
|
30
|
+
commit(post, 'auth')
|
31
|
+
end
|
32
|
+
|
33
|
+
def purchase(amount, payment_method, options = {})
|
34
|
+
post = {}
|
35
|
+
add_invoice(post, amount, options)
|
36
|
+
add_payment_method(post, payment_method, options)
|
37
|
+
add_customer_data(post, options)
|
38
|
+
add_transaction_descriptor(post, options)
|
39
|
+
add_point_of_sale(post, options) if payment_method.is_a?(String)
|
40
|
+
commit(post, 'authcapture')
|
41
|
+
end
|
42
|
+
|
43
|
+
def refund(amount, authorization, options = {})
|
44
|
+
post = {}
|
45
|
+
add_invoice(post, amount, options)
|
46
|
+
add_customer_data(post, options)
|
47
|
+
process_payment(post, authorization)
|
48
|
+
commit(post, 'refund')
|
49
|
+
end
|
50
|
+
|
51
|
+
def capture(amount, authorization, options = {})
|
52
|
+
post = {}
|
53
|
+
add_invoice(post, amount, options)
|
54
|
+
add_customer_data(post, options)
|
55
|
+
process_payment(post, authorization)
|
56
|
+
commit(post, 'capture')
|
57
|
+
end
|
58
|
+
|
59
|
+
def void(authorization, options = {})
|
60
|
+
post = {}
|
61
|
+
add_customer_data(post, options)
|
62
|
+
process_payment(post, authorization)
|
63
|
+
void_reasons(post, options)
|
64
|
+
commit(post, 'void')
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
def add_invoice(post, amount, options)
|
70
|
+
post['Amount'] = {}
|
71
|
+
post['Amount']['Total'] = localized_amount(amount, options[:currency])
|
72
|
+
post['Amount']['Currency'] = options[:currency] || currency(amount)
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_payment_method(post, payment_method, options)
|
76
|
+
post['PaymentMethod'] = { 'Card' => {} }
|
77
|
+
|
78
|
+
if payment_method.is_a?(String)
|
79
|
+
post['PaymentMethod']['Card']['CardPresent'] = false
|
80
|
+
post['PaymentMethod']['Token'] = { 'TokenID' => payment_method }
|
81
|
+
else
|
82
|
+
post['DataAction'] = 'token/add'
|
83
|
+
post['PaymentMethod']['Card']['CardPresent'] = true
|
84
|
+
card_info = post['PaymentMethod']['Card']
|
85
|
+
|
86
|
+
card_info['CVC'] = { 'CVC' => payment_method.verification_value } unless empty?(payment_method.verification_value)
|
87
|
+
card_info['PAN'] = {
|
88
|
+
'PAN' => payment_method.number,
|
89
|
+
'ExpMonth' => format(payment_method.month, :two_digits),
|
90
|
+
'ExpYear' => format(payment_method.year, :two_digits)
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
card_info = post['PaymentMethod']['Card']
|
95
|
+
|
96
|
+
if options[:billing_address].present?
|
97
|
+
billing_address = options[:billing_address]
|
98
|
+
card_info['BillingAddress'] = {
|
99
|
+
'Name' => billing_address[:name],
|
100
|
+
'Line1' => billing_address[:address1],
|
101
|
+
'Line2' => billing_address[:address2],
|
102
|
+
'City' => billing_address[:city],
|
103
|
+
'State' => billing_address[:state],
|
104
|
+
'PostalCode' => billing_address[:zip],
|
105
|
+
'Country' => billing_address[:country],
|
106
|
+
'Phone' => billing_address[:phone],
|
107
|
+
'Email' => options[:email]
|
108
|
+
}
|
109
|
+
end
|
110
|
+
|
111
|
+
if options[:three_d_secure].present?
|
112
|
+
secure_info = card_info['3DSecure'] = {}
|
113
|
+
secure_info['AuthenticationValue'] = options[:three_d_secure][:splitSdkServerTransId]
|
114
|
+
secure_info['ECommerceIndicator'] = options[:three_d_secure][:eci]
|
115
|
+
secure_info['3DSecureTransactionID'] = options[:three_d_secure][:authenticationValue]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_point_of_sale(post, options)
|
120
|
+
post['POS'] = {}
|
121
|
+
post['POS']['EntryMode'] = 'card-on-file'
|
122
|
+
post['POS']['Type'] = 'recurring'
|
123
|
+
post['POS']['Device'] = 'NA'
|
124
|
+
post['POS']['DeviceVersion'] = 'NA'
|
125
|
+
post['POS']['Application'] = 'Swiss CRM'
|
126
|
+
post['POS']['ApplicationVersion'] = API_VERSION
|
127
|
+
post['POS']['Timestamp'] = formated_timestamp
|
128
|
+
end
|
129
|
+
|
130
|
+
def add_customer_data(post, options)
|
131
|
+
post['Detail'] = {}
|
132
|
+
post['Detail']['MerchantData'] = {}
|
133
|
+
post['Detail']['MerchantData']['OrderNumber'] = options[:order_id]
|
134
|
+
post['Detail']['MerchantData']['CustomerID'] = options[:customer_id]
|
135
|
+
end
|
136
|
+
|
137
|
+
def add_transaction_descriptor(post, options)
|
138
|
+
return unless options[:descriptor]
|
139
|
+
|
140
|
+
post['Attributes'] = {}
|
141
|
+
post['Attributes']['TransactionDescriptor'] = {}
|
142
|
+
post['Attributes']['TransactionDescriptor']['Prefix'] = split_descriptor(options[:descriptor])
|
143
|
+
end
|
144
|
+
|
145
|
+
def process_payment(post, authorization)
|
146
|
+
post['TransactionID'], = split_authorization(authorization)
|
147
|
+
end
|
148
|
+
|
149
|
+
def void_reasons(post, options)
|
150
|
+
post['Reason'] = options[:reason] if options[:reason].present?
|
151
|
+
post['Detail']['MerchantData']['VoidReason'] = options[:void_reason] if options[:void_reason].present?
|
152
|
+
end
|
153
|
+
|
154
|
+
def commit(params, action)
|
155
|
+
request_body = params.to_json
|
156
|
+
request_endpoint = "#{url}#{action}"
|
157
|
+
response = ssl_post(request_endpoint, request_body, headers)
|
158
|
+
response_data = JSON.parse(response)
|
159
|
+
succeeded = success_from(response_data['ResponseText'])
|
160
|
+
Response.new(
|
161
|
+
succeeded,
|
162
|
+
response_data['ResponseText'],
|
163
|
+
response_data,
|
164
|
+
authorization: authorization_from(response_data, action),
|
165
|
+
test: test?,
|
166
|
+
response_type: response_type(response_data['ResponseCode']),
|
167
|
+
response_http_code: @response_http_code,
|
168
|
+
request_endpoint: request_endpoint,
|
169
|
+
request_method: :post,
|
170
|
+
request_body: request_body
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
def split_authorization(authorization)
|
175
|
+
authorization.split('#')
|
176
|
+
end
|
177
|
+
|
178
|
+
def split_descriptor(descriptor)
|
179
|
+
descriptor.split('*')[0]
|
180
|
+
end
|
181
|
+
|
182
|
+
def success_from(resonse_message)
|
183
|
+
resonse_message&.downcase&.include?('approved') ? true : false
|
184
|
+
end
|
185
|
+
|
186
|
+
def authorization_from(response, payment_type)
|
187
|
+
authorization = response['TransactionID'].present? ? response['TransactionID'] : 'Failed'
|
188
|
+
[authorization, payment_type].join('#')
|
189
|
+
end
|
190
|
+
|
191
|
+
def headers
|
192
|
+
{
|
193
|
+
'Content-Type' => 'application/json',
|
194
|
+
'Request-ID' => @options[:request_id],
|
195
|
+
'Authorization' => "Basic #{basic_auth}"
|
196
|
+
}
|
197
|
+
end
|
198
|
+
|
199
|
+
def basic_auth
|
200
|
+
Base64.strict_encode64("#{@options[:login]}:#{@options[:password]}")
|
201
|
+
end
|
202
|
+
|
203
|
+
def url
|
204
|
+
test? ? test_url : live_url
|
205
|
+
end
|
206
|
+
|
207
|
+
def response_type(code)
|
208
|
+
if SUCCESS_CODE.include?(code)
|
209
|
+
0
|
210
|
+
elsif SOFT_DECLINE_CODES.include?(code)
|
211
|
+
1
|
212
|
+
else
|
213
|
+
2
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def formated_timestamp
|
218
|
+
current_time = Time.now.utc
|
219
|
+
current_time.strftime('%Y-%m-%dT%H:%M:%S')
|
220
|
+
end
|
221
|
+
|
222
|
+
def handle_response(response)
|
223
|
+
@response_http_code = response.code.to_i
|
224
|
+
response.body
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|