activemerchant 1.79.2 → 1.129.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +1391 -0
- data/README.md +29 -14
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +55 -22
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +82 -62
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +328 -58
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +61 -56
- data/lib/active_merchant/billing/gateways/adyen.rb +562 -87
- 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 +35 -36
- data/lib/active_merchant/billing/gateways/authorize_net.rb +297 -196
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +94 -98
- data/lib/active_merchant/billing/gateways/axcessms.rb +64 -66
- data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
- data/lib/active_merchant/billing/gateways/banwire.rb +12 -12
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +140 -69
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
- data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +115 -115
- data/lib/active_merchant/billing/gateways/beanstream.rb +39 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -2
- data/lib/active_merchant/billing/gateways/blue_pay.rb +87 -58
- data/lib/active_merchant/billing/gateways/blue_snap.rb +405 -104
- data/lib/active_merchant/billing/gateways/bogus.rb +34 -30
- data/lib/active_merchant/billing/gateways/borgun.rb +97 -47
- data/lib/active_merchant/billing/gateways/bpoint.rb +20 -20
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +9 -3
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +561 -259
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +1 -1
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +53 -54
- data/lib/active_merchant/billing/gateways/cams.rb +31 -31
- data/lib/active_merchant/billing/gateways/card_connect.rb +85 -33
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +187 -169
- data/lib/active_merchant/billing/gateways/cardknox.rb +24 -25
- data/lib/active_merchant/billing/gateways/cardprocess.rb +9 -7
- data/lib/active_merchant/billing/gateways/cashnet.rb +43 -27
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +62 -52
- data/lib/active_merchant/billing/gateways/cenpos.rb +63 -62
- data/lib/active_merchant/billing/gateways/checkout.rb +21 -23
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +391 -113
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -3
- data/lib/active_merchant/billing/gateways/clearhaus.rb +40 -41
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +361 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +35 -30
- data/lib/active_merchant/billing/gateways/creditcall.rb +59 -59
- data/lib/active_merchant/billing/gateways/credorax.rb +326 -145
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +53 -53
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +566 -208
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +456 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +342 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +40 -56
- 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 +34 -40
- data/lib/active_merchant/billing/gateways/digitzs.rb +48 -45
- data/lib/active_merchant/billing/gateways/ebanx.rb +110 -60
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +351 -189
- data/lib/active_merchant/billing/gateways/element.rb +106 -56
- data/lib/active_merchant/billing/gateways/epay.rb +74 -64
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +74 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +105 -60
- data/lib/active_merchant/billing/gateways/exact.rb +29 -37
- data/lib/active_merchant/billing/gateways/ezic.rb +21 -22
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +70 -48
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -4
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +33 -13
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +106 -105
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +36 -36
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +2 -2
- data/lib/active_merchant/billing/gateways/forte.rb +70 -40
- data/lib/active_merchant/billing/gateways/garanti.rb +24 -31
- data/lib/active_merchant/billing/gateways/global_collect.rb +378 -154
- data/lib/active_merchant/billing/gateways/global_transport.rb +12 -13
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +236 -69
- data/lib/active_merchant/billing/gateways/iats_payments.rb +61 -39
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +41 -47
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +25 -24
- data/lib/active_merchant/billing/gateways/iridium.rb +243 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +73 -34
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +145 -152
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +154 -159
- data/lib/active_merchant/billing/gateways/komoju.rb +16 -16
- data/lib/active_merchant/billing/gateways/kushki.rb +127 -57
- data/lib/active_merchant/billing/gateways/latitude19.rb +111 -115
- data/lib/active_merchant/billing/gateways/linkpoint.rb +82 -85
- data/lib/active_merchant/billing/gateways/litle.rb +247 -53
- data/lib/active_merchant/billing/gateways/mastercard.rb +41 -23
- data/lib/active_merchant/billing/gateways/maxipago.rb +5 -5
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +135 -49
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +62 -29
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +40 -40
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +42 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +52 -14
- data/lib/active_merchant/billing/gateways/mercury.rb +47 -51
- data/lib/active_merchant/billing/gateways/metrics_global.rb +32 -42
- data/lib/active_merchant/billing/gateways/micropayment.rb +42 -45
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +45 -40
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +2 -2
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +29 -31
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +255 -138
- data/lib/active_merchant/billing/gateways/moneris.rb +226 -88
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +117 -43
- data/lib/active_merchant/billing/gateways/nab_transact.rb +28 -31
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +13 -15
- data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
- data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
- data/lib/active_merchant/billing/gateways/netbanx.rb +167 -80
- data/lib/active_merchant/billing/gateways/netbilling.rb +27 -30
- data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
- data/lib/active_merchant/billing/gateways/nmi.rb +134 -48
- data/lib/active_merchant/billing/gateways/ogone.rb +88 -58
- data/lib/active_merchant/billing/gateways/omise.rb +30 -31
- data/lib/active_merchant/billing/gateways/openpay.rb +45 -26
- data/lib/active_merchant/billing/gateways/opp.rb +166 -144
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +67 -64
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +726 -382
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +26 -27
- data/lib/active_merchant/billing/gateways/pagarme.rb +47 -56
- data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +39 -40
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +65 -65
- data/lib/active_merchant/billing/gateways/pay_hub.rb +39 -39
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +70 -54
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +71 -47
- data/lib/active_merchant/billing/gateways/payeezy.rb +159 -32
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +41 -36
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
- data/lib/active_merchant/billing/gateways/payflow.rb +178 -54
- data/lib/active_merchant/billing/gateways/payflow_express.rb +61 -65
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -2
- data/lib/active_merchant/billing/gateways/payment_express.rb +66 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +114 -25
- data/lib/active_merchant/billing/gateways/paymill.rb +134 -133
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +27 -14
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_express.rb +5 -2
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +79 -82
- data/lib/active_merchant/billing/gateways/payu_in.rb +59 -58
- data/lib/active_merchant/billing/gateways/payu_latam.rb +139 -97
- data/lib/active_merchant/billing/gateways/payway.rb +27 -27
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +87 -34
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +139 -140
- data/lib/active_merchant/billing/gateways/psigate.rb +44 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +29 -37
- data/lib/active_merchant/billing/gateways/qbms.rb +75 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +142 -55
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +103 -107
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +156 -158
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +7 -8
- data/lib/active_merchant/billing/gateways/quickpay.rb +1 -3
- data/lib/active_merchant/billing/gateways/qvalent.rb +137 -68
- 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 +132 -50
- data/lib/active_merchant/billing/gateways/redsys.rb +382 -186
- data/lib/active_merchant/billing/gateways/s5.rb +16 -16
- data/lib/active_merchant/billing/gateways/safe_charge.rb +83 -47
- data/lib/active_merchant/billing/gateways/sage.rb +49 -48
- data/lib/active_merchant/billing/gateways/sage_pay.rb +76 -83
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +32 -40
- data/lib/active_merchant/billing/gateways/secure_pay.rb +30 -40
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +23 -26
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +69 -31
- data/lib/active_merchant/billing/gateways/shift4.rb +342 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -53
- data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +66 -47
- data/lib/active_merchant/billing/gateways/stripe.rb +309 -148
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +556 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +18 -23
- data/lib/active_merchant/billing/gateways/telr.rb +46 -48
- data/lib/active_merchant/billing/gateways/tns.rb +8 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +37 -37
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +249 -245
- data/lib/active_merchant/billing/gateways/transact_pro.rb +25 -27
- data/lib/active_merchant/billing/gateways/transax.rb +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +22 -18
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +161 -88
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +231 -238
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +129 -55
- data/lib/active_merchant/billing/gateways/vanco.rb +42 -33
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +18 -22
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +115 -74
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +38 -41
- data/lib/active_merchant/billing/gateways/wirecard.rb +36 -37
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +39 -38
- data/lib/active_merchant/billing/gateways/worldpay.rb +756 -142
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +73 -83
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +31 -31
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +3 -3
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +32 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +24 -38
- data/lib/active_merchant/country.rb +9 -5
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +2 -0
- data/lib/active_merchant/network_connection_retries.rb +28 -31
- data/lib/active_merchant/post_data.rb +5 -3
- data/lib/active_merchant/posts_data.rb +5 -7
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +3 -3
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +1592 -2329
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +9 -10
- metadata +98 -37
- data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
- data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
- data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
- data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -309
@@ -0,0 +1,308 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PlexoGateway < Gateway
|
4
|
+
self.test_url = 'https://api.testing.plexo.com.uy/v1/payments'
|
5
|
+
self.live_url = 'https://api.plexo.com.uy/v1/payments'
|
6
|
+
|
7
|
+
self.supported_countries = ['UY']
|
8
|
+
self.default_currency = 'UYU'
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover passcard edenred anda tarjeta-d]
|
10
|
+
|
11
|
+
self.homepage_url = 'https://www.plexo.com.uy'
|
12
|
+
self.display_name = 'Plexo'
|
13
|
+
|
14
|
+
APPENDED_URLS = %w(captures refunds cancellations verify)
|
15
|
+
AMOUNT_IN_RESPONSE = %w(authonly purchase /verify)
|
16
|
+
APPROVED_STATUS = %w(approved authorized)
|
17
|
+
|
18
|
+
def initialize(options = {})
|
19
|
+
requires!(options, :client_id, :api_key)
|
20
|
+
@credentials = options
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def purchase(money, payment, options = {})
|
25
|
+
post = {}
|
26
|
+
build_auth_purchase_request(money, post, payment, options)
|
27
|
+
|
28
|
+
commit('purchase', post, options)
|
29
|
+
end
|
30
|
+
|
31
|
+
def authorize(money, payment, options = {})
|
32
|
+
post = {}
|
33
|
+
build_auth_purchase_request(money, post, payment, options)
|
34
|
+
add_capture_type(post, options)
|
35
|
+
|
36
|
+
commit('authonly', post, options)
|
37
|
+
end
|
38
|
+
|
39
|
+
def capture(money, authorization, options = {})
|
40
|
+
post = {}
|
41
|
+
post[:ReferenceId] = options[:reference_id] || generate_unique_id
|
42
|
+
post[:Amount] = amount(money)
|
43
|
+
|
44
|
+
commit("/#{authorization}/captures", post, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def refund(money, authorization, options = {})
|
48
|
+
post = {}
|
49
|
+
post[:ReferenceId] = options[:reference_id] || generate_unique_id
|
50
|
+
post[:Type] = options[:refund_type] || 'refund'
|
51
|
+
post[:Description] = options[:description]
|
52
|
+
post[:Reason] = options[:reason]
|
53
|
+
post[:Amount] = amount(money)
|
54
|
+
|
55
|
+
commit("/#{authorization}/refunds", post, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def void(authorization, options = {})
|
59
|
+
post = {}
|
60
|
+
post[:ReferenceId] = options[:reference_id] || generate_unique_id
|
61
|
+
post[:Description] = options[:description]
|
62
|
+
post[:Reason] = options[:reason]
|
63
|
+
|
64
|
+
commit("/#{authorization}/cancellations", post, options)
|
65
|
+
end
|
66
|
+
|
67
|
+
def verify(credit_card, options = {})
|
68
|
+
post = {}
|
69
|
+
post[:ReferenceId] = options[:reference_id] || generate_unique_id
|
70
|
+
post[:MerchantId] = options[:merchant_id] || @credentials[:merchant_id]
|
71
|
+
post[:StatementDescriptor] = options[:statement_descriptor] if options[:statement_descriptor]
|
72
|
+
post[:CustomerId] = options[:customer_id] if options[:customer_id]
|
73
|
+
money = options[:verify_amount].to_i || 100
|
74
|
+
|
75
|
+
add_payment_method(post, credit_card, options)
|
76
|
+
add_metadata(post, options[:metadata])
|
77
|
+
add_amount(money, post, options)
|
78
|
+
add_browser_details(post, options)
|
79
|
+
|
80
|
+
commit('/verify', post, options)
|
81
|
+
end
|
82
|
+
|
83
|
+
def supports_scrubbing?
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
def scrub(transcript)
|
88
|
+
transcript.
|
89
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
90
|
+
gsub(%r(("Number\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
91
|
+
gsub(%r(("Cvc\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
92
|
+
gsub(%r(("InvoiceNumber\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]').
|
93
|
+
gsub(%r(("MerchantId\\?"\s*:\s*\\?")[^"]*)i, '\1[FILTERED]')
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def encoded_credentials
|
99
|
+
Base64.encode64("#{@credentials[:client_id]}:#{@credentials[:api_key]}").delete("\n")
|
100
|
+
end
|
101
|
+
|
102
|
+
def build_auth_purchase_request(money, post, payment, options)
|
103
|
+
post[:ReferenceId] = options[:reference_id] || generate_unique_id
|
104
|
+
post[:MerchantId] = options[:merchant_id] || @credentials[:merchant_id]
|
105
|
+
post[:Installments] = options[:installments] if options[:installments]
|
106
|
+
post[:StatementDescriptor] = options[:statement_descriptor] if options[:statement_descriptor]
|
107
|
+
post[:CustomerId] = options[:customer_id] if options[:customer_id]
|
108
|
+
|
109
|
+
add_payment_method(post, payment, options)
|
110
|
+
add_items(post, options[:items])
|
111
|
+
add_metadata(post, options[:metadata])
|
112
|
+
add_amount(money, post, options)
|
113
|
+
add_browser_details(post, options)
|
114
|
+
end
|
115
|
+
|
116
|
+
def header(parameters = {})
|
117
|
+
{
|
118
|
+
'Content-Type' => 'application/json',
|
119
|
+
'Authorization' => "Basic #{encoded_credentials}"
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
def add_capture_type(post, options)
|
124
|
+
post[:Capture] = {}
|
125
|
+
post[:Capture][:Method] = options.dig(:capture_type, :method) || 'manual'
|
126
|
+
end
|
127
|
+
|
128
|
+
def add_items(post, items)
|
129
|
+
return unless items&.kind_of?(Array)
|
130
|
+
|
131
|
+
post[:Items] = []
|
132
|
+
|
133
|
+
items.each do |option_item|
|
134
|
+
item = {}
|
135
|
+
item[:ReferenceId] = option_item[:reference_id] || generate_unique_id
|
136
|
+
item[:Name] = option_item[:name] if option_item[:name]
|
137
|
+
item[:Description] = option_item[:description] if option_item[:description]
|
138
|
+
item[:Quantity] = option_item[:quantity] if option_item[:quantity]
|
139
|
+
item[:Price] = option_item[:price] if option_item[:price]
|
140
|
+
item[:Discount] = option_item[:discount] if option_item[:discount]
|
141
|
+
|
142
|
+
post[:Items].append(item)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def add_metadata(post, metadata)
|
147
|
+
return unless metadata&.kind_of?(Hash)
|
148
|
+
|
149
|
+
metadata.transform_keys! { |key| key.to_s.camelize.to_sym }
|
150
|
+
post[:Metadata] = metadata
|
151
|
+
end
|
152
|
+
|
153
|
+
def add_amount(money, post, amount_options)
|
154
|
+
post[:Amount] = {}
|
155
|
+
|
156
|
+
post[:Amount][:Currency] = amount_options[:currency] || self.default_currency
|
157
|
+
post[:Amount][:Total] = amount(money)
|
158
|
+
post[:Amount][:Details] = {}
|
159
|
+
add_amount_details(post[:Amount][:Details], amount_options[:amount_details]) if amount_options[:amount_details]
|
160
|
+
end
|
161
|
+
|
162
|
+
def add_amount_details(amount_details, options)
|
163
|
+
return unless options
|
164
|
+
|
165
|
+
amount_details[:TaxedAmount] = options[:taxed_amount] if options[:taxed_amount]
|
166
|
+
amount_details[:TipAmount] = options[:tip_amount] if options[:tip_amount]
|
167
|
+
amount_details[:DiscountAmount] = options[:discount_amount] if options[:discount_amount]
|
168
|
+
amount_details[:TaxableAmount] = options[:taxable_amount] if options[:taxable_amount]
|
169
|
+
add_tax(amount_details, options[:tax])
|
170
|
+
end
|
171
|
+
|
172
|
+
def add_tax(post, tax)
|
173
|
+
return unless tax
|
174
|
+
|
175
|
+
post[:Tax] = {}
|
176
|
+
post[:Tax][:Type] = tax[:type] if tax[:type]
|
177
|
+
post[:Tax][:Amount] = tax[:amount] if tax[:amount]
|
178
|
+
post[:Tax][:Rate] = tax[:rate] if tax[:rate]
|
179
|
+
end
|
180
|
+
|
181
|
+
def add_browser_details(post, browser_details)
|
182
|
+
return unless browser_details
|
183
|
+
|
184
|
+
post[:BrowserDetails] = {}
|
185
|
+
post[:BrowserDetails][:DeviceFingerprint] = browser_details[:finger_print] if browser_details[:finger_print]
|
186
|
+
post[:BrowserDetails][:IpAddress] = browser_details[:ip] if browser_details[:ip]
|
187
|
+
end
|
188
|
+
|
189
|
+
def add_payment_method(post, payment, options)
|
190
|
+
post[:paymentMethod] = {}
|
191
|
+
|
192
|
+
if payment&.is_a?(CreditCard)
|
193
|
+
post[:paymentMethod][:type] = 'card'
|
194
|
+
post[:paymentMethod][:Card] = {}
|
195
|
+
post[:paymentMethod][:Card][:Number] = payment.number
|
196
|
+
post[:paymentMethod][:Card][:ExpMonth] = format(payment.month, :two_digits) if payment.month
|
197
|
+
post[:paymentMethod][:Card][:ExpYear] = format(payment.year, :two_digits) if payment.year
|
198
|
+
post[:paymentMethod][:Card][:Cvc] = payment.verification_value if payment.verification_value
|
199
|
+
|
200
|
+
add_card_holder(post[:paymentMethod][:Card], payment, options)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def add_card_holder(card, payment, options)
|
205
|
+
requires!(options, :email)
|
206
|
+
|
207
|
+
cardholder = {}
|
208
|
+
cardholder[:FirstName] = payment.first_name if payment.first_name
|
209
|
+
cardholder[:LastName] = payment.last_name if payment.last_name
|
210
|
+
cardholder[:Email] = options[:email]
|
211
|
+
cardholder[:Birthdate] = options[:cardholder_birthdate] if options[:cardholder_birthdate]
|
212
|
+
cardholder[:Identification] = {}
|
213
|
+
cardholder[:Identification][:Type] = options[:identification_type] if options[:identification_type]
|
214
|
+
cardholder[:Identification][:Value] = options[:identification_value] if options[:identification_value]
|
215
|
+
add_billing_address(cardholder, options)
|
216
|
+
|
217
|
+
card[:Cardholder] = cardholder
|
218
|
+
end
|
219
|
+
|
220
|
+
def add_billing_address(cardholder, options)
|
221
|
+
return unless address = options[:billing_address]
|
222
|
+
|
223
|
+
cardholder[:BillingAddress] = {}
|
224
|
+
cardholder[:BillingAddress][:City] = address[:city]
|
225
|
+
cardholder[:BillingAddress][:Country] = address[:country]
|
226
|
+
cardholder[:BillingAddress][:Line1] = address[:address1]
|
227
|
+
cardholder[:BillingAddress][:Line2] = address[:address2]
|
228
|
+
cardholder[:BillingAddress][:PostalCode] = address[:zip]
|
229
|
+
cardholder[:BillingAddress][:State] = address[:state]
|
230
|
+
end
|
231
|
+
|
232
|
+
def parse(body)
|
233
|
+
return {} if body == ''
|
234
|
+
|
235
|
+
JSON.parse(body)
|
236
|
+
end
|
237
|
+
|
238
|
+
def build_url(action, base)
|
239
|
+
url = base
|
240
|
+
url += action if APPENDED_URLS.any? { |key| action.include?(key) }
|
241
|
+
url
|
242
|
+
end
|
243
|
+
|
244
|
+
def get_authorization_from_url(url)
|
245
|
+
url.split('/')[1]
|
246
|
+
end
|
247
|
+
|
248
|
+
def reorder_amount_fields(response)
|
249
|
+
return response unless response['amount']
|
250
|
+
|
251
|
+
amount_obj = response['amount']
|
252
|
+
response['amount'] = amount_obj['total'].to_i if amount_obj['total']
|
253
|
+
response['currency'] = amount_obj['currency'] if amount_obj['currency']
|
254
|
+
response['amount_details'] = amount_obj['details'] if amount_obj['details']
|
255
|
+
response
|
256
|
+
end
|
257
|
+
|
258
|
+
def commit(action, parameters, options = {})
|
259
|
+
base_url = (test? ? test_url : live_url)
|
260
|
+
url = build_url(action, base_url)
|
261
|
+
response = parse(ssl_post(url, parameters.to_json, header(options)))
|
262
|
+
response = reorder_amount_fields(response) if AMOUNT_IN_RESPONSE.include?(action)
|
263
|
+
|
264
|
+
Response.new(
|
265
|
+
success_from(response),
|
266
|
+
message_from(response),
|
267
|
+
response,
|
268
|
+
authorization: authorization_from(response, action),
|
269
|
+
test: test?,
|
270
|
+
error_code: error_code_from(response)
|
271
|
+
)
|
272
|
+
end
|
273
|
+
|
274
|
+
def handle_response(response)
|
275
|
+
case response.code.to_i
|
276
|
+
when 200...300, 400, 401
|
277
|
+
response.body
|
278
|
+
else
|
279
|
+
raise ResponseError.new(response)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
def success_from(response)
|
284
|
+
APPROVED_STATUS.include?(response['status'])
|
285
|
+
end
|
286
|
+
|
287
|
+
def message_from(response)
|
288
|
+
response = response['transactions']&.first if response['transactions']&.is_a?(Array)
|
289
|
+
response['resultMessage'] || response['message']
|
290
|
+
end
|
291
|
+
|
292
|
+
def authorization_from(response, action = nil)
|
293
|
+
if action.include?('captures')
|
294
|
+
get_authorization_from_url(action)
|
295
|
+
else
|
296
|
+
response['id']
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
def error_code_from(response)
|
301
|
+
return if success_from(response)
|
302
|
+
|
303
|
+
response = response['transactions']&.first if response['transactions']&.is_a?(Array)
|
304
|
+
response['resultCode'] || response['status']
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
@@ -3,97 +3,97 @@ module ActiveMerchant
|
|
3
3
|
class PlugnpayGateway < Gateway
|
4
4
|
class PlugnpayPostData < PostData
|
5
5
|
# Fields that will be sent even if they are blank
|
6
|
-
self.required_fields = [
|
7
|
-
|
6
|
+
self.required_fields = %i[publisher_name publisher_password
|
7
|
+
card_amount card_name card_number card_exp orderID]
|
8
8
|
end
|
9
9
|
self.live_url = self.test_url = 'https://pay1.plugnpay.com/payment/pnpremote.cgi'
|
10
10
|
|
11
11
|
CARD_CODE_MESSAGES = {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
'M' => 'Card verification number matched',
|
13
|
+
'N' => "Card verification number didn't match",
|
14
|
+
'P' => 'Card verification number was not processed',
|
15
|
+
'S' => 'Card verification number should be on card but was not indicated',
|
16
|
+
'U' => 'Issuer was not certified for card verification'
|
17
17
|
}
|
18
18
|
|
19
|
-
CARD_CODE_ERRORS = %w(
|
19
|
+
CARD_CODE_ERRORS = %w(N S)
|
20
20
|
|
21
21
|
AVS_MESSAGES = {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
22
|
+
'A' => 'Street address matches billing information, zip/postal code does not',
|
23
|
+
'B' => 'Address information not provided for address verification check',
|
24
|
+
'E' => 'Address verification service error',
|
25
|
+
'G' => 'Non-U.S. card-issuing bank',
|
26
|
+
'N' => 'Neither street address nor zip/postal match billing information',
|
27
|
+
'P' => 'Address verification not applicable for this transaction',
|
28
|
+
'R' => 'Payment gateway was unavailable or timed out',
|
29
|
+
'S' => 'Address verification service not supported by issuer',
|
30
|
+
'U' => 'Address information is unavailable',
|
31
|
+
'W' => '9-digit zip/postal code matches billing information, street address does not',
|
32
|
+
'X' => 'Street address and 9-digit zip/postal code matches billing information',
|
33
|
+
'Y' => 'Street address and 5-digit zip/postal code matches billing information',
|
34
|
+
'Z' => '5-digit zip/postal code matches billing information, street address does not'
|
35
35
|
}
|
36
36
|
|
37
|
-
AVS_ERRORS = %w(
|
37
|
+
AVS_ERRORS = %w(A E N R W Z)
|
38
38
|
|
39
39
|
PAYMENT_GATEWAY_RESPONSES = {
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
40
|
+
'P01' => 'AVS Mismatch Failure',
|
41
|
+
'P02' => 'CVV2 Mismatch Failure',
|
42
|
+
'P21' => 'Transaction may not be marked',
|
43
|
+
'P30' => 'Test Tran. Bad Card',
|
44
|
+
'P35' => 'Test Tran. Problem',
|
45
|
+
'P40' => 'Username already exists',
|
46
|
+
'P41' => 'Username is blank',
|
47
|
+
'P50' => 'Fraud Screen Failure',
|
48
|
+
'P51' => 'Missing PIN Code',
|
49
|
+
'P52' => 'Invalid Bank Acct. No.',
|
50
|
+
'P53' => 'Invalid Bank Routing No.',
|
51
|
+
'P54' => 'Invalid/Missing Check No.',
|
52
|
+
'P55' => 'Invalid Credit Card No.',
|
53
|
+
'P56' => 'Invalid CVV2/CVC2 No.',
|
54
|
+
'P57' => 'Expired. CC Exp. Date',
|
55
|
+
'P58' => 'Missing Data',
|
56
|
+
'P59' => 'Missing Email Address',
|
57
|
+
'P60' => 'Zip Code does not match Billing State.',
|
58
|
+
'P61' => 'Invalid Billing Zip Code',
|
59
|
+
'P62' => 'Zip Code does not match Shipping State.',
|
60
|
+
'P63' => 'Invalid Shipping Zip Code',
|
61
|
+
'P64' => 'Invalid Credit Card CVV2/CVC2 Format.',
|
62
|
+
'P65' => 'Maximum number of attempts has been exceeded.',
|
63
|
+
'P66' => 'Credit Card number has been flagged and can not be used to access this service.',
|
64
|
+
'P67' => 'IP Address is on Blocked List.',
|
65
|
+
'P68' => 'Billing country does not match ipaddress country.',
|
66
|
+
'P69' => 'US based ipaddresses are currently blocked.',
|
67
|
+
'P70' => 'Credit Cards issued from this bank are currently not being accepted.',
|
68
|
+
'P71' => 'Credit Cards issued from this bank are currently not being accepted.',
|
69
|
+
'P72' => 'Daily volume exceeded.',
|
70
|
+
'P73' => 'Too many transactions within allotted time.',
|
71
|
+
'P91' => 'Missing/incorrect password',
|
72
|
+
'P92' => 'Account not configured for mobil administration',
|
73
|
+
'P93' => 'IP Not registered to username.',
|
74
|
+
'P94' => 'Mode not permitted for this account.',
|
75
|
+
'P95' => 'Currently Blank',
|
76
|
+
'P96' => 'Currently Blank',
|
77
|
+
'P97' => 'Processor not responding',
|
78
|
+
'P98' => 'Missing merchant/publisher name',
|
79
|
+
'P99' => 'Currently Blank'
|
80
80
|
}
|
81
81
|
|
82
82
|
TRANSACTIONS = {
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
:
|
88
|
-
:
|
83
|
+
authorization: 'auth',
|
84
|
+
purchase: 'auth',
|
85
|
+
capture: 'mark',
|
86
|
+
void: 'void',
|
87
|
+
refund: 'return',
|
88
|
+
credit: 'newreturn'
|
89
89
|
}
|
90
90
|
|
91
|
-
SUCCESS_CODES = [
|
92
|
-
FAILURE_CODES = [
|
91
|
+
SUCCESS_CODES = %w[pending success]
|
92
|
+
FAILURE_CODES = %w[badcard fraud]
|
93
93
|
|
94
94
|
self.default_currency = 'USD'
|
95
95
|
self.supported_countries = ['US']
|
96
|
-
self.supported_cardtypes = [
|
96
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
97
97
|
self.homepage_url = 'http://www.plugnpay.com/'
|
98
98
|
self.display_name = "Plug'n Pay"
|
99
99
|
|
@@ -172,23 +172,23 @@ module ActiveMerchant
|
|
172
172
|
end
|
173
173
|
|
174
174
|
private
|
175
|
+
|
175
176
|
def commit(action, post)
|
176
|
-
response = parse(
|
177
|
+
response = parse(ssl_post(self.live_url, post_data(action, post)))
|
177
178
|
success = SUCCESS_CODES.include?(response[:finalstatus])
|
178
179
|
message = success ? 'Success' : message_from(response)
|
179
180
|
|
180
181
|
Response.new(success, message, response,
|
181
|
-
:
|
182
|
-
:
|
183
|
-
:
|
184
|
-
:
|
185
|
-
)
|
182
|
+
test: test?,
|
183
|
+
authorization: response[:orderid],
|
184
|
+
avs_result: { code: response[:avs_code] },
|
185
|
+
cvv_result: response[:cvvresp])
|
186
186
|
end
|
187
187
|
|
188
188
|
def parse(body)
|
189
189
|
body = CGI.unescape(body)
|
190
190
|
results = {}
|
191
|
-
body.split('&').collect { |e| e.split('=') }.each do |key,value|
|
191
|
+
body.split('&').collect { |e| e.split('=') }.each do |key, value|
|
192
192
|
results[key.downcase.to_sym] = normalize(value.to_s.strip)
|
193
193
|
end
|
194
194
|
|
@@ -218,7 +218,7 @@ module ActiveMerchant
|
|
218
218
|
|
219
219
|
def add_customer_data(post, options)
|
220
220
|
post[:email] = options[:email]
|
221
|
-
post[:dontsndmail]
|
221
|
+
post[:dontsndmail] = 'yes' unless options[:send_email_confirmation]
|
222
222
|
post[:ipaddress] = options[:ip]
|
223
223
|
end
|
224
224
|
|
@@ -255,7 +255,7 @@ module ActiveMerchant
|
|
255
255
|
post[:state] = shipping_address[:state]
|
256
256
|
else
|
257
257
|
post[:state] = 'ZZ'
|
258
|
-
post[:province]
|
258
|
+
post[:province] = shipping_address[:state]
|
259
259
|
end
|
260
260
|
|
261
261
|
post[:country] = shipping_address[:country]
|
@@ -273,8 +273,8 @@ module ActiveMerchant
|
|
273
273
|
end
|
274
274
|
|
275
275
|
def expdate(creditcard)
|
276
|
-
year = sprintf(
|
277
|
-
month = sprintf(
|
276
|
+
year = sprintf('%.4i', creditcard.year)
|
277
|
+
month = sprintf('%.2i', creditcard.month)
|
278
278
|
|
279
279
|
"#{month}/#{year[-2..-1]}"
|
280
280
|
end
|