swiss-activemerchant 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +4033 -0
- data/CONTRIBUTORS +568 -0
- data/MIT-LICENSE +20 -0
- data/README.md +249 -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 +243 -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 +227 -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 +312 -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 +120 -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,69 @@
|
|
1
|
+
module ActiveMerchant #:nodoc:
|
2
|
+
module Billing #:nodoc:
|
3
|
+
class PaypalExpressResponse < Response
|
4
|
+
def email
|
5
|
+
info['Payer']
|
6
|
+
end
|
7
|
+
|
8
|
+
def info
|
9
|
+
(@params['PayerInfo']||{})
|
10
|
+
end
|
11
|
+
|
12
|
+
def details
|
13
|
+
(@params['PaymentDetails']||{})
|
14
|
+
end
|
15
|
+
|
16
|
+
def checkout_status
|
17
|
+
(@params['CheckoutStatus']||{})
|
18
|
+
end
|
19
|
+
|
20
|
+
def name
|
21
|
+
payer = (info['PayerName']||{})
|
22
|
+
[payer['FirstName'], payer['MiddleName'], payer['LastName']].compact.join(' ')
|
23
|
+
end
|
24
|
+
|
25
|
+
def token
|
26
|
+
@params['Token']
|
27
|
+
end
|
28
|
+
|
29
|
+
def payer_id
|
30
|
+
info['PayerID']
|
31
|
+
end
|
32
|
+
|
33
|
+
def payer_country
|
34
|
+
info['PayerCountry']
|
35
|
+
end
|
36
|
+
|
37
|
+
# PayPal returns a contact telephone number only if your Merchant account
|
38
|
+
# profile settings require that the buyer enter one.
|
39
|
+
def contact_phone
|
40
|
+
@params['ContactPhone']
|
41
|
+
end
|
42
|
+
|
43
|
+
def address
|
44
|
+
address = (details['ShipToAddress']||{})
|
45
|
+
{ 'name' => address['Name'],
|
46
|
+
'company' => info['PayerBusiness'],
|
47
|
+
'address1' => address['Street1'],
|
48
|
+
'address2' => address['Street2'],
|
49
|
+
'city' => address['CityName'],
|
50
|
+
'state' => address['StateOrProvince'],
|
51
|
+
'country' => address['Country'],
|
52
|
+
'zip' => address['PostalCode'],
|
53
|
+
'phone' => (contact_phone || address['Phone'])
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def shipping
|
58
|
+
shipping = (@params['UserSelectedOptions']||{})
|
59
|
+
{ 'amount' => shipping['ShippingOptionAmount'],
|
60
|
+
'name' => shipping['ShippingOptionName']
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
def note
|
65
|
+
@params['note_text']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,262 @@
|
|
1
|
+
require 'active_merchant/billing/gateways/paypal/paypal_common_api'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
# This module is included in both PaypalGateway and PaypalExpressGateway
|
6
|
+
module PaypalRecurringApi
|
7
|
+
PAYPAL_NAMESPACE = ActiveMerchant::Billing::PaypalCommonAPI::PAYPAL_NAMESPACE
|
8
|
+
API_VERSION = ActiveMerchant::Billing::PaypalCommonAPI::API_VERSION
|
9
|
+
EBAY_NAMESPACE = ActiveMerchant::Billing::PaypalCommonAPI::EBAY_NAMESPACE
|
10
|
+
# Create a recurring payment.
|
11
|
+
#
|
12
|
+
# This transaction creates a recurring payment profile
|
13
|
+
# ==== Parameters
|
14
|
+
#
|
15
|
+
# * <tt>amount</tt> -- The amount to be charged to the customer at each interval as an Integer value in cents.
|
16
|
+
# * <tt>credit_card</tt> -- The CreditCard details for the transaction.
|
17
|
+
# * <tt>options</tt> -- A hash of parameters.
|
18
|
+
#
|
19
|
+
# ==== Options
|
20
|
+
#
|
21
|
+
# * <tt>:period</tt> -- [Day, Week, SemiMonth, Month, Year] default: Month
|
22
|
+
# * <tt>:frequency</tt> -- a number
|
23
|
+
# * <tt>:cycles</tt> -- Limit to certain # of cycles (OPTIONAL)
|
24
|
+
# * <tt>:start_date</tt> -- When does the charging starts (REQUIRED)
|
25
|
+
# * <tt>:description</tt> -- The description to appear in the profile (REQUIRED)
|
26
|
+
|
27
|
+
def recurring(amount, credit_card, options = {})
|
28
|
+
ActiveMerchant.deprecated Gateway::RECURRING_DEPRECATION_MESSAGE
|
29
|
+
|
30
|
+
options[:credit_card] = credit_card
|
31
|
+
options[:amount] = amount
|
32
|
+
requires!(options, :description, :start_date, :period, :frequency, :amount)
|
33
|
+
commit 'CreateRecurringPaymentsProfile', build_create_profile_request(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Update a recurring payment's details.
|
37
|
+
#
|
38
|
+
# This transaction updates an existing Recurring Billing Profile
|
39
|
+
# and the subscription must have already been created previously
|
40
|
+
# by calling +recurring()+. The ability to change certain
|
41
|
+
# details about a recurring payment is dependent on transaction history
|
42
|
+
# and the type of plan you're subscribed with paypal. Web Payment Pro
|
43
|
+
# seems to have the ability to update the most field.
|
44
|
+
#
|
45
|
+
# ==== Parameters
|
46
|
+
#
|
47
|
+
# * <tt>options</tt> -- A hash of parameters.
|
48
|
+
#
|
49
|
+
# ==== Options
|
50
|
+
#
|
51
|
+
# * <tt>:profile_id</tt> -- A string containing the <tt>:profile_id</tt>
|
52
|
+
# of the recurring payment already in place for a given credit card. (REQUIRED)
|
53
|
+
def update_recurring(options={})
|
54
|
+
ActiveMerchant.deprecated Gateway::RECURRING_DEPRECATION_MESSAGE
|
55
|
+
|
56
|
+
requires!(options, :profile_id)
|
57
|
+
opts = options.dup
|
58
|
+
commit 'UpdateRecurringPaymentsProfile', build_change_profile_request(opts.delete(:profile_id), opts)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Cancel a recurring payment.
|
62
|
+
#
|
63
|
+
# This transaction cancels an existing recurring billing profile. Your account must have recurring billing enabled
|
64
|
+
# and the subscription must have already been created previously by calling recurring()
|
65
|
+
#
|
66
|
+
# ==== Parameters
|
67
|
+
#
|
68
|
+
# * <tt>profile_id</tt> -- A string containing the +profile_id+ of the
|
69
|
+
# recurring payment already in place for a given credit card. (REQUIRED)
|
70
|
+
# * <tt>options</tt> -- A hash with extra info ('note' for ex.)
|
71
|
+
def cancel_recurring(profile_id, options = {})
|
72
|
+
ActiveMerchant.deprecated Gateway::RECURRING_DEPRECATION_MESSAGE
|
73
|
+
|
74
|
+
raise_error_if_blank('profile_id', profile_id)
|
75
|
+
commit 'ManageRecurringPaymentsProfileStatus', build_manage_profile_request(profile_id, 'Cancel', options)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Get Subscription Status of a recurring payment profile.
|
79
|
+
#
|
80
|
+
# ==== Parameters
|
81
|
+
#
|
82
|
+
# * <tt>profile_id</tt> -- A string containing the +profile_id+ of the
|
83
|
+
# recurring payment already in place for a given credit card. (REQUIRED)
|
84
|
+
def status_recurring(profile_id)
|
85
|
+
ActiveMerchant.deprecated Gateway::RECURRING_DEPRECATION_MESSAGE
|
86
|
+
|
87
|
+
raise_error_if_blank('profile_id', profile_id)
|
88
|
+
commit 'GetRecurringPaymentsProfileDetails', build_get_profile_details_request(profile_id)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Suspends a recurring payment profile.
|
92
|
+
#
|
93
|
+
# ==== Parameters
|
94
|
+
#
|
95
|
+
# * <tt>profile_id</tt> -- A string containing the +profile_id+ of the
|
96
|
+
# recurring payment already in place for a given credit card. (REQUIRED)
|
97
|
+
def suspend_recurring(profile_id, options = {})
|
98
|
+
ActiveMerchant.deprecated Gateway::RECURRING_DEPRECATION_MESSAGE
|
99
|
+
|
100
|
+
raise_error_if_blank('profile_id', profile_id)
|
101
|
+
commit 'ManageRecurringPaymentsProfileStatus', build_manage_profile_request(profile_id, 'Suspend', options)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Reactivates a suspended recurring payment profile.
|
105
|
+
#
|
106
|
+
# ==== Parameters
|
107
|
+
#
|
108
|
+
# * <tt>profile_id</tt> -- A string containing the +profile_id+ of the
|
109
|
+
# recurring payment already in place for a given credit card. (REQUIRED)
|
110
|
+
def reactivate_recurring(profile_id, options = {})
|
111
|
+
ActiveMerchant.deprecated Gateway::RECURRING_DEPRECATION_MESSAGE
|
112
|
+
|
113
|
+
raise_error_if_blank('profile_id', profile_id)
|
114
|
+
commit 'ManageRecurringPaymentsProfileStatus', build_manage_profile_request(profile_id, 'Reactivate', options)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Bills outstanding amount to a recurring payment profile.
|
118
|
+
#
|
119
|
+
# ==== Parameters
|
120
|
+
#
|
121
|
+
# * <tt>profile_id</tt> -- A string containing the +profile_id+ of the
|
122
|
+
# recurring payment already in place for a given credit card. (REQUIRED)
|
123
|
+
def bill_outstanding_amount(profile_id, options = {})
|
124
|
+
ActiveMerchant.deprecated Gateway::RECURRING_DEPRECATION_MESSAGE
|
125
|
+
|
126
|
+
raise_error_if_blank('profile_id', profile_id)
|
127
|
+
commit 'BillOutstandingAmount', build_bill_outstanding_amount(profile_id, options)
|
128
|
+
end
|
129
|
+
|
130
|
+
private
|
131
|
+
def raise_error_if_blank(field_name, field)
|
132
|
+
raise ArgumentError.new("Missing required parameter: #{field_name}") if field.blank?
|
133
|
+
end
|
134
|
+
def build_create_profile_request(options)
|
135
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
136
|
+
xml.tag! 'CreateRecurringPaymentsProfileReq', 'xmlns' => PAYPAL_NAMESPACE do
|
137
|
+
xml.tag! 'CreateRecurringPaymentsProfileRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
138
|
+
xml.tag! 'n2:Version', API_VERSION
|
139
|
+
xml.tag! 'n2:CreateRecurringPaymentsProfileRequestDetails' do
|
140
|
+
xml.tag! 'Token', options[:token] unless options[:token].blank?
|
141
|
+
if options[:credit_card]
|
142
|
+
add_credit_card(xml, options[:credit_card], (options[:billing_address] || options[:address]), options)
|
143
|
+
end
|
144
|
+
xml.tag! 'n2:RecurringPaymentsProfileDetails' do
|
145
|
+
xml.tag! 'n2:BillingStartDate', (options[:start_date].is_a?(Date) ? options[:start_date].to_time : options[:start_date]).utc.iso8601
|
146
|
+
xml.tag! 'n2:ProfileReference', options[:profile_reference] unless options[:profile_reference].blank?
|
147
|
+
end
|
148
|
+
xml.tag! 'n2:ScheduleDetails' do
|
149
|
+
xml.tag! 'n2:Description', options[:description]
|
150
|
+
xml.tag! 'n2:PaymentPeriod' do
|
151
|
+
xml.tag! 'n2:BillingPeriod', options[:period] || 'Month'
|
152
|
+
xml.tag! 'n2:BillingFrequency', options[:frequency]
|
153
|
+
xml.tag! 'n2:TotalBillingCycles', options[:total_billing_cycles] unless options[:total_billing_cycles].blank?
|
154
|
+
xml.tag! 'n2:Amount', amount(options[:amount]), 'currencyID' => options[:currency] || 'USD'
|
155
|
+
xml.tag! 'n2:TaxAmount', amount(options[:tax_amount] || 0), 'currencyID' => options[:currency] || 'USD' unless options[:tax_amount].blank?
|
156
|
+
xml.tag! 'n2:ShippingAmount', amount(options[:shipping_amount] || 0), 'currencyID' => options[:currency] || 'USD' unless options[:shipping_amount].blank?
|
157
|
+
end
|
158
|
+
if !options[:trial_amount].blank?
|
159
|
+
xml.tag! 'n2:TrialPeriod' do
|
160
|
+
xml.tag! 'n2:BillingPeriod', options[:trial_period] || 'Month'
|
161
|
+
xml.tag! 'n2:BillingFrequency', options[:trial_frequency]
|
162
|
+
xml.tag! 'n2:TotalBillingCycles', options[:trial_cycles] || 1
|
163
|
+
xml.tag! 'n2:Amount', amount(options[:trial_amount]), 'currencyID' => options[:currency] || 'USD'
|
164
|
+
xml.tag! 'n2:TaxAmount', amount(options[:trial_tax_amount] || 0), 'currencyID' => options[:currency] || 'USD' unless options[:trial_tax_amount].blank?
|
165
|
+
xml.tag! 'n2:ShippingAmount', amount(options[:trial_shipping_amount] || 0), 'currencyID' => options[:currency] || 'USD' unless options[:trial_shipping_amount].blank?
|
166
|
+
end
|
167
|
+
end
|
168
|
+
if !options[:initial_amount].blank?
|
169
|
+
xml.tag! 'n2:ActivationDetails' do
|
170
|
+
xml.tag! 'n2:InitialAmount', amount(options[:initial_amount]), 'currencyID' => options[:currency] || 'USD'
|
171
|
+
xml.tag! 'n2:FailedInitialAmountAction', options[:continue_on_failure] ? 'ContinueOnFailure' : 'CancelOnFailure'
|
172
|
+
end
|
173
|
+
end
|
174
|
+
xml.tag! 'n2:MaxFailedPayments', options[:max_failed_payments] unless options[:max_failed_payments].blank?
|
175
|
+
xml.tag! 'n2:AutoBillOutstandingAmount', options[:auto_bill_outstanding] ? 'AddToNextBilling' : 'NoAutoBill'
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
xml.target!
|
181
|
+
end
|
182
|
+
|
183
|
+
def build_get_profile_details_request(profile_id)
|
184
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
185
|
+
xml.tag! 'GetRecurringPaymentsProfileDetailsReq', 'xmlns' => PAYPAL_NAMESPACE do
|
186
|
+
xml.tag! 'GetRecurringPaymentsProfileDetailsRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
187
|
+
xml.tag! 'n2:Version', API_VERSION
|
188
|
+
xml.tag! 'ProfileID', profile_id
|
189
|
+
end
|
190
|
+
end
|
191
|
+
xml.target!
|
192
|
+
end
|
193
|
+
|
194
|
+
def build_change_profile_request(profile_id, options)
|
195
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
196
|
+
xml.tag! 'UpdateRecurringPaymentsProfileReq', 'xmlns' => PAYPAL_NAMESPACE do
|
197
|
+
xml.tag! 'UpdateRecurringPaymentsProfileRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
198
|
+
xml.tag! 'n2:Version', API_VERSION
|
199
|
+
xml.tag! 'n2:UpdateRecurringPaymentsProfileRequestDetails' do
|
200
|
+
xml.tag! 'ProfileID', profile_id
|
201
|
+
if options[:credit_card]
|
202
|
+
add_credit_card(xml, options[:credit_card], options[:address], options)
|
203
|
+
end
|
204
|
+
xml.tag! 'n2:Note', options[:note] unless options[:note].blank?
|
205
|
+
xml.tag! 'n2:Description', options[:description] unless options[:description].blank?
|
206
|
+
xml.tag! 'n2:ProfileReference', options[:reference] unless options[:reference].blank?
|
207
|
+
xml.tag! 'n2:AdditionalBillingCycles', options[:additional_billing_cycles] unless options[:additional_billing_cycles].blank?
|
208
|
+
xml.tag! 'n2:MaxFailedPayments', options[:max_failed_payments] unless options[:max_failed_payments].blank?
|
209
|
+
xml.tag! 'n2:AutoBillOutstandingAmount', options[:auto_bill_outstanding] ? 'AddToNextBilling' : 'NoAutoBill'
|
210
|
+
if options.has_key?(:amount)
|
211
|
+
xml.tag! 'n2:Amount', amount(options[:amount]), 'currencyID' => options[:currency] || 'USD'
|
212
|
+
end
|
213
|
+
if options.has_key?(:tax_amount)
|
214
|
+
xml.tag! 'n2:TaxAmount', amount(options[:tax_amount] || 0), 'currencyID' => options[:currency] || 'USD'
|
215
|
+
end
|
216
|
+
if options.has_key?(:start_date)
|
217
|
+
xml.tag! 'n2:BillingStartDate', (options[:start_date].is_a?(Date) ? options[:start_date].to_time : options[:start_date]).utc.iso8601
|
218
|
+
end
|
219
|
+
if options.has_key?(:outstanding_balance)
|
220
|
+
xml.tag! 'n2:OutstandingBalance', amount(options[:outstanding_balance]), 'currencyID' => options[:currency] || 'USD'
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
225
|
+
xml.target!
|
226
|
+
end
|
227
|
+
|
228
|
+
def build_manage_profile_request(profile_id, action, options)
|
229
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
230
|
+
xml.tag! 'ManageRecurringPaymentsProfileStatusReq', 'xmlns' => PAYPAL_NAMESPACE do
|
231
|
+
xml.tag! 'ManageRecurringPaymentsProfileStatusRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
232
|
+
xml.tag! 'n2:Version', API_VERSION
|
233
|
+
xml.tag! 'n2:ManageRecurringPaymentsProfileStatusRequestDetails' do
|
234
|
+
xml.tag! 'ProfileID', profile_id
|
235
|
+
xml.tag! 'n2:Action', action
|
236
|
+
xml.tag! 'n2:Note', options[:note] unless options[:note].blank?
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
xml.target!
|
241
|
+
end
|
242
|
+
|
243
|
+
def build_bill_outstanding_amount(profile_id, options)
|
244
|
+
xml = Builder::XmlMarkup.new :indent => 2
|
245
|
+
xml.tag! 'BillOutstandingAmountReq', 'xmlns' => PAYPAL_NAMESPACE do
|
246
|
+
xml.tag! 'BillOutstandingAmountRequest', 'xmlns:n2' => EBAY_NAMESPACE do
|
247
|
+
xml.tag! 'n2:Version', API_VERSION
|
248
|
+
xml.tag! 'n2:BillOutstandingAmountRequestDetails' do
|
249
|
+
xml.tag! 'ProfileID', profile_id
|
250
|
+
if options.has_key?(:amount)
|
251
|
+
xml.tag! 'n2:Amount', amount(options[:amount]), 'currencyID' => options[:currency] || 'USD'
|
252
|
+
end
|
253
|
+
xml.tag! 'n2:Note', options[:note] unless options[:note].blank?
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
xml.target!
|
258
|
+
end
|
259
|
+
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'active_merchant/billing/gateways/paypal/paypal_common_api'
|
2
|
+
require 'active_merchant/billing/gateways/paypal/paypal_recurring_api'
|
3
|
+
require 'active_merchant/billing/gateways/paypal_express'
|
4
|
+
|
5
|
+
module ActiveMerchant #:nodoc:
|
6
|
+
module Billing #:nodoc:
|
7
|
+
class PaypalGateway < Gateway
|
8
|
+
include PaypalCommonAPI
|
9
|
+
include PaypalRecurringApi
|
10
|
+
|
11
|
+
self.supported_countries = %w[CA NZ GB US]
|
12
|
+
self.supported_cardtypes = %i[visa master american_express discover]
|
13
|
+
self.homepage_url = 'https://www.paypal.com/us/webapps/mpp/paypal-payments-pro'
|
14
|
+
self.display_name = 'PayPal Payments Pro (US)'
|
15
|
+
|
16
|
+
def authorize(money, credit_card_or_referenced_id, options = {})
|
17
|
+
requires!(options, :ip)
|
18
|
+
commit define_transaction_type(credit_card_or_referenced_id), build_sale_or_authorization_request('Authorization', money, credit_card_or_referenced_id, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def purchase(money, credit_card_or_referenced_id, options = {})
|
22
|
+
requires!(options, :ip)
|
23
|
+
commit define_transaction_type(credit_card_or_referenced_id), build_sale_or_authorization_request('Sale', money, credit_card_or_referenced_id, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def verify(credit_card, options = {})
|
27
|
+
if %w(visa master).include?(credit_card.brand)
|
28
|
+
authorize(0, credit_card, options)
|
29
|
+
else
|
30
|
+
MultiResponse.run(:use_first_response) do |r|
|
31
|
+
r.process { authorize(100, credit_card, options) }
|
32
|
+
r.process(:ignore_result) { void(r.authorization, options) }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def express
|
38
|
+
@express ||= PaypalExpressGateway.new(@options)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def define_transaction_type(transaction_arg)
|
44
|
+
if transaction_arg.is_a?(String)
|
45
|
+
return 'DoReferenceTransaction'
|
46
|
+
else
|
47
|
+
return 'DoDirectPayment'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def build_sale_or_authorization_request(action, money, credit_card_or_referenced_id, options)
|
52
|
+
transaction_type = define_transaction_type(credit_card_or_referenced_id)
|
53
|
+
reference_id = credit_card_or_referenced_id if transaction_type == 'DoReferenceTransaction'
|
54
|
+
|
55
|
+
billing_address = options[:billing_address] || options[:address]
|
56
|
+
currency_code = options[:currency] || currency(money)
|
57
|
+
|
58
|
+
xml = Builder::XmlMarkup.new indent: 2
|
59
|
+
xml.tag! transaction_type + 'Req', 'xmlns' => PAYPAL_NAMESPACE do
|
60
|
+
xml.tag! transaction_type + 'Request', 'xmlns:n2' => EBAY_NAMESPACE do
|
61
|
+
xml.tag! 'n2:Version', api_version(options)
|
62
|
+
xml.tag! 'n2:' + transaction_type + 'RequestDetails' do
|
63
|
+
xml.tag! 'n2:ReferenceID', reference_id if transaction_type == 'DoReferenceTransaction'
|
64
|
+
xml.tag! 'n2:PaymentAction', action
|
65
|
+
add_descriptors(xml, options)
|
66
|
+
add_payment_details(xml, money, currency_code, options)
|
67
|
+
add_credit_card(xml, credit_card_or_referenced_id, billing_address, options) unless transaction_type == 'DoReferenceTransaction'
|
68
|
+
xml.tag! 'n2:IPAddress', options[:ip]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
xml.target!
|
74
|
+
end
|
75
|
+
|
76
|
+
def api_version(options)
|
77
|
+
return API_VERSION_3DS2 if options.dig(:three_d_secure, :version) =~ /^2/
|
78
|
+
|
79
|
+
API_VERSION
|
80
|
+
end
|
81
|
+
|
82
|
+
def add_credit_card(xml, credit_card, address, options)
|
83
|
+
xml.tag! 'n2:CreditCard' do
|
84
|
+
xml.tag! 'n2:CreditCardType', credit_card_type(card_brand(credit_card))
|
85
|
+
xml.tag! 'n2:CreditCardNumber', credit_card.number
|
86
|
+
xml.tag! 'n2:ExpMonth', format(credit_card.month, :two_digits)
|
87
|
+
xml.tag! 'n2:ExpYear', format(credit_card.year, :four_digits)
|
88
|
+
xml.tag! 'n2:CVV2', credit_card.verification_value unless credit_card.verification_value.blank?
|
89
|
+
|
90
|
+
xml.tag! 'n2:CardOwner' do
|
91
|
+
xml.tag! 'n2:PayerName' do
|
92
|
+
xml.tag! 'n2:FirstName', credit_card.first_name
|
93
|
+
xml.tag! 'n2:LastName', credit_card.last_name
|
94
|
+
end
|
95
|
+
|
96
|
+
xml.tag! 'n2:Payer', options[:email]
|
97
|
+
add_address(xml, 'n2:Address', address)
|
98
|
+
end
|
99
|
+
|
100
|
+
add_three_d_secure(xml, options) if options[:three_d_secure]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def add_descriptors(xml, options)
|
105
|
+
xml.tag! 'n2:SoftDescriptor', options[:soft_descriptor] unless options[:soft_descriptor].blank?
|
106
|
+
xml.tag! 'n2:SoftDescriptorCity', options[:soft_descriptor_city] unless options[:soft_descriptor_city].blank?
|
107
|
+
end
|
108
|
+
|
109
|
+
def add_three_d_secure(xml, options)
|
110
|
+
three_d_secure = options[:three_d_secure]
|
111
|
+
xml.tag! 'ThreeDSecureRequest' do
|
112
|
+
xml.tag! 'MpiVendor3ds', 'Y'
|
113
|
+
xml.tag! 'AuthStatus3ds', three_d_secure[:authentication_response_status] || three_d_secure[:trans_status] if three_d_secure[:authentication_response_status] || three_d_secure[:trans_status]
|
114
|
+
xml.tag! 'Cavv', three_d_secure[:cavv] unless three_d_secure[:cavv].blank?
|
115
|
+
xml.tag! 'Eci3ds', three_d_secure[:eci] unless three_d_secure[:eci].blank?
|
116
|
+
xml.tag! 'Xid', three_d_secure[:xid] unless three_d_secure[:xid].blank?
|
117
|
+
xml.tag! 'ThreeDSVersion', three_d_secure[:version] unless three_d_secure[:version].blank?
|
118
|
+
xml.tag! 'DSTransactionId', three_d_secure[:ds_transaction_id] unless three_d_secure[:ds_transaction_id].blank?
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def credit_card_type(type)
|
123
|
+
case type
|
124
|
+
when 'visa' then 'Visa'
|
125
|
+
when 'master' then 'MasterCard'
|
126
|
+
when 'discover' then 'Discover'
|
127
|
+
when 'american_express' then 'Amex'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def build_response(success, message, response, options = {})
|
132
|
+
Response.new(success, message, response, options)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'active_merchant/billing/gateways/paypal'
|
2
|
+
|
3
|
+
module ActiveMerchant #:nodoc:
|
4
|
+
module Billing #:nodoc:
|
5
|
+
# The PayPal gateway for PayPal Website Payments Pro Canada only supports Visa and MasterCard
|
6
|
+
class PaypalCaGateway < PaypalGateway
|
7
|
+
self.supported_cardtypes = %i[visa master]
|
8
|
+
self.supported_countries = ['CA']
|
9
|
+
self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_wp-pro-overview-outside'
|
10
|
+
self.display_name = 'PayPal Website Payments Pro (CA)'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'active_merchant/billing/gateways/paypal/paypal_common_api'
|
2
|
+
require 'active_merchant/billing/gateways/paypal/paypal_express_response'
|
3
|
+
require 'active_merchant/billing/gateways/paypal_express_common'
|
4
|
+
|
5
|
+
module ActiveMerchant #:nodoc:
|
6
|
+
module Billing #:nodoc:
|
7
|
+
class PaypalDigitalGoodsGateway < PaypalExpressGateway
|
8
|
+
self.test_redirect_url = 'https://www.sandbox.paypal.com/incontext'
|
9
|
+
self.live_redirect_url = 'https://www.paypal.com/incontext'
|
10
|
+
|
11
|
+
self.supported_countries = %w(AU CA CN FI GB ID IN IT MY NO NZ PH PL SE SG TH VN)
|
12
|
+
self.homepage_url = 'https://www.x.com/community/ppx/xspaces/digital_goods'
|
13
|
+
self.display_name = 'PayPal Express Checkout for Digital Goods'
|
14
|
+
|
15
|
+
def redirect_url_for(token, options = {})
|
16
|
+
options[:review] ||= false
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
# GATEWAY.setup_purchase(100,
|
21
|
+
# :ip => "127.0.0.1",
|
22
|
+
# :description => "Test Title",
|
23
|
+
# :return_url => "http://return.url",
|
24
|
+
# :cancel_return_url => "http://cancel.url",
|
25
|
+
# :items => [ { :name => "Charge",
|
26
|
+
# :number => "1",
|
27
|
+
# :quantity => "1",
|
28
|
+
# :amount => 100,
|
29
|
+
# :description => "Description",
|
30
|
+
# :category => "Digital" } ] )
|
31
|
+
def build_setup_request(action, money, options)
|
32
|
+
requires!(options, :items)
|
33
|
+
raise ArgumentError, 'Must include at least 1 Item' unless options[:items].length > 0
|
34
|
+
|
35
|
+
options[:items].each do |item|
|
36
|
+
requires!(item, :name, :number, :quantity, :amount, :description, :category)
|
37
|
+
raise ArgumentError, "Each of the items must have the category 'Digital'" unless item[:category] == 'Digital'
|
38
|
+
end
|
39
|
+
|
40
|
+
super
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|