swiss-crm-activemerchant 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +4033 -0
- data/CONTRIBUTORS +568 -0
- data/MIT-LICENSE +20 -0
- data/README.md +252 -0
- data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
- data/lib/active_merchant/billing/avs_result.rb +95 -0
- data/lib/active_merchant/billing/base.rb +48 -0
- data/lib/active_merchant/billing/check.rb +112 -0
- data/lib/active_merchant/billing/compatibility.rb +118 -0
- data/lib/active_merchant/billing/credit_card.rb +451 -0
- data/lib/active_merchant/billing/credit_card_formatting.rb +24 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +512 -0
- data/lib/active_merchant/billing/cvv_result.rb +37 -0
- data/lib/active_merchant/billing/gateway.rb +332 -0
- data/lib/active_merchant/billing/gateways/adyen.rb +774 -0
- 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 +205 -0
- data/lib/active_merchant/billing/gateways/authorize_net.rb +1125 -0
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +424 -0
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +977 -0
- data/lib/active_merchant/billing/gateways/axcessms.rb +242 -0
- data/lib/active_merchant/billing/gateways/balanced.rb +263 -0
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
- data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
- data/lib/active_merchant/billing/gateways/banwire.rb +116 -0
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
- data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +474 -0
- data/lib/active_merchant/billing/gateways/beanstream.rb +238 -0
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +57 -0
- data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -0
- data/lib/active_merchant/billing/gateways/blue_snap.rb +644 -0
- data/lib/active_merchant/billing/gateways/bogus.rb +190 -0
- data/lib/active_merchant/billing/gateways/borgun.rb +272 -0
- data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +28 -0
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +952 -0
- data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
- data/lib/active_merchant/billing/gateways/cams.rb +230 -0
- data/lib/active_merchant/billing/gateways/card_connect.rb +338 -0
- data/lib/active_merchant/billing/gateways/card_save.rb +21 -0
- data/lib/active_merchant/billing/gateways/card_stream.rb +394 -0
- 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 +235 -0
- data/lib/active_merchant/billing/gateways/cc5.rb +198 -0
- data/lib/active_merchant/billing/gateways/cecabank.rb +249 -0
- data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
- data/lib/active_merchant/billing/gateways/checkout.rb +212 -0
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +587 -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/commerce_hub.rb +366 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
- data/lib/active_merchant/billing/gateways/conekta.rb +230 -0
- data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
- data/lib/active_merchant/billing/gateways/credorax.rb +526 -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/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +1148 -0
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +343 -0
- data/lib/active_merchant/billing/gateways/data_cash.rb +302 -0
- 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 +199 -0
- data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
- data/lib/active_merchant/billing/gateways/ebanx.rb +346 -0
- data/lib/active_merchant/billing/gateways/efsnet.rb +215 -0
- data/lib/active_merchant/billing/gateways/elavon.rb +475 -0
- data/lib/active_merchant/billing/gateways/element.rb +406 -0
- data/lib/active_merchant/billing/gateways/epay.rb +296 -0
- data/lib/active_merchant/billing/gateways/evo_ca.rb +307 -0
- data/lib/active_merchant/billing/gateways/eway.rb +226 -0
- data/lib/active_merchant/billing/gateways/eway_managed.rb +289 -0
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +578 -0
- data/lib/active_merchant/billing/gateways/exact.rb +219 -0
- data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +223 -0
- data/lib/active_merchant/billing/gateways/federated_canada.rb +158 -0
- data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
- data/lib/active_merchant/billing/gateways/first_giving.rb +143 -0
- data/lib/active_merchant/billing/gateways/first_pay.rb +182 -0
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +452 -0
- 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/fluidpay.rb +275 -0
- data/lib/active_merchant/billing/gateways/forte.rb +286 -0
- data/lib/active_merchant/billing/gateways/garanti.rb +256 -0
- data/lib/active_merchant/billing/gateways/global_collect.rb +580 -0
- data/lib/active_merchant/billing/gateways/global_transport.rb +193 -0
- data/lib/active_merchant/billing/gateways/hdfc.rb +205 -0
- data/lib/active_merchant/billing/gateways/hps.rb +472 -0
- data/lib/active_merchant/billing/gateways/iats_payments.rb +312 -0
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
- data/lib/active_merchant/billing/gateways/inspire.rb +213 -0
- data/lib/active_merchant/billing/gateways/instapay.rb +159 -0
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
- data/lib/active_merchant/billing/gateways/iridium.rb +467 -0
- data/lib/active_merchant/billing/gateways/itransact.rb +448 -0
- data/lib/active_merchant/billing/gateways/iveri.rb +290 -0
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +395 -0
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
- data/lib/active_merchant/billing/gateways/klarna.rb +317 -0
- data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
- data/lib/active_merchant/billing/gateways/kushki.rb +297 -0
- data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
- data/lib/active_merchant/billing/gateways/linkpoint.rb +448 -0
- data/lib/active_merchant/billing/gateways/litle.rb +643 -0
- data/lib/active_merchant/billing/gateways/mastercard.rb +286 -0
- data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +348 -0
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +228 -0
- data/lib/active_merchant/billing/gateways/merchant_one.rb +110 -0
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +313 -0
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +284 -0
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +248 -0
- data/lib/active_merchant/billing/gateways/mercury.rb +352 -0
- data/lib/active_merchant/billing/gateways/metrics_global.rb +293 -0
- data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
- data/lib/active_merchant/billing/gateways/migs.rb +329 -0
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +215 -0
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +424 -0
- data/lib/active_merchant/billing/gateways/moneris.rb +488 -0
- data/lib/active_merchant/billing/gateways/money_movers.rb +150 -0
- data/lib/active_merchant/billing/gateways/mundipagg.rb +366 -0
- data/lib/active_merchant/billing/gateways/nab_transact.rb +299 -0
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
- data/lib/active_merchant/billing/gateways/net_registry.rb +198 -0
- data/lib/active_merchant/billing/gateways/netaxept.rb +180 -0
- data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
- data/lib/active_merchant/billing/gateways/netbilling.rb +229 -0
- data/lib/active_merchant/billing/gateways/netpay.rb +223 -0
- data/lib/active_merchant/billing/gateways/network_merchants.rb +238 -0
- data/lib/active_merchant/billing/gateways/nmi.rb +396 -0
- data/lib/active_merchant/billing/gateways/ogone.rb +509 -0
- data/lib/active_merchant/billing/gateways/omise.rb +323 -0
- data/lib/active_merchant/billing/gateways/openpay.rb +246 -0
- data/lib/active_merchant/billing/gateways/opp.rb +394 -0
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +331 -0
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +45 -0
- data/lib/active_merchant/billing/gateways/orbital.rb +1267 -0
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +206 -0
- data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
- data/lib/active_merchant/billing/gateways/pago_facil.rb +120 -0
- 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 +277 -0
- data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
- data/lib/active_merchant/billing/gateways/pay_junction.rb +390 -0
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
- data/lib/active_merchant/billing/gateways/pay_secure.rb +110 -0
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +224 -0
- data/lib/active_merchant/billing/gateways/payeezy.rb +513 -0
- data/lib/active_merchant/billing/gateways/payex.rb +409 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +235 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +42 -0
- data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
- data/lib/active_merchant/billing/gateways/payflow.rb +473 -0
- data/lib/active_merchant/billing/gateways/payflow_express.rb +220 -0
- data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +14 -0
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +20 -0
- data/lib/active_merchant/billing/gateways/payment_express.rb +373 -0
- data/lib/active_merchant/billing/gateways/paymentez.rb +365 -0
- data/lib/active_merchant/billing/gateways/paymill.rb +369 -0
- data/lib/active_merchant/billing/gateways/paynetworx.rb +228 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +718 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +69 -0
- data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +136 -0
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +44 -0
- data/lib/active_merchant/billing/gateways/paypal_express.rb +272 -0
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
- data/lib/active_merchant/billing/gateways/paypal_standard.rb +281 -0
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +159 -0
- data/lib/active_merchant/billing/gateways/paystation.rb +204 -0
- data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
- data/lib/active_merchant/billing/gateways/payu_latam.rb +482 -0
- data/lib/active_merchant/billing/gateways/payway.rb +207 -0
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +273 -0
- data/lib/active_merchant/billing/gateways/pixxels.rb +263 -0
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +283 -0
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
- data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
- data/lib/active_merchant/billing/gateways/psl_card.rb +295 -0
- data/lib/active_merchant/billing/gateways/qbms.rb +302 -0
- data/lib/active_merchant/billing/gateways/quantum.rb +274 -0
- 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 +24 -0
- data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
- 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 +400 -0
- data/lib/active_merchant/billing/gateways/redsys.rb +723 -0
- 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 +446 -0
- data/lib/active_merchant/billing/gateways/sage_pay.rb +434 -0
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +141 -0
- data/lib/active_merchant/billing/gateways/secure_net.rb +260 -0
- data/lib/active_merchant/billing/gateways/secure_pay.rb +191 -0
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +290 -0
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +103 -0
- data/lib/active_merchant/billing/gateways/securion_pay.rb +305 -0
- data/lib/active_merchant/billing/gateways/shift4.rb +345 -0
- data/lib/active_merchant/billing/gateways/simetrik.rb +368 -0
- data/lib/active_merchant/billing/gateways/skip_jack.rb +450 -0
- data/lib/active_merchant/billing/gateways/smart_ps.rb +274 -0
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +354 -0
- data/lib/active_merchant/billing/gateways/stripe.rb +866 -0
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +602 -0
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +151 -0
- data/lib/active_merchant/billing/gateways/telr.rb +273 -0
- data/lib/active_merchant/billing/gateways/tns.rb +23 -0
- data/lib/active_merchant/billing/gateways/trans_first.rb +240 -0
- 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 +21 -0
- data/lib/active_merchant/billing/gateways/transnational.rb +9 -0
- data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +500 -0
- data/lib/active_merchant/billing/gateways/usa_epay.rb +24 -0
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1612 -0
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +367 -0
- data/lib/active_merchant/billing/gateways/vanco.rb +303 -0
- data/lib/active_merchant/billing/gateways/verifi.rb +224 -0
- data/lib/active_merchant/billing/gateways/viaklix.rb +171 -0
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
- data/lib/active_merchant/billing/gateways/wepay.rb +235 -0
- data/lib/active_merchant/billing/gateways/wirecard.rb +430 -0
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
- data/lib/active_merchant/billing/gateways/worldpay.rb +1050 -0
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
- data/lib/active_merchant/billing/gateways.rb +14 -0
- data/lib/active_merchant/billing/model.rb +30 -0
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
- data/lib/active_merchant/billing/payment_token.rb +21 -0
- data/lib/active_merchant/billing/rails.rb +3 -0
- data/lib/active_merchant/billing/response.rb +121 -0
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +16 -0
- data/lib/active_merchant/connection.rb +194 -0
- data/lib/active_merchant/country.rb +338 -0
- data/lib/active_merchant/empty.rb +20 -0
- data/lib/active_merchant/errors.rb +38 -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 +3 -0
- data/lib/active_merchant.rb +63 -0
- data/lib/activemerchant.rb +1 -0
- data/lib/certs/cacert.pem +3214 -0
- data/lib/support/gateway_support.rb +69 -0
- data/lib/support/outbound_hosts.rb +28 -0
- data/lib/support/ssl_verify.rb +88 -0
- data/lib/support/ssl_version.rb +86 -0
- metadata +506 -0
@@ -0,0 +1,274 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'check.rb')
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class SmartPs < Gateway #:nodoc:
|
6
|
+
##
|
7
|
+
# This is the base gateway for processors who use the smartPS processing system
|
8
|
+
|
9
|
+
self.abstract_class = true
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
requires!(options, :login, :password)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
# Pass :store => true in the options to store the
|
17
|
+
# payment info at the gateway and get a generated
|
18
|
+
# customer_vault_id in the response.
|
19
|
+
# Pass :store => some_number_or_string to specify the
|
20
|
+
# customer_vault_id the gateway should use (make sure it's
|
21
|
+
# unique).
|
22
|
+
def authorize(money, creditcard, options = {})
|
23
|
+
post = {}
|
24
|
+
add_invoice(post, options)
|
25
|
+
add_payment_source(post, creditcard, options)
|
26
|
+
add_address(post, options[:billing_address] || options[:address])
|
27
|
+
add_address(post, options[:shipping_address], 'shipping')
|
28
|
+
add_customer_data(post, options)
|
29
|
+
add_currency(post, money, options)
|
30
|
+
add_taxes(post, options)
|
31
|
+
add_processor(post, options)
|
32
|
+
commit('auth', money, post)
|
33
|
+
end
|
34
|
+
|
35
|
+
def purchase(money, payment_source, options = {})
|
36
|
+
post = {}
|
37
|
+
add_invoice(post, options)
|
38
|
+
add_payment_source(post, payment_source, options)
|
39
|
+
add_address(post, options[:billing_address] || options[:address])
|
40
|
+
add_address(post, options[:shipping_address], 'shipping')
|
41
|
+
add_customer_data(post, options)
|
42
|
+
add_currency(post, money, options)
|
43
|
+
add_taxes(post, options)
|
44
|
+
add_processor(post, options)
|
45
|
+
add_eci(post, options)
|
46
|
+
commit('sale', money, post)
|
47
|
+
end
|
48
|
+
|
49
|
+
def capture(money, authorization, options = {})
|
50
|
+
post = {}
|
51
|
+
post[:transactionid] = authorization
|
52
|
+
commit('capture', money, post)
|
53
|
+
end
|
54
|
+
|
55
|
+
def void(authorization, options = {})
|
56
|
+
post = {}
|
57
|
+
post[:transactionid] = authorization
|
58
|
+
commit('void', nil, post)
|
59
|
+
end
|
60
|
+
|
61
|
+
def credit(money, payment_source, options = {})
|
62
|
+
post = {}
|
63
|
+
add_invoice(post, options)
|
64
|
+
add_payment_source(post, payment_source, options)
|
65
|
+
add_address(post, options[:billing_address] || options[:address])
|
66
|
+
add_customer_data(post, options)
|
67
|
+
add_sku(post, options)
|
68
|
+
add_currency(post, money, options)
|
69
|
+
add_processor(post, options)
|
70
|
+
commit('credit', money, post)
|
71
|
+
end
|
72
|
+
|
73
|
+
def refund(money, auth, options = {})
|
74
|
+
post = {}
|
75
|
+
add_transaction(post, auth)
|
76
|
+
commit('refund', money, post)
|
77
|
+
end
|
78
|
+
|
79
|
+
def verify(credit_card, options = {})
|
80
|
+
MultiResponse.run(:use_first_response) do |r|
|
81
|
+
r.process { authorize(100, credit_card, options) }
|
82
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Update the values (such as CC expiration) stored at
|
87
|
+
# the gateway. The CC number must be supplied in the
|
88
|
+
# CreditCard object.
|
89
|
+
def update(vault_id, creditcard, options = {})
|
90
|
+
post = {}
|
91
|
+
post[:customer_vault] = 'update_customer'
|
92
|
+
add_customer_vault_id(post, vault_id)
|
93
|
+
add_creditcard(post, creditcard, options)
|
94
|
+
add_address(post, options[:billing_address] || options[:address])
|
95
|
+
add_customer_data(post, options)
|
96
|
+
|
97
|
+
commit(nil, nil, post)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Amend an existing transaction
|
101
|
+
def amend(auth, options = {})
|
102
|
+
post = {}
|
103
|
+
add_invoice(post, options)
|
104
|
+
add_transaction(post, auth)
|
105
|
+
commit('update', nil, post)
|
106
|
+
end
|
107
|
+
|
108
|
+
def delete(vault_id)
|
109
|
+
post = {}
|
110
|
+
post[:customer_vault] = 'delete_customer'
|
111
|
+
add_customer_vault_id(post, vault_id)
|
112
|
+
commit(nil, nil, post)
|
113
|
+
end
|
114
|
+
|
115
|
+
# To match the other stored-value gateways, like TrustCommerce,
|
116
|
+
# store and unstore need to be defined
|
117
|
+
def store(payment_source, options = {})
|
118
|
+
post = {}
|
119
|
+
billing_id = options.delete(:billing_id).to_s || true
|
120
|
+
add_payment_source(post, payment_source, store: billing_id)
|
121
|
+
add_address(post, options[:billing_address] || options[:address])
|
122
|
+
add_customer_data(post, options)
|
123
|
+
commit(nil, nil, post)
|
124
|
+
end
|
125
|
+
|
126
|
+
alias unstore delete
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
def add_customer_data(post, options)
|
131
|
+
post[:email] = options[:email] if options.has_key? :email
|
132
|
+
|
133
|
+
post[:ipaddress] = options[:ip] if options.has_key? :ip
|
134
|
+
end
|
135
|
+
|
136
|
+
def add_address(post, address, prefix = '')
|
137
|
+
prefix += '_' unless prefix.blank?
|
138
|
+
unless address.blank? || address.values.blank?
|
139
|
+
post[prefix + 'address1'] = address[:address1].to_s
|
140
|
+
post[prefix + 'address2'] = address[:address2].to_s unless address[:address2].blank?
|
141
|
+
post[prefix + 'company'] = address[:company].to_s
|
142
|
+
post[prefix + 'phone'] = address[:phone].to_s
|
143
|
+
post[prefix + 'zip'] = address[:zip].to_s
|
144
|
+
post[prefix + 'city'] = address[:city].to_s
|
145
|
+
post[prefix + 'country'] = address[:country].to_s
|
146
|
+
post[prefix + 'state'] = address[:state].blank? ? 'n/a' : address[:state]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def add_currency(post, money, options)
|
151
|
+
post[:currency] = options[:currency] || currency(money)
|
152
|
+
end
|
153
|
+
|
154
|
+
def add_taxes(post, options)
|
155
|
+
post[:tax] = amount(options[:tax])
|
156
|
+
end
|
157
|
+
|
158
|
+
def add_processor(post, options)
|
159
|
+
post[:processor] = options[:processor] unless options[:processor].nil?
|
160
|
+
end
|
161
|
+
|
162
|
+
def add_invoice(post, options)
|
163
|
+
post[:orderid] = options[:order_id].to_s.gsub(/[^\w.]/, '')
|
164
|
+
end
|
165
|
+
|
166
|
+
def add_payment_source(params, source, options = {})
|
167
|
+
case determine_funding_source(source)
|
168
|
+
when :vault then add_customer_vault_id(params, source)
|
169
|
+
when :credit_card then add_creditcard(params, source, options)
|
170
|
+
when :check then add_check(params, source, options)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def add_customer_vault_id(params, vault_id)
|
175
|
+
params[:customer_vault_id] = vault_id
|
176
|
+
end
|
177
|
+
|
178
|
+
def add_creditcard(post, creditcard, options)
|
179
|
+
if options[:store]
|
180
|
+
post[:customer_vault] = 'add_customer'
|
181
|
+
post[:customer_vault_id] = options[:store] unless options[:store] == true
|
182
|
+
end
|
183
|
+
post[:ccnumber] = creditcard.number
|
184
|
+
post[:cvv] = creditcard.verification_value if creditcard.verification_value?
|
185
|
+
post[:ccexp] = expdate(creditcard)
|
186
|
+
post[:firstname] = creditcard.first_name
|
187
|
+
post[:lastname] = creditcard.last_name
|
188
|
+
end
|
189
|
+
|
190
|
+
def add_check(post, check, options)
|
191
|
+
if options[:store]
|
192
|
+
post[:customer_vault] = 'add_customer'
|
193
|
+
post[:customer_vault_id] = options[:store] unless options[:store] == true
|
194
|
+
end
|
195
|
+
|
196
|
+
post[:payment] = 'check' # Set transaction to ACH
|
197
|
+
post[:checkname] = check.name # The name on the customer's Checking Account
|
198
|
+
post[:checkaba] = check.routing_number # The customer's bank routing number
|
199
|
+
post[:checkaccount] = check.account_number # The customer's account number
|
200
|
+
post[:account_holder_type] = check.account_holder_type # The customer's type of ACH account
|
201
|
+
post[:account_type] = check.account_type # The customer's type of ACH account
|
202
|
+
end
|
203
|
+
|
204
|
+
def add_sku(post, options)
|
205
|
+
post['product_sku_#'] = options[:sku] || options['product_sku_#']
|
206
|
+
end
|
207
|
+
|
208
|
+
def add_transaction(post, auth)
|
209
|
+
post[:transactionid] = auth
|
210
|
+
end
|
211
|
+
|
212
|
+
def add_eci(post, options)
|
213
|
+
post[:billing_method] = options[:eci] if options[:eci]
|
214
|
+
end
|
215
|
+
|
216
|
+
def parse(body)
|
217
|
+
results = {}
|
218
|
+
body.split(/&/).each do |pair|
|
219
|
+
key, val = pair.split(/=/)
|
220
|
+
results[key] = val
|
221
|
+
end
|
222
|
+
|
223
|
+
results
|
224
|
+
end
|
225
|
+
|
226
|
+
def commit(action, money, parameters)
|
227
|
+
parameters[:amount] = localized_amount(money, parameters[:currency] || default_currency) if money
|
228
|
+
response = parse(ssl_post(self.live_url, post_data(action, parameters)))
|
229
|
+
Response.new(response['response'] == '1', message_from(response), response,
|
230
|
+
authorization: (response['transactionid'] || response['customer_vault_id']),
|
231
|
+
test: test?,
|
232
|
+
cvv_result: response['cvvresponse'],
|
233
|
+
avs_result: { code: response['avsresponse'] })
|
234
|
+
end
|
235
|
+
|
236
|
+
def expdate(creditcard)
|
237
|
+
year = sprintf('%.04i', creditcard.year)
|
238
|
+
month = sprintf('%.02i', creditcard.month)
|
239
|
+
|
240
|
+
"#{month}#{year[-2..-1]}"
|
241
|
+
end
|
242
|
+
|
243
|
+
def message_from(response)
|
244
|
+
case response['responsetext']
|
245
|
+
when 'SUCCESS', 'Approved', nil # This is dubious, but responses from UPDATE are nil.
|
246
|
+
'This transaction has been approved'
|
247
|
+
when 'DECLINE'
|
248
|
+
'This transaction has been declined'
|
249
|
+
else
|
250
|
+
response['responsetext']
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def post_data(action, parameters = {})
|
255
|
+
post = {}
|
256
|
+
post[:username] = @options[:login]
|
257
|
+
post[:password] = @options[:password]
|
258
|
+
post[:type] = action if action
|
259
|
+
|
260
|
+
request = post.merge(parameters).map { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
261
|
+
request
|
262
|
+
end
|
263
|
+
|
264
|
+
def determine_funding_source(source)
|
265
|
+
case
|
266
|
+
when source.is_a?(String) then :vault
|
267
|
+
when CreditCard.card_companies.include?(card_brand(source)) then :credit_card
|
268
|
+
when card_brand(source) == 'check' then :check
|
269
|
+
else raise ArgumentError, 'Unsupported funding source provided'
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class SoEasyPayGateway < Gateway
|
4
|
+
self.live_url = self.test_url = 'https://secure.soeasypay.com/gateway.asmx'
|
5
|
+
self.money_format = :cents
|
6
|
+
|
7
|
+
self.supported_countries = %w[
|
8
|
+
US CA AT BE BG HR CY CZ DK EE
|
9
|
+
FI FR DE GR HU IE IT LV LT LU
|
10
|
+
MT NL PL PT RO SK SI ES SE GB
|
11
|
+
IS NO CH
|
12
|
+
]
|
13
|
+
self.supported_cardtypes = %i[visa master american_express discover maestro jcb diners_club]
|
14
|
+
self.homepage_url = 'http://www.soeasypay.com/'
|
15
|
+
self.display_name = 'SoEasyPay'
|
16
|
+
|
17
|
+
def initialize(options = {})
|
18
|
+
requires!(options, :login, :password)
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
def authorize(money, payment_source, options = {})
|
23
|
+
if payment_source.respond_to?(:number)
|
24
|
+
commit('AuthorizeTransaction', do_authorization(money, payment_source, options), options)
|
25
|
+
else
|
26
|
+
commit('ReauthorizeTransaction', do_reauthorization(money, payment_source, options), options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def purchase(money, payment_source, options = {})
|
31
|
+
if payment_source.respond_to?(:number)
|
32
|
+
commit('SaleTransaction', do_sale(money, payment_source, options), options)
|
33
|
+
else
|
34
|
+
commit('RebillTransaction', do_rebill(money, payment_source, options), options)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def capture(money, authorization, options = {})
|
39
|
+
commit('CaptureTransaction', do_capture(money, authorization, options), options)
|
40
|
+
end
|
41
|
+
|
42
|
+
def refund(money, authorization, options = {})
|
43
|
+
commit('RefundTransaction', do_refund(money, authorization, options), options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def void(authorization, options = {})
|
47
|
+
commit('CancelTransaction', do_void(authorization, options), options)
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def do_authorization(money, card, options)
|
53
|
+
build_soap('AuthorizeTransaction') do |soap|
|
54
|
+
fill_credentials(soap, options)
|
55
|
+
fill_order_info(soap, money, options)
|
56
|
+
fill_cardholder(soap, card, options)
|
57
|
+
fill_card(soap, card)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def do_sale(money, card, options)
|
62
|
+
build_soap('SaleTransaction') do |soap|
|
63
|
+
fill_credentials(soap, options)
|
64
|
+
fill_order_info(soap, money, options)
|
65
|
+
fill_cardholder(soap, card, options)
|
66
|
+
fill_card(soap, card)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def do_reauthorization(money, authorization, options)
|
71
|
+
build_soap('ReauthorizeTransaction') do |soap|
|
72
|
+
fill_credentials(soap, options)
|
73
|
+
fill_order_info(soap, money, options)
|
74
|
+
fill_transaction_id(soap, authorization)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def do_rebill(money, authorization, options)
|
79
|
+
build_soap('RebillTransaction') do |soap|
|
80
|
+
fill_credentials(soap, options)
|
81
|
+
fill_order_info(soap, money, options)
|
82
|
+
fill_transaction_id(soap, authorization)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def do_capture(money, authorization, options)
|
87
|
+
build_soap('CaptureTransaction') do |soap|
|
88
|
+
fill_credentials(soap, options)
|
89
|
+
fill_order_info(soap, money, options, :no_currency)
|
90
|
+
fill_transaction_id(soap, authorization)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def do_refund(money, authorization, options)
|
95
|
+
build_soap('RefundTransaction') do |soap|
|
96
|
+
fill_credentials(soap, options)
|
97
|
+
fill_order_info(soap, money, options, :no_currency)
|
98
|
+
fill_transaction_id(soap, authorization)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def do_void(authorization, options)
|
103
|
+
build_soap('CancelTransaction') do |soap|
|
104
|
+
fill_credentials(soap, options)
|
105
|
+
fill_transaction_id(soap, authorization)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def fill_credentials(soap, options)
|
110
|
+
soap.tag!('websiteID', @options[:login].to_s)
|
111
|
+
soap.tag!('password', @options[:password].to_s)
|
112
|
+
end
|
113
|
+
|
114
|
+
def fill_cardholder(soap, card, options)
|
115
|
+
ch_info = options[:billing_address] || options[:address]
|
116
|
+
|
117
|
+
soap.tag!('customerIP', options[:ip].to_s)
|
118
|
+
name = card.name || ch_info[:name]
|
119
|
+
soap.tag!('cardHolderName', name.to_s)
|
120
|
+
address = ch_info[:address1] || ''
|
121
|
+
address << ch_info[:address2] if ch_info[:address2]
|
122
|
+
soap.tag!('cardHolderAddress', address.to_s)
|
123
|
+
soap.tag!('cardHolderZipcode', ch_info[:zip].to_s)
|
124
|
+
soap.tag!('cardHolderCity', ch_info[:city].to_s)
|
125
|
+
soap.tag!('cardHolderState', ch_info[:state].to_s)
|
126
|
+
soap.tag!('cardHolderCountryCode', ch_info[:country].to_s)
|
127
|
+
soap.tag!('cardHolderPhone', ch_info[:phone].to_s)
|
128
|
+
soap.tag!('cardHolderEmail', options[:email].to_s)
|
129
|
+
end
|
130
|
+
|
131
|
+
def fill_transaction_id(soap, transaction_id)
|
132
|
+
soap.tag!('transactionID', transaction_id.to_s)
|
133
|
+
end
|
134
|
+
|
135
|
+
def fill_card(soap, card)
|
136
|
+
soap.tag!('cardNumber', card.number.to_s)
|
137
|
+
soap.tag!('cardSecurityCode', card.verification_value.to_s)
|
138
|
+
soap.tag!('cardExpireMonth', card.month.to_s.rjust(2, '0'))
|
139
|
+
soap.tag!('cardExpireYear', card.year.to_s)
|
140
|
+
end
|
141
|
+
|
142
|
+
def fill_order_info(soap, money, options, skip_currency = false)
|
143
|
+
soap.tag!('orderID', options[:order_id].to_s)
|
144
|
+
soap.tag!('orderDescription', "Order #{options[:order_id]}")
|
145
|
+
soap.tag!('amount', amount(money).to_s)
|
146
|
+
soap.tag!('currency', (options[:currency] || currency(money)).to_s) unless skip_currency
|
147
|
+
end
|
148
|
+
|
149
|
+
def parse(response, action)
|
150
|
+
result = {}
|
151
|
+
document = REXML::Document.new(response)
|
152
|
+
response_element = document.root.get_elements("//*[@xsi:type='tns:#{action}Response']").first
|
153
|
+
response_element.elements.each do |element|
|
154
|
+
result[element.name.underscore] = element.text
|
155
|
+
end
|
156
|
+
result
|
157
|
+
end
|
158
|
+
|
159
|
+
def commit(soap_action, soap, options)
|
160
|
+
headers = { 'SOAPAction' => "\"urn:Interface##{soap_action}\"",
|
161
|
+
'Content-Type' => 'text/xml; charset=utf-8' }
|
162
|
+
response_string = ssl_post(test? ? self.test_url : self.live_url, soap, headers)
|
163
|
+
response = parse(response_string, soap_action)
|
164
|
+
return Response.new(response['errorcode'] == '000',
|
165
|
+
response['errormessage'],
|
166
|
+
response,
|
167
|
+
test: test?,
|
168
|
+
authorization: response['transaction_id'])
|
169
|
+
end
|
170
|
+
|
171
|
+
def build_soap(request)
|
172
|
+
retval = Builder::XmlMarkup.new(indent: 2)
|
173
|
+
retval.instruct!(:xml, version: '1.0', encoding: 'utf-8')
|
174
|
+
retval.tag!('soap:Envelope', {
|
175
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
176
|
+
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
|
177
|
+
'xmlns:soapenc' => 'http://schemas.xmlsoap.org/soap/encoding/',
|
178
|
+
'xmlns:tns' => 'urn:Interface',
|
179
|
+
'xmlns:types' => 'urn:Interface/encodedTypes',
|
180
|
+
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/'
|
181
|
+
}) do
|
182
|
+
retval.tag!('soap:Body', { 'soap:encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/' }) do
|
183
|
+
retval.tag!("tns:#{request}") do
|
184
|
+
retval.tag!("#{request}Request", { 'xsi:type' => "tns:#{request}Request" }) do
|
185
|
+
yield retval
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
retval.target!
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|