activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- 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 +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- 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 +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- 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 +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -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/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -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.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -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 +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- 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/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- 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 +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- 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 +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- 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 +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- 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 +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- 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 +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- 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 +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- 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 +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- 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 +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- 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 +6 -8
- data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -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 +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- 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 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.live_url = 'https://api.conekta.io/'
|
5
5
|
|
6
6
|
self.supported_countries = ['MX']
|
7
|
-
self.supported_cardtypes = [
|
7
|
+
self.supported_cardtypes = %i[visa master american_express carnet]
|
8
8
|
self.homepage_url = 'https://conekta.io/'
|
9
9
|
self.display_name = 'Conekta Gateway'
|
10
10
|
self.money_format = :cents
|
@@ -12,7 +12,7 @@ module ActiveMerchant #:nodoc:
|
|
12
12
|
|
13
13
|
def initialize(options = {})
|
14
14
|
requires!(options, :key)
|
15
|
-
options[:version] ||= '0.
|
15
|
+
options[:version] ||= '1.0.0'
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
@@ -23,7 +23,7 @@ module ActiveMerchant #:nodoc:
|
|
23
23
|
add_payment_source(post, payment_source, options)
|
24
24
|
add_details_data(post, options)
|
25
25
|
|
26
|
-
commit(:post, 'charges', post)
|
26
|
+
commit(:post, 'charges', post, options)
|
27
27
|
end
|
28
28
|
|
29
29
|
def authorize(money, payment_source, options = {})
|
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
add_details_data(post, options)
|
35
35
|
|
36
36
|
post[:capture] = false
|
37
|
-
commit(:post,
|
37
|
+
commit(:post, 'charges', post, options)
|
38
38
|
end
|
39
39
|
|
40
40
|
def capture(money, identifier, options = {})
|
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
|
|
43
43
|
post[:order_id] = identifier
|
44
44
|
add_order(post, money, options)
|
45
45
|
|
46
|
-
commit(:post, "charges/#{identifier}/capture", post)
|
46
|
+
commit(:post, "charges/#{identifier}/capture", post, options)
|
47
47
|
end
|
48
48
|
|
49
49
|
def refund(money, identifier, options)
|
@@ -52,30 +52,46 @@ module ActiveMerchant #:nodoc:
|
|
52
52
|
post[:order_id] = identifier
|
53
53
|
add_order(post, money, options)
|
54
54
|
|
55
|
-
commit(:post, "charges/#{identifier}/refund", post)
|
55
|
+
commit(:post, "charges/#{identifier}/refund", post, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def void(identifier, options = {})
|
59
|
+
post = {}
|
60
|
+
commit(:post, "charges/#{identifier}/void", post, options)
|
61
|
+
end
|
62
|
+
|
63
|
+
def supports_scrubbing
|
64
|
+
true
|
65
|
+
end
|
66
|
+
|
67
|
+
def scrub(transcript)
|
68
|
+
transcript.
|
69
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
70
|
+
gsub(%r((&?card%5Bnumber%5D=)[^&]*)i, '\1[FILTERED]').
|
71
|
+
gsub(%r((&?card%5Bcvc%5D=)[^&]*)i, '\1[FILTERED]')
|
56
72
|
end
|
57
73
|
|
58
74
|
private
|
59
75
|
|
60
76
|
def add_order(post, money, options)
|
61
|
-
post[:description] = options[:description] ||
|
77
|
+
post[:description] = options[:description] || 'Active Merchant Purchase'
|
62
78
|
post[:reference_id] = options[:order_id] if options[:order_id]
|
63
79
|
post[:currency] = (options[:currency] || currency(money)).downcase
|
80
|
+
post[:monthly_installments] = options[:monthly_installments] if options[:monthly_installments]
|
64
81
|
post[:amount] = amount(money)
|
65
82
|
end
|
66
83
|
|
67
84
|
def add_details_data(post, options)
|
68
85
|
details = {}
|
69
|
-
details[:name] = options[:customer] if options[:
|
86
|
+
details[:name] = options[:customer] || (options[:billing_address][:name] if options[:billing_address])
|
87
|
+
details[:phone] = options[:phone] || (options[:billing_address][:phone] if options[:billing_address])
|
70
88
|
details[:email] = options[:email] if options[:email]
|
71
|
-
details[:phone] = options[:phone] if options[:phone]
|
72
|
-
details[:device_fingerprint] = options[:device_fingerprint] if options[:device_fingerprint]
|
73
89
|
details[:ip] = options[:ip] if options[:ip]
|
74
90
|
add_billing_address(details, options)
|
75
91
|
add_line_items(details, options)
|
76
92
|
add_shipment(details, options)
|
77
|
-
|
78
93
|
post[:details] = details
|
94
|
+
post[:device_fingerprint] = options[:device_fingerprint] if options[:device_fingerprint]
|
79
95
|
end
|
80
96
|
|
81
97
|
def add_shipment(post, options)
|
@@ -89,7 +105,7 @@ module ActiveMerchant #:nodoc:
|
|
89
105
|
end
|
90
106
|
|
91
107
|
def add_shipment_address(post, options)
|
92
|
-
if(address = options[:shipping_address])
|
108
|
+
if (address = options[:shipping_address])
|
93
109
|
post[:address] = {}
|
94
110
|
post[:address][:street1] = address[:address1] if address[:address1]
|
95
111
|
post[:address][:street2] = address[:address2] if address[:address2]
|
@@ -108,7 +124,7 @@ module ActiveMerchant #:nodoc:
|
|
108
124
|
end
|
109
125
|
|
110
126
|
def add_billing_address(post, options)
|
111
|
-
if(address = (options[:billing_address] || options[:address]))
|
127
|
+
if (address = (options[:billing_address] || options[:address]))
|
112
128
|
post[:billing_address] = {}
|
113
129
|
post[:billing_address][:street1] = address[:address1] if address[:address1]
|
114
130
|
post[:billing_address][:street2] = address[:address2] if address[:address2]
|
@@ -126,7 +142,7 @@ module ActiveMerchant #:nodoc:
|
|
126
142
|
end
|
127
143
|
|
128
144
|
def add_address(post, options)
|
129
|
-
if(address = (options[:billing_address] || options[:address]))
|
145
|
+
if (address = (options[:billing_address] || options[:address]))
|
130
146
|
post[:address] = {}
|
131
147
|
post[:address][:street1] = address[:address1] if address[:address1]
|
132
148
|
post[:address][:street2] = address[:address2] if address[:address2]
|
@@ -146,33 +162,41 @@ module ActiveMerchant #:nodoc:
|
|
146
162
|
post[:card][:name] = payment_source.name
|
147
163
|
post[:card][:cvc] = payment_source.verification_value
|
148
164
|
post[:card][:number] = payment_source.number
|
149
|
-
post[:card][:exp_month] =
|
150
|
-
post[:card][:exp_year] =
|
165
|
+
post[:card][:exp_month] = sprintf('%02d', payment_source.month)
|
166
|
+
post[:card][:exp_year] = payment_source.year.to_s[-2, 2]
|
151
167
|
add_address(post[:card], options)
|
152
168
|
end
|
153
169
|
end
|
154
170
|
|
155
171
|
def parse(body)
|
156
172
|
return {} unless body
|
173
|
+
|
157
174
|
JSON.parse(body)
|
158
175
|
end
|
159
176
|
|
160
|
-
def headers(
|
177
|
+
def headers(options)
|
161
178
|
{
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
179
|
+
'Accept' => "application/vnd.conekta-v#{@options[:version]}+json",
|
180
|
+
'Accept-Language' => 'es',
|
181
|
+
'Authorization' => 'Basic ' + Base64.encode64("#{@options[:key]}:"),
|
182
|
+
'RaiseHtmlError' => 'false',
|
183
|
+
'Conekta-Client-User-Agent' => { 'agent' => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}" }.to_json,
|
184
|
+
'X-Conekta-Client-User-Agent' => conekta_client_user_agent(options),
|
185
|
+
'X-Conekta-Client-User-Metadata' => options[:meta].to_json
|
168
186
|
}
|
169
187
|
end
|
170
188
|
|
189
|
+
def conekta_client_user_agent(options)
|
190
|
+
return user_agent unless options[:application]
|
191
|
+
|
192
|
+
JSON.dump(JSON.parse(user_agent).merge!({ application: options[:application] }))
|
193
|
+
end
|
194
|
+
|
171
195
|
def commit(method, url, parameters, options = {})
|
172
196
|
success = false
|
173
197
|
begin
|
174
|
-
raw_response = parse(ssl_request(method, live_url + url, (parameters ? parameters.to_query : nil), headers(options
|
175
|
-
success = (raw_response.key?(
|
198
|
+
raw_response = parse(ssl_request(method, live_url + url, (parameters ? parameters.to_query : nil), headers(options)))
|
199
|
+
success = (raw_response.key?('object') && (raw_response['object'] != 'error'))
|
176
200
|
rescue ResponseError => e
|
177
201
|
raw_response = response_error(e.response.body)
|
178
202
|
rescue JSON::ParserError
|
@@ -181,29 +205,26 @@ module ActiveMerchant #:nodoc:
|
|
181
205
|
|
182
206
|
Response.new(
|
183
207
|
success,
|
184
|
-
raw_response[
|
208
|
+
raw_response['message_to_purchaser'],
|
185
209
|
raw_response,
|
186
210
|
test: test?,
|
187
|
-
authorization: raw_response[
|
211
|
+
authorization: raw_response['id']
|
188
212
|
)
|
189
213
|
end
|
190
214
|
|
191
215
|
def response_error(raw_response)
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
json_error(raw_response)
|
196
|
-
end
|
216
|
+
parse(raw_response)
|
217
|
+
rescue JSON::ParserError
|
218
|
+
json_error(raw_response)
|
197
219
|
end
|
198
220
|
|
199
221
|
def json_error(raw_response)
|
200
222
|
msg = 'Invalid response received from the Conekta API.'
|
201
223
|
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
202
224
|
{
|
203
|
-
|
225
|
+
'message' => msg
|
204
226
|
}
|
205
227
|
end
|
206
228
|
end
|
207
229
|
end
|
208
230
|
end
|
209
|
-
|
@@ -0,0 +1,272 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class CreditcallGateway < Gateway
|
6
|
+
include Empty
|
7
|
+
|
8
|
+
self.test_url = 'https://test.cardeasexml.com/generic.cex'
|
9
|
+
self.live_url = 'https://live.cardeasexml.com/generic.cex'
|
10
|
+
|
11
|
+
self.supported_countries = ['US']
|
12
|
+
self.default_currency = 'USD'
|
13
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
14
|
+
|
15
|
+
self.homepage_url = 'https://www.creditcall.com'
|
16
|
+
self.display_name = 'Creditcall'
|
17
|
+
|
18
|
+
CVV_CODE = {
|
19
|
+
'matched' => 'M',
|
20
|
+
'notmatched' => 'N',
|
21
|
+
'notchecked' => 'P',
|
22
|
+
'partialmatch' => 'N'
|
23
|
+
}
|
24
|
+
|
25
|
+
AVS_CODE = {
|
26
|
+
'matched;matched' => 'D',
|
27
|
+
'matched;notchecked' => 'B',
|
28
|
+
'matched;notmatched' => 'A',
|
29
|
+
'matched;partialmatch' => 'A',
|
30
|
+
'notchecked;matched' => 'P',
|
31
|
+
'notchecked;notchecked' => 'I',
|
32
|
+
'notchecked;notmatched' => 'I',
|
33
|
+
'notchecked;partialmatch' => 'I',
|
34
|
+
'notmatched;matched' => 'W',
|
35
|
+
'notmatched;notchecked' => 'C',
|
36
|
+
'notmatched;notmatched' => 'C',
|
37
|
+
'notmatched;partialmatch' => 'C',
|
38
|
+
'partialmatched;matched' => 'W',
|
39
|
+
'partialmatched;notchecked' => 'C',
|
40
|
+
'partialmatched;notmatched' => 'C',
|
41
|
+
'partialmatched;partialmatch' => 'C'
|
42
|
+
}
|
43
|
+
|
44
|
+
def initialize(options = {})
|
45
|
+
requires!(options, :terminal_id, :transaction_key)
|
46
|
+
super
|
47
|
+
end
|
48
|
+
|
49
|
+
def purchase(money, payment_method, options = {})
|
50
|
+
multi_response = MultiResponse.run do |r|
|
51
|
+
r.process { authorize(money, payment_method, options) }
|
52
|
+
r.process { capture(money, r.authorization, options) }
|
53
|
+
end
|
54
|
+
|
55
|
+
merged_params = multi_response.responses.map(&:params).reduce({}, :merge)
|
56
|
+
|
57
|
+
Response.new(
|
58
|
+
multi_response.primary_response.success?,
|
59
|
+
multi_response.primary_response.message,
|
60
|
+
merged_params,
|
61
|
+
authorization: multi_response.responses.first.authorization,
|
62
|
+
avs_result: AVSResult.new(code: avs_result_code_from(merged_params)),
|
63
|
+
cvv_result: CVVResult.new(cvv_result_code_from(merged_params)),
|
64
|
+
error_code: error_result_code_from(merged_params),
|
65
|
+
test: test?
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
def authorize(money, payment_method, options = {})
|
70
|
+
request = build_xml_request do |xml|
|
71
|
+
add_transaction_details(xml, money, nil, 'Auth', options)
|
72
|
+
add_terminal_details(xml, options)
|
73
|
+
add_card_details(xml, payment_method, options)
|
74
|
+
end
|
75
|
+
|
76
|
+
commit(request)
|
77
|
+
end
|
78
|
+
|
79
|
+
def capture(money, authorization, options = {})
|
80
|
+
request = build_xml_request do |xml|
|
81
|
+
add_transaction_details(xml, money, authorization, 'Conf', options)
|
82
|
+
add_terminal_details(xml, options)
|
83
|
+
end
|
84
|
+
|
85
|
+
commit(request)
|
86
|
+
end
|
87
|
+
|
88
|
+
def refund(money, authorization, options = {})
|
89
|
+
request = build_xml_request do |xml|
|
90
|
+
add_transaction_details(xml, money, authorization, 'Refund', options)
|
91
|
+
add_terminal_details(xml, options)
|
92
|
+
end
|
93
|
+
|
94
|
+
commit(request)
|
95
|
+
end
|
96
|
+
|
97
|
+
def void(authorization, options = {})
|
98
|
+
request = build_xml_request do |xml|
|
99
|
+
add_transaction_details(xml, nil, authorization, 'Void', options)
|
100
|
+
add_terminal_details(xml, options)
|
101
|
+
end
|
102
|
+
|
103
|
+
commit(request)
|
104
|
+
end
|
105
|
+
|
106
|
+
def verify(credit_card, options = {})
|
107
|
+
MultiResponse.run(:use_first_response) do |r|
|
108
|
+
r.process { authorize(100, credit_card, options) }
|
109
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def supports_scrubbing?
|
114
|
+
true
|
115
|
+
end
|
116
|
+
|
117
|
+
def scrub(transcript)
|
118
|
+
transcript.
|
119
|
+
gsub(%r((<TransactionKey>).+?(</TransactionKey>))i, '\1[FILTERED]\2').
|
120
|
+
gsub(%r((<PAN>).+?(</PAN>))i, '\1[FILTERED]\2').
|
121
|
+
gsub(%r((<CSC>).+?(</CSC>))i, '\1[FILTERED]\2')
|
122
|
+
end
|
123
|
+
|
124
|
+
private
|
125
|
+
|
126
|
+
def avs_result_code_from(params)
|
127
|
+
AVS_CODE["#{params['Address']};#{params['Zip']}"]
|
128
|
+
end
|
129
|
+
|
130
|
+
def cvv_result_code_from(params)
|
131
|
+
CVV_CODE[params['CSC']]
|
132
|
+
end
|
133
|
+
|
134
|
+
def error_result_code_from(params)
|
135
|
+
params['ErrorCode']
|
136
|
+
end
|
137
|
+
|
138
|
+
def build_xml_request
|
139
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
140
|
+
xml.Request(type: 'CardEaseXML', version: '1.0.0') do
|
141
|
+
yield(xml)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
builder.to_xml
|
145
|
+
end
|
146
|
+
|
147
|
+
def add_transaction_details(xml, amount, authorization, type, options = {})
|
148
|
+
xml.TransactionDetails do
|
149
|
+
xml.MessageType type
|
150
|
+
xml.Amount(unit: 'Minor') { xml.text(amount) } if amount
|
151
|
+
xml.CardEaseReference authorization if authorization
|
152
|
+
xml.VoidReason '01' if type == 'Void'
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def add_terminal_details(xml, options = {})
|
157
|
+
xml.TerminalDetails do
|
158
|
+
xml.TerminalID @options[:terminal_id]
|
159
|
+
xml.TransactionKey @options[:transaction_key]
|
160
|
+
xml.Software(version: 'SoftwareVersion') { xml.text('SoftwareName') }
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def add_card_details(xml, payment_method, options = {})
|
165
|
+
xml.CardDetails do
|
166
|
+
xml.Manual(type: manual_type(options)) do
|
167
|
+
xml.PAN payment_method.number
|
168
|
+
xml.ExpiryDate exp_date(payment_method)
|
169
|
+
xml.CSC payment_method.verification_value unless empty?(payment_method.verification_value)
|
170
|
+
end
|
171
|
+
|
172
|
+
add_additional_verification(xml, options)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def add_additional_verification(xml, options)
|
177
|
+
return unless (options[:verify_zip].to_s == 'true') || (options[:verify_address].to_s == 'true')
|
178
|
+
|
179
|
+
if address = options[:billing_address]
|
180
|
+
xml.AdditionalVerification do
|
181
|
+
xml.Zip address[:zip] if options[:verify_zip].to_s == 'true'
|
182
|
+
xml.Address address[:address1] if options[:verify_address].to_s == 'true'
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def exp_date(payment_method)
|
188
|
+
"#{format(payment_method.year, :two_digits)}#{format(payment_method.month, :two_digits)}"
|
189
|
+
end
|
190
|
+
|
191
|
+
def parse(body)
|
192
|
+
response = {}
|
193
|
+
xml = Nokogiri::XML(body)
|
194
|
+
|
195
|
+
node = xml.xpath('//Response/TransactionDetails')
|
196
|
+
node.children.each do |childnode|
|
197
|
+
response[childnode.name] = childnode.text
|
198
|
+
end
|
199
|
+
|
200
|
+
node = xml.xpath('//Response/Result')
|
201
|
+
node.children.each do |childnode|
|
202
|
+
if childnode.elements.empty?
|
203
|
+
response[childnode.name] = childnode.text
|
204
|
+
else
|
205
|
+
childnode_to_response(response, childnode)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
node = xml.xpath('//Response/CardDetails')
|
210
|
+
node.children.each do |childnode|
|
211
|
+
if childnode.elements.empty?
|
212
|
+
response[childnode.name] = childnode.text
|
213
|
+
else
|
214
|
+
childnode_to_response(response, childnode)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
response
|
219
|
+
end
|
220
|
+
|
221
|
+
def childnode_to_response(response, childnode)
|
222
|
+
childnode.elements.each do |element|
|
223
|
+
if element.name == 'Error'
|
224
|
+
response['ErrorCode'] = element.attr('code')
|
225
|
+
response['ErrorMessage'] = element.text
|
226
|
+
else
|
227
|
+
response[element.name] = element.text
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def commit(parameters)
|
233
|
+
response = parse(ssl_post(url, parameters))
|
234
|
+
|
235
|
+
Response.new(
|
236
|
+
success_from(response),
|
237
|
+
message_from(response),
|
238
|
+
response,
|
239
|
+
authorization: authorization_from(response),
|
240
|
+
avs_result: AVSResult.new(code: avs_result_code_from(response)),
|
241
|
+
cvv_result: CVVResult.new(cvv_result_code_from(response)),
|
242
|
+
error_code: error_result_code_from(response),
|
243
|
+
test: test?
|
244
|
+
)
|
245
|
+
end
|
246
|
+
|
247
|
+
def url
|
248
|
+
test? ? test_url : live_url
|
249
|
+
end
|
250
|
+
|
251
|
+
def success_from(response)
|
252
|
+
response['LocalResult'] == '0' || response['LocalResult'] == '00'
|
253
|
+
end
|
254
|
+
|
255
|
+
def message_from(response)
|
256
|
+
if success_from(response)
|
257
|
+
'Succeeded'
|
258
|
+
else
|
259
|
+
response['ErrorMessage']
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
def authorization_from(response)
|
264
|
+
response['CardEaseReference']
|
265
|
+
end
|
266
|
+
|
267
|
+
def manual_type(options)
|
268
|
+
options[:manual_type] || 'ecommerce'
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|