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,222 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
class BamboraApacGateway < Gateway
|
6
|
+
self.live_url = 'https://www.bambora.co.nz/interface/api'
|
7
|
+
self.test_url = 'https://demo.bambora.co.nz/interface/api'
|
8
|
+
|
9
|
+
self.supported_countries = %w[AU NZ]
|
10
|
+
self.supported_cardtypes = %i[visa master american_express diners_club jcb]
|
11
|
+
|
12
|
+
self.homepage_url = 'http://www.bambora.com/'
|
13
|
+
self.display_name = 'Bambora Asia-Pacific'
|
14
|
+
|
15
|
+
self.money_format = :cents
|
16
|
+
|
17
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
18
|
+
'05' => STANDARD_ERROR_CODE[:card_declined],
|
19
|
+
'06' => STANDARD_ERROR_CODE[:processing_error],
|
20
|
+
'14' => STANDARD_ERROR_CODE[:invalid_number],
|
21
|
+
'54' => STANDARD_ERROR_CODE[:expired_card]
|
22
|
+
}
|
23
|
+
|
24
|
+
def initialize(options = {})
|
25
|
+
requires!(options, :username, :password)
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def purchase(money, payment, options = {})
|
30
|
+
commit('SubmitSinglePayment') do |xml|
|
31
|
+
xml.Transaction do
|
32
|
+
xml.CustRef options[:order_id]
|
33
|
+
xml.Amount amount(money)
|
34
|
+
xml.TrnType '1'
|
35
|
+
add_payment(xml, payment)
|
36
|
+
add_credentials(xml, options)
|
37
|
+
xml.TrnSource options[:ip]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def authorize(money, payment, options = {})
|
43
|
+
commit('SubmitSinglePayment') do |xml|
|
44
|
+
xml.Transaction do
|
45
|
+
xml.CustRef options[:order_id]
|
46
|
+
xml.Amount amount(money)
|
47
|
+
xml.TrnType '2'
|
48
|
+
add_payment(xml, payment)
|
49
|
+
add_credentials(xml, options)
|
50
|
+
xml.TrnSource options[:ip]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def capture(money, authorization, options = {})
|
56
|
+
commit('SubmitSingleCapture') do |xml|
|
57
|
+
xml.Capture do
|
58
|
+
xml.Receipt authorization
|
59
|
+
xml.Amount amount(money)
|
60
|
+
add_credentials(xml, options)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def refund(money, authorization, options = {})
|
66
|
+
commit('SubmitSingleRefund') do |xml|
|
67
|
+
xml.Refund do
|
68
|
+
xml.Receipt authorization
|
69
|
+
xml.Amount amount(money)
|
70
|
+
add_credentials(xml, options)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def void(authorization, options = {})
|
76
|
+
commit('SubmitSingleVoid') do |xml|
|
77
|
+
xml.Void do
|
78
|
+
xml.Receipt authorization
|
79
|
+
xml.Amount amount(options[:amount])
|
80
|
+
add_credentials(xml, options)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def store(payment, options = {})
|
86
|
+
commit('TokeniseCreditCard') do |xml|
|
87
|
+
xml.TokeniseCreditCard do
|
88
|
+
xml.CardNumber payment.number
|
89
|
+
xml.ExpM format(payment.month, :two_digits)
|
90
|
+
xml.ExpY format(payment.year, :four_digits)
|
91
|
+
xml.TokeniseAlgorithmID options[:tokenise_algorithm_id] || 2
|
92
|
+
xml.UserName @options[:username]
|
93
|
+
xml.Password @options[:password]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def supports_scrubbing?
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
def scrub(transcript)
|
103
|
+
transcript.
|
104
|
+
gsub(%r((<CardNumber>)[^<]+(<))i, '\1[FILTERED]\2').
|
105
|
+
gsub(%r((<CVN>)[^<]+(<))i, '\1[FILTERED]\2').
|
106
|
+
gsub(%r((<Password>)[^<]+(<))i, '\1[FILTERED]\2')
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def add_credentials(xml, options)
|
112
|
+
xml.AccountNumber options[:account_number] if options[:account_number]
|
113
|
+
xml.Security do
|
114
|
+
xml.UserName @options[:username]
|
115
|
+
xml.Password @options[:password]
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def add_payment(xml, payment)
|
120
|
+
if payment.is_a?(String)
|
121
|
+
add_token(xml, payment)
|
122
|
+
else
|
123
|
+
add_credit_card(xml, payment)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def add_token(xml, payment)
|
128
|
+
xml.CreditCard do
|
129
|
+
xml.TokeniseAlgorithmID options[:tokenise_algorithm_id] || 2
|
130
|
+
xml.CardNumber payment
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def add_credit_card(xml, payment)
|
135
|
+
xml.CreditCard Registered: 'False' do
|
136
|
+
xml.CardNumber payment.number
|
137
|
+
xml.ExpM format(payment.month, :two_digits)
|
138
|
+
xml.ExpY format(payment.year, :four_digits)
|
139
|
+
xml.CVN payment.verification_value
|
140
|
+
xml.CardHolderName payment.name
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def parse(body)
|
145
|
+
element = Nokogiri::XML(body).root.first_element_child.first_element_child
|
146
|
+
|
147
|
+
response = {}
|
148
|
+
doc = Nokogiri::XML(element)
|
149
|
+
doc.root.elements.each do |e|
|
150
|
+
response[e.name.underscore.to_sym] = e.inner_text
|
151
|
+
end
|
152
|
+
response
|
153
|
+
end
|
154
|
+
|
155
|
+
def commit(action, &block)
|
156
|
+
headers = {
|
157
|
+
'Content-Type' => 'text/xml; charset=utf-8',
|
158
|
+
'SOAPAction' => "http://www.ippayments.com.au/interface/api/#{endpoint(action)}/#{action}"
|
159
|
+
}
|
160
|
+
response = parse(ssl_post("#{commit_url}/#{endpoint(action)}.asmx", new_submit_xml(action, &block), headers))
|
161
|
+
|
162
|
+
Response.new(
|
163
|
+
success_from(response),
|
164
|
+
message_from(response),
|
165
|
+
response,
|
166
|
+
authorization: authorization_from(response),
|
167
|
+
error_code: error_code_from(response),
|
168
|
+
test: test?
|
169
|
+
)
|
170
|
+
end
|
171
|
+
|
172
|
+
def new_submit_xml(action)
|
173
|
+
xml = Builder::XmlMarkup.new(indent: 2)
|
174
|
+
xml.instruct!
|
175
|
+
xml.soap :Envelope, 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema', 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' do
|
176
|
+
xml.soap :Body do
|
177
|
+
xml.__send__(action, 'xmlns' => "http://www.ippayments.com.au/interface/api/#{endpoint(action)}") do
|
178
|
+
if action == 'TokeniseCreditCard'
|
179
|
+
xml.tokeniseCreditCardXML do
|
180
|
+
inner_xml = Builder::XmlMarkup.new(indent: 2)
|
181
|
+
yield(inner_xml)
|
182
|
+
xml.cdata!(inner_xml.target!)
|
183
|
+
end
|
184
|
+
else
|
185
|
+
xml.trnXML do
|
186
|
+
inner_xml = Builder::XmlMarkup.new(indent: 2)
|
187
|
+
yield(inner_xml)
|
188
|
+
xml.cdata!(inner_xml.target!)
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
xml.target!
|
195
|
+
end
|
196
|
+
|
197
|
+
def endpoint(action)
|
198
|
+
action == 'TokeniseCreditCard' ? 'sipp' : 'dts'
|
199
|
+
end
|
200
|
+
|
201
|
+
def commit_url
|
202
|
+
test? ? test_url : live_url
|
203
|
+
end
|
204
|
+
|
205
|
+
def success_from(response)
|
206
|
+
response[:response_code] == '0' || response[:return_value] == '0'
|
207
|
+
end
|
208
|
+
|
209
|
+
def error_code_from(response)
|
210
|
+
STANDARD_ERROR_CODE_MAPPING[response[:declined_code]]
|
211
|
+
end
|
212
|
+
|
213
|
+
def message_from(response)
|
214
|
+
success_from(response) ? 'Succeeded' : response[:declined_message]
|
215
|
+
end
|
216
|
+
|
217
|
+
def authorization_from(response)
|
218
|
+
response[:receipt] || response[:token]
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
# For more information visit {Bank Frick Acquiring Services}[http://www.bankfrickacquiring.com/merchantsolutions_en.html]
|
6
|
+
#
|
7
|
+
# Written by Piers Chambers (Varyonic.com)
|
8
|
+
class BankFrickGateway < Gateway
|
9
|
+
self.test_url = 'https://test.ctpe.io/payment/ctpe'
|
10
|
+
self.live_url = 'https://ctpe.io/payment/ctpe'
|
11
|
+
|
12
|
+
self.supported_countries = %w[LI US]
|
13
|
+
self.default_currency = 'EUR'
|
14
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
15
|
+
|
16
|
+
self.homepage_url = 'http://www.bankfrickacquiring.com/'
|
17
|
+
self.display_name = 'Bank Frick'
|
18
|
+
|
19
|
+
# The set of supported transactions for this gateway.
|
20
|
+
# More operations are supported by the gateway itself, but
|
21
|
+
# are not supported in this library.
|
22
|
+
SUPPORTED_TRANSACTIONS = {
|
23
|
+
'sale' => 'CC.DB',
|
24
|
+
'authonly' => 'CC.PA',
|
25
|
+
'capture' => 'CC.CP',
|
26
|
+
'refund' => 'CC.RF',
|
27
|
+
'void' => 'CC.RV'
|
28
|
+
}
|
29
|
+
|
30
|
+
def initialize(options = {})
|
31
|
+
requires!(options, :sender, :channel, :userid, :userpwd)
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
def purchase(money, payment, options = {})
|
36
|
+
post = {}
|
37
|
+
add_invoice(post, money, options)
|
38
|
+
add_payment(post, payment)
|
39
|
+
add_address(post, payment, options)
|
40
|
+
add_customer_data(post, options)
|
41
|
+
|
42
|
+
commit('sale', post)
|
43
|
+
end
|
44
|
+
|
45
|
+
def authorize(money, payment, options = {})
|
46
|
+
post = {}
|
47
|
+
add_invoice(post, money, options)
|
48
|
+
add_payment(post, payment)
|
49
|
+
add_address(post, payment, options)
|
50
|
+
add_customer_data(post, options)
|
51
|
+
|
52
|
+
commit('authonly', post)
|
53
|
+
end
|
54
|
+
|
55
|
+
def capture(money, authorization, options = {})
|
56
|
+
post = {}
|
57
|
+
post[:authorization] = authorization
|
58
|
+
add_invoice(post, money, options)
|
59
|
+
|
60
|
+
commit('capture', post)
|
61
|
+
end
|
62
|
+
|
63
|
+
def refund(money, authorization, options = {})
|
64
|
+
post = {}
|
65
|
+
post[:authorization] = authorization
|
66
|
+
add_invoice(post, money, options)
|
67
|
+
|
68
|
+
commit('refund', post)
|
69
|
+
end
|
70
|
+
|
71
|
+
def void(authorization, options = {})
|
72
|
+
post = {}
|
73
|
+
post[:authorization] = authorization
|
74
|
+
|
75
|
+
commit('void', post)
|
76
|
+
end
|
77
|
+
|
78
|
+
def verify(credit_card, options = {})
|
79
|
+
MultiResponse.run(:use_first_response) do |r|
|
80
|
+
r.process { authorize(100, credit_card, options) }
|
81
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
|
87
|
+
def add_customer_data(post, options)
|
88
|
+
post[:email] = options[:email] || 'noone@example.com'
|
89
|
+
post[:ip] = options[:ip] || '0.0.0.0'
|
90
|
+
end
|
91
|
+
|
92
|
+
def add_address(post, creditcard, options)
|
93
|
+
if address = options[:billing_address] || options[:address]
|
94
|
+
post[:address] = address[:address1].to_s
|
95
|
+
post[:company] = address[:company].to_s
|
96
|
+
post[:phone] = address[:phone].to_s.gsub(/[^0-9]/, '') || '0000000'
|
97
|
+
post[:zip] = address[:zip].to_s
|
98
|
+
post[:city] = address[:city].to_s
|
99
|
+
post[:country] = address[:country].to_s
|
100
|
+
post[:state] = address[:state].blank? ? 'n/a' : address[:state]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_invoice(post, money, options)
|
105
|
+
post[:order_id] = options[:order_id] if post.has_key? :order_id
|
106
|
+
post[:amount] = amount(money)
|
107
|
+
post[:currency] = (options[:currency] || currency(money))
|
108
|
+
post[:description] = options[:description]
|
109
|
+
end
|
110
|
+
|
111
|
+
def add_payment(post, payment)
|
112
|
+
post[:first_name] = payment.first_name
|
113
|
+
post[:last_name] = payment.last_name
|
114
|
+
post[:brand] = payment.brand
|
115
|
+
post[:card_num] = payment.number
|
116
|
+
post[:card_code] = payment.verification_value if payment.verification_value?
|
117
|
+
post[:exp_year] = payment.year
|
118
|
+
post[:exp_month] = payment.month
|
119
|
+
end
|
120
|
+
|
121
|
+
def parse(body)
|
122
|
+
results = {}
|
123
|
+
xml = Nokogiri::XML(body)
|
124
|
+
resp = xml.xpath('//Response/Transaction/Identification')
|
125
|
+
resp.children.each do |element|
|
126
|
+
results[element.name.downcase.to_sym] = element.text
|
127
|
+
end
|
128
|
+
resp = xml.xpath('//Response/Transaction/Processing')
|
129
|
+
resp.children.each do |element|
|
130
|
+
results[element.name.downcase.to_sym] = element.text
|
131
|
+
end
|
132
|
+
results
|
133
|
+
end
|
134
|
+
|
135
|
+
def commit(action, parameters)
|
136
|
+
url = (test? ? test_url : live_url)
|
137
|
+
headers = {
|
138
|
+
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'
|
139
|
+
}
|
140
|
+
response = parse(ssl_post(url, post_data(action, parameters), headers))
|
141
|
+
|
142
|
+
Response.new(
|
143
|
+
success_from(response),
|
144
|
+
message_from(response),
|
145
|
+
response,
|
146
|
+
authorization: authorization_from(response),
|
147
|
+
test: test?
|
148
|
+
)
|
149
|
+
end
|
150
|
+
|
151
|
+
def success_from(response)
|
152
|
+
response[:result] == 'ACK'
|
153
|
+
end
|
154
|
+
|
155
|
+
def message_from(response)
|
156
|
+
response[:return]
|
157
|
+
end
|
158
|
+
|
159
|
+
def authorization_from(response)
|
160
|
+
response[:uniqueid]
|
161
|
+
end
|
162
|
+
|
163
|
+
def post_data(action, parameters = {})
|
164
|
+
xml = build_xml_request(action, parameters)
|
165
|
+
"load=#{CGI.escape(xml)}"
|
166
|
+
end
|
167
|
+
|
168
|
+
def build_xml_request(action, data)
|
169
|
+
xml = Builder::XmlMarkup.new indent: 2
|
170
|
+
xml.Request(version: '1.0') do
|
171
|
+
xml.Header do
|
172
|
+
xml.Security(sender: @options[:sender], type: 'MERCHANT')
|
173
|
+
end
|
174
|
+
xml.Transaction(response: 'SYNC', channel: @options[:channel], mode: 'LIVE') do
|
175
|
+
xml.User(pwd: @options[:userpwd], login: @options[:userid])
|
176
|
+
xml.Identification do
|
177
|
+
xml.TransactionID data[:order_id] if data.has_key? :order_id
|
178
|
+
xml.ReferenceID data[:authorization] if data.has_key? :authorization
|
179
|
+
end
|
180
|
+
xml.Account do
|
181
|
+
xml.Holder "#{data[:first_name]} #{data[:last_name]}"
|
182
|
+
xml.Brand data[:brand]
|
183
|
+
xml.Number data[:card_num]
|
184
|
+
xml.Bank data[:bankname]
|
185
|
+
xml.Country data[:country]
|
186
|
+
xml.Authorization data[:authorization]
|
187
|
+
xml.Verification data[:card_code]
|
188
|
+
xml.Year data[:exp_year]
|
189
|
+
xml.Month data[:exp_month]
|
190
|
+
end if data.has_key? :card_num
|
191
|
+
xml.Payment(code: SUPPORTED_TRANSACTIONS[action]) do
|
192
|
+
xml.Presentation do
|
193
|
+
xml.Amount data[:amount]
|
194
|
+
xml.Currency data[:currency]
|
195
|
+
xml.Usage data[:description]
|
196
|
+
end
|
197
|
+
end
|
198
|
+
xml.Customer do
|
199
|
+
xml.Contact do
|
200
|
+
xml.Email data[:email]
|
201
|
+
xml.Mobile data[:mobile]
|
202
|
+
xml.Ip data[:ip]
|
203
|
+
xml.Phone data[:phone]
|
204
|
+
end
|
205
|
+
xml.Address do
|
206
|
+
xml.Street data[:address]
|
207
|
+
xml.Zip data[:zip]
|
208
|
+
xml.City data[:city]
|
209
|
+
xml.State data[:state]
|
210
|
+
xml.Country data[:country]
|
211
|
+
end
|
212
|
+
xml.Name do
|
213
|
+
xml.Salutation data[:salutation]
|
214
|
+
xml.Title data[:title]
|
215
|
+
xml.Given data[:first_name]
|
216
|
+
xml.Family data[:last_name]
|
217
|
+
xml.Company data[:company]
|
218
|
+
end
|
219
|
+
end if data.has_key? :last_name
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class BanwireGateway < Gateway
|
4
|
+
URL = 'https://banwire.com/api.pago_pro'
|
5
|
+
|
6
|
+
self.supported_countries = ['MX']
|
7
|
+
self.supported_cardtypes = %i[visa master american_express]
|
8
|
+
self.homepage_url = 'http://www.banwire.com/'
|
9
|
+
self.display_name = 'Banwire'
|
10
|
+
|
11
|
+
def initialize(options = {})
|
12
|
+
requires!(options, :login)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def purchase(money, creditcard, options = {})
|
17
|
+
post = {}
|
18
|
+
add_response_type(post)
|
19
|
+
add_customer_data(post, options)
|
20
|
+
add_order_data(post, options)
|
21
|
+
add_creditcard(post, creditcard)
|
22
|
+
add_address(post, creditcard, options)
|
23
|
+
add_customer_data(post, options)
|
24
|
+
add_amount(post, money, options)
|
25
|
+
|
26
|
+
commit(money, post)
|
27
|
+
end
|
28
|
+
|
29
|
+
def supports_scrubbing?
|
30
|
+
true
|
31
|
+
end
|
32
|
+
|
33
|
+
def scrub(transcript)
|
34
|
+
transcript.
|
35
|
+
gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
|
36
|
+
gsub(%r((&?card_num=)[^&]*)i, '\1[FILTERED]').
|
37
|
+
gsub(%r((&?card_ccv2=)[^&]*)i, '\1[FILTERED]')
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def add_response_type(post)
|
43
|
+
post[:response_format] = 'JSON'
|
44
|
+
end
|
45
|
+
|
46
|
+
def add_customer_data(post, options)
|
47
|
+
post[:user] = @options[:login]
|
48
|
+
post[:phone] = options[:billing_address][:phone]
|
49
|
+
post[:mail] = options[:email] || 'unspecified@email.com'
|
50
|
+
end
|
51
|
+
|
52
|
+
def add_order_data(post, options)
|
53
|
+
post[:reference] = options[:order_id] || generate_unique_id
|
54
|
+
post[:concept] = options[:description]
|
55
|
+
end
|
56
|
+
|
57
|
+
def add_address(post, creditcard, options)
|
58
|
+
post[:address] = options[:billing_address][:address1]
|
59
|
+
post[:post_code] = options[:billing_address][:zip]
|
60
|
+
end
|
61
|
+
|
62
|
+
def add_creditcard(post, creditcard)
|
63
|
+
post[:card_num] = creditcard.number
|
64
|
+
post[:card_name] = creditcard.name
|
65
|
+
post[:card_type] = card_brand(creditcard)
|
66
|
+
post[:card_exp] = "#{sprintf('%02d', creditcard.month)}/#{creditcard.year.to_s[-2, 2]}"
|
67
|
+
post[:card_ccv2] = creditcard.verification_value
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_amount(post, money, options)
|
71
|
+
post[:ammount] = amount(money)
|
72
|
+
post[:currency] = options[:currency]
|
73
|
+
end
|
74
|
+
|
75
|
+
def card_brand(card)
|
76
|
+
brand = super
|
77
|
+
({ 'master' => 'mastercard', 'american_express' => 'amex' }[brand] || brand)
|
78
|
+
end
|
79
|
+
|
80
|
+
def parse(body)
|
81
|
+
JSON.parse(body)
|
82
|
+
end
|
83
|
+
|
84
|
+
def commit(money, parameters)
|
85
|
+
raw_response = ssl_post(URL, post_data(parameters))
|
86
|
+
begin
|
87
|
+
response = parse(raw_response)
|
88
|
+
rescue JSON::ParserError
|
89
|
+
response = json_error(raw_response)
|
90
|
+
end
|
91
|
+
|
92
|
+
Response.new(success?(response),
|
93
|
+
response['message'],
|
94
|
+
response,
|
95
|
+
test: test?,
|
96
|
+
authorization: response['code_auth'])
|
97
|
+
end
|
98
|
+
|
99
|
+
def success?(response)
|
100
|
+
(response['response'] == 'ok')
|
101
|
+
end
|
102
|
+
|
103
|
+
def post_data(parameters = {})
|
104
|
+
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
105
|
+
end
|
106
|
+
|
107
|
+
def json_error(raw_response)
|
108
|
+
msg = 'Invalid response received from the Banwire API. Please contact Banwire support if you continue to receive this message.'
|
109
|
+
msg += " (The raw response returned by the API was #{raw_response.inspect})"
|
110
|
+
{
|
111
|
+
'message' => msg
|
112
|
+
}
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|