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
@@ -1,23 +1,23 @@
|
|
1
1
|
module ActiveMerchant #:nodoc:
|
2
2
|
module Billing #:nodoc:
|
3
|
-
|
4
3
|
class UsaEpayTransactionGateway < Gateway
|
5
4
|
self.live_url = 'https://www.usaepay.com/gate'
|
6
5
|
self.test_url = 'https://sandbox.usaepay.com/gate'
|
7
6
|
|
8
|
-
self.supported_cardtypes = [
|
7
|
+
self.supported_cardtypes = %i[visa master american_express]
|
9
8
|
self.supported_countries = ['US']
|
10
9
|
self.homepage_url = 'http://www.usaepay.com/'
|
11
10
|
self.display_name = 'USA ePay'
|
12
11
|
|
13
12
|
TRANSACTIONS = {
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
13
|
+
authorization: 'cc:authonly',
|
14
|
+
purchase: 'cc:sale',
|
15
|
+
capture: 'cc:capture',
|
16
|
+
refund: 'cc:refund',
|
17
|
+
void: 'cc:void',
|
18
|
+
void_release: 'cc:void:release',
|
19
|
+
check_purchase: 'check:sale',
|
20
|
+
store: 'cc:save'
|
21
21
|
}
|
22
22
|
|
23
23
|
STANDARD_ERROR_CODE_MAPPING = {
|
@@ -34,9 +34,9 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
'10110' => STANDARD_ERROR_CODE[:incorrect_address],
|
35
35
|
'10111' => STANDARD_ERROR_CODE[:incorrect_address],
|
36
36
|
'10127' => STANDARD_ERROR_CODE[:card_declined],
|
37
|
-
'
|
38
|
-
'
|
39
|
-
'
|
37
|
+
'00043' => STANDARD_ERROR_CODE[:call_issuer],
|
38
|
+
'10205' => STANDARD_ERROR_CODE[:card_declined],
|
39
|
+
'10204' => STANDARD_ERROR_CODE[:pickup_card]
|
40
40
|
}
|
41
41
|
|
42
42
|
def initialize(options = {})
|
@@ -44,17 +44,20 @@ module ActiveMerchant #:nodoc:
|
|
44
44
|
super
|
45
45
|
end
|
46
46
|
|
47
|
-
def authorize(money,
|
47
|
+
def authorize(money, payment, options = {})
|
48
48
|
post = {}
|
49
49
|
|
50
50
|
add_amount(post, money)
|
51
51
|
add_invoice(post, options)
|
52
|
-
add_payment(post,
|
53
|
-
unless
|
54
|
-
add_address(post,
|
52
|
+
add_payment(post, payment)
|
53
|
+
unless payment.is_a?(CreditCard) && payment.track_data.present?
|
54
|
+
add_address(post, payment, options)
|
55
55
|
add_customer_data(post, options)
|
56
56
|
end
|
57
57
|
add_split_payments(post, options)
|
58
|
+
add_recurring_fields(post, options)
|
59
|
+
add_custom_fields(post, options)
|
60
|
+
add_line_items(post, options)
|
58
61
|
add_test_mode(post, options)
|
59
62
|
|
60
63
|
commit(:authorization, post)
|
@@ -65,19 +68,22 @@ module ActiveMerchant #:nodoc:
|
|
65
68
|
|
66
69
|
add_amount(post, money)
|
67
70
|
add_invoice(post, options)
|
68
|
-
add_payment(post, payment)
|
71
|
+
add_payment(post, payment, options)
|
69
72
|
unless payment.respond_to?(:track_data) && payment.track_data.present?
|
70
73
|
add_address(post, payment, options)
|
71
74
|
add_customer_data(post, options)
|
72
75
|
end
|
73
76
|
add_split_payments(post, options)
|
77
|
+
add_recurring_fields(post, options)
|
78
|
+
add_custom_fields(post, options)
|
79
|
+
add_line_items(post, options)
|
74
80
|
add_test_mode(post, options)
|
75
81
|
|
76
82
|
payment.respond_to?(:routing_number) ? commit(:check_purchase, post) : commit(:purchase, post)
|
77
83
|
end
|
78
84
|
|
79
85
|
def capture(money, authorization, options = {})
|
80
|
-
post = { :
|
86
|
+
post = { refNum: authorization }
|
81
87
|
|
82
88
|
add_amount(post, money)
|
83
89
|
add_test_mode(post, options)
|
@@ -85,13 +91,19 @@ module ActiveMerchant #:nodoc:
|
|
85
91
|
end
|
86
92
|
|
87
93
|
def refund(money, authorization, options = {})
|
88
|
-
post = { :
|
94
|
+
post = { refNum: authorization }
|
89
95
|
|
90
96
|
add_amount(post, money)
|
91
97
|
add_test_mode(post, options)
|
92
98
|
commit(:refund, post)
|
93
99
|
end
|
94
100
|
|
101
|
+
def store(payment, options = {})
|
102
|
+
post = {}
|
103
|
+
add_payment(post, payment, options)
|
104
|
+
commit(:store, post)
|
105
|
+
end
|
106
|
+
|
95
107
|
def verify(creditcard, options = {})
|
96
108
|
MultiResponse.run(:use_first_response) do |r|
|
97
109
|
r.process { authorize(1, creditcard, options) }
|
@@ -102,7 +114,7 @@ module ActiveMerchant #:nodoc:
|
|
102
114
|
# Pass `no_release: true` to keep the void from immediately settling
|
103
115
|
def void(authorization, options = {})
|
104
116
|
command = (options[:no_release] ? :void : :void_release)
|
105
|
-
post = { :
|
117
|
+
post = { refNum: authorization }
|
106
118
|
add_test_mode(post, options)
|
107
119
|
commit(command, post)
|
108
120
|
end
|
@@ -120,7 +132,7 @@ module ActiveMerchant #:nodoc:
|
|
120
132
|
gsub(%r((&?UMkey=)[^&]*)i, '\1[FILTERED]')
|
121
133
|
end
|
122
134
|
|
123
|
-
|
135
|
+
private
|
124
136
|
|
125
137
|
def add_amount(post, money)
|
126
138
|
post[:amount] = amount(money)
|
@@ -148,13 +160,9 @@ module ActiveMerchant #:nodoc:
|
|
148
160
|
end
|
149
161
|
end
|
150
162
|
|
151
|
-
if options.has_key? :customer
|
152
|
-
post[:custid] = options[:customer]
|
153
|
-
end
|
163
|
+
post[:custid] = options[:customer] if options.has_key? :customer
|
154
164
|
|
155
|
-
if options.has_key? :ip
|
156
|
-
post[:ip] = options[:ip]
|
157
|
-
end
|
165
|
+
post[:ip] = options[:ip] if options.has_key? :ip
|
158
166
|
end
|
159
167
|
|
160
168
|
def add_address(post, payment, options)
|
@@ -192,18 +200,28 @@ module ActiveMerchant #:nodoc:
|
|
192
200
|
end
|
193
201
|
|
194
202
|
def add_invoice(post, options)
|
195
|
-
post[:invoice] = options[:
|
203
|
+
post[:invoice] = options[:invoice]
|
204
|
+
post[:orderid] = options[:order_id]
|
196
205
|
post[:description] = options[:description]
|
197
206
|
end
|
198
207
|
|
199
|
-
def add_payment(post, payment)
|
208
|
+
def add_payment(post, payment, options = {})
|
200
209
|
if payment.respond_to?(:routing_number)
|
210
|
+
post[:checkformat] = options[:check_format] if options[:check_format]
|
211
|
+
if payment.account_type
|
212
|
+
account_type = payment.account_type.to_s.capitalize
|
213
|
+
raise ArgumentError, 'account_type must be checking or savings' unless %w(Checking Savings).include?(account_type)
|
214
|
+
|
215
|
+
post[:accounttype] = account_type
|
216
|
+
end
|
201
217
|
post[:account] = payment.account_number
|
202
218
|
post[:routing] = payment.routing_number
|
203
219
|
post[:name] = payment.name unless payment.name.blank?
|
204
220
|
elsif payment.respond_to?(:track_data) && payment.track_data.present?
|
205
221
|
post[:magstripe] = payment.track_data
|
206
222
|
post[:cardpresent] = true
|
223
|
+
elsif payment.is_a?(String)
|
224
|
+
post[:card] = payment
|
207
225
|
else
|
208
226
|
post[:card] = payment.number
|
209
227
|
post[:cvv2] = payment.verification_value if payment.verification_value?
|
@@ -220,6 +238,7 @@ module ActiveMerchant #:nodoc:
|
|
220
238
|
# see: http://wiki.usaepay.com/developer/transactionapi#split_payments
|
221
239
|
def add_split_payments(post, options)
|
222
240
|
return unless options[:split_payments].is_a?(Array)
|
241
|
+
|
223
242
|
options[:split_payments].each_with_index do |payment, index|
|
224
243
|
prefix = '%02d' % (index + 2)
|
225
244
|
post["#{prefix}key"] = payment[:key]
|
@@ -231,62 +250,117 @@ module ActiveMerchant #:nodoc:
|
|
231
250
|
post['onError'] = options[:on_error] || 'Void'
|
232
251
|
end
|
233
252
|
|
253
|
+
def add_recurring_fields(post, options)
|
254
|
+
return unless options[:recurring_fields].is_a?(Hash)
|
255
|
+
|
256
|
+
options[:recurring_fields].each do |key, value|
|
257
|
+
if value == true
|
258
|
+
value = 'yes'
|
259
|
+
elsif value == false
|
260
|
+
next
|
261
|
+
end
|
262
|
+
|
263
|
+
value = amount(value) if key == :bill_amount
|
264
|
+
|
265
|
+
post[key.to_s.delete('_')] = value
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
# see: https://wiki.usaepay.com/developer/transactionapi#merchant_defined_custom_fields
|
270
|
+
def add_custom_fields(post, options)
|
271
|
+
return unless options[:custom_fields].is_a?(Hash)
|
272
|
+
|
273
|
+
options[:custom_fields].each do |index, custom|
|
274
|
+
raise ArgumentError.new('Cannot specify custom field with index 0') if index.to_s.to_i.zero?
|
275
|
+
|
276
|
+
post["custom#{index}"] = custom
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
# see: https://wiki.usaepay.com/developer/transactionapi#line_item_details
|
281
|
+
def add_line_items(post, options)
|
282
|
+
return unless options[:line_items].is_a?(Array)
|
283
|
+
|
284
|
+
options[:line_items].each_with_index do |line_item, index|
|
285
|
+
%w(product_ref_num sku qty name description taxable tax_rate tax_amount commodity_code discount_rate discount_amount).each do |key|
|
286
|
+
post["line#{index}#{key.delete('_')}"] = line_item[key.to_sym] if line_item.has_key?(key.to_sym)
|
287
|
+
end
|
288
|
+
|
289
|
+
{
|
290
|
+
quantity: 'qty',
|
291
|
+
unit: 'um'
|
292
|
+
}.each do |key, umkey|
|
293
|
+
post["line#{index}#{umkey}"] = line_item[key.to_sym] if line_item.has_key?(key.to_sym)
|
294
|
+
end
|
295
|
+
|
296
|
+
post["line#{index}cost"] = amount(line_item[:cost])
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
234
300
|
def parse(body)
|
235
301
|
fields = {}
|
236
302
|
for line in body.split('&')
|
237
|
-
key, value = *line.scan(
|
303
|
+
key, value = *line.scan(%r{^(\w+)\=(.*)$}).flatten
|
238
304
|
fields[key] = CGI.unescape(value.to_s)
|
239
305
|
end
|
240
306
|
|
241
307
|
{
|
242
|
-
:
|
243
|
-
:
|
244
|
-
:
|
245
|
-
:
|
246
|
-
:
|
247
|
-
:
|
248
|
-
:
|
249
|
-
:
|
250
|
-
:
|
251
|
-
:
|
252
|
-
:
|
253
|
-
:
|
254
|
-
:
|
255
|
-
:
|
256
|
-
|
308
|
+
status: fields['UMstatus'],
|
309
|
+
auth_code: fields['UMauthCode'],
|
310
|
+
ref_num: fields['UMrefNum'],
|
311
|
+
card_ref: fields['UMcardRef'],
|
312
|
+
batch: fields['UMbatch'],
|
313
|
+
avs_result: fields['UMavsResult'],
|
314
|
+
avs_result_code: fields['UMavsResultCode'],
|
315
|
+
cvv2_result: fields['UMcvv2Result'],
|
316
|
+
cvv2_result_code: fields['UMcvv2ResultCode'],
|
317
|
+
vpas_result_code: fields['UMvpasResultCode'],
|
318
|
+
result: fields['UMresult'],
|
319
|
+
error: fields['UMerror'],
|
320
|
+
error_code: fields['UMerrorcode'],
|
321
|
+
acs_url: fields['UMacsurl'],
|
322
|
+
payload: fields['UMpayload']
|
323
|
+
}.delete_if { |_k, v| v.nil? }
|
257
324
|
end
|
258
325
|
|
259
326
|
def commit(action, parameters)
|
260
327
|
url = (test? ? self.test_url : self.live_url)
|
261
328
|
response = parse(ssl_post(url, post_data(action, parameters)))
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
:
|
267
|
-
:
|
268
|
-
|
329
|
+
approved = response[:status] == 'Approved'
|
330
|
+
error_code = nil
|
331
|
+
error_code = (STANDARD_ERROR_CODE_MAPPING[response[:error_code]] || STANDARD_ERROR_CODE[:processing_error]) unless approved
|
332
|
+
Response.new(approved, message_from(response), response,
|
333
|
+
test: test?,
|
334
|
+
authorization: authorization_from(action, response),
|
335
|
+
cvv_result: response[:cvv2_result_code],
|
336
|
+
avs_result: { code: response[:avs_result_code] },
|
337
|
+
error_code: error_code)
|
269
338
|
end
|
270
339
|
|
271
340
|
def message_from(response)
|
272
|
-
if response[:status] ==
|
341
|
+
if response[:status] == 'Approved'
|
273
342
|
return 'Success'
|
274
343
|
else
|
275
344
|
return 'Unspecified error' if response[:error].blank?
|
345
|
+
|
276
346
|
return response[:error]
|
277
347
|
end
|
278
348
|
end
|
279
349
|
|
350
|
+
def authorization_from(action, response)
|
351
|
+
return (action == :store ? response[:card_ref] : response[:ref_num])
|
352
|
+
end
|
353
|
+
|
280
354
|
def post_data(action, parameters = {})
|
281
355
|
parameters[:command] = TRANSACTIONS[action]
|
282
356
|
parameters[:key] = @options[:login]
|
283
357
|
parameters[:software] = 'Active Merchant'
|
284
358
|
parameters[:testmode] = (@options[:test] ? 1 : 0) unless parameters.has_key?(:testmode)
|
285
359
|
seed = SecureRandom.hex(32).upcase
|
286
|
-
hash = Digest::SHA1.hexdigest("#{parameters[:command]}:#{@options[:password]}:#{parameters[:amount]}:#{parameters[:invoice]}:#{seed}")
|
360
|
+
hash = Digest::SHA1.hexdigest("#{parameters[:command]}:#{@options[:pin] || @options[:password]}:#{parameters[:amount]}:#{parameters[:invoice]}:#{seed}")
|
287
361
|
parameters[:hash] = "s/#{seed}/#{hash}/n"
|
288
362
|
|
289
|
-
parameters.collect { |key, value| "UM#{key}=#{CGI.escape(value.to_s)}" }.join(
|
363
|
+
parameters.collect { |key, value| "UM#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
290
364
|
end
|
291
365
|
end
|
292
366
|
end
|
@@ -10,27 +10,36 @@ module ActiveMerchant
|
|
10
10
|
|
11
11
|
self.supported_countries = ['US']
|
12
12
|
self.default_currency = 'USD'
|
13
|
-
self.supported_cardtypes = [
|
13
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
14
14
|
|
15
15
|
self.homepage_url = 'http://vancopayments.com/'
|
16
16
|
self.display_name = 'Vanco Payment Solutions'
|
17
17
|
|
18
|
-
|
18
|
+
SECONDS_PER_DAY = 3600 * 24
|
19
|
+
BUFFER_TIME_IN_SECS = 60 * 3
|
20
|
+
|
21
|
+
def initialize(options = {})
|
19
22
|
requires!(options, :user_id, :password, :client_id)
|
20
23
|
super
|
21
24
|
end
|
22
25
|
|
23
|
-
def purchase(money, payment_method, options={})
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
def purchase(money, payment_method, options = {})
|
27
|
+
moment_less_than_24_hours_ago = Time.now - SECONDS_PER_DAY - BUFFER_TIME_IN_SECS
|
28
|
+
|
29
|
+
if options[:session_id] && options[:session_id][:created_at] >= moment_less_than_24_hours_ago
|
30
|
+
commit(purchase_request(money, payment_method, options[:session_id][:id], options), :response_transactionref)
|
31
|
+
else
|
32
|
+
MultiResponse.run do |r|
|
33
|
+
r.process { login }
|
34
|
+
r.process { commit(purchase_request(money, payment_method, r.params['response_sessionid'], options), :response_transactionref) }
|
35
|
+
end
|
27
36
|
end
|
28
37
|
end
|
29
38
|
|
30
|
-
def refund(money, authorization, options={})
|
39
|
+
def refund(money, authorization, options = {})
|
31
40
|
MultiResponse.run do |r|
|
32
41
|
r.process { login }
|
33
|
-
r.process { commit(refund_request(money, authorization, r.params[
|
42
|
+
r.process { commit(refund_request(money, authorization, r.params['response_sessionid']), :response_creditrequestreceived) }
|
34
43
|
end
|
35
44
|
end
|
36
45
|
|
@@ -52,7 +61,7 @@ module ActiveMerchant
|
|
52
61
|
|
53
62
|
doc = Nokogiri::XML(xml)
|
54
63
|
doc.root.xpath('*').each do |node|
|
55
|
-
if
|
64
|
+
if node.elements.empty?
|
56
65
|
response[node.name.downcase.to_sym] = node.text
|
57
66
|
else
|
58
67
|
node.elements.each do |childnode|
|
@@ -66,7 +75,7 @@ module ActiveMerchant
|
|
66
75
|
|
67
76
|
def childnode_to_response(response, node, childnode)
|
68
77
|
name = "#{node.name.downcase}_#{childnode.name.downcase}"
|
69
|
-
if name ==
|
78
|
+
if name == 'response_errors' && !childnode.elements.empty?
|
70
79
|
add_errors_to_response(response, childnode.to_s)
|
71
80
|
else
|
72
81
|
response[name.downcase.to_sym] = childnode.text
|
@@ -77,13 +86,13 @@ module ActiveMerchant
|
|
77
86
|
errors_hash = Hash.from_xml(errors_xml).values.first
|
78
87
|
response[:response_errors] = errors_hash
|
79
88
|
|
80
|
-
error = errors_hash[
|
89
|
+
error = errors_hash['Error']
|
81
90
|
if error.kind_of?(Hash)
|
82
|
-
response[:error_message] = error[
|
83
|
-
response[:error_codes] = error[
|
91
|
+
response[:error_message] = error['ErrorDescription']
|
92
|
+
response[:error_codes] = error['ErrorCode']
|
84
93
|
elsif error.kind_of?(Array)
|
85
|
-
error_str = error.map { |e| e[
|
86
|
-
error_codes = error.map { |e| e[
|
94
|
+
error_str = error.map { |e| e['ErrorDescription'] }.join('. ')
|
95
|
+
error_codes = error.map { |e| e['ErrorCode'] }.join(', ')
|
87
96
|
response[:error_message] = "#{error_str}."
|
88
97
|
response[:error_codes] = error_codes
|
89
98
|
end
|
@@ -107,7 +116,8 @@ module ActiveMerchant
|
|
107
116
|
end
|
108
117
|
|
109
118
|
def message_from(succeeded, response)
|
110
|
-
return
|
119
|
+
return 'Success' if succeeded
|
120
|
+
|
111
121
|
response[:error_message]
|
112
122
|
end
|
113
123
|
|
@@ -116,7 +126,7 @@ module ActiveMerchant
|
|
116
126
|
response[:response_customerref],
|
117
127
|
response[:response_paymentmethodref],
|
118
128
|
response[:response_transactionref]
|
119
|
-
].join(
|
129
|
+
].join('|')
|
120
130
|
end
|
121
131
|
|
122
132
|
def split_authorization(authorization)
|
@@ -125,7 +135,7 @@ module ActiveMerchant
|
|
125
135
|
|
126
136
|
def purchase_request(money, payment_method, session_id, options)
|
127
137
|
build_xml_request do |doc|
|
128
|
-
add_auth(doc,
|
138
|
+
add_auth(doc, 'EFTAddCompleteTransaction', session_id)
|
129
139
|
|
130
140
|
doc.Request do
|
131
141
|
doc.RequestVars do
|
@@ -141,7 +151,7 @@ module ActiveMerchant
|
|
141
151
|
|
142
152
|
def refund_request(money, authorization, session_id)
|
143
153
|
build_xml_request do |doc|
|
144
|
-
add_auth(doc,
|
154
|
+
add_auth(doc, 'EFTAddCredit', session_id)
|
145
155
|
|
146
156
|
doc.Request do
|
147
157
|
doc.RequestVars do
|
@@ -203,7 +213,7 @@ module ActiveMerchant
|
|
203
213
|
doc.CardExpYear(format(credit_card.year, :two_digits))
|
204
214
|
doc.CardCVV2(credit_card.verification_value)
|
205
215
|
doc.CardBillingName(credit_card.name)
|
206
|
-
doc.AccountType(
|
216
|
+
doc.AccountType('CC')
|
207
217
|
add_billing_address(doc, options)
|
208
218
|
end
|
209
219
|
|
@@ -220,28 +230,28 @@ module ActiveMerchant
|
|
220
230
|
end
|
221
231
|
|
222
232
|
def add_echeck(doc, echeck)
|
223
|
-
if echeck.account_type ==
|
224
|
-
doc.AccountType(
|
233
|
+
if echeck.account_type == 'savings'
|
234
|
+
doc.AccountType('S')
|
225
235
|
else
|
226
|
-
doc.AccountType(
|
236
|
+
doc.AccountType('C')
|
227
237
|
end
|
228
238
|
|
229
239
|
doc.CustomerName("#{echeck.last_name}, #{echeck.first_name}")
|
230
240
|
doc.AccountNumber(echeck.account_number)
|
231
241
|
doc.RoutingNumber(echeck.routing_number)
|
232
|
-
doc.TransactionTypeCode(
|
242
|
+
doc.TransactionTypeCode('WEB')
|
233
243
|
end
|
234
244
|
|
235
245
|
def add_purchase_noise(doc)
|
236
|
-
doc.StartDate(
|
237
|
-
doc.FrequencyCode(
|
246
|
+
doc.StartDate('0000-00-00')
|
247
|
+
doc.FrequencyCode('O')
|
238
248
|
end
|
239
249
|
|
240
250
|
def add_refund_noise(doc)
|
241
|
-
doc.ContactName(
|
242
|
-
doc.ContactPhone(
|
243
|
-
doc.ContactExtension(
|
244
|
-
doc.ReasonForCredit(
|
251
|
+
doc.ContactName('Bilbo Baggins')
|
252
|
+
doc.ContactPhone('1234567890')
|
253
|
+
doc.ContactExtension('None')
|
254
|
+
doc.ReasonForCredit('Refund requested')
|
245
255
|
end
|
246
256
|
|
247
257
|
def add_options(doc, options)
|
@@ -259,7 +269,7 @@ module ActiveMerchant
|
|
259
269
|
def login_request
|
260
270
|
build_xml_request do |doc|
|
261
271
|
doc.Auth do
|
262
|
-
add_request(doc,
|
272
|
+
add_request(doc, 'Login')
|
263
273
|
end
|
264
274
|
|
265
275
|
doc.Request do
|
@@ -273,7 +283,7 @@ module ActiveMerchant
|
|
273
283
|
|
274
284
|
def build_xml_request
|
275
285
|
builder = Nokogiri::XML::Builder.new
|
276
|
-
builder.__send__(
|
286
|
+
builder.__send__('VancoWS') do |doc|
|
277
287
|
yield(doc)
|
278
288
|
end
|
279
289
|
builder.to_xml
|
@@ -288,7 +298,6 @@ module ActiveMerchant
|
|
288
298
|
'Content-Type' => 'text/xml'
|
289
299
|
}
|
290
300
|
end
|
291
|
-
|
292
301
|
end
|
293
302
|
end
|
294
303
|
end
|