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
@@ -1,12 +1,12 @@
|
|
1
1
|
module ActiveMerchant
|
2
2
|
module Billing
|
3
3
|
module MastercardGateway
|
4
|
-
def initialize(options={})
|
4
|
+
def initialize(options = {})
|
5
5
|
requires!(options, :userid, :password)
|
6
6
|
super
|
7
7
|
end
|
8
8
|
|
9
|
-
def purchase(amount, payment_method, options={})
|
9
|
+
def purchase(amount, payment_method, options = {})
|
10
10
|
if options[:pay_mode]
|
11
11
|
post = new_post
|
12
12
|
add_invoice(post, amount, options)
|
@@ -24,7 +24,7 @@ module ActiveMerchant
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def authorize(amount, payment_method, options={})
|
27
|
+
def authorize(amount, payment_method, options = {})
|
28
28
|
post = new_post
|
29
29
|
add_invoice(post, amount, options)
|
30
30
|
add_reference(post, *new_authorization)
|
@@ -35,7 +35,7 @@ module ActiveMerchant
|
|
35
35
|
commit('authorize', post)
|
36
36
|
end
|
37
37
|
|
38
|
-
def capture(amount, authorization, options={})
|
38
|
+
def capture(amount, authorization, options = {})
|
39
39
|
post = new_post
|
40
40
|
add_invoice(post, amount, options, :transaction)
|
41
41
|
add_reference(post, *next_authorization(authorization))
|
@@ -45,7 +45,7 @@ module ActiveMerchant
|
|
45
45
|
commit('capture', post)
|
46
46
|
end
|
47
47
|
|
48
|
-
def refund(amount, authorization, options={})
|
48
|
+
def refund(amount, authorization, options = {})
|
49
49
|
post = new_post
|
50
50
|
add_invoice(post, amount, options, :transaction)
|
51
51
|
add_reference(post, *next_authorization(authorization))
|
@@ -54,14 +54,14 @@ module ActiveMerchant
|
|
54
54
|
commit('refund', post)
|
55
55
|
end
|
56
56
|
|
57
|
-
def void(authorization, options={})
|
57
|
+
def void(authorization, options = {})
|
58
58
|
post = new_post
|
59
59
|
add_reference(post, *next_authorization(authorization), :targetTransactionId)
|
60
60
|
|
61
61
|
commit('void', post)
|
62
62
|
end
|
63
63
|
|
64
|
-
def verify(credit_card, options={})
|
64
|
+
def verify(credit_card, options = {})
|
65
65
|
MultiResponse.run(:use_first_response) do |r|
|
66
66
|
r.process { authorize(100, credit_card, options) }
|
67
67
|
r.process(:ignore_result) { void(r.authorization, options) }
|
@@ -105,16 +105,16 @@ module ActiveMerchant
|
|
105
105
|
billing: {},
|
106
106
|
device: {},
|
107
107
|
shipping: {},
|
108
|
-
transaction: {}
|
108
|
+
transaction: {}
|
109
109
|
}
|
110
110
|
end
|
111
111
|
|
112
|
-
def add_invoice(post, amount, options, node
|
112
|
+
def add_invoice(post, amount, options, node = :order)
|
113
113
|
post[node][:amount] = amount(amount)
|
114
114
|
post[node][:currency] = (options[:currency] || currency(amount))
|
115
115
|
end
|
116
116
|
|
117
|
-
def add_reference(post, orderid, transactionid, transaction_reference, reference_key
|
117
|
+
def add_reference(post, orderid, transactionid, transaction_reference, reference_key = :reference)
|
118
118
|
post[:orderid] = orderid
|
119
119
|
post[:transactionid] = transactionid
|
120
120
|
post[:transaction][reference_key] = transaction_reference if transaction_reference
|
@@ -175,7 +175,8 @@ module ActiveMerchant
|
|
175
175
|
|
176
176
|
def add_3dsecure_id(post, options)
|
177
177
|
return unless options[:threed_secure_id]
|
178
|
-
|
178
|
+
|
179
|
+
post.merge!({ '3DSecureId' => options[:threed_secure_id] })
|
179
180
|
end
|
180
181
|
|
181
182
|
def country_code(country)
|
@@ -189,7 +190,7 @@ module ActiveMerchant
|
|
189
190
|
def headers
|
190
191
|
{
|
191
192
|
'Authorization' => 'Basic ' + Base64.encode64("merchant.#{@options[:userid]}:#{@options[:password]}").strip.delete("\r\n"),
|
192
|
-
'Content-Type' => 'application/json'
|
193
|
+
'Content-Type' => 'application/json'
|
193
194
|
}
|
194
195
|
end
|
195
196
|
|
@@ -206,8 +207,8 @@ module ActiveMerchant
|
|
206
207
|
succeeded,
|
207
208
|
message_from(succeeded, raw),
|
208
209
|
raw,
|
209
|
-
:
|
210
|
-
:
|
210
|
+
authorization: authorization_from(post, raw),
|
211
|
+
test: test?
|
211
212
|
)
|
212
213
|
end
|
213
214
|
|
@@ -217,14 +218,7 @@ module ActiveMerchant
|
|
217
218
|
|
218
219
|
def base_url
|
219
220
|
if test?
|
220
|
-
|
221
|
-
when 'asia_pacific'
|
222
|
-
test_ap_url
|
223
|
-
when 'europe'
|
224
|
-
test_eu_url
|
225
|
-
when 'north_america', nil
|
226
|
-
test_na_url
|
227
|
-
end
|
221
|
+
test_url
|
228
222
|
else
|
229
223
|
case @options[:region]
|
230
224
|
when 'asia_pacific'
|
@@ -11,7 +11,7 @@ module ActiveMerchant #:nodoc:
|
|
11
11
|
self.supported_countries = ['BR']
|
12
12
|
self.default_currency = 'BRL'
|
13
13
|
self.money_format = :dollars
|
14
|
-
self.supported_cardtypes = [
|
14
|
+
self.supported_cardtypes = %i[visa master discover american_express diners_club]
|
15
15
|
self.homepage_url = 'http://www.maxipago.com/'
|
16
16
|
self.display_name = 'maxiPago!'
|
17
17
|
|
@@ -212,7 +212,7 @@ module ActiveMerchant #:nodoc:
|
|
212
212
|
end
|
213
213
|
|
214
214
|
def add_order_id(xml, authorization)
|
215
|
-
order_id,
|
215
|
+
order_id, = split_authorization(authorization)
|
216
216
|
xml.orderID order_id
|
217
217
|
end
|
218
218
|
end
|
@@ -3,19 +3,19 @@ module ActiveMerchant #:nodoc:
|
|
3
3
|
class MercadoPagoGateway < Gateway
|
4
4
|
self.live_url = self.test_url = 'https://api.mercadopago.com/v1'
|
5
5
|
|
6
|
-
self.supported_countries = [
|
7
|
-
self.supported_cardtypes = [
|
6
|
+
self.supported_countries = %w[AR BR CL CO MX PE UY]
|
7
|
+
self.supported_cardtypes = %i[visa master american_express elo cabal naranja creditel]
|
8
8
|
|
9
9
|
self.homepage_url = 'https://www.mercadopago.com/'
|
10
10
|
self.display_name = 'Mercado Pago'
|
11
11
|
self.money_format = :dollars
|
12
12
|
|
13
|
-
def initialize(options={})
|
13
|
+
def initialize(options = {})
|
14
14
|
requires!(options, :access_token)
|
15
15
|
super
|
16
16
|
end
|
17
17
|
|
18
|
-
def purchase(money, payment, options={})
|
18
|
+
def purchase(money, payment, options = {})
|
19
19
|
MultiResponse.run do |r|
|
20
20
|
r.process { commit('tokenize', 'card_tokens', card_token_request(money, payment, options)) }
|
21
21
|
options[:card_token] = r.authorization.split('|').first
|
@@ -23,7 +23,7 @@ module ActiveMerchant #:nodoc:
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def authorize(money, payment, options={})
|
26
|
+
def authorize(money, payment, options = {})
|
27
27
|
MultiResponse.run do |r|
|
28
28
|
r.process { commit('tokenize', 'card_tokens', card_token_request(money, payment, options)) }
|
29
29
|
options[:card_token] = r.authorization.split('|').first
|
@@ -31,34 +31,40 @@ module ActiveMerchant #:nodoc:
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
def capture(money, authorization, options={})
|
34
|
+
def capture(money, authorization, options = {})
|
35
35
|
post = {}
|
36
|
-
authorization,
|
36
|
+
authorization, = authorization.split('|')
|
37
37
|
post[:capture] = true
|
38
38
|
post[:transaction_amount] = amount(money).to_f
|
39
39
|
commit('capture', "payments/#{authorization}", post)
|
40
40
|
end
|
41
41
|
|
42
|
-
def refund(money, authorization, options={})
|
42
|
+
def refund(money, authorization, options = {})
|
43
43
|
post = {}
|
44
44
|
authorization, original_amount = authorization.split('|')
|
45
45
|
post[:amount] = amount(money).to_f if original_amount && original_amount.to_f > amount(money).to_f
|
46
46
|
commit('refund', "payments/#{authorization}/refunds", post)
|
47
47
|
end
|
48
48
|
|
49
|
-
def void(authorization, options={})
|
50
|
-
authorization,
|
49
|
+
def void(authorization, options = {})
|
50
|
+
authorization, = authorization.split('|')
|
51
51
|
post = { status: 'cancelled' }
|
52
52
|
commit('void', "payments/#{authorization}", post)
|
53
53
|
end
|
54
54
|
|
55
|
-
def verify(credit_card, options={})
|
55
|
+
def verify(credit_card, options = {})
|
56
|
+
verify_amount = 100
|
57
|
+
verify_amount = options[:amount].to_i if options[:amount]
|
56
58
|
MultiResponse.run(:use_first_response) do |r|
|
57
|
-
r.process { authorize(
|
59
|
+
r.process { authorize(verify_amount, credit_card, options) }
|
58
60
|
r.process(:ignore_result) { void(r.authorization, options) }
|
59
61
|
end
|
60
62
|
end
|
61
63
|
|
64
|
+
def inquire(authorization, options = {})
|
65
|
+
commit('inquire', inquire_path(authorization, options), {})
|
66
|
+
end
|
67
|
+
|
62
68
|
def supports_scrubbing?
|
63
69
|
true
|
64
70
|
end
|
@@ -96,25 +102,31 @@ module ActiveMerchant #:nodoc:
|
|
96
102
|
add_customer_data(post, payment, options)
|
97
103
|
add_address(post, options)
|
98
104
|
add_processing_mode(post, options)
|
105
|
+
add_net_amount(post, options)
|
106
|
+
add_taxes(post, options)
|
107
|
+
add_notification_url(post, options)
|
99
108
|
post[:binary_mode] = (options[:binary_mode].nil? ? true : options[:binary_mode])
|
100
109
|
post
|
101
110
|
end
|
102
111
|
|
103
112
|
def authorize_request(money, payment, options = {})
|
104
113
|
post = purchase_request(money, payment, options)
|
105
|
-
post[:capture] = false
|
114
|
+
post[:capture] = options[:capture] || false
|
106
115
|
post
|
107
116
|
end
|
108
117
|
|
109
118
|
def add_processing_mode(post, options)
|
110
119
|
return unless options[:processing_mode]
|
120
|
+
|
111
121
|
post[:processing_mode] = options[:processing_mode]
|
112
122
|
post[:merchant_account_id] = options[:merchant_account_id] if options[:merchant_account_id]
|
123
|
+
post[:payment_method_option_id] = options[:payment_method_option_id] if options[:payment_method_option_id]
|
113
124
|
add_merchant_services(post, options)
|
114
125
|
end
|
115
126
|
|
116
127
|
def add_merchant_services(post, options)
|
117
128
|
return unless options[:fraud_scoring] || options[:fraud_manual_review]
|
129
|
+
|
118
130
|
merchant_services = {}
|
119
131
|
merchant_services[:fraud_scoring] = options[:fraud_scoring] if options[:fraud_scoring]
|
120
132
|
merchant_services[:fraud_manual_review] = options[:fraud_manual_review] if options[:fraud_manual_review]
|
@@ -123,6 +135,7 @@ module ActiveMerchant #:nodoc:
|
|
123
135
|
|
124
136
|
def add_additional_data(post, options)
|
125
137
|
post[:sponsor_id] = options[:sponsor_id]
|
138
|
+
post[:metadata] = options[:metadata] if options[:metadata]
|
126
139
|
post[:device_id] = options[:device_id] if options[:device_id]
|
127
140
|
post[:additional_info] = {
|
128
141
|
ip_address: options[:ip_address]
|
@@ -137,7 +150,7 @@ module ActiveMerchant #:nodoc:
|
|
137
150
|
email: options[:email],
|
138
151
|
first_name: payment.first_name,
|
139
152
|
last_name: payment.last_name
|
140
|
-
}
|
153
|
+
}.merge(options[:payer] || {})
|
141
154
|
end
|
142
155
|
|
143
156
|
def add_address(post, options)
|
@@ -185,7 +198,7 @@ module ActiveMerchant #:nodoc:
|
|
185
198
|
post[:description] = options[:description]
|
186
199
|
post[:installments] = options[:installments] ? options[:installments].to_i : 1
|
187
200
|
post[:statement_descriptor] = options[:statement_descriptor] if options[:statement_descriptor]
|
188
|
-
post[:external_reference] = options[:order_id] || SecureRandom.hex(16)
|
201
|
+
post[:external_reference] = options[:order_id] || options[:external_reference] || SecureRandom.hex(16)
|
189
202
|
end
|
190
203
|
|
191
204
|
def add_payment(post, options)
|
@@ -194,6 +207,51 @@ module ActiveMerchant #:nodoc:
|
|
194
207
|
post[:payment_method_id] = options[:payment_method_id] if options[:payment_method_id]
|
195
208
|
end
|
196
209
|
|
210
|
+
def add_net_amount(post, options)
|
211
|
+
post[:net_amount] = Float(options[:net_amount]) if options[:net_amount]
|
212
|
+
end
|
213
|
+
|
214
|
+
def add_notification_url(post, options)
|
215
|
+
post[:notification_url] = options[:notification_url] if options[:notification_url]
|
216
|
+
end
|
217
|
+
|
218
|
+
def add_taxes(post, options)
|
219
|
+
return unless (tax_object = options[:taxes])
|
220
|
+
|
221
|
+
if tax_object.is_a?(Array)
|
222
|
+
post[:taxes] = process_taxes_array(tax_object)
|
223
|
+
elsif tax_object.is_a?(Hash)
|
224
|
+
post[:taxes] = process_taxes_hash(tax_object)
|
225
|
+
else
|
226
|
+
raise taxes_error
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
def process_taxes_hash(tax_object)
|
231
|
+
[sanitize_taxes_hash(tax_object)]
|
232
|
+
end
|
233
|
+
|
234
|
+
def process_taxes_array(taxes_array)
|
235
|
+
taxes_array.map do |tax_object|
|
236
|
+
raise taxes_error unless tax_object.is_a?(Hash)
|
237
|
+
|
238
|
+
sanitize_taxes_hash(tax_object)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def sanitize_taxes_hash(tax_object)
|
243
|
+
tax_value = tax_object['value'] || tax_object[:value]
|
244
|
+
tax_type = tax_object['type'] || tax_object[:type]
|
245
|
+
|
246
|
+
raise taxes_error if tax_value.nil? || tax_type.nil?
|
247
|
+
|
248
|
+
{ value: Float(tax_value), type: tax_type }
|
249
|
+
end
|
250
|
+
|
251
|
+
def taxes_error
|
252
|
+
ArgumentError.new("Taxes should be a single object or array of objects with the shape: { value: 500, type: 'IVA' }")
|
253
|
+
end
|
254
|
+
|
197
255
|
def parse(body)
|
198
256
|
JSON.parse(body)
|
199
257
|
rescue JSON::ParserError
|
@@ -205,8 +263,12 @@ module ActiveMerchant #:nodoc:
|
|
205
263
|
end
|
206
264
|
|
207
265
|
def commit(action, path, parameters)
|
208
|
-
if [
|
266
|
+
if %w[capture void].include?(action)
|
209
267
|
response = parse(ssl_request(:put, url(path), post_data(parameters), headers))
|
268
|
+
elsif action == 'inquire'
|
269
|
+
response = parse(ssl_get(url(path), headers))
|
270
|
+
|
271
|
+
response = response[0]['results'][0] if response.is_a?(Array)
|
210
272
|
else
|
211
273
|
response = parse(ssl_post(url(path), post_data(parameters), headers(parameters)))
|
212
274
|
end
|
@@ -225,7 +287,7 @@ module ActiveMerchant #:nodoc:
|
|
225
287
|
if action == 'refund'
|
226
288
|
response['status'] != 404 && response['error'].nil?
|
227
289
|
else
|
228
|
-
[
|
290
|
+
%w[active approved authorized cancelled in_process].include?(response['status'])
|
229
291
|
end
|
230
292
|
end
|
231
293
|
|
@@ -241,6 +303,15 @@ module ActiveMerchant #:nodoc:
|
|
241
303
|
parameters.clone.tap { |p| p.delete(:device_id) }.to_json
|
242
304
|
end
|
243
305
|
|
306
|
+
def inquire_path(authorization, options)
|
307
|
+
if authorization
|
308
|
+
authorization, = authorization.split('|')
|
309
|
+
"payments/#{authorization}"
|
310
|
+
else
|
311
|
+
"payments/search?external_reference=#{options[:order_id] || options[:external_reference]}"
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
244
315
|
def error_code_from(action, response)
|
245
316
|
unless success_from(action, response)
|
246
317
|
if cause = response['cause']
|
@@ -260,7 +331,7 @@ module ActiveMerchant #:nodoc:
|
|
260
331
|
headers = {
|
261
332
|
'Content-Type' => 'application/json'
|
262
333
|
}
|
263
|
-
headers['X-
|
334
|
+
headers['X-meli-session-id'] = options[:device_id] if options[:device_id]
|
264
335
|
headers
|
265
336
|
end
|
266
337
|
|
@@ -10,7 +10,7 @@ module ActiveMerchant #:nodoc:
|
|
10
10
|
self.supported_countries = ['US']
|
11
11
|
|
12
12
|
# The card types supported by the payment gateway
|
13
|
-
self.supported_cardtypes = [
|
13
|
+
self.supported_cardtypes = %i[visa master american_express discover jcb]
|
14
14
|
|
15
15
|
# The homepage URL of the gateway
|
16
16
|
self.homepage_url = 'http://www.merchante-solutions.com/'
|
@@ -18,6 +18,8 @@ module ActiveMerchant #:nodoc:
|
|
18
18
|
# The name of the gateway
|
19
19
|
self.display_name = 'Merchant e-Solutions'
|
20
20
|
|
21
|
+
SUCCESS_RESPONSE_CODES = %w(000 085)
|
22
|
+
|
21
23
|
def initialize(options = {})
|
22
24
|
requires!(options, :login, :password)
|
23
25
|
super
|
@@ -25,28 +27,26 @@ module ActiveMerchant #:nodoc:
|
|
25
27
|
|
26
28
|
def authorize(money, creditcard_or_card_id, options = {})
|
27
29
|
post = {}
|
28
|
-
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
29
|
-
post[:moto_ecommerce_ind] = options[:moto_ecommerce_ind] if options.has_key?(:moto_ecommerce_ind)
|
30
30
|
add_invoice(post, options)
|
31
31
|
add_payment_source(post, creditcard_or_card_id, options)
|
32
32
|
add_address(post, options)
|
33
33
|
add_3dsecure_params(post, options)
|
34
|
+
add_stored_credentials(post, options)
|
34
35
|
commit('P', money, post)
|
35
36
|
end
|
36
37
|
|
37
38
|
def purchase(money, creditcard_or_card_id, options = {})
|
38
39
|
post = {}
|
39
|
-
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
40
|
-
post[:moto_ecommerce_ind] = options[:moto_ecommerce_ind] if options.has_key?(:moto_ecommerce_ind)
|
41
40
|
add_invoice(post, options)
|
42
41
|
add_payment_source(post, creditcard_or_card_id, options)
|
43
42
|
add_address(post, options)
|
44
43
|
add_3dsecure_params(post, options)
|
44
|
+
add_stored_credentials(post, options)
|
45
45
|
commit('D', money, post)
|
46
46
|
end
|
47
47
|
|
48
48
|
def capture(money, transaction_id, options = {})
|
49
|
-
post ={}
|
49
|
+
post = {}
|
50
50
|
post[:transaction_id] = transaction_id
|
51
51
|
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
52
52
|
add_invoice(post, options)
|
@@ -55,10 +55,10 @@ module ActiveMerchant #:nodoc:
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def store(creditcard, options = {})
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
MultiResponse.run do |r|
|
59
|
+
r.process { temporary_store(creditcard, options) }
|
60
|
+
r.process { verify(r.authorization, { store_card: 'y' }) }
|
61
|
+
end
|
62
62
|
end
|
63
63
|
|
64
64
|
def unstore(card_id, options = {})
|
@@ -94,6 +94,13 @@ module ActiveMerchant #:nodoc:
|
|
94
94
|
commit('V', nil, options.merge(post))
|
95
95
|
end
|
96
96
|
|
97
|
+
def verify(credit_card, options = {})
|
98
|
+
post = {}
|
99
|
+
post[:store_card] = options[:store_card] if options[:store_card]
|
100
|
+
add_payment_source(post, credit_card, options)
|
101
|
+
commit('A', 0, post)
|
102
|
+
end
|
103
|
+
|
97
104
|
def supports_scrubbing?
|
98
105
|
true
|
99
106
|
end
|
@@ -107,6 +114,13 @@ module ActiveMerchant #:nodoc:
|
|
107
114
|
|
108
115
|
private
|
109
116
|
|
117
|
+
def temporary_store(creditcard, options = {})
|
118
|
+
post = {}
|
119
|
+
post[:client_reference_number] = options[:customer] if options.has_key?(:customer)
|
120
|
+
add_creditcard(post, creditcard, options)
|
121
|
+
commit('T', nil, post)
|
122
|
+
end
|
123
|
+
|
110
124
|
def add_address(post, options)
|
111
125
|
if address = options[:billing_address] || options[:address]
|
112
126
|
post[:cardholder_street_address] = address[:address1].to_s.gsub(/[^\w.]/, '+')
|
@@ -133,9 +147,9 @@ module ActiveMerchant #:nodoc:
|
|
133
147
|
end
|
134
148
|
|
135
149
|
def add_creditcard(post, creditcard, options)
|
136
|
-
post[:card_number]
|
150
|
+
post[:card_number] = creditcard.number
|
137
151
|
post[:cvv2] = creditcard.verification_value if creditcard.verification_value?
|
138
|
-
post[:card_exp_date]
|
152
|
+
post[:card_exp_date] = expdate(creditcard)
|
139
153
|
end
|
140
154
|
|
141
155
|
def add_3dsecure_params(post, options)
|
@@ -145,6 +159,16 @@ module ActiveMerchant #:nodoc:
|
|
145
159
|
post[:ucaf_auth_data] = options[:ucaf_auth_data] unless empty?(options[:ucaf_auth_data])
|
146
160
|
end
|
147
161
|
|
162
|
+
def add_stored_credentials(post, options)
|
163
|
+
post[:client_reference_number] = options[:client_reference_number] if options[:client_reference_number]
|
164
|
+
post[:moto_ecommerce_ind] = options[:moto_ecommerce_ind] if options[:moto_ecommerce_ind]
|
165
|
+
post[:recurring_pmt_num] = options[:recurring_pmt_num] if options[:recurring_pmt_num]
|
166
|
+
post[:recurring_pmt_count] = options[:recurring_pmt_count] if options[:recurring_pmt_count]
|
167
|
+
post[:card_on_file] = options[:card_on_file] if options[:card_on_file]
|
168
|
+
post[:cit_mit_indicator] = options[:cit_mit_indicator] if options[:cit_mit_indicator]
|
169
|
+
post[:account_data_source] = options[:account_data_source] if options[:account_data_source]
|
170
|
+
end
|
171
|
+
|
148
172
|
def parse(body)
|
149
173
|
results = {}
|
150
174
|
body.split(/&/).each do |pair|
|
@@ -156,20 +180,30 @@ module ActiveMerchant #:nodoc:
|
|
156
180
|
|
157
181
|
def commit(action, money, parameters)
|
158
182
|
url = test? ? self.test_url : self.live_url
|
159
|
-
parameters[:transaction_amount]
|
183
|
+
parameters[:transaction_amount] = amount(money) if money unless action == 'V'
|
160
184
|
|
161
|
-
response =
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
185
|
+
response =
|
186
|
+
begin
|
187
|
+
parse(ssl_post(url, post_data(action, parameters)))
|
188
|
+
rescue ActiveMerchant::ResponseError => e
|
189
|
+
{ 'error_code' => '404', 'auth_response_text' => e.to_s }
|
190
|
+
end
|
191
|
+
|
192
|
+
Response.new(success_from(response), message_from(response), response,
|
193
|
+
authorization: authorization_from(response),
|
194
|
+
test: test?,
|
195
|
+
cvv_result: response['cvv2_result'],
|
196
|
+
avs_result: { code: response['avs_result'] })
|
197
|
+
end
|
198
|
+
|
199
|
+
def authorization_from(response)
|
200
|
+
return response['card_id'] if response['card_id']
|
201
|
+
|
202
|
+
response['transaction_id']
|
203
|
+
end
|
166
204
|
|
167
|
-
|
168
|
-
|
169
|
-
:test => test?,
|
170
|
-
:cvv_result => response['cvv2_result'],
|
171
|
-
:avs_result => { :code => response['avs_result'] }
|
172
|
-
)
|
205
|
+
def success_from(response)
|
206
|
+
SUCCESS_RESPONSE_CODES.include?(response['error_code'])
|
173
207
|
end
|
174
208
|
|
175
209
|
def message_from(response)
|
@@ -3,7 +3,6 @@ require 'cgi'
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class MerchantOneGateway < Gateway
|
6
|
-
|
7
6
|
class MerchantOneSslConnection < ActiveMerchant::Connection
|
8
7
|
def configure_ssl(http)
|
9
8
|
super(http)
|
@@ -14,7 +13,7 @@ module ActiveMerchant #:nodoc:
|
|
14
13
|
BASE_URL = 'https://secure.merchantonegateway.com/api/transact.php'
|
15
14
|
|
16
15
|
self.supported_countries = ['US']
|
17
|
-
self.supported_cardtypes = [
|
16
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
18
17
|
self.homepage_url = 'http://merchantone.com/'
|
19
18
|
self.display_name = 'Merchant One Gateway'
|
20
19
|
self.money_format = :dollars
|
@@ -77,10 +76,10 @@ module ActiveMerchant #:nodoc:
|
|
77
76
|
def add_creditcard(post, creditcard)
|
78
77
|
post['cvv'] = creditcard.verification_value
|
79
78
|
post['ccnumber'] = creditcard.number
|
80
|
-
post['ccexp'] = "#{sprintf(
|
79
|
+
post['ccexp'] = "#{sprintf('%02d', creditcard.month)}#{creditcard.year.to_s[-2, 2]}"
|
81
80
|
end
|
82
81
|
|
83
|
-
def commit(action, money, parameters={})
|
82
|
+
def commit(action, money, parameters = {})
|
84
83
|
parameters['username'] = @options[:username]
|
85
84
|
parameters['password'] = @options[:password]
|
86
85
|
parse(ssl_post(BASE_URL, post_data(action, parameters)))
|
@@ -91,21 +90,19 @@ module ActiveMerchant #:nodoc:
|
|
91
90
|
ret = ''
|
92
91
|
for key in parameters.keys
|
93
92
|
ret += "#{key}=#{CGI.escape(parameters[key].to_s)}"
|
94
|
-
if key != parameters.keys.last
|
95
|
-
ret += '&'
|
96
|
-
end
|
93
|
+
ret += '&' if key != parameters.keys.last
|
97
94
|
end
|
98
95
|
ret.to_s
|
99
96
|
end
|
100
97
|
|
101
98
|
def parse(data)
|
102
|
-
responses =
|
99
|
+
responses = CGI.parse(data).inject({}) { |h, (k, v)| h[k] = v.first; h }
|
103
100
|
Response.new(
|
104
101
|
(responses['response'].to_i == 1),
|
105
102
|
responses['responsetext'],
|
106
103
|
responses,
|
107
|
-
:
|
108
|
-
:
|
104
|
+
test: test?,
|
105
|
+
authorization: responses['transactionid']
|
109
106
|
)
|
110
107
|
end
|
111
108
|
end
|