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
@@ -24,11 +24,11 @@ module ActiveMerchant
|
|
24
24
|
r.process {
|
25
25
|
post = authorization_params(money, credit_card_or_reference, options)
|
26
26
|
add_autocapture(post, false)
|
27
|
-
commit(synchronized_path("/payments/#{r.responses.last.params[
|
27
|
+
commit(synchronized_path("/payments/#{r.responses.last.params['id']}/authorize"), post)
|
28
28
|
}
|
29
29
|
r.process {
|
30
30
|
post = capture_params(money, credit_card_or_reference, options)
|
31
|
-
commit(synchronized_path("/payments/#{r.responses.last.params[
|
31
|
+
commit(synchronized_path("/payments/#{r.responses.last.params['id']}/capture"), post)
|
32
32
|
}
|
33
33
|
end
|
34
34
|
end
|
@@ -42,7 +42,7 @@ module ActiveMerchant
|
|
42
42
|
r.process { create_payment(money, options) }
|
43
43
|
r.process {
|
44
44
|
post = authorization_params(money, credit_card_or_reference, options)
|
45
|
-
commit(synchronized_path("/payments/#{r.responses.last.params[
|
45
|
+
commit(synchronized_path("/payments/#{r.responses.last.params['id']}/authorize"), post)
|
46
46
|
}
|
47
47
|
end
|
48
48
|
end
|
@@ -68,7 +68,7 @@ module ActiveMerchant
|
|
68
68
|
commit(synchronized_path("/payments/#{identification}/refund"), post)
|
69
69
|
end
|
70
70
|
|
71
|
-
def verify(credit_card, options={})
|
71
|
+
def verify(credit_card, options = {})
|
72
72
|
MultiResponse.run(:use_first_response) do |r|
|
73
73
|
r.process { authorize(100, credit_card, options) }
|
74
74
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -78,7 +78,7 @@ module ActiveMerchant
|
|
78
78
|
def store(credit_card, options = {})
|
79
79
|
MultiResponse.run do |r|
|
80
80
|
r.process { create_store(options) }
|
81
|
-
r.process { authorize_store(r.authorization, credit_card, options)}
|
81
|
+
r.process { authorize_store(r.authorization, credit_card, options) }
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
@@ -99,201 +99,199 @@ module ActiveMerchant
|
|
99
99
|
|
100
100
|
private
|
101
101
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
add_amount(post, money, options)
|
106
|
-
add_credit_card_or_reference(post, credit_card_or_reference)
|
107
|
-
add_additional_params(:authorize, post, options)
|
102
|
+
def authorization_params(money, credit_card_or_reference, options = {})
|
103
|
+
post = {}
|
108
104
|
|
109
|
-
|
110
|
-
|
105
|
+
add_amount(post, money, options)
|
106
|
+
add_credit_card_or_reference(post, credit_card_or_reference, options)
|
107
|
+
add_additional_params(:authorize, post, options)
|
111
108
|
|
112
|
-
|
113
|
-
|
109
|
+
post
|
110
|
+
end
|
114
111
|
|
115
|
-
|
116
|
-
|
112
|
+
def capture_params(money, credit_card, options = {})
|
113
|
+
post = {}
|
117
114
|
|
118
|
-
|
119
|
-
|
115
|
+
add_amount(post, money, options)
|
116
|
+
add_additional_params(:capture, post, options)
|
120
117
|
|
121
|
-
|
122
|
-
|
123
|
-
commit('/cards', post)
|
124
|
-
end
|
118
|
+
post
|
119
|
+
end
|
125
120
|
|
126
|
-
|
127
|
-
|
121
|
+
def create_store(options = {})
|
122
|
+
post = {}
|
123
|
+
commit('/cards', post)
|
124
|
+
end
|
128
125
|
|
129
|
-
|
130
|
-
|
131
|
-
end
|
126
|
+
def authorize_store(identification, credit_card, options = {})
|
127
|
+
post = {}
|
132
128
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
end
|
129
|
+
add_credit_card_or_reference(post, credit_card, options)
|
130
|
+
commit(synchronized_path("/cards/#{identification}/authorize"), post)
|
131
|
+
end
|
137
132
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
commit('/payments', post)
|
143
|
-
end
|
133
|
+
def create_token(identification, options)
|
134
|
+
post = {}
|
135
|
+
commit(synchronized_path("/cards/#{identification}/tokens"), post)
|
136
|
+
end
|
144
137
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
response = response_error(e.response.body)
|
152
|
-
rescue JSON::ParserError
|
153
|
-
response = json_error(response)
|
154
|
-
end
|
138
|
+
def create_payment(money, options = {})
|
139
|
+
post = {}
|
140
|
+
add_currency(post, money, options)
|
141
|
+
add_invoice(post, options)
|
142
|
+
commit('/payments', post)
|
143
|
+
end
|
155
144
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
)
|
145
|
+
def commit(action, params = {})
|
146
|
+
success = false
|
147
|
+
begin
|
148
|
+
response = parse(ssl_post(self.live_url + action, params.to_json, headers))
|
149
|
+
success = successful?(response)
|
150
|
+
rescue ResponseError => e
|
151
|
+
response = response_error(e.response.body)
|
152
|
+
rescue JSON::ParserError
|
153
|
+
response = json_error(response)
|
160
154
|
end
|
161
155
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
response["id"].to_s
|
167
|
-
end
|
168
|
-
end
|
156
|
+
Response.new(success, message_from(success, response), response,
|
157
|
+
test: test?,
|
158
|
+
authorization: authorization_from(response))
|
159
|
+
end
|
169
160
|
|
170
|
-
|
171
|
-
|
161
|
+
def authorization_from(response)
|
162
|
+
if response['token']
|
163
|
+
response['token'].to_s
|
164
|
+
else
|
165
|
+
response['id'].to_s
|
172
166
|
end
|
167
|
+
end
|
173
168
|
|
174
|
-
|
175
|
-
|
176
|
-
|
169
|
+
def add_currency(post, money, options)
|
170
|
+
post[:currency] = options[:currency] || currency(money)
|
171
|
+
end
|
177
172
|
|
178
|
-
|
179
|
-
|
180
|
-
|
173
|
+
def add_amount(post, money, options)
|
174
|
+
post[:amount] = options[:amount] || amount(money)
|
175
|
+
end
|
181
176
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
end
|
177
|
+
def add_autocapture(post, value)
|
178
|
+
post[:auto_capture] = value
|
179
|
+
end
|
186
180
|
|
187
|
-
|
188
|
-
|
181
|
+
def add_order_id(post, options)
|
182
|
+
requires!(options, :order_id)
|
183
|
+
post[:order_id] = format_order_id(options[:order_id])
|
184
|
+
end
|
189
185
|
|
190
|
-
|
191
|
-
|
192
|
-
end
|
186
|
+
def add_invoice(post, options)
|
187
|
+
add_order_id(post, options)
|
193
188
|
|
194
|
-
|
195
|
-
post[:shipping_address] = map_address(options[:shipping_address])
|
196
|
-
end
|
189
|
+
post[:invoice_address] = map_address(options[:billing_address]) if options[:billing_address]
|
197
190
|
|
198
|
-
|
199
|
-
|
200
|
-
|
191
|
+
post[:shipping_address] = map_address(options[:shipping_address]) if options[:shipping_address]
|
192
|
+
|
193
|
+
%i[metadata branding_id variables].each do |field|
|
194
|
+
post[field] = options[field] if options[field]
|
201
195
|
end
|
196
|
+
end
|
202
197
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
end
|
198
|
+
def add_additional_params(action, post, options = {})
|
199
|
+
MD5_CHECK_FIELDS[API_VERSION][action].each do |key|
|
200
|
+
key = key.to_sym
|
201
|
+
post[key] = options[key] if options[key]
|
208
202
|
end
|
203
|
+
end
|
209
204
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
end
|
205
|
+
def add_credit_card_or_reference(post, credit_card_or_reference, options = {})
|
206
|
+
post[:card] ||= {}
|
207
|
+
if credit_card_or_reference.is_a?(String)
|
208
|
+
post[:card][:token] = credit_card_or_reference
|
209
|
+
else
|
210
|
+
post[:card][:number] = credit_card_or_reference.number
|
211
|
+
post[:card][:cvd] = credit_card_or_reference.verification_value
|
212
|
+
post[:card][:expiration] = expdate(credit_card_or_reference)
|
213
|
+
post[:card][:issued_to] = credit_card_or_reference.name
|
220
214
|
end
|
221
215
|
|
222
|
-
|
223
|
-
|
216
|
+
if options[:three_d_secure]
|
217
|
+
post[:card][:cavv] = options.dig(:three_d_secure, :cavv)
|
218
|
+
post[:card][:eci] = options.dig(:three_d_secure, :eci)
|
219
|
+
post[:card][:xav] = options.dig(:three_d_secure, :xid)
|
224
220
|
end
|
221
|
+
end
|
225
222
|
|
226
|
-
|
227
|
-
|
228
|
-
|
223
|
+
def parse(body)
|
224
|
+
JSON.parse(body)
|
225
|
+
end
|
229
226
|
|
230
|
-
|
231
|
-
|
227
|
+
def successful?(response)
|
228
|
+
has_error = response['errors']
|
229
|
+
invalid_code = invalid_operation_code?(response)
|
232
230
|
|
233
|
-
|
234
|
-
|
235
|
-
end
|
231
|
+
!(has_error || invalid_code)
|
232
|
+
end
|
236
233
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
operation && operation['qp_status_code'] != "20000"
|
241
|
-
end
|
242
|
-
end
|
234
|
+
def message_from(success, response)
|
235
|
+
success ? 'OK' : (response['message'] || invalid_operation_message(response) || 'Unknown error - please contact QuickPay')
|
236
|
+
end
|
243
237
|
|
244
|
-
|
245
|
-
|
238
|
+
def invalid_operation_code?(response)
|
239
|
+
if response['operations']
|
240
|
+
operation = response['operations'].last
|
241
|
+
operation && operation['qp_status_code'] != '20000'
|
246
242
|
end
|
243
|
+
end
|
247
244
|
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
country = Country.find(address[:country])
|
252
|
-
mapped = {
|
253
|
-
:name => address[:name],
|
254
|
-
:street => address[:address1],
|
255
|
-
:city => address[:city],
|
256
|
-
:region => address[:address2],
|
257
|
-
:zip_code => address[:zip],
|
258
|
-
:country_code => country.code(:alpha3).value
|
259
|
-
}
|
260
|
-
mapped
|
261
|
-
end
|
245
|
+
def invalid_operation_message(response)
|
246
|
+
response['operations'] && response['operations'].last['qp_status_msg']
|
247
|
+
end
|
262
248
|
|
263
|
-
|
264
|
-
|
265
|
-
|
249
|
+
def map_address(address)
|
250
|
+
return {} if address.nil?
|
251
|
+
|
252
|
+
requires!(address, :name, :address1, :city, :zip, :country)
|
253
|
+
country = Country.find(address[:country])
|
254
|
+
mapped = {
|
255
|
+
name: address[:name],
|
256
|
+
street: address[:address1],
|
257
|
+
city: address[:city],
|
258
|
+
region: address[:address2],
|
259
|
+
zip_code: address[:zip],
|
260
|
+
country_code: country.code(:alpha3).value
|
261
|
+
}
|
262
|
+
mapped
|
263
|
+
end
|
266
264
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
"Authorization" => "Basic " + auth,
|
271
|
-
"User-Agent" => "Quickpay-v#{API_VERSION} ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
272
|
-
"Accept" => "application/json",
|
273
|
-
"Accept-Version" => "v#{API_VERSION}",
|
274
|
-
"Content-Type" => "application/json"
|
275
|
-
}
|
276
|
-
end
|
265
|
+
def format_order_id(order_id)
|
266
|
+
truncate(order_id.to_s.delete('#'), 20)
|
267
|
+
end
|
277
268
|
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
269
|
+
def headers
|
270
|
+
auth = Base64.strict_encode64(":#{@options[:api_key]}")
|
271
|
+
{
|
272
|
+
'Authorization' => 'Basic ' + auth,
|
273
|
+
'User-Agent' => "Quickpay-v#{API_VERSION} ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
274
|
+
'Accept' => 'application/json',
|
275
|
+
'Accept-Version' => "v#{API_VERSION}",
|
276
|
+
'Content-Type' => 'application/json'
|
277
|
+
}
|
278
|
+
end
|
285
279
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
280
|
+
def response_error(raw_response)
|
281
|
+
parse(raw_response)
|
282
|
+
rescue JSON::ParserError
|
283
|
+
json_error(raw_response)
|
284
|
+
end
|
291
285
|
|
292
|
-
|
293
|
-
|
294
|
-
|
286
|
+
def json_error(raw_response)
|
287
|
+
msg = 'Invalid response received from the Quickpay API.'
|
288
|
+
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
289
|
+
{ 'message' => msg }
|
290
|
+
end
|
295
291
|
|
292
|
+
def synchronized_path(path)
|
293
|
+
"#{path}?synchronized"
|
294
|
+
end
|
296
295
|
end
|
297
|
-
|
298
296
|
end
|
299
297
|
end
|
@@ -6,7 +6,7 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
module Billing #:nodoc:
|
7
7
|
class QuickpayV4to7Gateway < Gateway
|
8
8
|
include QuickpayCommon
|
9
|
-
self.live_url = self.test_url = 'https://secure.quickpay.dk/api'
|
9
|
+
self.live_url = self.test_url = 'https://secure.quickpay.dk/api'
|
10
10
|
APPROVED = '000'
|
11
11
|
|
12
12
|
# The login is the QuickpayId
|
@@ -136,11 +136,12 @@ module ActiveMerchant #:nodoc:
|
|
136
136
|
end
|
137
137
|
|
138
138
|
def add_description(post, options)
|
139
|
-
post[:description] = options[:description] ||
|
139
|
+
post[:description] = options[:description] || 'Description'
|
140
140
|
end
|
141
141
|
|
142
142
|
def add_testmode(post)
|
143
143
|
return if post[:transaction].present?
|
144
|
+
|
144
145
|
post[:testmode] = test? ? '1' : '0'
|
145
146
|
end
|
146
147
|
|
@@ -164,9 +165,8 @@ module ActiveMerchant #:nodoc:
|
|
164
165
|
response = parse(ssl_post(self.live_url, post_data(action, params)))
|
165
166
|
|
166
167
|
Response.new(successful?(response), message_from(response), response,
|
167
|
-
:
|
168
|
-
:
|
169
|
-
)
|
168
|
+
test: test?,
|
169
|
+
authorization: response[:transaction])
|
170
170
|
end
|
171
171
|
|
172
172
|
def successful?(response)
|
@@ -196,7 +196,7 @@ module ActiveMerchant #:nodoc:
|
|
196
196
|
params[:apikey] = @options[:apikey] if @options[:apikey]
|
197
197
|
params[:md5check] = generate_check_hash(action, params)
|
198
198
|
|
199
|
-
params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
199
|
+
params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
200
200
|
end
|
201
201
|
|
202
202
|
def generate_check_hash(action, params)
|
@@ -219,9 +219,8 @@ module ActiveMerchant #:nodoc:
|
|
219
219
|
|
220
220
|
# Limited to 20 digits max
|
221
221
|
def format_order_number(number)
|
222
|
-
number.to_s.gsub(/[^\w]/, '').rjust(4,
|
222
|
+
number.to_s.gsub(/[^\w]/, '').rjust(4, '0')[0...20]
|
223
223
|
end
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
|
-
|
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
self.abstract_class = true
|
11
11
|
|
12
12
|
def self.new(options = {})
|
13
|
-
options.fetch(:login) { raise ArgumentError.new(
|
13
|
+
options.fetch(:login) { raise ArgumentError.new('Missing required parameter: login') }
|
14
14
|
|
15
15
|
version = options[:login].to_i < 10000000 ? 10 : 7
|
16
16
|
if version <= 7
|
@@ -19,8 +19,6 @@ module ActiveMerchant #:nodoc:
|
|
19
19
|
QuickpayV10Gateway.new(options)
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
23
22
|
end
|
24
23
|
end
|
25
24
|
end
|
26
|
-
|