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,158 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class FederatedCanadaGateway < Gateway
|
4
|
+
# Same URL for both test and live, testing is done by using the test username (demo) and password (password).
|
5
|
+
self.live_url = self.test_url = 'https://secure.federatedgateway.com/api/transact.php'
|
6
|
+
|
7
|
+
APPROVED, DECLINED, ERROR = 1, 2, 3
|
8
|
+
|
9
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
10
|
+
self.supported_countries = ['CA']
|
11
|
+
|
12
|
+
self.default_currency = 'CAD'
|
13
|
+
|
14
|
+
# The card types supported by the payment gateway
|
15
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
16
|
+
|
17
|
+
# The homepage URL of the gateway
|
18
|
+
self.homepage_url = 'http://www.federatedcanada.com/'
|
19
|
+
|
20
|
+
# The name of the gateway
|
21
|
+
self.display_name = 'Federated Canada'
|
22
|
+
|
23
|
+
def initialize(options = {})
|
24
|
+
requires!(options, :login, :password)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def purchase(money, creditcard, options = {})
|
29
|
+
post = {}
|
30
|
+
add_invoice(post, options)
|
31
|
+
add_creditcard(post, creditcard)
|
32
|
+
add_address(post, options)
|
33
|
+
add_customer_data(post, options)
|
34
|
+
commit('sale', money, post)
|
35
|
+
end
|
36
|
+
|
37
|
+
def authorize(money, creditcard, options = {})
|
38
|
+
post = {}
|
39
|
+
add_invoice(post, options)
|
40
|
+
add_creditcard(post, creditcard)
|
41
|
+
add_address(post, options)
|
42
|
+
add_customer_data(post, options)
|
43
|
+
commit('auth', money, post)
|
44
|
+
end
|
45
|
+
|
46
|
+
def capture(money, authorization, options = {})
|
47
|
+
options[:transactionid] = authorization
|
48
|
+
commit('capture', money, options)
|
49
|
+
end
|
50
|
+
|
51
|
+
def void(authorization, options = {})
|
52
|
+
options[:transactionid] = authorization
|
53
|
+
commit('void', nil, options)
|
54
|
+
end
|
55
|
+
|
56
|
+
def refund(money, authorization, options = {})
|
57
|
+
commit('refund', money, options.merge(transactionid: authorization))
|
58
|
+
end
|
59
|
+
|
60
|
+
def credit(money, authorization, options = {})
|
61
|
+
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
|
62
|
+
refund(money, authorization, options)
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def add_customer_data(post, options)
|
68
|
+
post[:firstname] = options[:first_name]
|
69
|
+
post[:lastname] = options[:last_name]
|
70
|
+
|
71
|
+
post[:email] = options[:email]
|
72
|
+
end
|
73
|
+
|
74
|
+
def add_address(post, options)
|
75
|
+
if address = (options[:billing_address] || options[:address])
|
76
|
+
post[:company] = address[:company]
|
77
|
+
post[:address1] = address[:address1]
|
78
|
+
post[:address2] = address[:address2]
|
79
|
+
post[:city] = address[:city]
|
80
|
+
post[:state] = address[:state]
|
81
|
+
post[:zip] = address[:zip]
|
82
|
+
post[:country] = address[:country]
|
83
|
+
post[:phone] = address[:phone]
|
84
|
+
end
|
85
|
+
if address = options[:shipping_address]
|
86
|
+
post[:shipping_firstname] = address[:first_name]
|
87
|
+
post[:shipping_lastname] = address[:last_name]
|
88
|
+
post[:shipping_company] = address[:company]
|
89
|
+
post[:shipping_address1] = address[:address1]
|
90
|
+
post[:shipping_address2] = address[:address2]
|
91
|
+
post[:shipping_city] = address[:city]
|
92
|
+
post[:shipping_state] = address[:state]
|
93
|
+
post[:shipping_zip] = address[:zip]
|
94
|
+
post[:shipping_country] = address[:country]
|
95
|
+
post[:shipping_email] = address[:email]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def add_invoice(post, options)
|
100
|
+
post[:orderid] = options[:order_id]
|
101
|
+
post[:orderdescription] = options[:description]
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_creditcard(post, creditcard)
|
105
|
+
post[:ccnumber] = creditcard.number
|
106
|
+
post[:ccexp] = expdate(creditcard)
|
107
|
+
post[:cvv] = creditcard.verification_value
|
108
|
+
end
|
109
|
+
|
110
|
+
def parse(body)
|
111
|
+
body.split('&').inject({}) do |memo, x|
|
112
|
+
k, v = x.split('=')
|
113
|
+
memo[k] = v
|
114
|
+
memo
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def commit(action, money, parameters)
|
119
|
+
parameters[:amount] = amount(money)
|
120
|
+
data = ssl_post(self.live_url, post_data(action, parameters))
|
121
|
+
response = parse(data)
|
122
|
+
message = message_from(response)
|
123
|
+
|
124
|
+
Response.new(success?(response), message, response,
|
125
|
+
test: test?,
|
126
|
+
authorization: response['transactionid'],
|
127
|
+
avs_result: { code: response['avsresponse'] },
|
128
|
+
cvv_result: response['cvvresponse'])
|
129
|
+
end
|
130
|
+
|
131
|
+
def success?(response)
|
132
|
+
response['response'] == '1'
|
133
|
+
end
|
134
|
+
|
135
|
+
def test?
|
136
|
+
@options[:login].eql?('demo') && @options[:password].eql?('password')
|
137
|
+
end
|
138
|
+
|
139
|
+
def message_from(response)
|
140
|
+
case response['response'].to_i
|
141
|
+
when APPROVED
|
142
|
+
'Transaction Approved'
|
143
|
+
when DECLINED
|
144
|
+
'Transaction Declined'
|
145
|
+
else
|
146
|
+
'Error in transaction data or system error'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
def post_data(action, parameters = {})
|
151
|
+
parameters[:type] = action
|
152
|
+
parameters[:username] = @options[:login]
|
153
|
+
parameters[:password] = @options[:password]
|
154
|
+
parameters.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_merchant/billing/gateways/cc5'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class FinansbankGateway < CC5Gateway
|
6
|
+
self.live_url = 'https://www.fbwebpos.com/servlet/cc5ApiServer'
|
7
|
+
self.test_url = 'https://entegrasyon.asseco-see.com.tr/fim/api'
|
8
|
+
|
9
|
+
# The countries the gateway supports merchants from as 2 digit ISO country codes
|
10
|
+
self.supported_countries = %w[US TR]
|
11
|
+
|
12
|
+
# The card types supported by the payment gateway
|
13
|
+
self.supported_cardtypes = %i[visa master]
|
14
|
+
|
15
|
+
# The homepage URL of the gateway
|
16
|
+
self.homepage_url = 'https://www.fbwebpos.com/'
|
17
|
+
|
18
|
+
# The name of the gateway
|
19
|
+
self.display_name = 'Finansbank WebPOS'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class FirstGivingGateway < Gateway
|
6
|
+
self.test_url = 'http://usapisandbox.fgdev.net'
|
7
|
+
self.live_url = 'https://api.firstgiving.com'
|
8
|
+
|
9
|
+
self.supported_countries = ['US']
|
10
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
11
|
+
self.homepage_url = 'http://www.firstgiving.com/'
|
12
|
+
self.default_currency = 'USD'
|
13
|
+
self.display_name = 'FirstGiving'
|
14
|
+
|
15
|
+
def initialize(options = {})
|
16
|
+
requires!(options, :application_key, :security_token, :charity_id)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def purchase(money, creditcard, options = {})
|
21
|
+
post = {}
|
22
|
+
add_invoice(post, options)
|
23
|
+
add_creditcard(post, creditcard)
|
24
|
+
add_address(post, options)
|
25
|
+
add_customer_data(post, options)
|
26
|
+
add_donation_data(post, money, options)
|
27
|
+
commit('/donation/creditcard', post)
|
28
|
+
end
|
29
|
+
|
30
|
+
def refund(money, identifier, options = {})
|
31
|
+
get = {}
|
32
|
+
get[:transactionId] = identifier
|
33
|
+
get[:tranType] = 'REFUNDREQUEST'
|
34
|
+
commit('/transaction/refundrequest?' + encode(get))
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def add_donation_data(post, money, options)
|
40
|
+
post[:amount] = amount(money)
|
41
|
+
post[:charityId] = @options[:charity_id]
|
42
|
+
post[:description] = (options[:description] || 'Purchase')
|
43
|
+
post[:currencyCode] = (options[:currency] || currency(money))
|
44
|
+
end
|
45
|
+
|
46
|
+
def add_customer_data(post, options)
|
47
|
+
post[:billToEmail] = (options[:email] || 'activemerchant@example.com')
|
48
|
+
post[:remoteAddr] = (options[:ip] || '127.0.0.1')
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_address(post, options)
|
52
|
+
if (billing_address = (options[:billing_address] || options[:address]))
|
53
|
+
post[:billToAddressLine1] = billing_address[:address1]
|
54
|
+
post[:billToCity] = billing_address[:city]
|
55
|
+
post[:billToState] = billing_address[:state]
|
56
|
+
post[:billToZip] = billing_address[:zip]
|
57
|
+
post[:billToCountry] = billing_address[:country]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_invoice(post, options)
|
62
|
+
post[:orderId] = options[:order_id]
|
63
|
+
end
|
64
|
+
|
65
|
+
def add_creditcard(post, creditcard)
|
66
|
+
post[:billToFirstName] = creditcard.first_name
|
67
|
+
post[:billToLastName] = creditcard.last_name
|
68
|
+
post[:ccNumber] = creditcard.number
|
69
|
+
post[:ccType] = creditcard_brand(creditcard.brand)
|
70
|
+
post[:ccExpDateMonth] = creditcard.month
|
71
|
+
post[:ccExpDateYear] = creditcard.year
|
72
|
+
post[:ccCardValidationNum] = creditcard.verification_value
|
73
|
+
end
|
74
|
+
|
75
|
+
def parse(body)
|
76
|
+
response = {}
|
77
|
+
|
78
|
+
xml = Nokogiri::XML(body)
|
79
|
+
element = xml.xpath('//firstGivingDonationApi/firstGivingResponse').first
|
80
|
+
|
81
|
+
element.attributes.each do |name, attribute|
|
82
|
+
response[name] = attribute.content
|
83
|
+
end
|
84
|
+
element.children.each do |child|
|
85
|
+
next if child.text?
|
86
|
+
|
87
|
+
response[child.name] = child.text
|
88
|
+
end
|
89
|
+
|
90
|
+
response
|
91
|
+
end
|
92
|
+
|
93
|
+
def commit(action, post = nil)
|
94
|
+
url = (test? ? self.test_url : self.live_url) + action
|
95
|
+
|
96
|
+
begin
|
97
|
+
if post
|
98
|
+
response = parse(ssl_post(url, post_data(post), headers))
|
99
|
+
else
|
100
|
+
response = parse(ssl_get(url, headers))
|
101
|
+
end
|
102
|
+
rescue ResponseError => e
|
103
|
+
response = parse(e.response.body)
|
104
|
+
end
|
105
|
+
|
106
|
+
Response.new(
|
107
|
+
(response['acknowledgement'] == 'Success'),
|
108
|
+
(response['friendlyErrorMessage'] || response['verboseErrorMessage'] || response['acknowledgement']),
|
109
|
+
response,
|
110
|
+
authorization: response['transactionId'],
|
111
|
+
test: test?
|
112
|
+
)
|
113
|
+
end
|
114
|
+
|
115
|
+
def post_data(post)
|
116
|
+
post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
117
|
+
end
|
118
|
+
|
119
|
+
def encode(hash)
|
120
|
+
hash.collect { |(k, v)| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join('&')
|
121
|
+
end
|
122
|
+
|
123
|
+
def creditcard_brand(brand)
|
124
|
+
case brand
|
125
|
+
when 'visa' then 'VI'
|
126
|
+
when 'master' then 'MC'
|
127
|
+
when 'discover' then 'DI'
|
128
|
+
when 'american_express' then 'AX'
|
129
|
+
else
|
130
|
+
raise "Unhandled credit card brand #{brand}"
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def headers
|
135
|
+
{
|
136
|
+
'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
|
137
|
+
'JG_APPLICATIONKEY' => @options[:application_key].to_s,
|
138
|
+
'JG_SECURITYTOKEN' => @options[:security_token].to_s
|
139
|
+
}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,182 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class FirstPayGateway < Gateway
|
6
|
+
self.live_url = 'https://secure.goemerchant.com/secure/gateway/xmlgateway.aspx'
|
7
|
+
|
8
|
+
self.supported_countries = ['US']
|
9
|
+
self.default_currency = 'USD'
|
10
|
+
self.money_format = :dollars
|
11
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
12
|
+
|
13
|
+
self.homepage_url = 'http://1stpaygateway.net/'
|
14
|
+
self.display_name = '1stPayGateway.Net'
|
15
|
+
|
16
|
+
def initialize(options = {})
|
17
|
+
requires!(options, :transaction_center_id, :gateway_id)
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def purchase(money, payment, options = {})
|
22
|
+
post = {}
|
23
|
+
add_invoice(post, money, options)
|
24
|
+
add_payment(post, payment, options)
|
25
|
+
add_address(post, payment, options)
|
26
|
+
add_customer_data(post, options)
|
27
|
+
|
28
|
+
commit('sale', post)
|
29
|
+
end
|
30
|
+
|
31
|
+
def authorize(money, payment, options = {})
|
32
|
+
post = {}
|
33
|
+
add_invoice(post, money, options)
|
34
|
+
add_payment(post, payment, options)
|
35
|
+
add_address(post, payment, options)
|
36
|
+
add_customer_data(post, options)
|
37
|
+
|
38
|
+
commit('auth', post)
|
39
|
+
end
|
40
|
+
|
41
|
+
def capture(money, authorization, options = {})
|
42
|
+
post = {}
|
43
|
+
add_reference(post, 'settle', money, authorization)
|
44
|
+
commit('settle', post)
|
45
|
+
end
|
46
|
+
|
47
|
+
def refund(money, authorization, options = {})
|
48
|
+
post = {}
|
49
|
+
add_reference(post, 'credit', money, authorization)
|
50
|
+
commit('credit', post)
|
51
|
+
end
|
52
|
+
|
53
|
+
def void(authorization, options = {})
|
54
|
+
post = {}
|
55
|
+
add_reference(post, 'void', nil, authorization)
|
56
|
+
commit('void', post)
|
57
|
+
end
|
58
|
+
|
59
|
+
def supports_scrubbing?
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
63
|
+
def scrub(transcript)
|
64
|
+
transcript.
|
65
|
+
gsub(%r((gateway_id)[^<]*(</FIELD>))i, '\1[FILTERED]\2').
|
66
|
+
gsub(%r((card_number)[^<]*(</FIELD>))i, '\1[FILTERED]\2').
|
67
|
+
gsub(%r((cvv2)[^<]*(</FIELD>))i, '\1[FILTERED]\2')
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def add_authentication(post, options)
|
73
|
+
post[:transaction_center_id] = options[:transaction_center_id]
|
74
|
+
post[:gateway_id] = options[:gateway_id]
|
75
|
+
end
|
76
|
+
|
77
|
+
def add_customer_data(post, options)
|
78
|
+
post[:owner_email] = options[:email] if options[:email]
|
79
|
+
post[:remote_ip_address] = options[:ip] if options[:ip]
|
80
|
+
post[:processor_id] = options[:processor_id] if options[:processor_id]
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_address(post, creditcard, options)
|
84
|
+
if address = options[:billing_address] || options[:address]
|
85
|
+
post[:owner_name] = address[:name]
|
86
|
+
post[:owner_street] = address[:address1]
|
87
|
+
post[:owner_street2] = address[:address2] if address[:address2]
|
88
|
+
post[:owner_city] = address[:city]
|
89
|
+
post[:owner_state] = address[:state]
|
90
|
+
post[:owner_zip] = address[:zip]
|
91
|
+
post[:owner_country] = address[:country]
|
92
|
+
post[:owner_phone] = address[:phone] if address[:phone]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_invoice(post, money, options)
|
97
|
+
post[:order_id] = options[:order_id]
|
98
|
+
post[:total] = amount(money)
|
99
|
+
end
|
100
|
+
|
101
|
+
def add_payment(post, payment, options)
|
102
|
+
post[:card_name] = payment.brand # Unclear if need to map to known names or open text field??
|
103
|
+
post[:card_number] = payment.number
|
104
|
+
post[:card_exp] = expdate(payment)
|
105
|
+
post[:cvv2] = payment.verification_value
|
106
|
+
post[:recurring] = options[:recurring] if options[:recurring]
|
107
|
+
post[:recurring_start_date] = options[:recurring_start_date] if options[:recurring_start_date]
|
108
|
+
post[:recurring_end_date] = options[:recurring_end_date] if options[:recurring_end_date]
|
109
|
+
post[:recurring_type] = options[:recurring_type] if options[:recurring_type]
|
110
|
+
end
|
111
|
+
|
112
|
+
def add_reference(post, action, money, authorization)
|
113
|
+
post[:"#{action}_amount1"] = amount(money) if money
|
114
|
+
post[:total_number_transactions] = 1
|
115
|
+
post[:reference_number1] = authorization
|
116
|
+
end
|
117
|
+
|
118
|
+
def parse(xml)
|
119
|
+
response = {}
|
120
|
+
|
121
|
+
doc = Nokogiri::XML(xml)
|
122
|
+
doc.root&.xpath('//RESPONSE/FIELDS/FIELD')&.each do |field|
|
123
|
+
response[field['KEY']] = field.text
|
124
|
+
end
|
125
|
+
|
126
|
+
response
|
127
|
+
end
|
128
|
+
|
129
|
+
def commit(action, parameters)
|
130
|
+
response = parse(ssl_post(live_url, post_data(action, parameters)))
|
131
|
+
|
132
|
+
Response.new(
|
133
|
+
success_from(response),
|
134
|
+
message_from(response),
|
135
|
+
response,
|
136
|
+
authorization: authorization_from(response),
|
137
|
+
error_code: error_code_from(response),
|
138
|
+
test: test?
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
142
|
+
def success_from(response)
|
143
|
+
(
|
144
|
+
(response['status'] == '1') ||
|
145
|
+
(response['status1'] == '1')
|
146
|
+
)
|
147
|
+
end
|
148
|
+
|
149
|
+
def message_from(response)
|
150
|
+
# Silly inconsistent gateway. Always make capitalized (but not all caps)
|
151
|
+
msg = (response['auth_response'] || response['response1'])
|
152
|
+
msg&.downcase&.capitalize
|
153
|
+
end
|
154
|
+
|
155
|
+
def error_code_from(response)
|
156
|
+
response['error']
|
157
|
+
end
|
158
|
+
|
159
|
+
def authorization_from(response)
|
160
|
+
response['reference_number'] || response['reference_number1']
|
161
|
+
end
|
162
|
+
|
163
|
+
def post_data(action, parameters = {})
|
164
|
+
parameters[:transaction_center_id] = @options[:transaction_center_id]
|
165
|
+
parameters[:gateway_id] = @options[:gateway_id]
|
166
|
+
|
167
|
+
parameters[:operation_type] = action
|
168
|
+
|
169
|
+
xml = Builder::XmlMarkup.new
|
170
|
+
xml.instruct!
|
171
|
+
xml.tag! 'TRANSACTION' do
|
172
|
+
xml.tag! 'FIELDS' do
|
173
|
+
parameters.each do |key, value|
|
174
|
+
xml.tag! 'FIELD', value, { 'KEY' => key }
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
xml.target!
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|