activemerchant 1.45.0 → 1.126.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG +2167 -2
- data/CONTRIBUTORS +57 -0
- data/README.md +62 -41
- data/lib/active_merchant/billing/avs_result.rb +25 -28
- data/lib/active_merchant/billing/base.rb +11 -35
- data/lib/active_merchant/billing/check.rb +28 -24
- data/lib/active_merchant/billing/compatibility.rb +10 -12
- data/lib/active_merchant/billing/credit_card.rb +141 -69
- data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
- data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +125 -61
- data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
- data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
- data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
- data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
- 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 +24 -13
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- 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 +143 -62
- data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
- data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
- data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
- data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
- data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
- data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
- data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
- data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
- data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
- data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
- data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
- data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
- data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
- data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
- data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
- data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
- data/lib/active_merchant/billing/gateways/element.rb +386 -0
- data/lib/active_merchant/billing/gateways/epay.rb +92 -71
- data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
- data/lib/active_merchant/billing/gateways/eway.rb +85 -73
- data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
- data/lib/active_merchant/billing/gateways/exact.rb +37 -36
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
- data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
- data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
- data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
- data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
- data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
- data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
- data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
- data/lib/active_merchant/billing/gateways/hps.rb +252 -68
- data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
- data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
- data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
- data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
- data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
- data/lib/active_merchant/billing/gateways/litle.rb +371 -94
- data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
- data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
- data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
- data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +101 -37
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +422 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
- data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
- data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- 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 +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
- 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 +279 -174
- data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
- data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- 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 +245 -0
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
- data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
- data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
- data/lib/active_merchant/billing/gateways/payex.rb +39 -42
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
- 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 +215 -46
- data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
- data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
- data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
- data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
- data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
- data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
- 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 +113 -37
- data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
- data/lib/active_merchant/billing/gateways/priority.rb +369 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
- data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
- data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
- data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
- data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
- data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
- data/lib/active_merchant/billing/gateways/realex.rb +154 -52
- data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
- data/lib/active_merchant/billing/gateways/s5.rb +247 -0
- data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
- data/lib/active_merchant/billing/gateways/sage.rb +404 -133
- data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
- data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
- data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
- data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
- 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 +108 -43
- data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +16 -217
- data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
- data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
- 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 +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
- data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
- data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
- data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
- data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
- data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
- data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
- data/lib/active_merchant/billing/gateways.rb +8 -11
- data/lib/active_merchant/billing/model.rb +2 -2
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +1 -1
- data/lib/active_merchant/billing/rails.rb +1 -1
- data/lib/active_merchant/billing/response.rb +19 -13
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +3 -0
- data/lib/active_merchant/connection.rb +196 -0
- data/lib/active_merchant/country.rb +13 -8
- data/lib/active_merchant/errors.rb +6 -0
- data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
- data/lib/active_merchant/network_connection_retries.rb +78 -0
- data/lib/active_merchant/post_data.rb +26 -0
- data/lib/active_merchant/posts_data.rb +92 -0
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +14 -59
- data/lib/activemerchant.rb +1 -1
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +8 -10
- data/lib/support/outbound_hosts.rb +13 -10
- data/lib/support/ssl_verify.rb +9 -14
- data/lib/support/ssl_version.rb +86 -0
- metadata +136 -94
- checksums.yaml.gz.sig +0 -1
- data/lib/active_merchant/billing/gateways/app55.rb +0 -176
- data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
- data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
- 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 -291
- data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
- data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
- data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
- data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
- data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
- data/lib/active_merchant/offsite_payments_shim.rb +0 -19
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'active_merchant/billing/gateways/paypal/paypal_common_api'
|
2
|
+
require 'active_merchant/billing/gateways/paypal/paypal_express_response'
|
3
|
+
require 'active_merchant/billing/gateways/paypal_express_common'
|
4
4
|
|
5
5
|
module ActiveMerchant #:nodoc:
|
6
6
|
module Billing #:nodoc:
|
@@ -30,7 +30,8 @@ module ActiveMerchant #:nodoc:
|
|
30
30
|
# :category => "Digital" } ] )
|
31
31
|
def build_setup_request(action, money, options)
|
32
32
|
requires!(options, :items)
|
33
|
-
raise ArgumentError,
|
33
|
+
raise ArgumentError, 'Must include at least 1 Item' unless options[:items].length > 0
|
34
|
+
|
34
35
|
options[:items].each do |item|
|
35
36
|
requires!(item, :name, :number, :quantity, :amount, :description, :category)
|
36
37
|
raise ArgumentError, "Each of the items must have the category 'Digital'" unless item[:category] == 'Digital'
|
@@ -38,7 +39,6 @@ module ActiveMerchant #:nodoc:
|
|
38
39
|
|
39
40
|
super
|
40
41
|
end
|
41
|
-
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require 'active_merchant/billing/gateways/paypal/paypal_common_api'
|
2
|
+
require 'active_merchant/billing/gateways/paypal/paypal_express_response'
|
3
|
+
require 'active_merchant/billing/gateways/paypal/paypal_recurring_api'
|
4
|
+
require 'active_merchant/billing/gateways/paypal_express_common'
|
5
5
|
|
6
6
|
module ActiveMerchant #:nodoc:
|
7
7
|
module Billing #:nodoc:
|
@@ -30,6 +30,7 @@ module ActiveMerchant #:nodoc:
|
|
30
30
|
self.supported_countries = ['US']
|
31
31
|
self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=xpt/merchant/ExpressCheckoutIntro-outside'
|
32
32
|
self.display_name = 'PayPal Express Checkout'
|
33
|
+
self.currencies_without_fractions = %w(HUF JPY TWD)
|
33
34
|
|
34
35
|
def setup_authorization(money, options = {})
|
35
36
|
requires!(options, :return_url, :cancel_return_url)
|
@@ -72,7 +73,7 @@ module ActiveMerchant #:nodoc:
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def authorize_reference_transaction(money, options = {})
|
75
|
-
requires!(options, :reference_id
|
76
|
+
requires!(options, :reference_id)
|
76
77
|
|
77
78
|
commit 'DoReferenceTransaction', build_reference_transaction_request('Authorization', money, options)
|
78
79
|
end
|
@@ -145,7 +146,9 @@ module ActiveMerchant #:nodoc:
|
|
145
146
|
xml.tag! 'n2:cpp-payflow-color', options[:background_color] unless options[:background_color].blank?
|
146
147
|
if options[:allow_guest_checkout]
|
147
148
|
xml.tag! 'n2:SolutionType', 'Sole'
|
148
|
-
|
149
|
+
unless options[:paypal_chooses_landing_page]
|
150
|
+
xml.tag! 'n2:LandingPage', options[:landing_page] || 'Billing'
|
151
|
+
end
|
149
152
|
end
|
150
153
|
xml.tag! 'n2:BuyerEmail', options[:email] unless options[:email].blank?
|
151
154
|
|
@@ -186,6 +189,8 @@ module ActiveMerchant #:nodoc:
|
|
186
189
|
if options.has_key?(:allow_buyer_optin)
|
187
190
|
xml.tag! 'n2:BuyerEmailOptInEnable', (options[:allow_buyer_optin] ? '1' : '0')
|
188
191
|
end
|
192
|
+
|
193
|
+
xml.tag! 'n2:TotalType', options[:total_type] unless options[:total_type].blank?
|
189
194
|
end
|
190
195
|
end
|
191
196
|
end
|
@@ -245,6 +250,7 @@ module ActiveMerchant #:nodoc:
|
|
245
250
|
xml.tag! 'n2:PaymentType', options[:payment_type] || 'Any'
|
246
251
|
add_payment_details(xml, money, currency_code, options)
|
247
252
|
xml.tag! 'n2:IPAddress', options[:ip]
|
253
|
+
xml.tag! 'n2:MerchantSessionId', options[:merchant_session_id] if options[:merchant_session_id].present?
|
248
254
|
end
|
249
255
|
end
|
250
256
|
end
|
@@ -11,13 +11,13 @@ module ActiveMerchant
|
|
11
11
|
end
|
12
12
|
base.live_redirect_url = 'https://www.paypal.com/cgi-bin/webscr'
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def redirect_url
|
16
16
|
test? ? test_redirect_url : live_redirect_url
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def redirect_url_for(token, options = {})
|
20
|
-
options = {:
|
20
|
+
options = { review: true, mobile: false }.update(options)
|
21
21
|
|
22
22
|
cmd = options[:mobile] ? '_express-checkout-mobile' : '_express-checkout'
|
23
23
|
url = "#{redirect_url}?cmd=#{cmd}&token=#{token}"
|
@@ -0,0 +1,412 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PaysafeGateway < Gateway
|
4
|
+
self.test_url = 'https://api.test.paysafe.com'
|
5
|
+
self.live_url = 'https://api.paysafe.com'
|
6
|
+
|
7
|
+
self.supported_countries = %w(AL AT BE BA BG CA HR CY CZ DK EE FI FR DE GR HU IS IE IT LV LI LT LU MT ME NL MK NO PL PT RO RS SK SI ES SE CH TR GB US)
|
8
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
9
|
+
|
10
|
+
self.homepage_url = 'https://www.paysafe.com/'
|
11
|
+
self.display_name = 'Paysafe'
|
12
|
+
|
13
|
+
def initialize(options = {})
|
14
|
+
requires!(options, :username, :password, :account_id)
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def purchase(money, payment, options = {})
|
19
|
+
post = {}
|
20
|
+
add_invoice(post, money, options)
|
21
|
+
add_payment(post, payment)
|
22
|
+
add_billing_address(post, options)
|
23
|
+
add_merchant_details(post, options)
|
24
|
+
add_airline_travel_details(post, options)
|
25
|
+
add_customer_data(post, payment, options) unless payment.is_a?(String)
|
26
|
+
add_three_d_secure(post, payment, options) if options[:three_d_secure]
|
27
|
+
add_stored_credential(post, options) if options[:stored_credential]
|
28
|
+
add_split_pay_details(post, options)
|
29
|
+
post[:settleWithAuth] = true
|
30
|
+
|
31
|
+
commit(:post, 'auths', post, options)
|
32
|
+
end
|
33
|
+
|
34
|
+
def authorize(money, payment, options = {})
|
35
|
+
post = {}
|
36
|
+
add_invoice(post, money, options)
|
37
|
+
add_payment(post, payment)
|
38
|
+
add_billing_address(post, options)
|
39
|
+
add_merchant_details(post, options)
|
40
|
+
add_customer_data(post, payment, options) unless payment.is_a?(String)
|
41
|
+
add_three_d_secure(post, payment, options) if options[:three_d_secure]
|
42
|
+
add_stored_credential(post, options) if options[:stored_credential]
|
43
|
+
|
44
|
+
commit(:post, 'auths', post, options)
|
45
|
+
end
|
46
|
+
|
47
|
+
def capture(money, authorization, options = {})
|
48
|
+
post = {}
|
49
|
+
add_invoice(post, money, options)
|
50
|
+
|
51
|
+
commit(:post, "auths/#{authorization}/settlements", post, options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def refund(money, authorization, options = {})
|
55
|
+
post = {}
|
56
|
+
add_invoice(post, money, options)
|
57
|
+
|
58
|
+
commit(:post, "settlements/#{authorization}/refunds", post, options)
|
59
|
+
end
|
60
|
+
|
61
|
+
def void(authorization, options = {})
|
62
|
+
post = {}
|
63
|
+
money = options[:amount]
|
64
|
+
add_invoice(post, money, options)
|
65
|
+
|
66
|
+
commit(:post, "auths/#{authorization}/voidauths", post, options)
|
67
|
+
end
|
68
|
+
|
69
|
+
def credit(money, payment, options = {})
|
70
|
+
post = {}
|
71
|
+
add_invoice(post, money, options)
|
72
|
+
add_payment(post, payment)
|
73
|
+
|
74
|
+
commit(:post, 'standalonecredits', post, options)
|
75
|
+
end
|
76
|
+
|
77
|
+
# This is a '$0 auth' done at a specific verification endpoint at the gateway
|
78
|
+
def verify(payment, options = {})
|
79
|
+
post = {}
|
80
|
+
add_payment(post, payment)
|
81
|
+
add_billing_address(post, options)
|
82
|
+
add_customer_data(post, payment, options) unless payment.is_a?(String)
|
83
|
+
|
84
|
+
commit(:post, 'verifications', post, options)
|
85
|
+
end
|
86
|
+
|
87
|
+
def store(payment, options = {})
|
88
|
+
post = {}
|
89
|
+
add_payment(post, payment)
|
90
|
+
add_address_for_vaulting(post, options)
|
91
|
+
add_profile_data(post, payment, options)
|
92
|
+
add_store_data(post, payment, options)
|
93
|
+
|
94
|
+
commit(:post, 'profiles', post, options)
|
95
|
+
end
|
96
|
+
|
97
|
+
def unstore(pm_profile_id)
|
98
|
+
commit(:delete, "profiles/#{get_id_from_store_auth(pm_profile_id)}", nil, nil)
|
99
|
+
end
|
100
|
+
|
101
|
+
def supports_scrubbing?
|
102
|
+
true
|
103
|
+
end
|
104
|
+
|
105
|
+
def scrub(transcript)
|
106
|
+
transcript.
|
107
|
+
gsub(%r((Authorization: Basic )[a-zA-Z0-9:_]+), '\1[FILTERED]').
|
108
|
+
gsub(%r(("cardNum\\?":\\?")\d+), '\1[FILTERED]').
|
109
|
+
gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]')
|
110
|
+
end
|
111
|
+
|
112
|
+
private
|
113
|
+
|
114
|
+
# Customer data can be included in transactions where the payment method is a credit card
|
115
|
+
# but should not be sent when the payment method is a token
|
116
|
+
def add_customer_data(post, creditcard, options)
|
117
|
+
post[:profile] = {}
|
118
|
+
post[:profile][:firstName] = creditcard.first_name
|
119
|
+
post[:profile][:lastName] = creditcard.last_name
|
120
|
+
post[:profile][:email] = options[:email] if options[:email]
|
121
|
+
post[:customerIp] = options[:ip] if options[:ip]
|
122
|
+
end
|
123
|
+
|
124
|
+
def add_billing_address(post, options)
|
125
|
+
return unless address = options[:billing_address] || options[:address]
|
126
|
+
|
127
|
+
post[:billingDetails] = {}
|
128
|
+
post[:billingDetails][:street] = address[:address1]
|
129
|
+
post[:billingDetails][:city] = address[:city]
|
130
|
+
post[:billingDetails][:state] = address[:state]
|
131
|
+
post[:billingDetails][:country] = address[:country]
|
132
|
+
post[:billingDetails][:zip] = address[:zip]
|
133
|
+
post[:billingDetails][:phone] = address[:phone]
|
134
|
+
end
|
135
|
+
|
136
|
+
# The add_address_for_vaulting method is applicable to the store method, as the APIs address
|
137
|
+
# object is formatted differently from the standard transaction billing address
|
138
|
+
def add_address_for_vaulting(post, options)
|
139
|
+
return unless address = options[:billing_address] || options[:address]
|
140
|
+
|
141
|
+
post[:card][:billingAddress] = {}
|
142
|
+
post[:card][:billingAddress][:street] = address[:address1]
|
143
|
+
post[:card][:billingAddress][:street2] = address[:address2]
|
144
|
+
post[:card][:billingAddress][:city] = address[:city]
|
145
|
+
post[:card][:billingAddress][:zip] = address[:zip]
|
146
|
+
post[:card][:billingAddress][:country] = address[:country]
|
147
|
+
post[:card][:billingAddress][:state] = address[:state] if address[:state]
|
148
|
+
end
|
149
|
+
|
150
|
+
# This data is specific to creating a profile at the gateway's vault level
|
151
|
+
def add_profile_data(post, payment, options)
|
152
|
+
post[:firstName] = payment.first_name
|
153
|
+
post[:lastName] = payment.last_name
|
154
|
+
post[:dateOfBirth] = {}
|
155
|
+
post[:dateOfBirth][:year] = options[:date_of_birth][:year]
|
156
|
+
post[:dateOfBirth][:month] = options[:date_of_birth][:month]
|
157
|
+
post[:dateOfBirth][:day] = options[:date_of_birth][:day]
|
158
|
+
post[:email] = options[:email] if options[:email]
|
159
|
+
post[:ip] = options[:ip] if options[:ip]
|
160
|
+
|
161
|
+
if options[:phone]
|
162
|
+
post[:phone] = options[:phone]
|
163
|
+
elsif address = options[:billing_address] || options[:address]
|
164
|
+
post[:phone] = address[:phone] if address[:phone]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def add_store_data(post, payment, options)
|
169
|
+
post[:merchantCustomerId] = options[:customer_id] || SecureRandom.hex(12)
|
170
|
+
post[:locale] = options[:locale] || 'en_US'
|
171
|
+
post[:card][:holderName] = payment.name
|
172
|
+
end
|
173
|
+
|
174
|
+
# Paysafe expects minor units so we are not calling amount method on money parameter
|
175
|
+
def add_invoice(post, money, options)
|
176
|
+
post[:amount] = money
|
177
|
+
end
|
178
|
+
|
179
|
+
def add_payment(post, payment)
|
180
|
+
if payment.is_a?(String)
|
181
|
+
post[:card] = {}
|
182
|
+
post[:card][:paymentToken] = get_pm_from_store_auth(payment)
|
183
|
+
else
|
184
|
+
post[:card] = { cardExpiry: {} }
|
185
|
+
post[:card][:cardNum] = payment.number
|
186
|
+
post[:card][:cardExpiry][:month] = payment.month
|
187
|
+
post[:card][:cardExpiry][:year] = payment.year
|
188
|
+
post[:card][:cvv] = payment.verification_value
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def add_merchant_details(post, options)
|
193
|
+
return unless options[:merchant_descriptor]
|
194
|
+
|
195
|
+
post[:merchantDescriptor] = {}
|
196
|
+
post[:merchantDescriptor][:dynamicDescriptor] = options[:merchant_descriptor][:dynamic_descriptor] if options[:merchant_descriptor][:dynamic_descriptor]
|
197
|
+
post[:merchantDescriptor][:phone] = options[:merchant_descriptor][:phone] if options[:merchant_descriptor][:phone]
|
198
|
+
end
|
199
|
+
|
200
|
+
def add_three_d_secure(post, payment, options)
|
201
|
+
three_d_secure = options[:three_d_secure]
|
202
|
+
|
203
|
+
post[:authentication] = {}
|
204
|
+
post[:authentication][:eci] = three_d_secure[:eci]
|
205
|
+
post[:authentication][:cavv] = three_d_secure[:cavv]
|
206
|
+
post[:authentication][:xid] = three_d_secure[:xid] if three_d_secure[:xid]
|
207
|
+
post[:authentication][:threeDSecureVersion] = three_d_secure[:version]
|
208
|
+
post[:authentication][:directoryServerTransactionId] = three_d_secure[:ds_transaction_id] unless payment.is_a?(String) || !mastercard?(payment)
|
209
|
+
end
|
210
|
+
|
211
|
+
def add_airline_travel_details(post, options)
|
212
|
+
return unless options[:airline_travel_details]
|
213
|
+
|
214
|
+
post[:airlineTravelDetails] = {}
|
215
|
+
post[:airlineTravelDetails][:passengerName] = options[:airline_travel_details][:passenger_name] if options[:airline_travel_details][:passenger_name]
|
216
|
+
post[:airlineTravelDetails][:departureDate] = options[:airline_travel_details][:departure_date] if options[:airline_travel_details][:departure_date]
|
217
|
+
post[:airlineTravelDetails][:origin] = options[:airline_travel_details][:origin] if options[:airline_travel_details][:origin]
|
218
|
+
post[:airlineTravelDetails][:computerizedReservationSystem] = options[:airline_travel_details][:computerized_reservation_system] if options[:airline_travel_details][:computerized_reservation_system]
|
219
|
+
post[:airlineTravelDetails][:customerReferenceNumber] = options[:airline_travel_details][:customer_reference_number] if options[:airline_travel_details][:customer_reference_number]
|
220
|
+
|
221
|
+
add_ticket_details(post, options)
|
222
|
+
add_travel_agency_details(post, options)
|
223
|
+
add_trip_legs(post, options)
|
224
|
+
end
|
225
|
+
|
226
|
+
def add_ticket_details(post, options)
|
227
|
+
return unless ticket = options[:airline_travel_details][:ticket]
|
228
|
+
|
229
|
+
post[:airlineTravelDetails][:ticket] = {}
|
230
|
+
post[:airlineTravelDetails][:ticket][:ticketNumber] = ticket[:ticket_number] if ticket[:ticket_number]
|
231
|
+
post[:airlineTravelDetails][:ticket][:isRestrictedTicket] = ticket[:is_restricted_ticket] if ticket[:is_restricted_ticket]
|
232
|
+
end
|
233
|
+
|
234
|
+
def add_travel_agency_details(post, options)
|
235
|
+
return unless agency = options[:airline_travel_details][:travel_agency]
|
236
|
+
|
237
|
+
post[:airlineTravelDetails][:travelAgency] = {}
|
238
|
+
post[:airlineTravelDetails][:travelAgency][:name] = agency[:name] if agency[:name]
|
239
|
+
post[:airlineTravelDetails][:travelAgency][:code] = agency[:code] if agency[:code]
|
240
|
+
end
|
241
|
+
|
242
|
+
def add_trip_legs(post, options)
|
243
|
+
return unless trip_legs = options[:airline_travel_details][:trip_legs]
|
244
|
+
|
245
|
+
trip_legs_hash = {}
|
246
|
+
trip_legs.each.with_index(1) do |leg, i|
|
247
|
+
my_leg = "leg#{i}".to_sym
|
248
|
+
details = add_leg_details(my_leg, leg[1])
|
249
|
+
|
250
|
+
trip_legs_hash[my_leg] = details
|
251
|
+
end
|
252
|
+
post[:airlineTravelDetails][:tripLegs] = trip_legs_hash
|
253
|
+
end
|
254
|
+
|
255
|
+
def add_leg_details(obj, leg)
|
256
|
+
details = {}
|
257
|
+
add_flight_details(details, obj, leg)
|
258
|
+
details[:serviceClass] = leg[:service_class] if leg[:service_class]
|
259
|
+
details[:isStopOverAllowed] = leg[:is_stop_over_allowed] if leg[:is_stop_over_allowed]
|
260
|
+
details[:destination] = leg[:destination] if leg[:destination]
|
261
|
+
details[:fareBasis] = leg[:fare_basis] if leg[:fare_basis]
|
262
|
+
details[:departureDate] = leg[:departure_date] if leg[:departure_date]
|
263
|
+
|
264
|
+
details
|
265
|
+
end
|
266
|
+
|
267
|
+
def add_flight_details(details, obj, leg)
|
268
|
+
details[:flight] = {}
|
269
|
+
details[:flight][:carrierCode] = leg[:flight][:carrier_code] if leg[:flight][:carrier_code]
|
270
|
+
details[:flight][:flightNumber] = leg[:flight][:flight_number] if leg[:flight][:flight_number]
|
271
|
+
end
|
272
|
+
|
273
|
+
def add_split_pay_details(post, options)
|
274
|
+
return unless options[:split_pay]
|
275
|
+
|
276
|
+
split_pay = []
|
277
|
+
options[:split_pay].each do |pmnt|
|
278
|
+
split = {}
|
279
|
+
|
280
|
+
split[:linkedAccount] = pmnt[:linked_account]
|
281
|
+
split[:amount] = pmnt[:amount].to_i if pmnt[:amount]
|
282
|
+
split[:percent] = pmnt[:percent].to_i if pmnt[:percent]
|
283
|
+
|
284
|
+
split_pay << split
|
285
|
+
end
|
286
|
+
post[:splitpay] = split_pay
|
287
|
+
end
|
288
|
+
|
289
|
+
def add_stored_credential(post, options)
|
290
|
+
return unless options[:stored_credential]
|
291
|
+
|
292
|
+
post[:storedCredential] = {}
|
293
|
+
|
294
|
+
case options[:stored_credential][:initial_transaction]
|
295
|
+
when true
|
296
|
+
post[:storedCredential][:occurrence] = 'INITIAL'
|
297
|
+
when false
|
298
|
+
post[:storedCredential][:occurrence] = 'SUBSEQUENT'
|
299
|
+
end
|
300
|
+
|
301
|
+
case options[:stored_credential][:reason_type]
|
302
|
+
when 'recurring', 'installment'
|
303
|
+
post[:storedCredential][:type] = 'RECURRING'
|
304
|
+
when 'unscheduled'
|
305
|
+
if options[:stored_credential][:initiator] == 'merchant'
|
306
|
+
post[:storedCredential][:type] = 'TOPUP'
|
307
|
+
elsif options[:stored_credential][:initiator] == 'cardholder'
|
308
|
+
post[:storedCredential][:type] = 'ADHOC'
|
309
|
+
else
|
310
|
+
return
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
post[:storedCredential][:initialTransactionId] = options[:stored_credential][:network_transaction_id] if options[:stored_credential][:network_transaction_id]
|
315
|
+
end
|
316
|
+
|
317
|
+
def mastercard?(payment)
|
318
|
+
return false unless payment.respond_to?(:brand)
|
319
|
+
|
320
|
+
payment.brand == 'master'
|
321
|
+
end
|
322
|
+
|
323
|
+
def parse(body)
|
324
|
+
return {} if body.empty?
|
325
|
+
|
326
|
+
JSON.parse(body)
|
327
|
+
end
|
328
|
+
|
329
|
+
def commit(method, action, parameters, options)
|
330
|
+
url = url(action)
|
331
|
+
raw_response = ssl_request(method, url, post_data(parameters, options), headers)
|
332
|
+
response = parse(raw_response)
|
333
|
+
success = success_from(response)
|
334
|
+
|
335
|
+
Response.new(
|
336
|
+
success,
|
337
|
+
message_from(success, response),
|
338
|
+
response,
|
339
|
+
authorization: authorization_from(action, response),
|
340
|
+
avs_result: AVSResult.new(code: response['avsResponse']),
|
341
|
+
cvv_result: CVVResult.new(response['cvvVerification']),
|
342
|
+
test: test?,
|
343
|
+
error_code: success ? nil : error_code_from(response)
|
344
|
+
)
|
345
|
+
end
|
346
|
+
|
347
|
+
def headers
|
348
|
+
{
|
349
|
+
'Content-Type' => 'application/json',
|
350
|
+
'Authorization' => 'Basic ' + Base64.strict_encode64("#{@options[:username]}:#{@options[:password]}")
|
351
|
+
}
|
352
|
+
end
|
353
|
+
|
354
|
+
def url(action, options = {})
|
355
|
+
base_url = (test? ? test_url : live_url)
|
356
|
+
|
357
|
+
if action.include? 'profiles'
|
358
|
+
"#{base_url}/customervault/v1/#{action}"
|
359
|
+
else
|
360
|
+
"#{base_url}/cardpayments/v1/accounts/#{@options[:account_id]}/#{action}"
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
def success_from(response)
|
365
|
+
return false if response['status'] == 'FAILED' || response['error']
|
366
|
+
|
367
|
+
true
|
368
|
+
end
|
369
|
+
|
370
|
+
def message_from(success, response)
|
371
|
+
return response['status'] unless response['error']
|
372
|
+
|
373
|
+
"Error(s)- code:#{response['error']['code']}, message:#{response['error']['message']}"
|
374
|
+
end
|
375
|
+
|
376
|
+
def authorization_from(action, response)
|
377
|
+
if action == 'profiles'
|
378
|
+
pm = response['cards'].first['paymentToken']
|
379
|
+
"#{pm}|#{response['id']}"
|
380
|
+
else
|
381
|
+
response['id']
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
def get_pm_from_store_auth(authorization)
|
386
|
+
authorization.split('|')[0]
|
387
|
+
end
|
388
|
+
|
389
|
+
def get_id_from_store_auth(authorization)
|
390
|
+
authorization.split('|')[1]
|
391
|
+
end
|
392
|
+
|
393
|
+
def post_data(parameters = {}, options = {})
|
394
|
+
return unless parameters.present?
|
395
|
+
|
396
|
+
parameters[:merchantRefNum] = options[:merchant_ref_num] || SecureRandom.hex(16).to_s
|
397
|
+
|
398
|
+
parameters.to_json
|
399
|
+
end
|
400
|
+
|
401
|
+
def error_code_from(response)
|
402
|
+
return unless response['error']
|
403
|
+
|
404
|
+
response['error']['code']
|
405
|
+
end
|
406
|
+
|
407
|
+
def handle_response(response)
|
408
|
+
response.body
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
@@ -4,7 +4,7 @@ module ActiveMerchant #:nodoc:
|
|
4
4
|
self.live_url = self.test_url = 'https://secure.payscout.com/api/transact.php'
|
5
5
|
|
6
6
|
self.supported_countries = ['US']
|
7
|
-
self.supported_cardtypes = [
|
7
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
8
8
|
self.default_currency = 'USD'
|
9
9
|
self.homepage_url = 'http://www.payscout.com/'
|
10
10
|
self.display_name = 'Payscout'
|
@@ -41,7 +41,6 @@ module ActiveMerchant #:nodoc:
|
|
41
41
|
commit('capture', money, post)
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
44
|
def refund(money, authorization, options = {})
|
46
45
|
post = {}
|
47
46
|
post[:transactionid] = authorization
|
@@ -63,7 +62,7 @@ module ActiveMerchant #:nodoc:
|
|
63
62
|
post[:address1] = address[:address1].to_s
|
64
63
|
post[:address2] = address[:address2].to_s
|
65
64
|
post[:city] = address[:city].to_s
|
66
|
-
post[:state] = (address[:state].blank?
|
65
|
+
post[:state] = (address[:state].blank? ? 'n/a' : address[:state])
|
67
66
|
post[:zip] = address[:zip].to_s
|
68
67
|
post[:country] = address[:country].to_s
|
69
68
|
post[:phone] = address[:phone].to_s
|
@@ -79,7 +78,7 @@ module ActiveMerchant #:nodoc:
|
|
79
78
|
post[:shipping_address2] = address[:address2].to_s
|
80
79
|
post[:shipping_city] = address[:city].to_s
|
81
80
|
post[:shipping_country] = address[:country].to_s
|
82
|
-
post[:shipping_state] = (address[:state].blank?
|
81
|
+
post[:shipping_state] = (address[:state].blank? ? 'n/a' : address[:state])
|
83
82
|
post[:shipping_zip] = address[:zip].to_s
|
84
83
|
post[:shipping_email] = address[:email].to_s
|
85
84
|
end
|
@@ -103,7 +102,7 @@ module ActiveMerchant #:nodoc:
|
|
103
102
|
end
|
104
103
|
|
105
104
|
def parse(body)
|
106
|
-
Hash[body.split('&').map{|x|x.split('=')}]
|
105
|
+
Hash[body.split('&').map { |x| x.split('=') }]
|
107
106
|
end
|
108
107
|
|
109
108
|
def commit(action, money, parameters)
|
@@ -117,12 +116,11 @@ module ActiveMerchant #:nodoc:
|
|
117
116
|
message = message_from(response)
|
118
117
|
test_mode = (test? || message =~ /TESTMODE/)
|
119
118
|
Response.new(success?(response), message, response,
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
)
|
119
|
+
test: test_mode,
|
120
|
+
authorization: response['transactionid'],
|
121
|
+
fraud_review: fraud_review?(response),
|
122
|
+
avs_result: { code: response['avsresponse'] },
|
123
|
+
cvv_result: response['cvvresponse'])
|
126
124
|
end
|
127
125
|
|
128
126
|
def message_from(response)
|
@@ -153,10 +151,9 @@ module ActiveMerchant #:nodoc:
|
|
153
151
|
post[:password] = @options[:password]
|
154
152
|
post[:type] = action
|
155
153
|
|
156
|
-
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join(
|
154
|
+
request = post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
157
155
|
request
|
158
156
|
end
|
159
157
|
end
|
160
158
|
end
|
161
159
|
end
|
162
|
-
|