activemerchant 1.100.0 → 1.133.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1057 -0
- data/README.md +11 -9
- data/lib/active_merchant/billing/avs_result.rb +9 -9
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +49 -17
- data/lib/active_merchant/billing/compatibility.rb +5 -4
- data/lib/active_merchant/billing/credit_card.rb +55 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +38 -36
- data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
- 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 +14 -14
- data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
- data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
- data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
- data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
- data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
- data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
- data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
- data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
- data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
- 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 +387 -175
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/cams.rb +10 -10
- data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
- data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
- data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
- data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
- data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
- data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
- data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
- data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
- data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
- data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
- data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
- data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
- data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
- data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
- data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
- data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
- data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
- data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
- data/lib/active_merchant/billing/gateways/element.rb +71 -21
- data/lib/active_merchant/billing/gateways/epay.rb +43 -43
- data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
- data/lib/active_merchant/billing/gateways/eway.rb +9 -9
- data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
- data/lib/active_merchant/billing/gateways/exact.rb +19 -20
- data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
- data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +38 -22
- data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
- data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
- data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
- data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
- data/lib/active_merchant/billing/gateways/hps.rb +171 -50
- data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
- data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
- data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
- data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
- data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
- data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
- data/lib/active_merchant/billing/gateways/litle.rb +181 -45
- data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
- data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
- data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
- data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
- data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +18 -21
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +236 -150
- data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
- data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
- data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
- data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
- data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
- data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
- data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
- data/lib/active_merchant/billing/gateways/omise.rb +15 -16
- data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
- data/lib/active_merchant/billing/gateways/opp.rb +39 -33
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
- data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
- data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
- data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
- data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
- data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
- data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
- data/lib/active_merchant/billing/gateways/payex.rb +24 -25
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
- data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
- data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
- 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 +13 -5
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
- 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 +8 -9
- data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
- data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
- data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
- data/lib/active_merchant/billing/gateways/payway.rb +22 -22
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +60 -21
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
- data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
- data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
- data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
- data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
- 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 +42 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
- data/lib/active_merchant/billing/gateways/s5.rb +10 -9
- data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
- data/lib/active_merchant/billing/gateways/sage.rb +19 -21
- data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
- data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
- data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
- 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 +19 -19
- data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
- data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
- data/lib/active_merchant/billing/gateways/telr.rb +17 -18
- data/lib/active_merchant/billing/gateways/tns.rb +3 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
- data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
- data/lib/active_merchant/billing/gateways/transax.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
- data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
- data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
- data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
- data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
- data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
- data/lib/active_merchant/billing/response.rb +25 -6
- 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 +14 -15
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +15 -17
- data/lib/active_merchant/post_data.rb +3 -2
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -2
- data/lib/certs/cacert.pem +1587 -2361
- data/lib/support/gateway_support.rb +1 -1
- data/lib/support/ssl_verify.rb +3 -7
- data/lib/support/ssl_version.rb +2 -3
- metadata +86 -34
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -4,12 +4,12 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.test_url = 'https://gateway.test.clearhaus.com'
|
5
5
|
self.live_url = 'https://gateway.clearhaus.com'
|
6
6
|
|
7
|
-
self.supported_countries = [
|
8
|
-
|
7
|
+
self.supported_countries = %w[DK NO SE FI DE CH NL AD AT BE BG HR CY CZ FO GL EE FR GR
|
8
|
+
HU IS IE IT LV LI LT LU MT PL PT RO SK SI ES GB]
|
9
9
|
|
10
10
|
self.default_currency = 'EUR'
|
11
|
-
self.currencies_without_fractions = %w(BIF
|
12
|
-
self.supported_cardtypes = [
|
11
|
+
self.currencies_without_fractions = %w(BIF CLP DJF GNF JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
|
12
|
+
self.supported_cardtypes = %i[visa master]
|
13
13
|
|
14
14
|
self.homepage_url = 'https://www.clearhaus.com'
|
15
15
|
self.display_name = 'Clearhaus'
|
@@ -36,31 +36,32 @@ module ActiveMerchant #:nodoc:
|
|
36
36
|
50000 => 'Clearhaus error'
|
37
37
|
}
|
38
38
|
|
39
|
-
def initialize(options={})
|
39
|
+
def initialize(options = {})
|
40
40
|
requires!(options, :api_key)
|
41
41
|
options[:private_key] = options[:private_key].strip if options[:private_key]
|
42
42
|
super
|
43
43
|
end
|
44
44
|
|
45
|
-
def purchase(amount, payment, options={})
|
45
|
+
def purchase(amount, payment, options = {})
|
46
46
|
MultiResponse.run(:use_first_response) do |r|
|
47
47
|
r.process { authorize(amount, payment, options) }
|
48
48
|
r.process { capture(amount, r.authorization, options) }
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def authorize(amount, payment, options={})
|
52
|
+
def authorize(amount, payment, options = {})
|
53
53
|
post = {}
|
54
54
|
add_invoice(post, amount, options)
|
55
55
|
|
56
|
-
action =
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
action =
|
57
|
+
if payment.respond_to?(:number)
|
58
|
+
add_payment(post, payment)
|
59
|
+
'/authorizations'
|
60
|
+
elsif payment.kind_of?(String)
|
61
|
+
"/cards/#{payment}/authorizations"
|
62
|
+
else
|
63
|
+
raise ArgumentError.new("Unknown payment type #{payment.inspect}")
|
64
|
+
end
|
64
65
|
|
65
66
|
post[:recurring] = options[:recurring] if options[:recurring]
|
66
67
|
post[:card][:pares] = options[:pares] if options[:pares]
|
@@ -68,14 +69,14 @@ module ActiveMerchant #:nodoc:
|
|
68
69
|
commit(action, post)
|
69
70
|
end
|
70
71
|
|
71
|
-
def capture(amount, authorization, options={})
|
72
|
+
def capture(amount, authorization, options = {})
|
72
73
|
post = {}
|
73
74
|
add_invoice(post, amount, options)
|
74
75
|
|
75
76
|
commit("/authorizations/#{authorization}/captures", post)
|
76
77
|
end
|
77
78
|
|
78
|
-
def refund(amount, authorization, options={})
|
79
|
+
def refund(amount, authorization, options = {})
|
79
80
|
post = {}
|
80
81
|
add_amount(post, amount, options)
|
81
82
|
|
@@ -86,14 +87,14 @@ module ActiveMerchant #:nodoc:
|
|
86
87
|
commit("/authorizations/#{authorization}/voids", options)
|
87
88
|
end
|
88
89
|
|
89
|
-
def verify(credit_card, options={})
|
90
|
+
def verify(credit_card, options = {})
|
90
91
|
MultiResponse.run(:use_first_response) do |r|
|
91
92
|
r.process { authorize(0, credit_card, options) }
|
92
93
|
r.process(:ignore_result) { void(r.authorization, options) }
|
93
94
|
end
|
94
95
|
end
|
95
96
|
|
96
|
-
def store(credit_card, options={})
|
97
|
+
def store(credit_card, options = {})
|
97
98
|
post = {}
|
98
99
|
add_payment(post, credit_card)
|
99
100
|
|
@@ -127,12 +128,10 @@ module ActiveMerchant #:nodoc:
|
|
127
128
|
def add_payment(post, payment)
|
128
129
|
card = {}
|
129
130
|
card[:pan] = payment.number
|
130
|
-
card[:expire_month] = '%02d'% payment.month
|
131
|
+
card[:expire_month] = '%02d' % payment.month
|
131
132
|
card[:expire_year] = payment.year
|
132
133
|
|
133
|
-
if payment.verification_value?
|
134
|
-
card[:csc] = payment.verification_value
|
135
|
-
end
|
134
|
+
card[:csc] = payment.verification_value if payment.verification_value?
|
136
135
|
|
137
136
|
post[:card] = card if card.any?
|
138
137
|
end
|
@@ -161,12 +160,14 @@ module ActiveMerchant #:nodoc:
|
|
161
160
|
end
|
162
161
|
end
|
163
162
|
|
164
|
-
response =
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
163
|
+
response =
|
164
|
+
begin
|
165
|
+
parse(ssl_post(url, body, headers))
|
166
|
+
rescue ResponseError => e
|
167
|
+
raise unless e.response.code.to_s =~ /400/
|
168
|
+
|
169
|
+
parse(e.response.body)
|
170
|
+
end
|
170
171
|
|
171
172
|
Response.new(
|
172
173
|
success_from(response),
|
@@ -205,15 +206,13 @@ module ActiveMerchant #:nodoc:
|
|
205
206
|
|
206
207
|
def generate_signature(body)
|
207
208
|
key = OpenSSL::PKey::RSA.new(@options[:private_key])
|
208
|
-
hex = key.sign(OpenSSL::Digest.new('sha256'), body).
|
209
|
+
hex = key.sign(OpenSSL::Digest.new('sha256'), body).unpack1('H*')
|
209
210
|
|
210
211
|
"#{@options[:signing_key]} RS256-hex #{hex}"
|
211
212
|
end
|
212
213
|
|
213
214
|
def error_code_from(response)
|
214
|
-
unless success_from(response)
|
215
|
-
response['status']['code']
|
216
|
-
end
|
215
|
+
response['status']['code'] unless success_from(response)
|
217
216
|
end
|
218
217
|
end
|
219
218
|
end
|
@@ -0,0 +1,370 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class CommerceHubGateway < Gateway
|
4
|
+
self.test_url = 'https://cert.api.fiservapps.com/ch'
|
5
|
+
self.live_url = 'https://prod.api.fiservapps.com/ch'
|
6
|
+
|
7
|
+
self.supported_countries = ['US']
|
8
|
+
self.default_currency = 'USD'
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
10
|
+
|
11
|
+
self.homepage_url = 'https://developer.fiserv.com/product/CommerceHub'
|
12
|
+
self.display_name = 'CommerceHub'
|
13
|
+
|
14
|
+
STANDARD_ERROR_CODE_MAPPING = {}
|
15
|
+
|
16
|
+
SCHEDULED_REASON_TYPES = %w(recurring installment)
|
17
|
+
ENDPOINTS = {
|
18
|
+
'sale' => '/payments/v1/charges',
|
19
|
+
'void' => '/payments/v1/cancels',
|
20
|
+
'refund' => '/payments/v1/refunds',
|
21
|
+
'vault' => '/payments-vas/v1/tokens',
|
22
|
+
'verify' => '/payments-vas/v1/accounts/verification'
|
23
|
+
}
|
24
|
+
|
25
|
+
def initialize(options = {})
|
26
|
+
requires!(options, :api_key, :api_secret, :merchant_id, :terminal_id)
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def purchase(money, payment, options = {})
|
31
|
+
post = {}
|
32
|
+
options[:capture_flag] = true
|
33
|
+
options[:create_token] = false
|
34
|
+
|
35
|
+
add_transaction_details(post, options, 'sale')
|
36
|
+
build_purchase_and_auth_request(post, money, payment, options)
|
37
|
+
|
38
|
+
commit('sale', post, options)
|
39
|
+
end
|
40
|
+
|
41
|
+
def authorize(money, payment, options = {})
|
42
|
+
post = {}
|
43
|
+
options[:capture_flag] = false
|
44
|
+
options[:create_token] = false
|
45
|
+
|
46
|
+
add_transaction_details(post, options, 'sale')
|
47
|
+
build_purchase_and_auth_request(post, money, payment, options)
|
48
|
+
|
49
|
+
commit('sale', post, options)
|
50
|
+
end
|
51
|
+
|
52
|
+
def capture(money, authorization, options = {})
|
53
|
+
post = {}
|
54
|
+
options[:capture_flag] = true
|
55
|
+
add_invoice(post, money, options)
|
56
|
+
add_transaction_details(post, options, 'capture')
|
57
|
+
add_reference_transaction_details(post, authorization, options, :capture)
|
58
|
+
|
59
|
+
commit('sale', post, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def refund(money, authorization, options = {})
|
63
|
+
post = {}
|
64
|
+
add_invoice(post, money, options) if money
|
65
|
+
add_transaction_details(post, options)
|
66
|
+
add_reference_transaction_details(post, authorization, options, :refund)
|
67
|
+
|
68
|
+
commit('refund', post, options)
|
69
|
+
end
|
70
|
+
|
71
|
+
def void(authorization, options = {})
|
72
|
+
post = {}
|
73
|
+
add_transaction_details(post, options)
|
74
|
+
add_reference_transaction_details(post, authorization, options, :void)
|
75
|
+
|
76
|
+
commit('void', post, options)
|
77
|
+
end
|
78
|
+
|
79
|
+
def store(credit_card, options = {})
|
80
|
+
post = {}
|
81
|
+
add_payment(post, credit_card, options)
|
82
|
+
add_billing_address(post, credit_card, options)
|
83
|
+
add_transaction_details(post, options)
|
84
|
+
add_transaction_interaction(post, options)
|
85
|
+
|
86
|
+
commit('vault', post, options)
|
87
|
+
end
|
88
|
+
|
89
|
+
def verify(credit_card, options = {})
|
90
|
+
post = {}
|
91
|
+
add_payment(post, credit_card, options)
|
92
|
+
add_billing_address(post, credit_card, options)
|
93
|
+
|
94
|
+
commit('verify', post, options)
|
95
|
+
end
|
96
|
+
|
97
|
+
def supports_scrubbing?
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
def scrub(transcript)
|
102
|
+
transcript.
|
103
|
+
gsub(%r((Authorization: )[a-zA-Z0-9+./=]+), '\1[FILTERED]').
|
104
|
+
gsub(%r((Api-Key: )\w+), '\1[FILTERED]').
|
105
|
+
gsub(%r(("cardData\\?":\\?")\d+), '\1[FILTERED]').
|
106
|
+
gsub(%r(("securityCode\\?":\\?")\d+), '\1[FILTERED]').
|
107
|
+
gsub(%r(("cavv\\?":\\?")\w+), '\1[FILTERED]')
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def add_transaction_interaction(post, options)
|
113
|
+
post[:transactionInteraction] = {}
|
114
|
+
post[:transactionInteraction][:origin] = options[:origin] || 'ECOM'
|
115
|
+
post[:transactionInteraction][:eciIndicator] = options[:eci_indicator] || 'CHANNEL_ENCRYPTED'
|
116
|
+
post[:transactionInteraction][:posConditionCode] = options[:pos_condition_code] || 'CARD_NOT_PRESENT_ECOM'
|
117
|
+
post[:transactionInteraction][:posEntryMode] = (options[:pos_entry_mode] || 'MANUAL') unless options[:encryption_data].present?
|
118
|
+
post[:transactionInteraction][:additionalPosInformation] = {}
|
119
|
+
post[:transactionInteraction][:additionalPosInformation][:dataEntrySource] = options[:data_entry_source] || 'UNSPECIFIED'
|
120
|
+
end
|
121
|
+
|
122
|
+
def add_transaction_details(post, options, action = nil)
|
123
|
+
details = {
|
124
|
+
captureFlag: options[:capture_flag],
|
125
|
+
createToken: options[:create_token],
|
126
|
+
physicalGoodsIndicator: [true, 'true'].include?(options[:physical_goods_indicator])
|
127
|
+
}
|
128
|
+
|
129
|
+
if options[:order_id].present? && action == 'sale'
|
130
|
+
details[:merchantOrderId] = options[:order_id]
|
131
|
+
details[:merchantTransactionId] = options[:order_id]
|
132
|
+
end
|
133
|
+
|
134
|
+
if action != 'capture'
|
135
|
+
details[:merchantInvoiceNumber] = options[:merchant_invoice_number] || rand.to_s[2..13]
|
136
|
+
details[:primaryTransactionType] = options[:primary_transaction_type]
|
137
|
+
details[:accountVerification] = options[:account_verification]
|
138
|
+
end
|
139
|
+
|
140
|
+
post[:transactionDetails] = details.compact
|
141
|
+
end
|
142
|
+
|
143
|
+
def add_billing_address(post, payment, options)
|
144
|
+
return unless billing = options[:billing_address]
|
145
|
+
|
146
|
+
billing_address = {}
|
147
|
+
if payment.is_a?(CreditCard)
|
148
|
+
billing_address[:firstName] = payment.first_name if payment.first_name
|
149
|
+
billing_address[:lastName] = payment.last_name if payment.last_name
|
150
|
+
end
|
151
|
+
address = {}
|
152
|
+
address[:street] = billing[:address1] if billing[:address1]
|
153
|
+
address[:houseNumberOrName] = billing[:address2] if billing[:address2]
|
154
|
+
address[:recipientNameOrAddress] = billing[:name] if billing[:name]
|
155
|
+
address[:city] = billing[:city] if billing[:city]
|
156
|
+
address[:stateOrProvince] = billing[:state] if billing[:state]
|
157
|
+
address[:postalCode] = billing[:zip] if billing[:zip]
|
158
|
+
address[:country] = billing[:country] if billing[:country]
|
159
|
+
|
160
|
+
billing_address[:address] = address unless address.empty?
|
161
|
+
if billing[:phone_number]
|
162
|
+
billing_address[:phone] = {}
|
163
|
+
billing_address[:phone][:phoneNumber] = billing[:phone_number]
|
164
|
+
end
|
165
|
+
post[:billingAddress] = billing_address
|
166
|
+
end
|
167
|
+
|
168
|
+
def add_shipping_address(post, options)
|
169
|
+
return unless shipping = options[:shipping_address]
|
170
|
+
|
171
|
+
shipping_address = {}
|
172
|
+
address = {}
|
173
|
+
address[:street] = shipping[:address1] if shipping[:address1]
|
174
|
+
address[:houseNumberOrName] = shipping[:address2] if shipping[:address2]
|
175
|
+
address[:recipientNameOrAddress] = shipping[:name] if shipping[:name]
|
176
|
+
address[:city] = shipping[:city] if shipping[:city]
|
177
|
+
address[:stateOrProvince] = shipping[:state] if shipping[:state]
|
178
|
+
address[:postalCode] = shipping[:zip] if shipping[:zip]
|
179
|
+
address[:country] = shipping[:country] if shipping[:country]
|
180
|
+
|
181
|
+
shipping_address[:address] = address unless address.empty?
|
182
|
+
if shipping[:phone_number]
|
183
|
+
shipping_address[:phone] = {}
|
184
|
+
shipping_address[:phone][:phoneNumber] = shipping[:phone_number]
|
185
|
+
end
|
186
|
+
post[:shippingAddress] = shipping_address
|
187
|
+
end
|
188
|
+
|
189
|
+
def build_purchase_and_auth_request(post, money, payment, options)
|
190
|
+
add_invoice(post, money, options)
|
191
|
+
add_payment(post, payment, options)
|
192
|
+
add_stored_credentials(post, options)
|
193
|
+
add_transaction_interaction(post, options)
|
194
|
+
add_billing_address(post, payment, options)
|
195
|
+
add_shipping_address(post, options)
|
196
|
+
end
|
197
|
+
|
198
|
+
def add_reference_transaction_details(post, authorization, options, action = nil)
|
199
|
+
reference_details = {}
|
200
|
+
_merchant_reference, transaction_id = authorization.include?('|') ? authorization.split('|') : [nil, authorization]
|
201
|
+
|
202
|
+
reference_details[:referenceTransactionId] = transaction_id
|
203
|
+
reference_details[:referenceTransactionType] = (options[:reference_transaction_type] || 'CHARGES') unless action == :capture
|
204
|
+
post[:referenceTransactionDetails] = reference_details.compact
|
205
|
+
end
|
206
|
+
|
207
|
+
def add_invoice(post, money, options)
|
208
|
+
post[:amount] = {
|
209
|
+
total: amount(money).to_f,
|
210
|
+
currency: options[:currency] || self.default_currency
|
211
|
+
}
|
212
|
+
end
|
213
|
+
|
214
|
+
def add_stored_credentials(post, options)
|
215
|
+
return unless stored_credential = options[:stored_credential]
|
216
|
+
|
217
|
+
post[:storedCredentials] = {}
|
218
|
+
post[:storedCredentials][:sequence] = stored_credential[:initial_transaction] ? 'FIRST' : 'SUBSEQUENT'
|
219
|
+
post[:storedCredentials][:initiator] = stored_credential[:initiator] == 'merchant' ? 'MERCHANT' : 'CARD_HOLDER'
|
220
|
+
post[:storedCredentials][:scheduled] = SCHEDULED_REASON_TYPES.include?(stored_credential[:reason_type])
|
221
|
+
post[:storedCredentials][:schemeReferenceTransactionId] = options[:scheme_reference_transaction_id] || stored_credential[:network_transaction_id]
|
222
|
+
end
|
223
|
+
|
224
|
+
def add_credit_card(source, payment, options)
|
225
|
+
source[:sourceType] = 'PaymentCard'
|
226
|
+
source[:card] = {}
|
227
|
+
source[:card][:cardData] = payment.number
|
228
|
+
source[:card][:expirationMonth] = format(payment.month, :two_digits) if payment.month
|
229
|
+
source[:card][:expirationYear] = format(payment.year, :four_digits) if payment.year
|
230
|
+
if payment.verification_value
|
231
|
+
source[:card][:securityCode] = payment.verification_value
|
232
|
+
source[:card][:securityCodeIndicator] = 'PROVIDED'
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
def add_payment_token(source, payment, options)
|
237
|
+
source[:sourceType] = 'PaymentToken'
|
238
|
+
source[:tokenData] = payment
|
239
|
+
source[:tokenSource] = options[:token_source] if options[:token_source]
|
240
|
+
if options[:card_expiration_month] || options[:card_expiration_year]
|
241
|
+
source[:card] = {}
|
242
|
+
source[:card][:expirationMonth] = options[:card_expiration_month] if options[:card_expiration_month]
|
243
|
+
source[:card][:expirationYear] = options[:card_expiration_year] if options[:card_expiration_year]
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def add_decrypted_wallet(source, payment, options)
|
248
|
+
source[:sourceType] = 'DecryptedWallet'
|
249
|
+
source[:card] = {}
|
250
|
+
source[:card][:cardData] = payment.number
|
251
|
+
source[:card][:expirationMonth] = format(payment.month, :two_digits)
|
252
|
+
source[:card][:expirationYear] = format(payment.year, :four_digits)
|
253
|
+
source[:cavv] = payment.payment_cryptogram
|
254
|
+
source[:walletType] = payment.source.to_s.upcase
|
255
|
+
end
|
256
|
+
|
257
|
+
def add_payment(post, payment, options = {})
|
258
|
+
source = {}
|
259
|
+
case payment
|
260
|
+
when NetworkTokenizationCreditCard
|
261
|
+
add_decrypted_wallet(source, payment, options)
|
262
|
+
when CreditCard
|
263
|
+
if options[:encryption_data].present?
|
264
|
+
source[:sourceType] = 'PaymentCard'
|
265
|
+
source[:encryptionData] = options[:encryption_data]
|
266
|
+
else
|
267
|
+
add_credit_card(source, payment, options)
|
268
|
+
end
|
269
|
+
when String
|
270
|
+
add_payment_token(source, payment, options)
|
271
|
+
end
|
272
|
+
post[:source] = source
|
273
|
+
end
|
274
|
+
|
275
|
+
def parse(body)
|
276
|
+
JSON.parse(body)
|
277
|
+
end
|
278
|
+
|
279
|
+
def headers(request, options)
|
280
|
+
time = DateTime.now.strftime('%Q').to_s
|
281
|
+
client_request_id = options[:client_request_id] || rand.to_s[2..8]
|
282
|
+
raw_signature = @options[:api_key] + client_request_id.to_s + time + request
|
283
|
+
hmac = OpenSSL::HMAC.digest('sha256', @options[:api_secret], raw_signature)
|
284
|
+
signature = Base64.strict_encode64(hmac.to_s).to_s
|
285
|
+
|
286
|
+
{
|
287
|
+
'Client-Request-Id' => client_request_id,
|
288
|
+
'Api-Key' => @options[:api_key],
|
289
|
+
'Timestamp' => time,
|
290
|
+
'Accept-Language' => 'application/json',
|
291
|
+
'Auth-Token-Type' => 'HMAC',
|
292
|
+
'Content-Type' => 'application/json',
|
293
|
+
'Accept' => 'application/json',
|
294
|
+
'Authorization' => signature
|
295
|
+
}
|
296
|
+
end
|
297
|
+
|
298
|
+
def add_merchant_details(post)
|
299
|
+
post[:merchantDetails] = {}
|
300
|
+
post[:merchantDetails][:terminalId] = @options[:terminal_id]
|
301
|
+
post[:merchantDetails][:merchantId] = @options[:merchant_id]
|
302
|
+
end
|
303
|
+
|
304
|
+
def commit(action, parameters, options)
|
305
|
+
url = (test? ? test_url : live_url) + ENDPOINTS[action]
|
306
|
+
add_merchant_details(parameters)
|
307
|
+
response = parse(ssl_post(url, parameters.to_json, headers(parameters.to_json, options)))
|
308
|
+
|
309
|
+
Response.new(
|
310
|
+
success_from(response, action),
|
311
|
+
message_from(response, action),
|
312
|
+
response,
|
313
|
+
authorization: authorization_from(action, response, options),
|
314
|
+
test: test?,
|
315
|
+
error_code: error_code_from(response, action),
|
316
|
+
avs_result: AVSResult.new(code: get_avs_cvv(response, 'avs')),
|
317
|
+
cvv_result: CVVResult.new(get_avs_cvv(response, 'cvv'))
|
318
|
+
)
|
319
|
+
end
|
320
|
+
|
321
|
+
def get_avs_cvv(response, type = 'avs')
|
322
|
+
response.dig(
|
323
|
+
'paymentReceipt',
|
324
|
+
'processorResponseDetails',
|
325
|
+
'bankAssociationDetails',
|
326
|
+
'avsSecurityCodeResponse',
|
327
|
+
'association',
|
328
|
+
type == 'avs' ? 'avsCode' : 'securityCodeResponse'
|
329
|
+
)
|
330
|
+
end
|
331
|
+
|
332
|
+
def handle_response(response)
|
333
|
+
case response.code.to_i
|
334
|
+
when 200...300, 400, 401, 429
|
335
|
+
response.body
|
336
|
+
else
|
337
|
+
raise ResponseError.new(response)
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
341
|
+
def success_from(response, action = nil)
|
342
|
+
return message_from(response, action) == 'VERIFIED' if action == 'verify'
|
343
|
+
|
344
|
+
(response.dig('paymentReceipt', 'processorResponseDetails', 'responseCode') || response.dig('paymentTokens', 0, 'tokenResponseCode')) == '000'
|
345
|
+
end
|
346
|
+
|
347
|
+
def message_from(response, action = nil)
|
348
|
+
return response.dig('error', 0, 'message') if response['error'].present?
|
349
|
+
return response.dig('gatewayResponse', 'transactionState') if action == 'verify'
|
350
|
+
|
351
|
+
response.dig('paymentReceipt', 'processorResponseDetails', 'responseMessage') || response.dig('gatewayResponse', 'transactionType')
|
352
|
+
end
|
353
|
+
|
354
|
+
def authorization_from(action, response, options)
|
355
|
+
case action
|
356
|
+
when 'vault'
|
357
|
+
response.dig('paymentTokens', 0, 'tokenData')
|
358
|
+
when 'sale'
|
359
|
+
[options[:order_id] || '', response.dig('gatewayResponse', 'transactionProcessingDetails', 'transactionId')].join('|')
|
360
|
+
else
|
361
|
+
response.dig('gatewayResponse', 'transactionProcessingDetails', 'transactionId')
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
def error_code_from(response, action)
|
366
|
+
response.dig('error', 0, 'code') unless success_from(response, action)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
end
|
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
|
|
11
11
|
|
12
12
|
self.money_format = :dollars
|
13
13
|
self.default_currency = 'EUR'
|
14
|
-
self.supported_cardtypes = [
|
14
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
15
15
|
self.homepage_url = 'http://www.commercegate.com/'
|
16
16
|
self.display_name = 'CommerceGate'
|
17
17
|
|
@@ -74,8 +74,8 @@ module ActiveMerchant #:nodoc:
|
|
74
74
|
post[:customerIP] = options[:ip] || '127.0.0.1'
|
75
75
|
post[:amount] = amount(money)
|
76
76
|
post[:email] = options[:email] || 'unknown@example.com'
|
77
|
-
post[:currencyCode]= options[:currency] || currency(money)
|
78
|
-
post[:merchAcct]
|
77
|
+
post[:currencyCode] = options[:currency] || currency(money)
|
78
|
+
post[:merchAcct] = options[:merchant]
|
79
79
|
end
|
80
80
|
|
81
81
|
def add_creditcard(params, creditcard)
|
@@ -102,7 +102,7 @@ module ActiveMerchant #:nodoc:
|
|
102
102
|
response,
|
103
103
|
authorization: response['transID'],
|
104
104
|
test: test?,
|
105
|
-
avs_result: {code: response['avsCode']},
|
105
|
+
avs_result: { code: response['avsCode'] },
|
106
106
|
cvv_result: response['cvvCode']
|
107
107
|
)
|
108
108
|
end
|
@@ -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
|
@@ -105,7 +105,7 @@ module ActiveMerchant #:nodoc:
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def add_shipment_address(post, options)
|
108
|
-
if(address = options[:shipping_address])
|
108
|
+
if (address = options[:shipping_address])
|
109
109
|
post[:address] = {}
|
110
110
|
post[:address][:street1] = address[:address1] if address[:address1]
|
111
111
|
post[:address][:street2] = address[:address2] if address[:address2]
|
@@ -124,7 +124,7 @@ module ActiveMerchant #:nodoc:
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def add_billing_address(post, options)
|
127
|
-
if(address = (options[:billing_address] || options[:address]))
|
127
|
+
if (address = (options[:billing_address] || options[:address]))
|
128
128
|
post[:billing_address] = {}
|
129
129
|
post[:billing_address][:street1] = address[:address1] if address[:address1]
|
130
130
|
post[:billing_address][:street2] = address[:address2] if address[:address2]
|
@@ -142,7 +142,7 @@ module ActiveMerchant #:nodoc:
|
|
142
142
|
end
|
143
143
|
|
144
144
|
def add_address(post, options)
|
145
|
-
if(address = (options[:billing_address] || options[:address]))
|
145
|
+
if (address = (options[:billing_address] || options[:address]))
|
146
146
|
post[:address] = {}
|
147
147
|
post[:address][:street1] = address[:address1] if address[:address1]
|
148
148
|
post[:address][:street2] = address[:address2] if address[:address2]
|
@@ -170,6 +170,7 @@ module ActiveMerchant #:nodoc:
|
|
170
170
|
|
171
171
|
def parse(body)
|
172
172
|
return {} unless body
|
173
|
+
|
173
174
|
JSON.parse(body)
|
174
175
|
end
|
175
176
|
|
@@ -179,7 +180,7 @@ module ActiveMerchant #:nodoc:
|
|
179
180
|
'Accept-Language' => 'es',
|
180
181
|
'Authorization' => 'Basic ' + Base64.encode64("#{@options[:key]}:"),
|
181
182
|
'RaiseHtmlError' => 'false',
|
182
|
-
'Conekta-Client-User-Agent' => {'agent'=>"Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}"}.to_json,
|
183
|
+
'Conekta-Client-User-Agent' => { 'agent' => "Conekta ActiveMerchantBindings/#{ActiveMerchant::VERSION}" }.to_json,
|
183
184
|
'X-Conekta-Client-User-Agent' => conekta_client_user_agent(options),
|
184
185
|
'X-Conekta-Client-User-Metadata' => options[:meta].to_json
|
185
186
|
}
|
@@ -187,7 +188,8 @@ module ActiveMerchant #:nodoc:
|
|
187
188
|
|
188
189
|
def conekta_client_user_agent(options)
|
189
190
|
return user_agent unless options[:application]
|
190
|
-
|
191
|
+
|
192
|
+
JSON.dump(JSON.parse(user_agent).merge!({ application: options[:application] }))
|
191
193
|
end
|
192
194
|
|
193
195
|
def commit(method, url, parameters, options = {})
|