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,110 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PaySecureGateway < Gateway
|
4
|
+
self.live_url = self.test_url = 'https://clearance.commsecure.com.au/cgi-bin/PSDirect'
|
5
|
+
|
6
|
+
self.money_format = :cents
|
7
|
+
|
8
|
+
# Currently Authorization and Capture is not implemented because
|
9
|
+
# capturing requires the original credit card information
|
10
|
+
TRANSACTIONS = {
|
11
|
+
purchase: 'PURCHASE',
|
12
|
+
authorization: 'AUTHORISE',
|
13
|
+
capture: 'ADVICE',
|
14
|
+
credit: 'REFUND'
|
15
|
+
}
|
16
|
+
|
17
|
+
SUCCESS = 'Accepted'
|
18
|
+
SUCCESS_MESSAGE = 'The transaction was approved'
|
19
|
+
|
20
|
+
self.supported_countries = ['AU']
|
21
|
+
self.homepage_url = 'http://www.commsecure.com.au/paysecure.shtml'
|
22
|
+
self.display_name = 'PaySecure'
|
23
|
+
self.supported_cardtypes = %i[visa master american_express diners_club]
|
24
|
+
|
25
|
+
def initialize(options = {})
|
26
|
+
requires!(options, :login, :password)
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def purchase(money, credit_card, options = {})
|
31
|
+
requires!(options, :order_id)
|
32
|
+
|
33
|
+
post = {}
|
34
|
+
add_amount(post, money)
|
35
|
+
add_invoice(post, options)
|
36
|
+
add_credit_card(post, credit_card)
|
37
|
+
|
38
|
+
commit(:purchase, money, post)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
# Used for capturing, which is currently not supported.
|
44
|
+
def add_reference(post, identification)
|
45
|
+
auth, trans_id = identification.split(';')
|
46
|
+
post[:authnum] = auth
|
47
|
+
post[:transid] = trans_id
|
48
|
+
end
|
49
|
+
|
50
|
+
def add_amount(post, money)
|
51
|
+
post[:amount] = amount(money)
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_invoice(post, options)
|
55
|
+
post[:merchant_transid] = options[:order_id].to_s.slice(0, 21)
|
56
|
+
post[:memnum] = options[:invoice]
|
57
|
+
post[:custnum] = options[:customer]
|
58
|
+
post[:clientdata] = options[:description]
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_credit_card(post, credit_card)
|
62
|
+
post[:cardnum] = credit_card.number
|
63
|
+
post[:cardname] = credit_card.name
|
64
|
+
post[:expiry] = expdate(credit_card)
|
65
|
+
post[:cvv2] = credit_card.verification_value
|
66
|
+
end
|
67
|
+
|
68
|
+
def commit(action, money, parameters)
|
69
|
+
response = parse(ssl_post(self.live_url, post_data(action, parameters)))
|
70
|
+
|
71
|
+
Response.new(successful?(response), message_from(response), response,
|
72
|
+
test: test_response?(response),
|
73
|
+
authorization: authorization_from(response))
|
74
|
+
end
|
75
|
+
|
76
|
+
def successful?(response)
|
77
|
+
response[:status] == SUCCESS
|
78
|
+
end
|
79
|
+
|
80
|
+
def authorization_from(response)
|
81
|
+
[response[:authnum], response[:transid]].compact.join(';')
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_response?(response)
|
85
|
+
!!(response[:transid] =~ /SimProxy/)
|
86
|
+
end
|
87
|
+
|
88
|
+
def message_from(response)
|
89
|
+
successful?(response) ? SUCCESS_MESSAGE : response[:errorstring]
|
90
|
+
end
|
91
|
+
|
92
|
+
def parse(body)
|
93
|
+
response = {}
|
94
|
+
body.to_s.each_line do |l|
|
95
|
+
key, value = l.split(':', 2)
|
96
|
+
response[key.to_s.downcase.to_sym] = value.strip
|
97
|
+
end
|
98
|
+
response
|
99
|
+
end
|
100
|
+
|
101
|
+
def post_data(action, parameters = {})
|
102
|
+
parameters[:request_type] = TRANSACTIONS[action]
|
103
|
+
parameters[:merchant_id] = @options[:login]
|
104
|
+
parameters[:password] = @options[:password]
|
105
|
+
|
106
|
+
parameters.reject { |_k, v| v.blank? }.collect { |key, value| "#{key.to_s.upcase}=#{CGI.escape(value.to_s)}" }.join('&')
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,450 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PayTraceGateway < Gateway
|
4
|
+
self.test_url = 'https://api.paytrace.com'
|
5
|
+
self.live_url = 'https://api.paytrace.com'
|
6
|
+
|
7
|
+
self.supported_countries = ['US']
|
8
|
+
self.default_currency = 'USD'
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
10
|
+
|
11
|
+
self.homepage_url = 'https://paytrace.com/'
|
12
|
+
self.display_name = 'PayTrace'
|
13
|
+
|
14
|
+
# Response codes based on API Response Codes found here: https://developers.paytrace.com/support/home#14000041297
|
15
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
16
|
+
'1' => STANDARD_ERROR_CODE[:error_occurred],
|
17
|
+
'102' => STANDARD_ERROR_CODE[:declined],
|
18
|
+
'103' => STANDARD_ERROR_CODE[:auto_voided],
|
19
|
+
'107' => STANDARD_ERROR_CODE[:unsuccessful_refund],
|
20
|
+
'108' => STANDARD_ERROR_CODE[:test_refund],
|
21
|
+
'110' => STANDARD_ERROR_CODE[:unsuccessful_void],
|
22
|
+
'113' => STANDARD_ERROR_CODE[:unsuccessful_capture]
|
23
|
+
}
|
24
|
+
|
25
|
+
ENDPOINTS = {
|
26
|
+
customer_id_sale: 'transactions/sale/by_customer',
|
27
|
+
keyed_sale: 'transactions/sale/keyed',
|
28
|
+
customer_id_auth: 'transactions/authorization/by_customer',
|
29
|
+
keyed_auth: 'transactions/authorization/keyed',
|
30
|
+
capture: 'transactions/authorization/capture',
|
31
|
+
transaction_refund: 'transactions/refund/for_transaction',
|
32
|
+
transaction_void: 'transactions/void',
|
33
|
+
store: 'customer/create',
|
34
|
+
redact: 'customer/delete',
|
35
|
+
level_3_visa: 'level_three/visa',
|
36
|
+
level_3_mastercard: 'level_three/mastercard',
|
37
|
+
ach_sale: 'checks/sale/by_account',
|
38
|
+
ach_customer_sale: 'checks/sale/by_customer',
|
39
|
+
ach_authorize: 'checks/hold/by_account',
|
40
|
+
ach_customer_authorize: 'checks/hold/by_customer',
|
41
|
+
ach_refund: 'checks/refund/by_transaction',
|
42
|
+
ach_capture: 'checks/manage/fund',
|
43
|
+
ach_void: 'checks/manage/void'
|
44
|
+
}
|
45
|
+
|
46
|
+
def initialize(options = {})
|
47
|
+
requires!(options, :username, :password, :integrator_id)
|
48
|
+
super
|
49
|
+
acquire_access_token
|
50
|
+
end
|
51
|
+
|
52
|
+
def purchase(money, payment_or_customer_id, options = {})
|
53
|
+
if visa_or_mastercard?(options)
|
54
|
+
MultiResponse.run(:use_first_response) do |r|
|
55
|
+
endpoint = customer_id?(payment_or_customer_id) ? ENDPOINTS[:customer_id_sale] : ENDPOINTS[:keyed_sale]
|
56
|
+
|
57
|
+
r.process { commit(endpoint, build_purchase_request(money, payment_or_customer_id, options)) }
|
58
|
+
r.process { commit(ENDPOINTS[:"level_3_#{options[:visa_or_mastercard]}"], send_level_3_data(r, options)) }
|
59
|
+
end
|
60
|
+
else
|
61
|
+
post = build_purchase_request(money, payment_or_customer_id, options)
|
62
|
+
endpoint = if payment_or_customer_id.kind_of?(Check)
|
63
|
+
ENDPOINTS[:ach_sale]
|
64
|
+
elsif options[:check_transaction]
|
65
|
+
ENDPOINTS[:ach_customer_sale]
|
66
|
+
elsif post[:customer_id]
|
67
|
+
ENDPOINTS[:customer_id_sale]
|
68
|
+
else
|
69
|
+
ENDPOINTS[:keyed_sale]
|
70
|
+
end
|
71
|
+
response = commit(endpoint, post)
|
72
|
+
check_token_response(response, endpoint, post, options)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def authorize(money, payment_or_customer_id, options = {})
|
77
|
+
post = {}
|
78
|
+
add_amount(post, money, options)
|
79
|
+
if customer_id?(payment_or_customer_id)
|
80
|
+
post[:customer_id] = payment_or_customer_id
|
81
|
+
endpoint = if options[:check_transaction]
|
82
|
+
ENDPOINTS[:ach_customer_authorize]
|
83
|
+
else
|
84
|
+
ENDPOINTS[:customer_id_auth]
|
85
|
+
end
|
86
|
+
else
|
87
|
+
add_payment(post, payment_or_customer_id)
|
88
|
+
add_address(post, payment_or_customer_id, options)
|
89
|
+
add_customer_data(post, options)
|
90
|
+
endpoint = payment_or_customer_id.kind_of?(Check) ? ENDPOINTS[:ach_authorize] : ENDPOINTS[:keyed_auth]
|
91
|
+
end
|
92
|
+
response = commit(endpoint, post)
|
93
|
+
check_token_response(response, endpoint, post, options)
|
94
|
+
end
|
95
|
+
|
96
|
+
def capture(money, authorization, options = {})
|
97
|
+
if visa_or_mastercard?(options)
|
98
|
+
MultiResponse.run do |r|
|
99
|
+
r.process { commit(ENDPOINTS[:capture], build_capture_request(money, authorization, options)) }
|
100
|
+
r.process { commit(ENDPOINTS[:"level_3_#{options[:visa_or_mastercard]}"], send_level_3_data(r, options)) }
|
101
|
+
end
|
102
|
+
else
|
103
|
+
post = build_capture_request(money, authorization, options)
|
104
|
+
endpoint = if options[:check_transaction]
|
105
|
+
ENDPOINTS[:ach_capture]
|
106
|
+
else
|
107
|
+
ENDPOINTS[:capture]
|
108
|
+
end
|
109
|
+
response = commit(endpoint, post)
|
110
|
+
check_token_response(response, endpoint, post, options)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def refund(money, authorization, options = {})
|
115
|
+
# currently only support full and partial refunds of settled transactions via a transaction ID
|
116
|
+
post = {}
|
117
|
+
add_amount(post, money, options)
|
118
|
+
if options[:check_transaction]
|
119
|
+
post[:check_transaction_id] = authorization
|
120
|
+
endpoint = ENDPOINTS[:ach_refund]
|
121
|
+
else
|
122
|
+
post[:transaction_id] = authorization
|
123
|
+
endpoint = ENDPOINTS[:transaction_refund]
|
124
|
+
end
|
125
|
+
response = commit(endpoint, post)
|
126
|
+
check_token_response(response, endpoint, post, options)
|
127
|
+
end
|
128
|
+
|
129
|
+
def void(authorization, options = {})
|
130
|
+
post = {}
|
131
|
+
if options[:check_transaction]
|
132
|
+
post[:check_transaction_id] = authorization
|
133
|
+
endpoint = ENDPOINTS[:ach_void]
|
134
|
+
else
|
135
|
+
post[:transaction_id] = authorization
|
136
|
+
endpoint = ENDPOINTS[:transaction_void]
|
137
|
+
end
|
138
|
+
|
139
|
+
response = commit(endpoint, post)
|
140
|
+
check_token_response(response, endpoint, post, options)
|
141
|
+
end
|
142
|
+
|
143
|
+
def verify(credit_card, options = {})
|
144
|
+
authorize(0, credit_card, options)
|
145
|
+
end
|
146
|
+
|
147
|
+
# The customer_IDs that come from storing cards can be used for auth and purchase transaction types
|
148
|
+
def store(credit_card, options = {})
|
149
|
+
post = {}
|
150
|
+
post[:customer_id] = options[:customer_id] || SecureRandom.hex(12)
|
151
|
+
add_payment(post, credit_card)
|
152
|
+
add_address(post, credit_card, options)
|
153
|
+
response = commit(ENDPOINTS[:store], post)
|
154
|
+
check_token_response(response, ENDPOINTS[:store], post, options)
|
155
|
+
end
|
156
|
+
|
157
|
+
def unstore(customer_id)
|
158
|
+
post = {}
|
159
|
+
post[:customer_id] = customer_id
|
160
|
+
response = commit(ENDPOINTS[:redact], post)
|
161
|
+
check_token_response(response, ENDPOINTS[:redact], post, options)
|
162
|
+
end
|
163
|
+
|
164
|
+
def supports_scrubbing?
|
165
|
+
true
|
166
|
+
end
|
167
|
+
|
168
|
+
def scrub(transcript)
|
169
|
+
transcript.
|
170
|
+
gsub(%r((Authorization: Bearer )[a-zA-Z0-9:_]+), '\1[FILTERED]').
|
171
|
+
gsub(%r(("credit_card\\?":{\\?"number\\?":\\?")\d+), '\1[FILTERED]').
|
172
|
+
gsub(%r(("cvv\\?":\\?")\d+), '\1[FILTERED]').
|
173
|
+
gsub(%r(("username\\?":\\?")\w+@+\w+.+\w+), '\1[FILTERED]').
|
174
|
+
gsub(%r(("password\\?":\\?")\w+), '\1[FILTERED]').
|
175
|
+
gsub(%r(("integrator_id\\?":\\?")\w+), '\1[FILTERED]')
|
176
|
+
end
|
177
|
+
|
178
|
+
def acquire_access_token
|
179
|
+
post = {}
|
180
|
+
post[:grant_type] = 'password'
|
181
|
+
post[:username] = @options[:username]
|
182
|
+
post[:password] = @options[:password]
|
183
|
+
data = post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
|
184
|
+
url = live_url + '/oauth/token'
|
185
|
+
oauth_headers = {
|
186
|
+
'Accept' => '*/*',
|
187
|
+
'Content-Type' => 'application/x-www-form-urlencoded'
|
188
|
+
}
|
189
|
+
response = ssl_post(url, data, oauth_headers)
|
190
|
+
json_response = JSON.parse(response)
|
191
|
+
|
192
|
+
@options[:access_token] = json_response['access_token'] if json_response['access_token']
|
193
|
+
response
|
194
|
+
end
|
195
|
+
|
196
|
+
private
|
197
|
+
|
198
|
+
def build_purchase_request(money, payment_or_customer_id, options)
|
199
|
+
post = {}
|
200
|
+
add_amount(post, money, options)
|
201
|
+
if customer_id?(payment_or_customer_id)
|
202
|
+
post[:customer_id] = payment_or_customer_id
|
203
|
+
else
|
204
|
+
add_payment(post, payment_or_customer_id)
|
205
|
+
add_address(post, payment_or_customer_id, options)
|
206
|
+
add_customer_data(post, options)
|
207
|
+
end
|
208
|
+
|
209
|
+
post
|
210
|
+
end
|
211
|
+
|
212
|
+
def build_capture_request(money, authorization, options)
|
213
|
+
post = {}
|
214
|
+
if options[:check_transaction]
|
215
|
+
post[:check_transaction_id] = authorization
|
216
|
+
else
|
217
|
+
post[:transaction_id] = authorization
|
218
|
+
end
|
219
|
+
add_amount(post, money, options)
|
220
|
+
|
221
|
+
post
|
222
|
+
end
|
223
|
+
|
224
|
+
# method can only be used to add level 3 data to any approved and unsettled sale transaction so it is built into the standard purchase workflow above
|
225
|
+
def send_level_3_data(response, options)
|
226
|
+
post = {}
|
227
|
+
post[:transaction_id] = response.authorization
|
228
|
+
add_level_3_data(post, options)
|
229
|
+
|
230
|
+
post
|
231
|
+
end
|
232
|
+
|
233
|
+
def visa_or_mastercard?(options)
|
234
|
+
return false unless options[:visa_or_mastercard]
|
235
|
+
|
236
|
+
options[:visa_or_mastercard] == 'visa' || options[:visa_or_mastercard] == 'mastercard'
|
237
|
+
end
|
238
|
+
|
239
|
+
def customer_id?(payment_or_customer_id)
|
240
|
+
payment_or_customer_id.class == String
|
241
|
+
end
|
242
|
+
|
243
|
+
def string_literal_to_boolean(value)
|
244
|
+
return value unless value.class == String
|
245
|
+
|
246
|
+
if value.casecmp('true').zero?
|
247
|
+
true
|
248
|
+
elsif value.casecmp('false').zero?
|
249
|
+
false
|
250
|
+
else return nil
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
def add_customer_data(post, options)
|
255
|
+
return unless options[:email]
|
256
|
+
|
257
|
+
post[:email] = options[:email]
|
258
|
+
end
|
259
|
+
|
260
|
+
def add_address(post, creditcard, options)
|
261
|
+
return unless options[:billing_address] || options[:address]
|
262
|
+
|
263
|
+
address = options[:billing_address] || options[:address]
|
264
|
+
post[:billing_address] = {}
|
265
|
+
post[:billing_address][:name] = creditcard.name
|
266
|
+
post[:billing_address][:street_address] = address[:address1]
|
267
|
+
post[:billing_address][:city] = address[:city]
|
268
|
+
post[:billing_address][:state] = address[:state]
|
269
|
+
post[:billing_address][:zip] = address[:zip]
|
270
|
+
end
|
271
|
+
|
272
|
+
def add_amount(post, money, options)
|
273
|
+
post[:amount] = amount(money)
|
274
|
+
end
|
275
|
+
|
276
|
+
def add_payment(post, payment)
|
277
|
+
if payment.kind_of?(Check)
|
278
|
+
post[:check] = {}
|
279
|
+
post[:check][:account_number] = payment.account_number
|
280
|
+
post[:check][:routing_number] = payment.routing_number
|
281
|
+
else
|
282
|
+
post[:credit_card] = {}
|
283
|
+
post[:credit_card][:number] = payment.number
|
284
|
+
post[:credit_card][:expiration_month] = payment.month
|
285
|
+
post[:credit_card][:expiration_year] = payment.year
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def add_level_3_data(post, options)
|
290
|
+
post[:invoice_id] = options[:invoice_id] if options[:invoice_id]
|
291
|
+
post[:customer_reference_id] = options[:customer_reference_id] if options[:customer_reference_id]
|
292
|
+
post[:tax_amount] = options[:tax_amount].to_i if options[:tax_amount]
|
293
|
+
post[:national_tax_amount] = options[:national_tax_amount].to_i if options[:national_tax_amount]
|
294
|
+
post[:merchant_tax_id] = options[:merchant_tax_id] if options[:merchant_tax_id]
|
295
|
+
post[:customer_tax_id] = options[:customer_tax_id] if options[:customer_tax_id]
|
296
|
+
post[:commodity_code] = options[:commodity_code] if options[:commodity_code]
|
297
|
+
post[:discount_amount] = options[:discount_amount].to_i if options[:discount_amount]
|
298
|
+
post[:freight_amount] = options[:freight_amount].to_i if options[:freight_amount]
|
299
|
+
post[:duty_amount] = options[:duty_amount].to_i if options[:duty_amount]
|
300
|
+
post[:additional_tax_amount] = options[:additional_tax_amount].to_i if options[:additional_tax_amount]
|
301
|
+
post[:additional_tax_rate] = options[:additional_tax_rate].to_i if options[:additional_tax_rate]
|
302
|
+
|
303
|
+
add_source_address(post, options)
|
304
|
+
add_shipping_address(post, options)
|
305
|
+
add_line_items(post, options)
|
306
|
+
end
|
307
|
+
|
308
|
+
def add_source_address(post, options)
|
309
|
+
return unless source_address = options[:source_address] ||
|
310
|
+
options[:billing_address] ||
|
311
|
+
options[:address]
|
312
|
+
|
313
|
+
post[:source_address] = {}
|
314
|
+
post[:source_address][:zip] = source_address[:zip] if source_address[:zip]
|
315
|
+
end
|
316
|
+
|
317
|
+
def add_shipping_address(post, options)
|
318
|
+
return unless shipping_address = options[:shipping_address]
|
319
|
+
|
320
|
+
post[:shipping_address] = {}
|
321
|
+
post[:shipping_address][:name] = shipping_address[:name] if shipping_address[:name]
|
322
|
+
post[:shipping_address][:street_address] = shipping_address[:address1] if shipping_address[:address1]
|
323
|
+
post[:shipping_address][:street_address2] = shipping_address[:address2] if shipping_address[:address2]
|
324
|
+
post[:shipping_address][:city] = shipping_address[:city] if shipping_address[:city]
|
325
|
+
post[:shipping_address][:state] = shipping_address[:state] if shipping_address[:state]
|
326
|
+
post[:shipping_address][:zip] = shipping_address[:zip] if shipping_address[:zip]
|
327
|
+
post[:shipping_address][:country] = shipping_address[:country] if shipping_address[:country]
|
328
|
+
end
|
329
|
+
|
330
|
+
def add_line_items(post, options)
|
331
|
+
return unless options[:line_items]
|
332
|
+
|
333
|
+
line_items = []
|
334
|
+
options[:line_items].each do |li|
|
335
|
+
obj = {}
|
336
|
+
|
337
|
+
obj[:additional_tax_amount] = li[:additional_tax_amount].to_i if li[:additional_tax_amount]
|
338
|
+
obj[:additional_tax_included] = string_literal_to_boolean(li[:additional_tax_included]) if li[:additional_tax_included]
|
339
|
+
obj[:additional_tax_rate] = li[:additional_tax_rate].to_i if li[:additional_tax_rate]
|
340
|
+
obj[:amount] = li[:amount].to_i if li[:amount]
|
341
|
+
obj[:commodity_code] = li[:commodity_code] if li[:commodity_code]
|
342
|
+
obj[:debit_or_credit] = li[:debit_or_credit] if li[:debit_or_credit]
|
343
|
+
obj[:description] = li[:description] if li[:description]
|
344
|
+
obj[:discount_amount] = li[:discount_amount].to_i if li[:discount_amount]
|
345
|
+
obj[:discount_rate] = li[:discount_rate].to_i if li[:discount_rate]
|
346
|
+
obj[:discount_included] = string_literal_to_boolean(li[:discount_included]) if li[:discount_included]
|
347
|
+
obj[:merchant_tax_id] = li[:merchant_tax_id] if li[:merchant_tax_id]
|
348
|
+
obj[:product_id] = li[:product_id] if li[:product_id]
|
349
|
+
obj[:quantity] = li[:quantity] if li[:quantity]
|
350
|
+
obj[:transaction_id] = li[:transaction_id] if li[:transaction_id]
|
351
|
+
obj[:tax_included] = string_literal_to_boolean(li[:tax_included]) if li[:tax_included]
|
352
|
+
obj[:unit_of_measure] = li[:unit_of_measure] if li[:unit_of_measure]
|
353
|
+
obj[:unit_cost] = li[:unit_cost].to_i if li[:unit_cost]
|
354
|
+
|
355
|
+
line_items << obj
|
356
|
+
end
|
357
|
+
post[:line_items] = line_items
|
358
|
+
end
|
359
|
+
|
360
|
+
def check_token_response(response, endpoint, body = {}, options = {})
|
361
|
+
return response unless response.params['error'] == 'invalid_token'
|
362
|
+
|
363
|
+
acquire_access_token
|
364
|
+
commit(endpoint, body)
|
365
|
+
end
|
366
|
+
|
367
|
+
def parse(body)
|
368
|
+
JSON.parse(body)
|
369
|
+
end
|
370
|
+
|
371
|
+
def commit(action, parameters)
|
372
|
+
base_url = (test? ? test_url : live_url)
|
373
|
+
url = base_url + '/v1/' + action
|
374
|
+
raw_response = ssl_post(url, post_data(parameters), headers)
|
375
|
+
response = parse(raw_response)
|
376
|
+
success = success_from(response)
|
377
|
+
|
378
|
+
Response.new(
|
379
|
+
success,
|
380
|
+
message_from(success, response),
|
381
|
+
response,
|
382
|
+
authorization: authorization_from(action, response),
|
383
|
+
avs_result: AVSResult.new(code: response['avs_response']),
|
384
|
+
cvv_result: response['csc_response'],
|
385
|
+
test: test?,
|
386
|
+
error_code: success ? nil : error_code_from(response)
|
387
|
+
)
|
388
|
+
rescue JSON::ParserError
|
389
|
+
unparsable_response(raw_response)
|
390
|
+
end
|
391
|
+
|
392
|
+
def unparsable_response(raw_response)
|
393
|
+
message = 'Unparsable response received from PayTrace. Please contact PayTrace if you continue to receive this message.'
|
394
|
+
message += " (The raw response returned by the API was #{raw_response.inspect})"
|
395
|
+
return Response.new(false, message)
|
396
|
+
end
|
397
|
+
|
398
|
+
def headers
|
399
|
+
{
|
400
|
+
'Content-type' => 'application/json',
|
401
|
+
'Authorization' => 'Bearer ' + @options[:access_token]
|
402
|
+
}
|
403
|
+
end
|
404
|
+
|
405
|
+
def success_from(response)
|
406
|
+
response['success']
|
407
|
+
end
|
408
|
+
|
409
|
+
def message_from(success, response)
|
410
|
+
return response['status_message'] if success
|
411
|
+
|
412
|
+
if error = response['errors']
|
413
|
+
message = 'Errors-'
|
414
|
+
error.each do |k, v|
|
415
|
+
message.concat(" code:#{k}, message:#{v}")
|
416
|
+
end
|
417
|
+
else
|
418
|
+
message = response['status_message'].to_s + " #{response['approval_message']}"
|
419
|
+
end
|
420
|
+
|
421
|
+
message
|
422
|
+
end
|
423
|
+
|
424
|
+
# store transactions do not return a transaction_id, but they return a customer_id that will then be used as the third_party_token for the stored payment method
|
425
|
+
def authorization_from(action, response)
|
426
|
+
if action == ENDPOINTS[:store]
|
427
|
+
response['customer_id']
|
428
|
+
else
|
429
|
+
response['transaction_id'] || response['check_transaction_id']
|
430
|
+
end
|
431
|
+
end
|
432
|
+
|
433
|
+
def post_data(parameters = {})
|
434
|
+
parameters[:password] = @options[:password]
|
435
|
+
parameters[:username] = @options[:username]
|
436
|
+
parameters[:integrator_id] = @options[:integrator_id]
|
437
|
+
|
438
|
+
parameters.to_json
|
439
|
+
end
|
440
|
+
|
441
|
+
def error_code_from(response)
|
442
|
+
STANDARD_ERROR_CODE_MAPPING[response['response_code']]
|
443
|
+
end
|
444
|
+
|
445
|
+
def handle_response(response)
|
446
|
+
response.body
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|