activemerchant 1.100.0 → 1.133.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +1057 -0
- data/README.md +11 -9
- data/lib/active_merchant/billing/avs_result.rb +9 -9
- data/lib/active_merchant/billing/base.rb +0 -13
- data/lib/active_merchant/billing/check.rb +49 -17
- data/lib/active_merchant/billing/compatibility.rb +5 -4
- data/lib/active_merchant/billing/credit_card.rb +55 -8
- data/lib/active_merchant/billing/credit_card_formatting.rb +1 -0
- data/lib/active_merchant/billing/credit_card_methods.rb +209 -36
- data/lib/active_merchant/billing/cvv_result.rb +0 -1
- data/lib/active_merchant/billing/gateway.rb +38 -36
- data/lib/active_merchant/billing/gateways/adyen.rb +399 -78
- 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 +14 -14
- data/lib/active_merchant/billing/gateways/authorize_net.rb +200 -130
- data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +27 -20
- data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +48 -51
- data/lib/active_merchant/billing/gateways/axcessms.rb +13 -15
- data/lib/active_merchant/billing/gateways/balanced.rb +43 -36
- data/lib/active_merchant/billing/gateways/bambora_apac.rb +16 -20
- data/lib/active_merchant/billing/gateways/bank_frick.rb +13 -13
- data/lib/active_merchant/billing/gateways/banwire.rb +5 -5
- data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +43 -30
- data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +1 -1
- data/lib/active_merchant/billing/gateways/be2bill.rb +5 -5
- data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +37 -36
- data/lib/active_merchant/billing/gateways/beanstream.rb +21 -3
- data/lib/active_merchant/billing/gateways/beanstream_interac.rb +1 -1
- data/lib/active_merchant/billing/gateways/blue_pay.rb +53 -28
- data/lib/active_merchant/billing/gateways/blue_snap.rb +176 -54
- data/lib/active_merchant/billing/gateways/bogus.rb +24 -20
- data/lib/active_merchant/billing/gateways/borgun.rb +92 -38
- data/lib/active_merchant/billing/gateways/bpoint.rb +15 -15
- data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +8 -2
- data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
- data/lib/active_merchant/billing/gateways/braintree.rb +1 -1
- data/lib/active_merchant/billing/gateways/braintree_blue.rb +387 -175
- data/lib/active_merchant/billing/gateways/bridge_pay.rb +13 -13
- data/lib/active_merchant/billing/gateways/cams.rb +10 -10
- data/lib/active_merchant/billing/gateways/card_connect.rb +33 -14
- data/lib/active_merchant/billing/gateways/card_save.rb +3 -4
- data/lib/active_merchant/billing/gateways/card_stream.rb +67 -40
- data/lib/active_merchant/billing/gateways/cardknox.rb +13 -13
- data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -2
- data/lib/active_merchant/billing/gateways/cashnet.rb +28 -12
- data/lib/active_merchant/billing/gateways/cc5.rb +9 -9
- data/lib/active_merchant/billing/gateways/cecabank.rb +38 -38
- data/lib/active_merchant/billing/gateways/cenpos.rb +29 -28
- data/lib/active_merchant/billing/gateways/checkout.rb +7 -9
- data/lib/active_merchant/billing/gateways/checkout_v2.rb +316 -68
- data/lib/active_merchant/billing/gateways/citrus_pay.rb +1 -2
- data/lib/active_merchant/billing/gateways/clearhaus.rb +32 -33
- data/lib/active_merchant/billing/gateways/commerce_hub.rb +370 -0
- data/lib/active_merchant/billing/gateways/commercegate.rb +4 -4
- data/lib/active_merchant/billing/gateways/conekta.rb +8 -6
- data/lib/active_merchant/billing/gateways/creditcall.rb +18 -17
- data/lib/active_merchant/billing/gateways/credorax.rb +152 -63
- data/lib/active_merchant/billing/gateways/ct_payment.rb +15 -14
- data/lib/active_merchant/billing/gateways/culqi.rb +30 -28
- data/lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb +36 -0
- data/lib/active_merchant/billing/gateways/cyber_source.rb +496 -187
- data/lib/active_merchant/billing/gateways/cyber_source_rest.rb +454 -0
- data/lib/active_merchant/billing/gateways/d_local.rb +148 -31
- data/lib/active_merchant/billing/gateways/data_cash.rb +34 -37
- data/lib/active_merchant/billing/gateways/decidir.rb +134 -21
- data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
- data/lib/active_merchant/billing/gateways/dibs.rb +10 -10
- data/lib/active_merchant/billing/gateways/digitzs.rb +11 -8
- data/lib/active_merchant/billing/gateways/ebanx.rb +90 -40
- data/lib/active_merchant/billing/gateways/efsnet.rb +36 -36
- data/lib/active_merchant/billing/gateways/elavon.rb +349 -194
- data/lib/active_merchant/billing/gateways/element.rb +71 -21
- data/lib/active_merchant/billing/gateways/epay.rb +43 -43
- data/lib/active_merchant/billing/gateways/evo_ca.rb +12 -13
- data/lib/active_merchant/billing/gateways/eway.rb +9 -9
- data/lib/active_merchant/billing/gateways/eway_managed.rb +55 -56
- data/lib/active_merchant/billing/gateways/eway_rapid.rb +37 -22
- data/lib/active_merchant/billing/gateways/exact.rb +19 -20
- data/lib/active_merchant/billing/gateways/ezic.rb +9 -9
- data/lib/active_merchant/billing/gateways/fat_zebra.rb +24 -19
- data/lib/active_merchant/billing/gateways/federated_canada.rb +6 -7
- data/lib/active_merchant/billing/gateways/finansbank.rb +3 -3
- data/lib/active_merchant/billing/gateways/first_giving.rb +5 -4
- data/lib/active_merchant/billing/gateways/first_pay.rb +7 -7
- data/lib/active_merchant/billing/gateways/firstdata_e4.rb +39 -38
- data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +51 -31
- data/lib/active_merchant/billing/gateways/flo2cash.rb +24 -24
- data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +1 -1
- data/lib/active_merchant/billing/gateways/forte.rb +38 -22
- data/lib/active_merchant/billing/gateways/garanti.rb +12 -15
- data/lib/active_merchant/billing/gateways/global_collect.rb +333 -89
- data/lib/active_merchant/billing/gateways/global_transport.rb +8 -9
- data/lib/active_merchant/billing/gateways/hdfc.rb +22 -23
- data/lib/active_merchant/billing/gateways/hps.rb +171 -50
- data/lib/active_merchant/billing/gateways/iats_payments.rb +47 -25
- data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +1 -1
- data/lib/active_merchant/billing/gateways/inspire.rb +22 -27
- data/lib/active_merchant/billing/gateways/instapay.rb +5 -8
- data/lib/active_merchant/billing/gateways/ipg.rb +420 -0
- data/lib/active_merchant/billing/gateways/ipp.rb +9 -9
- data/lib/active_merchant/billing/gateways/iridium.rb +30 -31
- data/lib/active_merchant/billing/gateways/itransact.rb +11 -10
- data/lib/active_merchant/billing/gateways/iveri.rb +62 -23
- data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
- data/lib/active_merchant/billing/gateways/jetpay.rb +10 -17
- data/lib/active_merchant/billing/gateways/jetpay_v2.rb +13 -18
- data/lib/active_merchant/billing/gateways/komoju.rb +1 -1
- data/lib/active_merchant/billing/gateways/kushki.rb +100 -22
- data/lib/active_merchant/billing/gateways/latitude19.rb +20 -19
- data/lib/active_merchant/billing/gateways/linkpoint.rb +71 -72
- data/lib/active_merchant/billing/gateways/litle.rb +181 -45
- data/lib/active_merchant/billing/gateways/mastercard.rb +16 -22
- data/lib/active_merchant/billing/gateways/maxipago.rb +2 -2
- data/lib/active_merchant/billing/gateways/mercado_pago.rb +89 -18
- data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +58 -24
- data/lib/active_merchant/billing/gateways/merchant_one.rb +7 -10
- data/lib/active_merchant/billing/gateways/merchant_partners.rb +19 -19
- data/lib/active_merchant/billing/gateways/merchant_ware.rb +18 -22
- data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +15 -17
- data/lib/active_merchant/billing/gateways/merchant_warrior.rb +46 -8
- data/lib/active_merchant/billing/gateways/mercury.rb +19 -23
- data/lib/active_merchant/billing/gateways/metrics_global.rb +24 -33
- data/lib/active_merchant/billing/gateways/micropayment.rb +11 -12
- data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
- data/lib/active_merchant/billing/gateways/migs.rb +18 -21
- data/lib/active_merchant/billing/gateways/mit.rb +260 -0
- data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +10 -12
- data/lib/active_merchant/billing/gateways/moka.rb +290 -0
- data/lib/active_merchant/billing/gateways/monei.rb +236 -150
- data/lib/active_merchant/billing/gateways/moneris.rb +122 -53
- data/lib/active_merchant/billing/gateways/money_movers.rb +6 -7
- data/lib/active_merchant/billing/gateways/mundipagg.rb +69 -23
- data/lib/active_merchant/billing/gateways/nab_transact.rb +18 -20
- data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +10 -12
- data/lib/active_merchant/billing/gateways/net_registry.rb +8 -9
- data/lib/active_merchant/billing/gateways/netaxept.rb +12 -12
- data/lib/active_merchant/billing/gateways/netbanx.rb +128 -46
- data/lib/active_merchant/billing/gateways/netbilling.rb +18 -21
- data/lib/active_merchant/billing/gateways/netpay.rb +5 -4
- data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -10
- data/lib/active_merchant/billing/gateways/nmi.rb +69 -27
- data/lib/active_merchant/billing/gateways/ogone.rb +62 -31
- data/lib/active_merchant/billing/gateways/omise.rb +15 -16
- data/lib/active_merchant/billing/gateways/openpay.rb +33 -15
- data/lib/active_merchant/billing/gateways/opp.rb +39 -33
- data/lib/active_merchant/billing/gateways/optimal_payment.rb +43 -42
- data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +3 -5
- data/lib/active_merchant/billing/gateways/orbital.rb +623 -362
- data/lib/active_merchant/billing/gateways/pac_net_raven.rb +20 -20
- data/lib/active_merchant/billing/gateways/pagarme.rb +16 -23
- data/lib/active_merchant/billing/gateways/pago_facil.rb +4 -6
- data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
- data/lib/active_merchant/billing/gateways/pay_conex.rb +17 -17
- data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +30 -33
- data/lib/active_merchant/billing/gateways/pay_hub.rb +10 -10
- data/lib/active_merchant/billing/gateways/pay_junction.rb +31 -31
- data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +36 -18
- data/lib/active_merchant/billing/gateways/pay_secure.rb +10 -11
- data/lib/active_merchant/billing/gateways/pay_trace.rb +450 -0
- data/lib/active_merchant/billing/gateways/paybox_direct.rb +64 -40
- data/lib/active_merchant/billing/gateways/payeezy.rb +130 -27
- data/lib/active_merchant/billing/gateways/payex.rb +24 -25
- data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +17 -17
- data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +1 -1
- data/lib/active_merchant/billing/gateways/payflow.rb +103 -25
- data/lib/active_merchant/billing/gateways/payflow_express.rb +4 -4
- data/lib/active_merchant/billing/gateways/payflow_uk.rb +1 -1
- data/lib/active_merchant/billing/gateways/payment_express.rb +22 -18
- data/lib/active_merchant/billing/gateways/paymentez.rb +89 -24
- data/lib/active_merchant/billing/gateways/paymill.rb +14 -16
- data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +2 -1
- data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +4 -0
- data/lib/active_merchant/billing/gateways/paypal.rb +13 -5
- data/lib/active_merchant/billing/gateways/paypal_ca.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +1 -1
- data/lib/active_merchant/billing/gateways/paypal_express.rb +4 -1
- data/lib/active_merchant/billing/gateways/paypal_express_common.rb +1 -1
- data/lib/active_merchant/billing/gateways/paysafe.rb +420 -0
- data/lib/active_merchant/billing/gateways/payscout.rb +8 -9
- data/lib/active_merchant/billing/gateways/paystation.rb +6 -9
- data/lib/active_merchant/billing/gateways/payu_in.rb +20 -19
- data/lib/active_merchant/billing/gateways/payu_latam.rb +70 -37
- data/lib/active_merchant/billing/gateways/payway.rb +22 -22
- data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
- data/lib/active_merchant/billing/gateways/pin.rb +60 -21
- data/lib/active_merchant/billing/gateways/plexo.rb +308 -0
- data/lib/active_merchant/billing/gateways/plugnpay.rb +20 -21
- data/lib/active_merchant/billing/gateways/priority.rb +392 -0
- data/lib/active_merchant/billing/gateways/pro_pay.rb +13 -14
- data/lib/active_merchant/billing/gateways/psigate.rb +29 -29
- data/lib/active_merchant/billing/gateways/psl_card.rb +7 -8
- data/lib/active_merchant/billing/gateways/qbms.rb +25 -26
- data/lib/active_merchant/billing/gateways/quantum.rb +9 -11
- data/lib/active_merchant/billing/gateways/quickbooks.rb +126 -39
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +98 -98
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +19 -23
- data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +3 -3
- data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
- data/lib/active_merchant/billing/gateways/qvalent.rb +36 -20
- 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 +42 -16
- data/lib/active_merchant/billing/gateways/redsys.rb +191 -86
- data/lib/active_merchant/billing/gateways/s5.rb +10 -9
- data/lib/active_merchant/billing/gateways/safe_charge.rb +70 -33
- data/lib/active_merchant/billing/gateways/sage.rb +19 -21
- data/lib/active_merchant/billing/gateways/sage_pay.rb +57 -57
- data/lib/active_merchant/billing/gateways/sallie_mae.rb +3 -4
- data/lib/active_merchant/billing/gateways/secure_net.rb +19 -26
- data/lib/active_merchant/billing/gateways/secure_pay.rb +24 -33
- data/lib/active_merchant/billing/gateways/secure_pay_au.rb +18 -20
- data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +4 -5
- data/lib/active_merchant/billing/gateways/securion_pay.rb +48 -7
- 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 +19 -19
- data/lib/active_merchant/billing/gateways/smart_ps.rb +26 -32
- data/lib/active_merchant/billing/gateways/so_easy_pay.rb +24 -25
- data/lib/active_merchant/billing/gateways/spreedly_core.rb +27 -21
- data/lib/active_merchant/billing/gateways/stripe.rb +126 -53
- data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +441 -113
- data/lib/active_merchant/billing/gateways/swipe_checkout.rb +7 -8
- data/lib/active_merchant/billing/gateways/telr.rb +17 -18
- data/lib/active_merchant/billing/gateways/tns.rb +3 -7
- data/lib/active_merchant/billing/gateways/trans_first.rb +10 -9
- data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +28 -24
- data/lib/active_merchant/billing/gateways/transact_pro.rb +13 -15
- data/lib/active_merchant/billing/gateways/transax.rb +1 -2
- data/lib/active_merchant/billing/gateways/trexle.rb +5 -2
- data/lib/active_merchant/billing/gateways/trust_commerce.rb +57 -47
- data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -2
- data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +176 -184
- data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +60 -48
- data/lib/active_merchant/billing/gateways/vanco.rb +17 -8
- data/lib/active_merchant/billing/gateways/verifi.rb +13 -14
- data/lib/active_merchant/billing/gateways/viaklix.rb +9 -14
- data/lib/active_merchant/billing/gateways/visanet_peru.rb +26 -21
- data/lib/active_merchant/billing/gateways/vpos.rb +223 -0
- data/lib/active_merchant/billing/gateways/webpay.rb +4 -4
- data/lib/active_merchant/billing/gateways/wepay.rb +14 -16
- data/lib/active_merchant/billing/gateways/wirecard.rb +14 -16
- data/lib/active_merchant/billing/gateways/wompi.rb +197 -0
- data/lib/active_merchant/billing/gateways/world_net.rb +36 -35
- data/lib/active_merchant/billing/gateways/worldpay.rb +556 -190
- data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +47 -54
- data/lib/active_merchant/billing/gateways/worldpay_us.rb +16 -16
- data/lib/active_merchant/billing/network_tokenization_credit_card.rb +2 -2
- data/lib/active_merchant/billing/response.rb +25 -6
- data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
- data/lib/active_merchant/billing.rb +1 -0
- data/lib/active_merchant/connection.rb +14 -15
- data/lib/active_merchant/country.rb +3 -1
- data/lib/active_merchant/errors.rb +4 -1
- data/lib/active_merchant/net_http_ssl_connection.rb +1 -0
- data/lib/active_merchant/network_connection_retries.rb +15 -17
- data/lib/active_merchant/post_data.rb +3 -2
- data/lib/active_merchant/posts_data.rb +2 -2
- data/lib/active_merchant/version.rb +1 -1
- data/lib/active_merchant.rb +2 -2
- data/lib/certs/cacert.pem +1587 -2361
- data/lib/support/gateway_support.rb +1 -1
- data/lib/support/ssl_verify.rb +3 -7
- data/lib/support/ssl_version.rb +2 -3
- metadata +86 -34
- data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -352
@@ -0,0 +1,253 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PaywayDotComGateway < Gateway
|
4
|
+
self.test_url = 'https://paywaywsdev.com/PaywayWS/Payment/CreditCard'
|
5
|
+
self.live_url = 'https://paywayws.net/PaywayWS/Payment/CreditCard'
|
6
|
+
|
7
|
+
self.supported_countries = %w[US CA]
|
8
|
+
self.default_currency = 'USD'
|
9
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
10
|
+
|
11
|
+
self.money_format = :cents
|
12
|
+
|
13
|
+
self.homepage_url = 'http://www.payway.com'
|
14
|
+
self.display_name = 'Payway Gateway'
|
15
|
+
|
16
|
+
STANDARD_ERROR_CODE_MAPPING = {
|
17
|
+
'5012' => STANDARD_ERROR_CODE[:card_declined],
|
18
|
+
'5035' => STANDARD_ERROR_CODE[:invalid_number],
|
19
|
+
'5037' => STANDARD_ERROR_CODE[:invalid_expiry_date],
|
20
|
+
'5045' => STANDARD_ERROR_CODE[:incorrect_zip]
|
21
|
+
}
|
22
|
+
|
23
|
+
# Payway to standard AVSResult codes.
|
24
|
+
AVS_MAPPING = {
|
25
|
+
'N1' => 'I', # No address given with order
|
26
|
+
'N2' => 'I', # Bill-to address did not pass
|
27
|
+
'““' => 'R', # AVS not performed (Blanks returned)
|
28
|
+
'IU' => 'G', # AVS not performed by Issuer
|
29
|
+
'ID' => 'S', # Issuer does not participate in AVS
|
30
|
+
'IE' => 'E', # Edit Error - AVS data is invalid
|
31
|
+
'IS' => 'R', # System unavailable or time-out
|
32
|
+
'IB' => 'B', # Street address match. Postal code not verified due to incompatible formats (both were sent).
|
33
|
+
'IC' => 'C', # Street address and postal code not verified due to incompatible format (both were sent).
|
34
|
+
'IP' => 'P', # Postal code match. Street address not verified due to incompatible formats (both were sent).
|
35
|
+
'A1' => 'K', # Accountholder name matches
|
36
|
+
'A3' => 'V', # Accountholder name, billing address and postal code.
|
37
|
+
'A4' => 'L', # Accountholder name and billing postal code match
|
38
|
+
'A7' => 'O', # Accountholder name and billing address match
|
39
|
+
'B3' => 'H', # Accountholder name incorrect, billing address and postal code match
|
40
|
+
'B4' => 'F', # Accountholder name incorrect, billing postal code matches
|
41
|
+
'B7' => 'T', # Accountholder name incorrect, billing address matches
|
42
|
+
'B8' => 'N', # Accountholder name, billing address and postal code are all incorrect
|
43
|
+
'??' => 'R', # A double question mark symbol indicates an unrecognized response from association
|
44
|
+
'I1' => 'X', # Zip code +4 and Address Match
|
45
|
+
'I2' => 'W', # Zip code +4 Match
|
46
|
+
'I3' => 'Y', # Zip code and Address Match
|
47
|
+
'I4' => 'Z', # Zip code Match
|
48
|
+
'I5' => 'M', # +4 and Address Match
|
49
|
+
'I6' => 'W', # +4 Match
|
50
|
+
'I7' => 'A', # Address Match
|
51
|
+
'I8' => 'C', # No Match
|
52
|
+
}
|
53
|
+
|
54
|
+
PAYWAY_WS_SUCCESS = '5000'
|
55
|
+
|
56
|
+
SCRUB_PATTERNS = [
|
57
|
+
%r(("password\\?":\\?")[^\\]+),
|
58
|
+
%r(("fsv\\?":\\?")\d+),
|
59
|
+
%r(("fsv\\?": \\?")\d+),
|
60
|
+
%r(("accountNumber\\?":\\?")\d+),
|
61
|
+
%r(("accountNumber\\?": \\?")[^\\]+),
|
62
|
+
%r(("Invalid account number: )\d+)
|
63
|
+
].freeze
|
64
|
+
|
65
|
+
SCRUB_REPLACEMENT = '\1[FILTERED]'
|
66
|
+
|
67
|
+
def initialize(options = {})
|
68
|
+
requires!(options, :login, :password, :company_id, :source_id)
|
69
|
+
super
|
70
|
+
end
|
71
|
+
|
72
|
+
def purchase(money, payment, options = {})
|
73
|
+
post = {}
|
74
|
+
add_common(post, options)
|
75
|
+
add_card_payment(post, payment, options)
|
76
|
+
add_card_transaction_details(post, money, options)
|
77
|
+
add_address(post, payment, options)
|
78
|
+
|
79
|
+
commit('sale', post)
|
80
|
+
end
|
81
|
+
|
82
|
+
def authorize(money, payment, options = {})
|
83
|
+
post = {}
|
84
|
+
add_common(post, options)
|
85
|
+
add_card_payment(post, payment, options)
|
86
|
+
add_card_transaction_details(post, money, options)
|
87
|
+
add_address(post, payment, options)
|
88
|
+
|
89
|
+
commit('authorize', post)
|
90
|
+
end
|
91
|
+
|
92
|
+
def capture(money, authorization, options = {})
|
93
|
+
post = {}
|
94
|
+
add_common(post, options)
|
95
|
+
add_card_transaction_name(post, authorization, options)
|
96
|
+
|
97
|
+
commit('capture', post)
|
98
|
+
end
|
99
|
+
|
100
|
+
def credit(money, payment, options = {})
|
101
|
+
post = {}
|
102
|
+
add_common(post, options)
|
103
|
+
add_card_payment(post, payment, options)
|
104
|
+
add_card_transaction_details(post, money, options)
|
105
|
+
add_address(post, payment, options)
|
106
|
+
|
107
|
+
commit('credit', post)
|
108
|
+
end
|
109
|
+
|
110
|
+
def void(authorization, options = {})
|
111
|
+
post = {}
|
112
|
+
add_common(post, options)
|
113
|
+
add_card_transaction_name(post, authorization, options)
|
114
|
+
|
115
|
+
commit('void', post)
|
116
|
+
end
|
117
|
+
|
118
|
+
def supports_scrubbing?
|
119
|
+
true
|
120
|
+
end
|
121
|
+
|
122
|
+
def scrub(transcript)
|
123
|
+
SCRUB_PATTERNS.inject(transcript) do |text, pattern|
|
124
|
+
text.gsub(pattern, SCRUB_REPLACEMENT)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
private
|
129
|
+
|
130
|
+
def add_common(post, options)
|
131
|
+
post[:userName] = @options[:login]
|
132
|
+
post[:password] = @options[:password]
|
133
|
+
post[:companyId] = @options[:company_id]
|
134
|
+
post[:cardTransaction] = {}
|
135
|
+
post[:cardTransaction][:sourceId] = @options[:source_id]
|
136
|
+
end
|
137
|
+
|
138
|
+
def add_address(post, payment, options)
|
139
|
+
post[:cardAccount] ||= {}
|
140
|
+
address = options[:billing_address] || options[:address] || {}
|
141
|
+
first_name, last_name = split_names(address[:name])
|
142
|
+
full_address = "#{address[:address1]} #{address[:address2]}".strip
|
143
|
+
phone = address[:phone] || address[:phone_number]
|
144
|
+
|
145
|
+
post[:cardAccount][:firstName] = first_name if first_name
|
146
|
+
post[:cardAccount][:lastName] = last_name if last_name
|
147
|
+
post[:cardAccount][:address] = full_address if full_address
|
148
|
+
post[:cardAccount][:city] = address[:city] if address[:city]
|
149
|
+
post[:cardAccount][:state] = address[:state] if address[:state]
|
150
|
+
post[:cardAccount][:zip] = address[:zip] if address[:zip]
|
151
|
+
post[:cardAccount][:phone] = phone if phone
|
152
|
+
end
|
153
|
+
|
154
|
+
def add_card_transaction_details(post, money, options)
|
155
|
+
post[:cardTransaction][:amount] = amount(money)
|
156
|
+
eci_type = options[:eci_type].nil? ? '1' : options[:eci_type]
|
157
|
+
post[:cardTransaction][:eciType] = eci_type
|
158
|
+
post[:cardTransaction][:processorSoftDescriptor] = options[:processor_soft_descriptor] if options[:processor_soft_descriptor]
|
159
|
+
post[:cardTransaction][:tax] = options[:tax] if options[:tax]
|
160
|
+
end
|
161
|
+
|
162
|
+
def add_card_transaction_name(post, identifier, options)
|
163
|
+
post[:cardTransaction][:name] = identifier
|
164
|
+
end
|
165
|
+
|
166
|
+
def add_card_payment(post, payment, options)
|
167
|
+
# credit_card
|
168
|
+
post[:accountInputMode] = 'primaryAccountNumber'
|
169
|
+
|
170
|
+
post[:cardAccount] ||= {}
|
171
|
+
post[:cardAccount][:accountNumber] = payment.number
|
172
|
+
post[:cardAccount][:fsv] = payment.verification_value
|
173
|
+
post[:cardAccount][:expirationDate] = expdate(payment)
|
174
|
+
post[:cardAccount][:email] = options[:email] if options[:email]
|
175
|
+
end
|
176
|
+
|
177
|
+
def expdate(credit_card)
|
178
|
+
year = format(credit_card.year, :four_digits)
|
179
|
+
month = format(credit_card.month, :two_digits)
|
180
|
+
|
181
|
+
month + year
|
182
|
+
end
|
183
|
+
|
184
|
+
def parse(body)
|
185
|
+
body.blank? ? {} : JSON.parse(body)
|
186
|
+
end
|
187
|
+
|
188
|
+
def commit(action, parameters)
|
189
|
+
parameters[:request] = action
|
190
|
+
|
191
|
+
url = (test? ? test_url : live_url)
|
192
|
+
payload = parameters.to_json unless parameters.nil?
|
193
|
+
|
194
|
+
response =
|
195
|
+
begin
|
196
|
+
parse(ssl_request(:post, url, payload, headers))
|
197
|
+
rescue ResponseError => e
|
198
|
+
return Response.new(false, 'Invalid Login') if e.response.code == '401'
|
199
|
+
|
200
|
+
parse(e.response.body)
|
201
|
+
end
|
202
|
+
|
203
|
+
success = success_from(response)
|
204
|
+
avs_result_code = response['cardTransaction'].nil? || response['cardTransaction']['addressVerificationResults'].nil? ? '' : response['cardTransaction']['addressVerificationResults']
|
205
|
+
avs_result = AVSResult.new(code: AVS_MAPPING[avs_result_code])
|
206
|
+
cvv_result = CVVResult.new(response['cardTransaction']['fraudSecurityResults']) if response['cardTransaction'] && response['cardTransaction']['fraudSecurityResults']
|
207
|
+
|
208
|
+
Response.new(
|
209
|
+
success,
|
210
|
+
message_from(success, response),
|
211
|
+
response,
|
212
|
+
test: test?,
|
213
|
+
error_code: error_code_from(response),
|
214
|
+
authorization: authorization_from(response),
|
215
|
+
avs_result: avs_result,
|
216
|
+
cvv_result: cvv_result
|
217
|
+
)
|
218
|
+
end
|
219
|
+
|
220
|
+
def success_from(response)
|
221
|
+
response['paywayCode'] == PAYWAY_WS_SUCCESS
|
222
|
+
end
|
223
|
+
|
224
|
+
def error_code_from(response)
|
225
|
+
return '' if success_from(response)
|
226
|
+
|
227
|
+
error = !STANDARD_ERROR_CODE_MAPPING[response['paywayCode']].nil? ? STANDARD_ERROR_CODE_MAPPING[response['paywayCode']] : STANDARD_ERROR_CODE[:processing_error]
|
228
|
+
return error
|
229
|
+
end
|
230
|
+
|
231
|
+
def message_from(success, response)
|
232
|
+
return '' if response['paywayCode'].nil?
|
233
|
+
|
234
|
+
return response['paywayCode'] + '-' + 'success' if success
|
235
|
+
|
236
|
+
response['paywayCode']
|
237
|
+
end
|
238
|
+
|
239
|
+
def authorization_from(response)
|
240
|
+
return '' if !success_from(response) || response['cardTransaction'].nil?
|
241
|
+
|
242
|
+
response['cardTransaction']['name']
|
243
|
+
end
|
244
|
+
|
245
|
+
def headers
|
246
|
+
{
|
247
|
+
'Accept' => 'application/json',
|
248
|
+
'Content-type' => 'application/json'
|
249
|
+
}
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
@@ -6,8 +6,8 @@ module ActiveMerchant #:nodoc:
|
|
6
6
|
|
7
7
|
self.default_currency = 'AUD'
|
8
8
|
self.money_format = :cents
|
9
|
-
self.supported_countries =
|
10
|
-
self.supported_cardtypes = [
|
9
|
+
self.supported_countries = %w(AU NZ)
|
10
|
+
self.supported_cardtypes = %i[visa master american_express diners_club discover jcb]
|
11
11
|
self.homepage_url = 'http://www.pinpayments.com/'
|
12
12
|
self.display_name = 'Pin Payments'
|
13
13
|
|
@@ -30,6 +30,7 @@ module ActiveMerchant #:nodoc:
|
|
30
30
|
add_address(post, creditcard, options)
|
31
31
|
add_capture(post, options)
|
32
32
|
add_metadata(post, options)
|
33
|
+
add_3ds(post, options)
|
33
34
|
|
34
35
|
commit(:post, 'charges', post, options)
|
35
36
|
end
|
@@ -45,9 +46,20 @@ module ActiveMerchant #:nodoc:
|
|
45
46
|
commit(:post, 'customers', post, options)
|
46
47
|
end
|
47
48
|
|
49
|
+
# Unstore a customer and associated credit card.
|
50
|
+
def unstore(token)
|
51
|
+
customer_token =
|
52
|
+
if /cus_/.match?(token)
|
53
|
+
get_customer_token(token)
|
54
|
+
else
|
55
|
+
token
|
56
|
+
end
|
57
|
+
commit(:delete, "customers/#{CGI.escape(customer_token)}", {}, {})
|
58
|
+
end
|
59
|
+
|
48
60
|
# Refund a transaction
|
49
61
|
def refund(money, token, options = {})
|
50
|
-
commit(:post, "charges/#{CGI.escape(token)}/refunds", { :
|
62
|
+
commit(:post, "charges/#{CGI.escape(token)}/refunds", { amount: amount(money) }, options)
|
51
63
|
end
|
52
64
|
|
53
65
|
# Authorize an amount on a credit card. Once authorized, you can later
|
@@ -61,7 +73,12 @@ module ActiveMerchant #:nodoc:
|
|
61
73
|
# Captures a previously authorized charge. Capturing only part of the original
|
62
74
|
# authorization is currently not supported.
|
63
75
|
def capture(money, token, options = {})
|
64
|
-
commit(:put, "charges/#{CGI.escape(token)}/capture", { :
|
76
|
+
commit(:put, "charges/#{CGI.escape(token)}/capture", { amount: amount(money) }, options)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Voids a previously authorized charge.
|
80
|
+
def void(token, options = {})
|
81
|
+
commit(:put, "charges/#{CGI.escape(token)}/void", {}, options)
|
65
82
|
end
|
66
83
|
|
67
84
|
# Updates the credit card for the customer.
|
@@ -101,16 +118,17 @@ module ActiveMerchant #:nodoc:
|
|
101
118
|
|
102
119
|
def add_address(post, creditcard, options)
|
103
120
|
return if creditcard.kind_of?(String)
|
121
|
+
|
104
122
|
address = (options[:billing_address] || options[:address])
|
105
123
|
return unless address
|
106
124
|
|
107
125
|
post[:card] ||= {}
|
108
126
|
post[:card].merge!(
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:
|
127
|
+
address_line1: address[:address1],
|
128
|
+
address_city: address[:city],
|
129
|
+
address_postcode: address[:zip],
|
130
|
+
address_state: address[:state],
|
131
|
+
address_country: address[:country]
|
114
132
|
)
|
115
133
|
end
|
116
134
|
|
@@ -130,14 +148,14 @@ module ActiveMerchant #:nodoc:
|
|
130
148
|
post[:card] ||= {}
|
131
149
|
|
132
150
|
post[:card].merge!(
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
151
|
+
number: creditcard.number,
|
152
|
+
expiry_month: creditcard.month,
|
153
|
+
expiry_year: creditcard.year,
|
154
|
+
cvc: creditcard.verification_value,
|
155
|
+
name: creditcard.name
|
138
156
|
)
|
139
157
|
elsif creditcard.kind_of?(String)
|
140
|
-
if
|
158
|
+
if /^card_/.match?(creditcard)
|
141
159
|
post[:card_token] = get_card_token(creditcard)
|
142
160
|
else
|
143
161
|
post[:customer_token] = creditcard
|
@@ -157,6 +175,16 @@ module ActiveMerchant #:nodoc:
|
|
157
175
|
post[:metadata] = options[:metadata] if options[:metadata]
|
158
176
|
end
|
159
177
|
|
178
|
+
def add_3ds(post, options)
|
179
|
+
if options[:three_d_secure]
|
180
|
+
post[:three_d_secure] = {}
|
181
|
+
post[:three_d_secure][:version] = options[:three_d_secure][:version] if options[:three_d_secure][:version]
|
182
|
+
post[:three_d_secure][:eci] = options[:three_d_secure][:eci] if options[:three_d_secure][:eci]
|
183
|
+
post[:three_d_secure][:cavv] = options[:three_d_secure][:cavv] if options[:three_d_secure][:cavv]
|
184
|
+
post[:three_d_secure][:transaction_id] = options[:three_d_secure][:ds_transaction_id] || options[:three_d_secure][:xid]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
160
188
|
def headers(params = {})
|
161
189
|
result = {
|
162
190
|
'Content-Type' => 'application/json',
|
@@ -178,7 +206,9 @@ module ActiveMerchant #:nodoc:
|
|
178
206
|
body = parse(e.response.body)
|
179
207
|
end
|
180
208
|
|
181
|
-
if body
|
209
|
+
if body.nil?
|
210
|
+
no_content_response
|
211
|
+
elsif body['response']
|
182
212
|
success_response(body)
|
183
213
|
elsif body['error']
|
184
214
|
error_response(body)
|
@@ -193,8 +223,8 @@ module ActiveMerchant #:nodoc:
|
|
193
223
|
true,
|
194
224
|
response['status_message'],
|
195
225
|
body,
|
196
|
-
:
|
197
|
-
:
|
226
|
+
authorization: token(response),
|
227
|
+
test: test?
|
198
228
|
)
|
199
229
|
end
|
200
230
|
|
@@ -203,8 +233,17 @@ module ActiveMerchant #:nodoc:
|
|
203
233
|
false,
|
204
234
|
body['error_description'],
|
205
235
|
body,
|
206
|
-
:
|
207
|
-
:
|
236
|
+
authorization: nil,
|
237
|
+
test: test?
|
238
|
+
)
|
239
|
+
end
|
240
|
+
|
241
|
+
def no_content_response
|
242
|
+
Response.new(
|
243
|
+
true,
|
244
|
+
nil,
|
245
|
+
{},
|
246
|
+
test: test?
|
208
247
|
)
|
209
248
|
end
|
210
249
|
|
@@ -223,7 +262,7 @@ module ActiveMerchant #:nodoc:
|
|
223
262
|
end
|
224
263
|
|
225
264
|
def parse(body)
|
226
|
-
JSON.parse(body)
|
265
|
+
JSON.parse(body) unless body.nil? || body.length == 0
|
227
266
|
end
|
228
267
|
|
229
268
|
def post_data(parameters = {})
|