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
@@ -7,15 +7,15 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
AUTHORIZATION_EMV_SUCCESS = '8A023030'
|
8
8
|
AUTHORIZATION_EMV_DECLINE = '8A023035'
|
9
9
|
|
10
|
-
SUCCESS_MESSAGE =
|
11
|
-
FAILURE_MESSAGE =
|
12
|
-
NUMBER_ERROR_MESSAGE =
|
13
|
-
AMOUNT_ERROR_MESSAGE =
|
14
|
-
UNSTORE_ERROR_MESSAGE =
|
15
|
-
CAPTURE_ERROR_MESSAGE =
|
16
|
-
VOID_ERROR_MESSAGE =
|
17
|
-
REFUND_ERROR_MESSAGE =
|
18
|
-
CHECK_ERROR_MESSAGE =
|
10
|
+
SUCCESS_MESSAGE = 'Bogus Gateway: Forced success'
|
11
|
+
FAILURE_MESSAGE = 'Bogus Gateway: Forced failure'
|
12
|
+
NUMBER_ERROR_MESSAGE = 'Bogus Gateway: Use CreditCard number ending in 1 for success, 2 for exception and anything else for error'
|
13
|
+
AMOUNT_ERROR_MESSAGE = 'Bogus Gateway: Use amount ending in 00 for success, 05 for failure and anything else for exception'
|
14
|
+
UNSTORE_ERROR_MESSAGE = 'Bogus Gateway: Use trans_id ending in 1 for success, 2 for exception and anything else for error'
|
15
|
+
CAPTURE_ERROR_MESSAGE = 'Bogus Gateway: Use authorization number ending in 1 for exception, 2 for error and anything else for success'
|
16
|
+
VOID_ERROR_MESSAGE = 'Bogus Gateway: Use authorization number ending in 1 for exception, 2 for error and anything else for success'
|
17
|
+
REFUND_ERROR_MESSAGE = 'Bogus Gateway: Use trans_id number ending in 1 for exception, 2 for error and anything else for success'
|
18
|
+
CHECK_ERROR_MESSAGE = 'Bogus Gateway: Use bank account number ending in 1 for success, 2 for exception and anything else for error'
|
19
19
|
|
20
20
|
self.supported_countries = []
|
21
21
|
self.supported_cardtypes = [:bogus]
|
@@ -47,9 +47,9 @@ module ActiveMerchant #:nodoc:
|
|
47
47
|
money = amount(money)
|
48
48
|
case normalize(paysource)
|
49
49
|
when /1$/
|
50
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
50
|
+
Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true)
|
51
51
|
when /2$/
|
52
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
52
|
+
Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
53
53
|
else
|
54
54
|
raise Error, error_message(paysource)
|
55
55
|
end
|
@@ -61,9 +61,9 @@ module ActiveMerchant #:nodoc:
|
|
61
61
|
when /1$/
|
62
62
|
raise Error, REFUND_ERROR_MESSAGE
|
63
63
|
when /2$/
|
64
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
64
|
+
Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
65
65
|
else
|
66
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
66
|
+
Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
@@ -73,9 +73,9 @@ module ActiveMerchant #:nodoc:
|
|
73
73
|
when /1$/
|
74
74
|
raise Error, CAPTURE_ERROR_MESSAGE
|
75
75
|
when /2$/
|
76
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
76
|
+
Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
77
77
|
else
|
78
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
78
|
+
Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -84,18 +84,22 @@ module ActiveMerchant #:nodoc:
|
|
84
84
|
when /1$/
|
85
85
|
raise Error, VOID_ERROR_MESSAGE
|
86
86
|
when /2$/
|
87
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
87
|
+
Response.new(false, FAILURE_MESSAGE, { authorization: reference, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
88
88
|
else
|
89
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
89
|
+
Response.new(true, SUCCESS_MESSAGE, { authorization: reference }, test: true)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
def verify(credit_card, options = {})
|
94
|
+
authorize(0, credit_card, options)
|
95
|
+
end
|
96
|
+
|
93
97
|
def store(paysource, options = {})
|
94
98
|
case normalize(paysource)
|
95
99
|
when /1$/
|
96
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
100
|
+
Response.new(true, SUCCESS_MESSAGE, { billingid: '1' }, test: true, authorization: AUTHORIZATION)
|
97
101
|
when /2$/
|
98
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
102
|
+
Response.new(false, FAILURE_MESSAGE, { billingid: nil, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
99
103
|
else
|
100
104
|
raise Error, error_message(paysource)
|
101
105
|
end
|
@@ -104,9 +108,9 @@ module ActiveMerchant #:nodoc:
|
|
104
108
|
def unstore(reference, options = {})
|
105
109
|
case reference
|
106
110
|
when /1$/
|
107
|
-
Response.new(true, SUCCESS_MESSAGE, {}, :
|
111
|
+
Response.new(true, SUCCESS_MESSAGE, {}, test: true)
|
108
112
|
when /2$/
|
109
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
113
|
+
Response.new(false, FAILURE_MESSAGE, { error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
110
114
|
else
|
111
115
|
raise Error, UNSTORE_ERROR_MESSAGE
|
112
116
|
end
|
@@ -118,9 +122,9 @@ module ActiveMerchant #:nodoc:
|
|
118
122
|
money = amount(money)
|
119
123
|
case money
|
120
124
|
when /00$/
|
121
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
125
|
+
Response.new(true, SUCCESS_MESSAGE, { authorized_amount: money }, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
|
122
126
|
when /05$/
|
123
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
127
|
+
Response.new(false, FAILURE_MESSAGE, { authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
|
124
128
|
else
|
125
129
|
raise Error, error_message(paysource)
|
126
130
|
end
|
@@ -129,10 +133,10 @@ module ActiveMerchant #:nodoc:
|
|
129
133
|
def authorize_swipe(money, paysource, options = {})
|
130
134
|
money = amount(money)
|
131
135
|
case normalize(paysource)
|
132
|
-
when /1
|
133
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
136
|
+
when /1$/, AUTHORIZATION
|
137
|
+
Response.new(true, SUCCESS_MESSAGE, { authorized_amount: money }, test: true, authorization: AUTHORIZATION)
|
134
138
|
when /2$/
|
135
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
139
|
+
Response.new(false, FAILURE_MESSAGE, { authorized_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
136
140
|
else
|
137
141
|
raise Error, error_message(paysource)
|
138
142
|
end
|
@@ -142,9 +146,9 @@ module ActiveMerchant #:nodoc:
|
|
142
146
|
money = amount(money)
|
143
147
|
case money
|
144
148
|
when /00$/
|
145
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
149
|
+
Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true, authorization: AUTHORIZATION, emv_authorization: AUTHORIZATION_EMV_SUCCESS)
|
146
150
|
when /05$/
|
147
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
151
|
+
Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error], emv_authorization: AUTHORIZATION_EMV_DECLINE)
|
148
152
|
else
|
149
153
|
raise Error, error_message(paysource)
|
150
154
|
end
|
@@ -154,9 +158,9 @@ module ActiveMerchant #:nodoc:
|
|
154
158
|
money = amount(money)
|
155
159
|
case normalize(paysource)
|
156
160
|
when /1$/, AUTHORIZATION
|
157
|
-
Response.new(true, SUCCESS_MESSAGE, {:
|
161
|
+
Response.new(true, SUCCESS_MESSAGE, { paid_amount: money }, test: true, authorization: AUTHORIZATION)
|
158
162
|
when /2$/
|
159
|
-
Response.new(false, FAILURE_MESSAGE, {:
|
163
|
+
Response.new(false, FAILURE_MESSAGE, { paid_amount: money, error: FAILURE_MESSAGE }, test: true, error_code: STANDARD_ERROR_CODE[:processing_error])
|
160
164
|
else
|
161
165
|
raise Error, error_message(paysource)
|
162
166
|
end
|
@@ -1,43 +1,59 @@
|
|
1
|
-
require
|
1
|
+
require 'nokogiri'
|
2
2
|
|
3
3
|
module ActiveMerchant #:nodoc:
|
4
4
|
module Billing #:nodoc:
|
5
5
|
class BorgunGateway < Gateway
|
6
|
-
self.display_name =
|
6
|
+
self.display_name = 'Borgun'
|
7
7
|
self.homepage_url = 'http://www.borgun.com'
|
8
8
|
|
9
9
|
self.test_url = 'https://gatewaytest.borgun.is/ws/Heimir.pub.ws:Authorization'
|
10
10
|
self.live_url = 'https://gateway01.borgun.is/ws/Heimir.pub.ws:Authorization'
|
11
11
|
|
12
|
-
self.supported_countries = [
|
12
|
+
self.supported_countries = %w[IS GB HU CZ DE DK SE]
|
13
13
|
self.default_currency = 'ISK'
|
14
14
|
self.money_format = :cents
|
15
|
-
self.supported_cardtypes = [
|
15
|
+
self.supported_cardtypes = %i[visa master american_express diners_club discover jcb]
|
16
16
|
|
17
17
|
self.homepage_url = 'https://www.borgun.is/'
|
18
18
|
|
19
|
-
def initialize(options={})
|
19
|
+
def initialize(options = {})
|
20
20
|
requires!(options, :processor, :merchant_id, :username, :password)
|
21
21
|
super
|
22
22
|
end
|
23
23
|
|
24
|
-
def purchase(money, payment, options={})
|
24
|
+
def purchase(money, payment, options = {})
|
25
25
|
post = {}
|
26
|
-
|
26
|
+
action = ''
|
27
|
+
if options[:apply_3d_secure] == '1'
|
28
|
+
add_3ds_preauth_fields(post, options)
|
29
|
+
action = '3ds_preauth'
|
30
|
+
else
|
31
|
+
post[:TransType] = '1'
|
32
|
+
add_3ds_fields(post, options)
|
33
|
+
action = 'sale'
|
34
|
+
end
|
27
35
|
add_invoice(post, money, options)
|
28
36
|
add_payment_method(post, payment)
|
29
|
-
commit(
|
37
|
+
commit(action, post, options)
|
30
38
|
end
|
31
39
|
|
32
|
-
def authorize(money, payment, options={})
|
40
|
+
def authorize(money, payment, options = {})
|
33
41
|
post = {}
|
34
|
-
|
42
|
+
action = ''
|
43
|
+
if options[:apply_3d_secure] == '1'
|
44
|
+
add_3ds_preauth_fields(post, options)
|
45
|
+
action = '3ds_preauth'
|
46
|
+
else
|
47
|
+
post[:TransType] = '5'
|
48
|
+
add_3ds_fields(post, options)
|
49
|
+
action = 'authonly'
|
50
|
+
end
|
35
51
|
add_invoice(post, money, options)
|
36
52
|
add_payment_method(post, payment)
|
37
|
-
commit(
|
53
|
+
commit(action, post, options)
|
38
54
|
end
|
39
55
|
|
40
|
-
def capture(money, authorization, options={})
|
56
|
+
def capture(money, authorization, options = {})
|
41
57
|
post = {}
|
42
58
|
post[:TransType] = '1'
|
43
59
|
add_invoice(post, money, options)
|
@@ -45,7 +61,7 @@ module ActiveMerchant #:nodoc:
|
|
45
61
|
commit('capture', post)
|
46
62
|
end
|
47
63
|
|
48
|
-
def refund(money, authorization, options={})
|
64
|
+
def refund(money, authorization, options = {})
|
49
65
|
post = {}
|
50
66
|
post[:TransType] = '3'
|
51
67
|
add_invoice(post, money, options)
|
@@ -53,7 +69,7 @@ module ActiveMerchant #:nodoc:
|
|
53
69
|
commit('refund', post)
|
54
70
|
end
|
55
71
|
|
56
|
-
def void(authorization, options={})
|
72
|
+
def void(authorization, options = {})
|
57
73
|
post = {}
|
58
74
|
# TransType, TrAmount, and currency must match original values from auth or purchase.
|
59
75
|
_, _, _, _, _, transtype, tramount, currency = split_authorization(authorization)
|
@@ -76,14 +92,31 @@ module ActiveMerchant #:nodoc:
|
|
76
92
|
|
77
93
|
private
|
78
94
|
|
79
|
-
CURRENCY_CODES = Hash.new{|
|
80
|
-
CURRENCY_CODES[
|
81
|
-
CURRENCY_CODES[
|
82
|
-
CURRENCY_CODES[
|
95
|
+
CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency for HDFC: #{k}") }
|
96
|
+
CURRENCY_CODES['ISK'] = '352'
|
97
|
+
CURRENCY_CODES['EUR'] = '978'
|
98
|
+
CURRENCY_CODES['USD'] = '840'
|
99
|
+
|
100
|
+
def add_3ds_fields(post, options)
|
101
|
+
post[:ThreeDSMessageId] = options[:three_ds_message_id] if options[:three_ds_message_id]
|
102
|
+
post[:ThreeDS_PARes] = options[:three_ds_pares] if options[:three_ds_pares]
|
103
|
+
post[:ThreeDS_CRes] = options[:three_ds_cres] if options[:three_ds_cres]
|
104
|
+
end
|
105
|
+
|
106
|
+
def add_3ds_preauth_fields(post, options)
|
107
|
+
post[:SaleDescription] = options[:sale_description] || ''
|
108
|
+
post[:MerchantReturnURL] = options[:merchant_return_url] if options[:merchant_return_url]
|
109
|
+
end
|
83
110
|
|
84
111
|
def add_invoice(post, money, options)
|
85
112
|
post[:TrAmount] = amount(money)
|
86
113
|
post[:TrCurrency] = CURRENCY_CODES[options[:currency] || currency(money)]
|
114
|
+
# The ISK currency must have a currency exponent of 2 on the 3DS request but not on the auth request
|
115
|
+
if post[:TrCurrency] == '352' && options[:apply_3d_secure] == '1'
|
116
|
+
post[:TrCurrencyExponent] = 2
|
117
|
+
else
|
118
|
+
post[:TrCurrencyExponent] = 0
|
119
|
+
end
|
87
120
|
post[:TerminalID] = options[:terminal_id] || '1'
|
88
121
|
end
|
89
122
|
|
@@ -91,28 +124,28 @@ module ActiveMerchant #:nodoc:
|
|
91
124
|
post[:PAN] = payment_method.number
|
92
125
|
post[:ExpDate] = format(payment_method.year, :two_digits) + format(payment_method.month, :two_digits)
|
93
126
|
post[:CVC2] = payment_method.verification_value
|
94
|
-
post[:DateAndTime] = Time.now.strftime(
|
127
|
+
post[:DateAndTime] = Time.now.strftime('%y%m%d%H%M%S')
|
95
128
|
post[:RRN] = 'AMRCNT' + six_random_digits
|
96
129
|
end
|
97
130
|
|
98
131
|
def add_reference(post, authorization)
|
99
|
-
dateandtime,
|
132
|
+
dateandtime, _batch, transaction, rrn, authcode, = split_authorization(authorization)
|
100
133
|
post[:DateAndTime] = dateandtime
|
101
134
|
post[:Transaction] = transaction
|
102
135
|
post[:RRN] = rrn
|
103
136
|
post[:AuthCode] = authcode
|
104
137
|
end
|
105
138
|
|
106
|
-
def parse(xml)
|
139
|
+
def parse(xml, options = nil)
|
107
140
|
response = {}
|
108
141
|
|
109
142
|
doc = Nokogiri::XML(CGI.unescapeHTML(xml))
|
110
|
-
body = doc.xpath('//getAuthorizationReply')
|
143
|
+
body = options[:apply_3d_secure] == '1' ? doc.xpath('//get3DSAuthenticationReply') : doc.xpath('//getAuthorizationReply')
|
111
144
|
body = doc.xpath('//cancelAuthorizationReply') if body.length == 0
|
112
145
|
body.children.each do |node|
|
113
146
|
if node.text?
|
114
147
|
next
|
115
|
-
elsif
|
148
|
+
elsif node.elements.size == 0
|
116
149
|
response[node.name.downcase.to_sym] = node.text
|
117
150
|
else
|
118
151
|
node.elements.each do |childnode|
|
@@ -121,19 +154,17 @@ module ActiveMerchant #:nodoc:
|
|
121
154
|
end
|
122
155
|
end
|
123
156
|
end
|
124
|
-
|
125
157
|
response
|
126
158
|
end
|
127
159
|
|
128
|
-
def commit(action, post)
|
160
|
+
def commit(action, post, options = {})
|
129
161
|
post[:Version] = '1000'
|
130
162
|
post[:Processor] = @options[:processor]
|
131
163
|
post[:MerchantID] = @options[:merchant_id]
|
132
164
|
|
133
|
-
|
134
|
-
request = build_request(action, post)
|
165
|
+
request = build_request(action, post, options)
|
135
166
|
raw = ssl_post(url(action), request, headers)
|
136
|
-
pairs = parse(raw)
|
167
|
+
pairs = parse(raw, options)
|
137
168
|
success = success_from(pairs)
|
138
169
|
|
139
170
|
Response.new(
|
@@ -146,12 +177,12 @@ module ActiveMerchant #:nodoc:
|
|
146
177
|
end
|
147
178
|
|
148
179
|
def success_from(response)
|
149
|
-
(response[:actioncode] == '000')
|
180
|
+
(response[:actioncode] == '000') || (response[:status_resultcode] == '0')
|
150
181
|
end
|
151
182
|
|
152
183
|
def message_from(succeeded, response)
|
153
184
|
if succeeded
|
154
|
-
|
185
|
+
'Succeeded'
|
155
186
|
else
|
156
187
|
response[:message] || "Error with ActionCode=#{response[:actioncode]}"
|
157
188
|
end
|
@@ -167,46 +198,65 @@ module ActiveMerchant #:nodoc:
|
|
167
198
|
response[:transtype],
|
168
199
|
response[:tramount],
|
169
200
|
response[:trcurrency]
|
170
|
-
].join(
|
201
|
+
].join('|')
|
171
202
|
end
|
172
203
|
|
173
204
|
def split_authorization(authorization)
|
174
|
-
dateandtime, batch, transaction, rrn, authcode, transtype, tramount, currency = authorization.split(
|
205
|
+
dateandtime, batch, transaction, rrn, authcode, transtype, tramount, currency = authorization.split('|')
|
175
206
|
[dateandtime, batch, transaction, rrn, authcode, transtype, tramount, currency]
|
176
207
|
end
|
177
208
|
|
178
209
|
def headers
|
179
210
|
{
|
180
|
-
'Authorization' => 'Basic ' + Base64.strict_encode64(@options[:username].to_s + ':' + @options[:password].to_s)
|
211
|
+
'Authorization' => 'Basic ' + Base64.strict_encode64(@options[:username].to_s + ':' + @options[:password].to_s)
|
181
212
|
}
|
182
213
|
end
|
183
214
|
|
184
|
-
def build_request(action, post)
|
185
|
-
mode =
|
186
|
-
|
187
|
-
xml
|
188
|
-
xml.
|
215
|
+
def build_request(action, post, options = {})
|
216
|
+
mode = action == 'void' ? 'cancel' : 'get'
|
217
|
+
transaction_type = action == '3ds_preauth' ? '3DSAuthentication' : 'Authorization'
|
218
|
+
xml = Builder::XmlMarkup.new indent: 18
|
219
|
+
xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
|
220
|
+
xml.tag!("#{mode}#{transaction_type}") do
|
189
221
|
post.each do |field, value|
|
190
222
|
xml.tag!(field, value)
|
191
223
|
end
|
224
|
+
build_airline_xml(xml, options[:passenger_itinerary_data]) if options[:passenger_itinerary_data]
|
192
225
|
end
|
193
226
|
inner = CGI.escapeHTML(xml.target!)
|
194
|
-
envelope(mode).sub(/{{ :body }}/,inner)
|
227
|
+
envelope(mode, action).sub(/{{ :body }}/, inner)
|
195
228
|
end
|
196
229
|
|
197
|
-
def
|
198
|
-
|
230
|
+
def build_airline_xml(xml, airline_data)
|
231
|
+
xml.tag!('PassengerItineraryData') do
|
232
|
+
xml.tag!('A1') do
|
233
|
+
airline_data.each do |field, value|
|
234
|
+
xml.tag!(field, value)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
def envelope(mode, action)
|
241
|
+
if action == '3ds_preauth'
|
242
|
+
transaction_action = "#{mode}3DSAuthentication"
|
243
|
+
request_action = "#{mode}Auth3DSReqXml"
|
244
|
+
else
|
245
|
+
transaction_action = "#{mode}AuthorizationInput"
|
246
|
+
request_action = "#{mode}AuthReqXml"
|
247
|
+
end
|
248
|
+
<<-XML
|
199
249
|
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aut="http://Borgun/Heimir/pub/ws/Authorization">
|
200
250
|
<soapenv:Header/>
|
201
251
|
<soapenv:Body>
|
202
|
-
<aut:#{
|
203
|
-
<#{
|
252
|
+
<aut:#{transaction_action}>
|
253
|
+
<#{request_action}>
|
204
254
|
{{ :body }}
|
205
|
-
</#{
|
206
|
-
</aut:#{
|
255
|
+
</#{request_action}>
|
256
|
+
</aut:#{transaction_action}>
|
207
257
|
</soapenv:Body>
|
208
258
|
</soapenv:Envelope>
|
209
|
-
|
259
|
+
XML
|
210
260
|
end
|
211
261
|
|
212
262
|
def url(action)
|
@@ -214,7 +264,7 @@ module ActiveMerchant #:nodoc:
|
|
214
264
|
end
|
215
265
|
|
216
266
|
def six_random_digits
|
217
|
-
(0...6).map { (48
|
267
|
+
(0...6).map { rand(48..57).chr }.join
|
218
268
|
end
|
219
269
|
end
|
220
270
|
end
|
@@ -7,17 +7,17 @@ module ActiveMerchant #:nodoc:
|
|
7
7
|
|
8
8
|
self.supported_countries = ['AU']
|
9
9
|
self.default_currency = 'AUD'
|
10
|
-
self.supported_cardtypes = [
|
10
|
+
self.supported_cardtypes = %i[visa master american_express diners_club]
|
11
11
|
|
12
12
|
self.homepage_url = 'https://www.bpoint.com.au/bpoint'
|
13
13
|
self.display_name = 'BPoint'
|
14
14
|
|
15
|
-
def initialize(options={})
|
15
|
+
def initialize(options = {})
|
16
16
|
requires!(options, :username, :password, :merchant_number)
|
17
17
|
super
|
18
18
|
end
|
19
19
|
|
20
|
-
def store(credit_card, options={})
|
20
|
+
def store(credit_card, options = {})
|
21
21
|
options[:crn1] ||= 'DEFAULT'
|
22
22
|
request_body = soap_request do |xml|
|
23
23
|
add_token(xml, credit_card, options)
|
@@ -25,7 +25,7 @@ module ActiveMerchant #:nodoc:
|
|
25
25
|
commit(request_body)
|
26
26
|
end
|
27
27
|
|
28
|
-
def purchase(amount, credit_card, options={})
|
28
|
+
def purchase(amount, credit_card, options = {})
|
29
29
|
request_body = soap_request do |xml|
|
30
30
|
process_payment(xml) do |payment_xml|
|
31
31
|
add_purchase(payment_xml, amount, credit_card, options)
|
@@ -34,7 +34,7 @@ module ActiveMerchant #:nodoc:
|
|
34
34
|
commit(request_body)
|
35
35
|
end
|
36
36
|
|
37
|
-
def authorize(amount, credit_card, options={})
|
37
|
+
def authorize(amount, credit_card, options = {})
|
38
38
|
request_body = soap_request do |xml|
|
39
39
|
process_payment(xml) do |payment_xml|
|
40
40
|
add_authorize(payment_xml, amount, credit_card, options)
|
@@ -43,7 +43,7 @@ module ActiveMerchant #:nodoc:
|
|
43
43
|
commit(request_body)
|
44
44
|
end
|
45
45
|
|
46
|
-
def capture(amount, authorization, options={})
|
46
|
+
def capture(amount, authorization, options = {})
|
47
47
|
request_body = soap_request do |xml|
|
48
48
|
process_payment(xml) do |payment_xml|
|
49
49
|
add_capture(payment_xml, amount, authorization, options)
|
@@ -52,7 +52,7 @@ module ActiveMerchant #:nodoc:
|
|
52
52
|
commit(request_body)
|
53
53
|
end
|
54
54
|
|
55
|
-
def refund(amount, authorization, options={})
|
55
|
+
def refund(amount, authorization, options = {})
|
56
56
|
request_body = soap_request do |xml|
|
57
57
|
process_payment(xml) do |payment_xml|
|
58
58
|
add_refund(payment_xml, amount, authorization, options)
|
@@ -61,19 +61,19 @@ module ActiveMerchant #:nodoc:
|
|
61
61
|
commit(request_body)
|
62
62
|
end
|
63
63
|
|
64
|
-
def void(
|
64
|
+
def void(authorization, options = {})
|
65
65
|
request_body = soap_request do |xml|
|
66
66
|
process_payment(xml) do |payment_xml|
|
67
|
-
add_void(payment_xml,
|
67
|
+
add_void(payment_xml, authorization, options)
|
68
68
|
end
|
69
69
|
end
|
70
70
|
commit(request_body)
|
71
71
|
end
|
72
72
|
|
73
|
-
def verify(credit_card, options={})
|
73
|
+
def verify(credit_card, options = {})
|
74
74
|
MultiResponse.run(:use_first_response) do |r|
|
75
75
|
r.process { authorize(100, credit_card, options) }
|
76
|
-
r.process(:ignore_result) { void(
|
76
|
+
r.process(:ignore_result) { void(r.authorization, options.merge(amount: 100)) }
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -91,7 +91,7 @@ module ActiveMerchant #:nodoc:
|
|
91
91
|
private
|
92
92
|
|
93
93
|
def soap_request
|
94
|
-
Nokogiri::XML::Builder.new(:
|
94
|
+
Nokogiri::XML::Builder.new(encoding: 'utf-8') do |xml|
|
95
95
|
xml.send('soap12:Envelope', soap_envelope_attributes) {
|
96
96
|
xml.send('soap12:Body') {
|
97
97
|
yield(xml) if block_given?
|
@@ -154,7 +154,9 @@ module ActiveMerchant #:nodoc:
|
|
154
154
|
transaction_number_xml(xml, transaction_number)
|
155
155
|
end
|
156
156
|
|
157
|
-
def add_void(xml,
|
157
|
+
def add_void(xml, transaction_number, options)
|
158
|
+
# The amount parameter is required for void requests on BPoint.
|
159
|
+
amount = options[:amount]
|
158
160
|
payment_xml(xml, 'REVERSAL', amount, options)
|
159
161
|
transaction_number_xml(xml, transaction_number)
|
160
162
|
end
|
@@ -163,10 +165,10 @@ module ActiveMerchant #:nodoc:
|
|
163
165
|
xml.send('PaymentType', payment_type)
|
164
166
|
xml.send('TxnType', 'WEB_SHOP')
|
165
167
|
xml.send('BillerCode', options.fetch(:biller_code, ''))
|
166
|
-
xml.send('MerchantReference',
|
167
|
-
xml.send('CRN1',
|
168
|
-
xml.send('CRN2',
|
169
|
-
xml.send('CRN3',
|
168
|
+
xml.send('MerchantReference', options[:order_id]) if options[:order_id]
|
169
|
+
xml.send('CRN1', options[:crn1]) if options[:crn1]
|
170
|
+
xml.send('CRN2', options[:crn2]) if options[:crn2]
|
171
|
+
xml.send('CRN3', options[:crn3]) if options[:crn3]
|
170
172
|
xml.send('Amount', amount)
|
171
173
|
end
|
172
174
|
|
@@ -185,7 +187,7 @@ module ActiveMerchant #:nodoc:
|
|
185
187
|
end
|
186
188
|
|
187
189
|
def request_headers
|
188
|
-
{
|
190
|
+
{ 'Content-Type' => 'application/soap+xml; charset=utf-8' }
|
189
191
|
end
|
190
192
|
|
191
193
|
def parse(body)
|
@@ -240,7 +242,6 @@ module ActiveMerchant #:nodoc:
|
|
240
242
|
end
|
241
243
|
|
242
244
|
class ProcessPaymentResponse < BPointResponse
|
243
|
-
|
244
245
|
private
|
245
246
|
|
246
247
|
def authorization_key
|
@@ -257,7 +258,6 @@ module ActiveMerchant #:nodoc:
|
|
257
258
|
end
|
258
259
|
|
259
260
|
class AddTokenResponse < BPointResponse
|
260
|
-
|
261
261
|
private
|
262
262
|
|
263
263
|
def authorization_key
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BraintreeCommon
|
2
2
|
def self.included(base)
|
3
3
|
base.supported_countries = %w(US CA AD AT BE BG HR CY CZ DK EE FI FR GI DE GR GG HU IS IM IE IT JE LV LI LT LU MT MC NL NO PL PT RO SM SK SI ES SE CH TR GB SG HK MY AU NZ)
|
4
|
-
base.supported_cardtypes = [
|
4
|
+
base.supported_cardtypes = %i[visa master american_express discover jcb diners_club maestro]
|
5
5
|
base.homepage_url = 'http://www.braintreepaymentsolutions.com'
|
6
6
|
base.display_name = 'Braintree'
|
7
7
|
base.default_currency = 'USD'
|
@@ -13,10 +13,16 @@ module BraintreeCommon
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def scrub(transcript)
|
16
|
-
return
|
16
|
+
return '' if transcript.blank?
|
17
|
+
|
17
18
|
transcript.
|
18
19
|
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
19
20
|
gsub(%r((&?ccnumber=)\d*(&?)), '\1[FILTERED]\2').
|
20
|
-
gsub(%r((&?cvv=)\d*(&?)), '\1[FILTERED]\2')
|
21
|
+
gsub(%r((&?cvv=)\d*(&?)), '\1[FILTERED]\2').
|
22
|
+
gsub(%r((<account-number>)\d+(</account-number>)), '\1[FILTERED]\2').
|
23
|
+
gsub(%r((<payment-method-nonce>)[^<]+(</payment-method-nonce>)), '\1[FILTERED]\2').
|
24
|
+
gsub(%r((<payment-method-token>)[^<]+(</payment-method-token>)), '\1[FILTERED]\2').
|
25
|
+
gsub(%r((<value>)[^<]{100,}(</value>)), '\1[FILTERED]\2').
|
26
|
+
gsub(%r((<token>)[^<]+(</token>)), '\1[FILTERED]\2')
|
21
27
|
end
|
22
28
|
end
|