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,390 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
# PayJunction Gateway
|
4
|
+
#
|
5
|
+
# This gateway accepts the following arguments:
|
6
|
+
# :login => your PayJunction username
|
7
|
+
# :password => your PayJunction pass
|
8
|
+
#
|
9
|
+
# Example use:
|
10
|
+
#
|
11
|
+
# gateway = ActiveMerchant::Billing::Base.gateway(:pay_junction).new(
|
12
|
+
# :login => "my_account",
|
13
|
+
# :password => "my_pass"
|
14
|
+
# )
|
15
|
+
#
|
16
|
+
# # set up credit card obj as in main ActiveMerchant example
|
17
|
+
# creditcard = ActiveMerchant::Billing::CreditCard.new(
|
18
|
+
# :type => 'visa',
|
19
|
+
# :number => '4242424242424242',
|
20
|
+
# :month => 8,
|
21
|
+
# :year => 2009,
|
22
|
+
# :first_name => 'Bob',
|
23
|
+
# :last_name => 'Bobsen'
|
24
|
+
# )
|
25
|
+
#
|
26
|
+
# # optionally specify address if using AVS
|
27
|
+
# address = { :address1 => '101 Test Ave', :city => 'Test', :state => 'TS',
|
28
|
+
# :zip => '10101', :country => 'US' }
|
29
|
+
#
|
30
|
+
# # run request
|
31
|
+
# response = gateway.purchase(1000, creditcard, :address => address) # charge 10 dollars
|
32
|
+
#
|
33
|
+
# 1) Check whether the transaction was successful
|
34
|
+
#
|
35
|
+
# response.success?
|
36
|
+
#
|
37
|
+
# 2) Retrieve the message returned by PayJunction
|
38
|
+
#
|
39
|
+
# response.message
|
40
|
+
#
|
41
|
+
# 3) Retrieve the unique transaction ID returned by PayJunction
|
42
|
+
#
|
43
|
+
# response.authorization
|
44
|
+
#
|
45
|
+
# This gateway supports "instant" transactions. These transactions allow you
|
46
|
+
# to execute an operation on a previously run card without card information
|
47
|
+
# provided you have the transaction id from a previous transaction with the
|
48
|
+
# same card. All functions that take a credit card object for this gateway
|
49
|
+
# can take a transaction id string instead.
|
50
|
+
#
|
51
|
+
# Test Transactions
|
52
|
+
#
|
53
|
+
# See the source for initialize() for test account information. Note that
|
54
|
+
# PayJunction does not allow test transactions on your account, so if the
|
55
|
+
# gateway is running in :test mode your transaction will be run against
|
56
|
+
# PayJunction's global test account and will not show up in your account.
|
57
|
+
#
|
58
|
+
# Transactions ran on this account go through a test processor, so there is no
|
59
|
+
# need to void or otherwise cancel transactions. However, for further safety,
|
60
|
+
# please use the special card numbers 4433221111223344 or 4444333322221111 and
|
61
|
+
# keep transaction amounts below $4.00 when testing.
|
62
|
+
#
|
63
|
+
# Also note, transactions ran for an amount between $0.00 and $1.99 will likely
|
64
|
+
# result in denial. To demonstrate approvals, use amounts between $2.00 and $4.00.
|
65
|
+
#
|
66
|
+
# Test transactions can be checked by logging into
|
67
|
+
# PayJunction Web Login with username 'pj-cm-01' and password 'pj-cm-01p'
|
68
|
+
#
|
69
|
+
# Usage Details
|
70
|
+
#
|
71
|
+
# Below is a map of values accepted by PayJunction and how you should submit
|
72
|
+
# each to ActiveMerchant
|
73
|
+
#
|
74
|
+
# PayJunction Field ActiveMerchant Use
|
75
|
+
#
|
76
|
+
# dc_logon provide as :login value to gateway instantiation
|
77
|
+
# dc_password provide as :password value to gateway instantiation
|
78
|
+
#
|
79
|
+
# dc_name will be retrieved from credit_card.name
|
80
|
+
# dc_first_name :first_name on CreditCard object instantiation
|
81
|
+
# dc_last_name :last_name on CreditCard object instantiation
|
82
|
+
# dc_number :number on CreditCard object instantiation
|
83
|
+
# dc_expiration_month :month on CreditCard object instantiation
|
84
|
+
# dc_expiration_year :year on CreditCard object instantiation
|
85
|
+
# dc_verification_number :verification_value on CC object instantiation
|
86
|
+
#
|
87
|
+
# dc_transaction_amount include as argument to method for your transaction type
|
88
|
+
# dc_transaction_type do nothing, set by your transaction type
|
89
|
+
# dc_version do nothing, always "1.2"
|
90
|
+
#
|
91
|
+
# dc_transaction_id submit as a string in place of CreditCard obj for
|
92
|
+
# "instant" transactions.
|
93
|
+
#
|
94
|
+
# dc_invoice :order_id in options for transaction method
|
95
|
+
# dc_notes :description in options for transaction method
|
96
|
+
#
|
97
|
+
# See example use above for address AVS fields
|
98
|
+
# See #recurring for periodic transaction fields
|
99
|
+
class PayJunctionGateway < Gateway
|
100
|
+
API_VERSION = '1.2'
|
101
|
+
|
102
|
+
class_attribute :test_url, :live_url
|
103
|
+
|
104
|
+
self.test_url = 'https://www.payjunctionlabs.com/quick_link'
|
105
|
+
self.live_url = 'https://payjunction.com/quick_link'
|
106
|
+
|
107
|
+
TEST_LOGIN = 'pj-ql-01'
|
108
|
+
TEST_PASSWORD = 'pj-ql-01p'
|
109
|
+
|
110
|
+
SUCCESS_CODES = %w[00 85]
|
111
|
+
SUCCESS_MESSAGE = 'The transaction was approved.'
|
112
|
+
|
113
|
+
FAILURE_MESSAGE = 'The transaction was declined.'
|
114
|
+
|
115
|
+
DECLINE_CODES = {
|
116
|
+
'AE' => 'Address verification failed because address did not match.',
|
117
|
+
'ZE' => 'Address verification failed because zip did not match.',
|
118
|
+
'XE' => 'Address verification failed because zip and address did not match.',
|
119
|
+
'YE' => 'Address verification failed because zip and address did not match.',
|
120
|
+
'OE' => 'Address verification failed because address or zip did not match.',
|
121
|
+
'UE' => 'Address verification failed because cardholder address unavailable.',
|
122
|
+
'RE' => 'Address verification failed because address verification system is not working.',
|
123
|
+
'SE' => 'Address verification failed because address verification system is unavailable.',
|
124
|
+
'EE' => 'Address verification failed because transaction is not a mail or phone order.',
|
125
|
+
'GE' => 'Address verification failed because international support is unavailable.',
|
126
|
+
'CE' => 'Declined because CVV2/CVC2 code did not match.',
|
127
|
+
'04' => 'Declined. Pick up card.',
|
128
|
+
'07' => 'Declined. Pick up card (Special Condition).',
|
129
|
+
'41' => 'Declined. Pick up card (Lost).',
|
130
|
+
'43' => 'Declined. Pick up card (Stolen).',
|
131
|
+
'13' => 'Declined because of the amount is invalid.',
|
132
|
+
'14' => 'Declined because the card number is invalid.',
|
133
|
+
'80' => 'Declined because of an invalid date.',
|
134
|
+
'05' => 'Declined. Do not honor.',
|
135
|
+
'51' => 'Declined because of insufficient funds.',
|
136
|
+
'N4' => 'Declined because the amount exceeds issuer withdrawal limit.',
|
137
|
+
'61' => 'Declined because the amount exceeds withdrawal limit.',
|
138
|
+
'62' => 'Declined because of an invalid service code (restricted).',
|
139
|
+
'65' => 'Declined because the card activity limit exceeded.',
|
140
|
+
'93' => 'Declined because there a violation (the transaction could not be completed).',
|
141
|
+
'06' => 'Declined because address verification failed.',
|
142
|
+
'54' => 'Declined because the card has expired.',
|
143
|
+
'15' => 'Declined because there is no such issuer.',
|
144
|
+
'96' => 'Declined because of a system error.',
|
145
|
+
'N7' => 'Declined because of a CVV2/CVC2 mismatch.',
|
146
|
+
'M4' => 'Declined.',
|
147
|
+
'FE' => 'There was a format error with your Trinity Gateway Service (API) request.',
|
148
|
+
'LE' => 'Could not log you in (problem with dc_logon and/or dc_password).',
|
149
|
+
'NL' => 'Aborted because of a system error, please try again later. ',
|
150
|
+
'AB' => 'Aborted because of an upstream system error, please try again later.'
|
151
|
+
}
|
152
|
+
|
153
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
154
|
+
self.supported_countries = ['US']
|
155
|
+
self.homepage_url = 'http://www.payjunction.com/'
|
156
|
+
self.display_name = 'PayJunction'
|
157
|
+
|
158
|
+
def initialize(options = {})
|
159
|
+
requires!(options, :login, :password)
|
160
|
+
super
|
161
|
+
end
|
162
|
+
|
163
|
+
# The first half of the preauth(authorize)/postauth(capture) model.
|
164
|
+
# Checks to make sure funds are available for a transaction, and returns a
|
165
|
+
# transaction_id that can be used later to postauthorize (capture) the funds.
|
166
|
+
def authorize(money, payment_source, options = {})
|
167
|
+
parameters = {
|
168
|
+
transaction_amount: amount(money)
|
169
|
+
}
|
170
|
+
|
171
|
+
add_payment_source(parameters, payment_source)
|
172
|
+
add_address(parameters, options)
|
173
|
+
add_optional_fields(parameters, options)
|
174
|
+
commit('AUTHORIZATION', parameters)
|
175
|
+
end
|
176
|
+
|
177
|
+
# A simple sale, capturing funds immediately.
|
178
|
+
# Execute authorization and capture in a single step.
|
179
|
+
def purchase(money, payment_source, options = {})
|
180
|
+
parameters = {
|
181
|
+
transaction_amount: amount(money)
|
182
|
+
}
|
183
|
+
|
184
|
+
add_payment_source(parameters, payment_source)
|
185
|
+
add_address(parameters, options)
|
186
|
+
add_optional_fields(parameters, options)
|
187
|
+
commit('AUTHORIZATION_CAPTURE', parameters)
|
188
|
+
end
|
189
|
+
|
190
|
+
# The second half of the preauth(authorize)/postauth(capture) model.
|
191
|
+
# Retrieve funds that have been previously authorized with _authorization_
|
192
|
+
def capture(money, authorization, options = {})
|
193
|
+
parameters = {
|
194
|
+
transaction_id: authorization,
|
195
|
+
posture: 'capture'
|
196
|
+
}
|
197
|
+
|
198
|
+
add_optional_fields(parameters, options)
|
199
|
+
commit('update', parameters)
|
200
|
+
end
|
201
|
+
|
202
|
+
# Return money to a card that was previously billed.
|
203
|
+
# _authorization_ should be the transaction id of the transaction we are returning.
|
204
|
+
def refund(money, authorization, options = {})
|
205
|
+
parameters = {
|
206
|
+
transaction_amount: amount(money),
|
207
|
+
transaction_id: authorization
|
208
|
+
}
|
209
|
+
|
210
|
+
commit('CREDIT', parameters)
|
211
|
+
end
|
212
|
+
|
213
|
+
def credit(money, authorization, options = {})
|
214
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
215
|
+
refund(money, authorization, options)
|
216
|
+
end
|
217
|
+
|
218
|
+
# Cancel a transaction that has been charged but has not yet made it
|
219
|
+
# through the batch process.
|
220
|
+
def void(authorization, options = {})
|
221
|
+
parameters = {
|
222
|
+
transaction_id: authorization,
|
223
|
+
posture: 'void'
|
224
|
+
}
|
225
|
+
|
226
|
+
add_optional_fields(parameters, options)
|
227
|
+
commit('update', parameters)
|
228
|
+
end
|
229
|
+
|
230
|
+
# Set up a sale that will be made on a regular basis for the same amount
|
231
|
+
# (ex. $20 a month for 12 months)
|
232
|
+
#
|
233
|
+
# The parameter :periodicity should be specified as either :monthly, :weekly, or :daily
|
234
|
+
# The parameter :payments should be the number of payments to be made
|
235
|
+
#
|
236
|
+
# gateway.recurring('2000', creditcard, :periodicity => :monthly, :payments => 12)
|
237
|
+
#
|
238
|
+
# The optional parameter :starting_at takes a date or time argument or a string in
|
239
|
+
# YYYYMMDD format and can be used to specify when the first charge will be made.
|
240
|
+
# If omitted the first charge will be immediate.
|
241
|
+
def recurring(money, payment_source, options = {})
|
242
|
+
ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
|
243
|
+
|
244
|
+
requires!(options, %i[periodicity monthly weekly daily], :payments)
|
245
|
+
|
246
|
+
periodic_type =
|
247
|
+
case options[:periodicity]
|
248
|
+
when :monthly
|
249
|
+
'month'
|
250
|
+
when :weekly
|
251
|
+
'week'
|
252
|
+
when :daily
|
253
|
+
'day'
|
254
|
+
end
|
255
|
+
|
256
|
+
if options[:starting_at].nil?
|
257
|
+
start_date = Time.now.strftime('%Y-%m-%d')
|
258
|
+
elsif options[:starting_at].is_a?(String)
|
259
|
+
sa = options[:starting_at]
|
260
|
+
start_date = "#{sa[0..3]}-#{sa[4..5]}-#{sa[6..7]}"
|
261
|
+
else
|
262
|
+
start_date = options[:starting_at].strftime('%Y-%m-%d')
|
263
|
+
end
|
264
|
+
|
265
|
+
parameters = {
|
266
|
+
transaction_amount: amount(money),
|
267
|
+
schedule_periodic_type: periodic_type,
|
268
|
+
schedule_create: 'true',
|
269
|
+
schedule_limit: options[:payments].to_i > 1 ? options[:payments] : 1,
|
270
|
+
schedule_periodic_number: 1,
|
271
|
+
schedule_start: start_date
|
272
|
+
}
|
273
|
+
|
274
|
+
add_payment_source(parameters, payment_source)
|
275
|
+
add_optional_fields(parameters, options)
|
276
|
+
add_address(parameters, options)
|
277
|
+
commit('AUTHORIZATION_CAPTURE', parameters)
|
278
|
+
end
|
279
|
+
|
280
|
+
def test?
|
281
|
+
(test_login? || super)
|
282
|
+
end
|
283
|
+
|
284
|
+
private
|
285
|
+
|
286
|
+
def test_login?
|
287
|
+
@options[:login] == TEST_LOGIN && @options[:password] == TEST_PASSWORD
|
288
|
+
end
|
289
|
+
|
290
|
+
# add fields depending on payment source selected (cc or transaction id)
|
291
|
+
def add_payment_source(params, source)
|
292
|
+
if source.is_a?(String)
|
293
|
+
add_billing_id(params, source)
|
294
|
+
else
|
295
|
+
add_creditcard(params, source)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
# add fields for credit card
|
300
|
+
def add_creditcard(params, creditcard)
|
301
|
+
if creditcard.respond_to?(:track_data) && creditcard.track_data.present?
|
302
|
+
params[:track] = creditcard.track_data
|
303
|
+
else
|
304
|
+
params[:name] = creditcard.name
|
305
|
+
params[:number] = creditcard.number
|
306
|
+
params[:expiration_month] = creditcard.month
|
307
|
+
params[:expiration_year] = creditcard.year
|
308
|
+
params[:verification_number] = creditcard.verification_value if creditcard.verification_value?
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# add field for "instant" transaction, using previous transaction id
|
313
|
+
def add_billing_id(params, billingid)
|
314
|
+
params[:transaction_id] = billingid
|
315
|
+
end
|
316
|
+
|
317
|
+
# add address fields if present
|
318
|
+
def add_address(params, options)
|
319
|
+
address = options[:billing_address] || options[:address]
|
320
|
+
|
321
|
+
if address
|
322
|
+
params[:address] = address[:address1] unless address[:address1].blank?
|
323
|
+
params[:city] = address[:city] unless address[:city].blank?
|
324
|
+
params[:state] = address[:state] unless address[:state].blank?
|
325
|
+
params[:zipcode] = address[:zip] unless address[:zip].blank?
|
326
|
+
params[:country] = address[:country] unless address[:country].blank?
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
def add_optional_fields(params, options)
|
331
|
+
params[:notes] = options[:description] unless options[:description].blank?
|
332
|
+
params[:invoice] = options[:order_id].to_s.gsub(/[^-\/\w.,']/, '') unless options[:order_id].blank?
|
333
|
+
end
|
334
|
+
|
335
|
+
def commit(action, parameters)
|
336
|
+
url = test? ? self.test_url : self.live_url
|
337
|
+
|
338
|
+
response = parse(ssl_post(url, post_data(action, parameters)))
|
339
|
+
|
340
|
+
Response.new(successful?(response), message_from(response), response,
|
341
|
+
test: test?,
|
342
|
+
authorization: response[:transaction_id] || parameters[:transaction_id])
|
343
|
+
end
|
344
|
+
|
345
|
+
def successful?(response)
|
346
|
+
SUCCESS_CODES.include?(response[:response_code]) || response[:query_status] == true
|
347
|
+
end
|
348
|
+
|
349
|
+
def message_from(response)
|
350
|
+
if successful?(response)
|
351
|
+
SUCCESS_MESSAGE
|
352
|
+
else
|
353
|
+
DECLINE_CODES[response[:response_code]] || FAILURE_MESSAGE
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
def post_data(action, params)
|
358
|
+
if test?
|
359
|
+
# test requests must use global test account
|
360
|
+
params[:logon] = TEST_LOGIN
|
361
|
+
params[:password] = TEST_PASSWORD
|
362
|
+
else
|
363
|
+
params[:logon] = @options[:login]
|
364
|
+
params[:password] = @options[:password]
|
365
|
+
end
|
366
|
+
params[:version] = API_VERSION
|
367
|
+
params[:transaction_type] = action
|
368
|
+
|
369
|
+
params.reject { |_k, v| v.blank? }.collect { |k, v| "dc_#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
370
|
+
end
|
371
|
+
|
372
|
+
def parse(body)
|
373
|
+
# PayJunction uses the Field Separator ASCII character to separate key/val
|
374
|
+
# pairs in the response. The <FS> character's octal value is 034.
|
375
|
+
#
|
376
|
+
# Sample response:
|
377
|
+
#
|
378
|
+
# transaction_id=44752<FS>response_code=M4<FS>response_message=Declined (INV TEST CARD).
|
379
|
+
|
380
|
+
pairs = body.chomp.split("\034")
|
381
|
+
response = {}
|
382
|
+
pairs.each do |pair|
|
383
|
+
key, val = pair.split('=')
|
384
|
+
response[key[3..-1].to_sym] = val ? normalize(val) : nil
|
385
|
+
end
|
386
|
+
response
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
@@ -0,0 +1,206 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PayJunctionV2Gateway < Gateway
|
4
|
+
self.display_name = 'PayJunction'
|
5
|
+
self.homepage_url = 'https://www.payjunction.com/'
|
6
|
+
|
7
|
+
self.test_url = 'https://api.payjunctionlabs.com/transactions'
|
8
|
+
self.live_url = 'https://api.payjunction.com/transactions'
|
9
|
+
|
10
|
+
self.supported_countries = ['US']
|
11
|
+
self.default_currency = 'USD'
|
12
|
+
self.money_format = :dollars
|
13
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
requires!(options, :api_login, :api_password, :api_key)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def purchase(amount, payment_method, options = {})
|
21
|
+
post = {}
|
22
|
+
add_invoice(post, amount, options)
|
23
|
+
add_payment_method(post, payment_method)
|
24
|
+
add_address(post, options)
|
25
|
+
|
26
|
+
commit('purchase', post)
|
27
|
+
end
|
28
|
+
|
29
|
+
def authorize(amount, payment_method, options = {})
|
30
|
+
post = {}
|
31
|
+
post[:status] = 'HOLD'
|
32
|
+
add_invoice(post, amount, options)
|
33
|
+
add_payment_method(post, payment_method)
|
34
|
+
add_address(post, options)
|
35
|
+
|
36
|
+
commit('authorize', post)
|
37
|
+
end
|
38
|
+
|
39
|
+
def capture(amount, authorization, options = {})
|
40
|
+
post = {}
|
41
|
+
post[:status] = 'CAPTURE'
|
42
|
+
post[:transactionId] = authorization
|
43
|
+
add_invoice(post, amount, options)
|
44
|
+
|
45
|
+
commit('capture', post)
|
46
|
+
end
|
47
|
+
|
48
|
+
def void(authorization, options = {})
|
49
|
+
post = {}
|
50
|
+
post[:status] = 'VOID'
|
51
|
+
post[:transactionId] = authorization
|
52
|
+
|
53
|
+
commit('void', post)
|
54
|
+
end
|
55
|
+
|
56
|
+
def refund(amount, authorization, options = {})
|
57
|
+
post = {}
|
58
|
+
post[:action] = 'REFUND'
|
59
|
+
post[:transactionId] = authorization
|
60
|
+
add_invoice(post, amount, options)
|
61
|
+
|
62
|
+
commit('refund', post)
|
63
|
+
end
|
64
|
+
|
65
|
+
def credit(amount, payment_method, options = {})
|
66
|
+
post = {}
|
67
|
+
post[:action] = 'REFUND'
|
68
|
+
add_invoice(post, amount, options)
|
69
|
+
add_payment_method(post, payment_method)
|
70
|
+
|
71
|
+
commit('credit', post)
|
72
|
+
end
|
73
|
+
|
74
|
+
def verify(credit_card, options = {})
|
75
|
+
MultiResponse.run(:use_first_response) do |r|
|
76
|
+
r.process { authorize(100, credit_card, options) }
|
77
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def store(payment_method, options = {})
|
82
|
+
verify(payment_method, options)
|
83
|
+
end
|
84
|
+
|
85
|
+
def supports_scrubbing?
|
86
|
+
true
|
87
|
+
end
|
88
|
+
|
89
|
+
def scrub(transcript)
|
90
|
+
transcript.
|
91
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
92
|
+
gsub(%r((X-Pj-Application-Key: )[\w-]+), '\1[FILTERED]').
|
93
|
+
gsub(%r((cardNumber=)\d+), '\1[FILTERED]').
|
94
|
+
gsub(%r((cardCvv=)\d+), '\1[FILTERED]')
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def add_invoice(post, money, options)
|
100
|
+
post[:amountBase] = amount(money) if money
|
101
|
+
post[:invoiceNumber] = options[:order_id] if options[:order_id]
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_payment_method(post, payment_method)
|
105
|
+
if payment_method.is_a? Integer
|
106
|
+
post[:transactionId] = payment_method
|
107
|
+
else
|
108
|
+
post[:cardNumber] = payment_method.number
|
109
|
+
post[:cardExpMonth] = format(payment_method.month, :two_digits)
|
110
|
+
post[:cardExpYear] = format(payment_method.year, :four_digits)
|
111
|
+
post[:cardCvv] = payment_method.verification_value
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def add_address(post, options)
|
116
|
+
if address = options[:billing_address]
|
117
|
+
post[:billingFirstName] = address[:first_name] if address[:first_name]
|
118
|
+
post[:billingLastName] = address[:last_name] if address[:last_name]
|
119
|
+
post[:billingCompanyName] = address[:company] if address[:company]
|
120
|
+
post[:billingPhone] = address[:phone_number] if address[:phone_number]
|
121
|
+
post[:billingAddress] = address[:address1] if address[:address1]
|
122
|
+
post[:billingCity] = address[:city] if address[:city]
|
123
|
+
post[:billingState] = address[:state] if address[:state]
|
124
|
+
post[:billingCountry] = address[:country] if address[:country]
|
125
|
+
post[:billingZip] = address[:zip] if address[:zip]
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def commit(action, params)
|
130
|
+
response =
|
131
|
+
begin
|
132
|
+
parse(ssl_invoke(action, params))
|
133
|
+
rescue ResponseError => e
|
134
|
+
parse(e.response.body)
|
135
|
+
end
|
136
|
+
|
137
|
+
success = success_from(response)
|
138
|
+
Response.new(
|
139
|
+
success,
|
140
|
+
message_from(response),
|
141
|
+
response,
|
142
|
+
authorization: success ? authorization_from(response) : nil,
|
143
|
+
error_code: success ? nil : error_from(response),
|
144
|
+
test: test?
|
145
|
+
)
|
146
|
+
end
|
147
|
+
|
148
|
+
def ssl_invoke(action, params)
|
149
|
+
if %w[purchase authorize refund credit].include?(action)
|
150
|
+
ssl_post(url(), post_data(params), headers)
|
151
|
+
else
|
152
|
+
ssl_request(:put, url(params), post_data(params), headers)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def headers
|
157
|
+
{
|
158
|
+
'Authorization' => 'Basic ' + Base64.encode64("#{@options[:api_login]}:#{@options[:api_password]}").strip,
|
159
|
+
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
|
160
|
+
'Accept' => 'application/json',
|
161
|
+
'X-PJ-Application-Key' => @options[:api_key].to_s
|
162
|
+
}
|
163
|
+
end
|
164
|
+
|
165
|
+
def post_data(params)
|
166
|
+
params.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
167
|
+
end
|
168
|
+
|
169
|
+
def url(params = {})
|
170
|
+
test? ? "#{test_url}/#{params[:transactionId]}" : "#{live_url}/#{params[:transactionId]}"
|
171
|
+
end
|
172
|
+
|
173
|
+
def parse(body)
|
174
|
+
JSON.parse(body)
|
175
|
+
rescue JSON::ParserError
|
176
|
+
message = 'Invalid JSON response received from PayJunctionV2Gateway. Please contact PayJunctionV2Gateway if you continue to receive this message.'
|
177
|
+
message += " (The raw response returned by the API was #{body.inspect})"
|
178
|
+
{
|
179
|
+
'errors' => [{
|
180
|
+
'message' => message
|
181
|
+
}]
|
182
|
+
}
|
183
|
+
end
|
184
|
+
|
185
|
+
def success_from(response)
|
186
|
+
return response['response']['approved'] if response['response']
|
187
|
+
|
188
|
+
false
|
189
|
+
end
|
190
|
+
|
191
|
+
def message_from(response)
|
192
|
+
return response['response']['message'] if response['response']
|
193
|
+
|
194
|
+
response['errors']&.inject('') { |message, error| error['message'] + '|' + message }
|
195
|
+
end
|
196
|
+
|
197
|
+
def authorization_from(response)
|
198
|
+
response['transactionId']
|
199
|
+
end
|
200
|
+
|
201
|
+
def error_from(response)
|
202
|
+
response['response']['code'] if response['response']
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|