activemerchant 1.45.0 → 1.126.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (288) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG +2167 -2
  3. data/CONTRIBUTORS +57 -0
  4. data/README.md +62 -41
  5. data/lib/active_merchant/billing/avs_result.rb +25 -28
  6. data/lib/active_merchant/billing/base.rb +11 -35
  7. data/lib/active_merchant/billing/check.rb +28 -24
  8. data/lib/active_merchant/billing/compatibility.rb +10 -12
  9. data/lib/active_merchant/billing/credit_card.rb +141 -69
  10. data/lib/active_merchant/billing/credit_card_formatting.rb +4 -4
  11. data/lib/active_merchant/billing/credit_card_methods.rb +348 -52
  12. data/lib/active_merchant/billing/cvv_result.rb +0 -1
  13. data/lib/active_merchant/billing/gateway.rb +125 -61
  14. data/lib/active_merchant/billing/gateways/adyen.rb +633 -127
  15. data/lib/active_merchant/billing/gateways/airwallex.rb +341 -0
  16. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  17. data/lib/active_merchant/billing/gateways/authorize_net.rb +883 -195
  18. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +31 -24
  19. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +104 -103
  20. data/lib/active_merchant/billing/gateways/axcessms.rb +179 -0
  21. data/lib/active_merchant/billing/gateways/balanced.rb +72 -65
  22. data/lib/active_merchant/billing/gateways/bambora_apac.rb +222 -0
  23. data/lib/active_merchant/billing/gateways/bank_frick.rb +16 -16
  24. data/lib/active_merchant/billing/gateways/banwire.rb +24 -13
  25. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +397 -0
  26. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +7 -7
  27. data/lib/active_merchant/billing/gateways/be2bill.rb +7 -7
  28. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +143 -62
  29. data/lib/active_merchant/billing/gateways/beanstream.rb +45 -13
  30. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +13 -10
  31. data/lib/active_merchant/billing/gateways/blue_pay.rb +549 -506
  32. data/lib/active_merchant/billing/gateways/blue_snap.rb +623 -0
  33. data/lib/active_merchant/billing/gateways/bogus.rb +82 -36
  34. data/lib/active_merchant/billing/gateways/borgun.rb +61 -40
  35. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  36. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +21 -2
  37. data/lib/active_merchant/billing/gateways/braintree/token_nonce.rb +113 -0
  38. data/lib/active_merchant/billing/gateways/braintree.rb +3 -3
  39. data/lib/active_merchant/billing/gateways/braintree_blue.rb +592 -203
  40. data/lib/active_merchant/billing/gateways/braintree_orange.rb +3 -4
  41. data/lib/active_merchant/billing/gateways/bridge_pay.rb +116 -61
  42. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  43. data/lib/active_merchant/billing/gateways/card_connect.rb +320 -0
  44. data/lib/active_merchant/billing/gateways/card_save.rb +7 -9
  45. data/lib/active_merchant/billing/gateways/card_stream.rb +248 -97
  46. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  47. data/lib/active_merchant/billing/gateways/cardprocess.rb +256 -0
  48. data/lib/active_merchant/billing/gateways/cashnet.rb +70 -26
  49. data/lib/active_merchant/billing/gateways/cc5.rb +14 -17
  50. data/lib/active_merchant/billing/gateways/cecabank.rb +73 -53
  51. data/lib/active_merchant/billing/gateways/cenpos.rb +328 -0
  52. data/lib/active_merchant/billing/gateways/checkout.rb +32 -33
  53. data/lib/active_merchant/billing/gateways/checkout_v2.rb +340 -0
  54. data/lib/active_merchant/billing/gateways/citrus_pay.rb +21 -0
  55. data/lib/active_merchant/billing/gateways/clearhaus.rb +219 -0
  56. data/lib/active_merchant/billing/gateways/commercegate.rb +11 -12
  57. data/lib/active_merchant/billing/gateways/conekta.rb +55 -34
  58. data/lib/active_merchant/billing/gateways/creditcall.rb +272 -0
  59. data/lib/active_merchant/billing/gateways/credorax.rb +506 -0
  60. data/lib/active_merchant/billing/gateways/ct_payment.rb +269 -0
  61. data/lib/active_merchant/billing/gateways/culqi.rb +279 -0
  62. data/lib/active_merchant/billing/gateways/cyber_source.rb +637 -221
  63. data/lib/active_merchant/billing/gateways/d_local.rb +303 -0
  64. data/lib/active_merchant/billing/gateways/data_cash.rb +57 -355
  65. data/lib/active_merchant/billing/gateways/decidir.rb +347 -0
  66. data/lib/active_merchant/billing/gateways/decidir_plus.rb +344 -0
  67. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  68. data/lib/active_merchant/billing/gateways/digitzs.rb +295 -0
  69. data/lib/active_merchant/billing/gateways/ebanx.rb +334 -0
  70. data/lib/active_merchant/billing/gateways/efsnet.rb +46 -50
  71. data/lib/active_merchant/billing/gateways/elavon.rb +377 -250
  72. data/lib/active_merchant/billing/gateways/element.rb +386 -0
  73. data/lib/active_merchant/billing/gateways/epay.rb +92 -71
  74. data/lib/active_merchant/billing/gateways/evo_ca.rb +13 -14
  75. data/lib/active_merchant/billing/gateways/eway.rb +85 -73
  76. data/lib/active_merchant/billing/gateways/eway_managed.rb +85 -87
  77. data/lib/active_merchant/billing/gateways/eway_rapid.rb +134 -80
  78. data/lib/active_merchant/billing/gateways/exact.rb +37 -36
  79. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  80. data/lib/active_merchant/billing/gateways/fat_zebra.rb +124 -74
  81. data/lib/active_merchant/billing/gateways/federated_canada.rb +11 -13
  82. data/lib/active_merchant/billing/gateways/finansbank.rb +4 -5
  83. data/lib/active_merchant/billing/gateways/first_giving.rb +23 -23
  84. data/lib/active_merchant/billing/gateways/first_pay.rb +45 -23
  85. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +184 -87
  86. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +505 -0
  87. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  88. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  89. data/lib/active_merchant/billing/gateways/forte.rb +286 -0
  90. data/lib/active_merchant/billing/gateways/garanti.rb +31 -32
  91. data/lib/active_merchant/billing/gateways/global_collect.rb +507 -0
  92. data/lib/active_merchant/billing/gateways/global_transport.rb +25 -15
  93. data/lib/active_merchant/billing/gateways/hdfc.rb +55 -57
  94. data/lib/active_merchant/billing/gateways/hps.rb +252 -68
  95. data/lib/active_merchant/billing/gateways/iats_payments.rb +99 -38
  96. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  97. data/lib/active_merchant/billing/gateways/inspire.rb +48 -48
  98. data/lib/active_merchant/billing/gateways/instapay.rb +10 -14
  99. data/lib/active_merchant/billing/gateways/ipg.rb +415 -0
  100. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  101. data/lib/active_merchant/billing/gateways/iridium.rb +254 -244
  102. data/lib/active_merchant/billing/gateways/itransact.rb +14 -14
  103. data/lib/active_merchant/billing/gateways/iveri.rb +254 -0
  104. data/lib/active_merchant/billing/gateways/ixopay.rb +320 -0
  105. data/lib/active_merchant/billing/gateways/jetpay.rb +200 -80
  106. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +432 -0
  107. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  108. data/lib/active_merchant/billing/gateways/kushki.rb +277 -0
  109. data/lib/active_merchant/billing/gateways/latitude19.rb +412 -0
  110. data/lib/active_merchant/billing/gateways/linkpoint.rb +95 -85
  111. data/lib/active_merchant/billing/gateways/litle.rb +371 -94
  112. data/lib/active_merchant/billing/gateways/mastercard.rb +293 -0
  113. data/lib/active_merchant/billing/gateways/maxipago.rb +146 -123
  114. data/lib/active_merchant/billing/gateways/mercado_pago.rb +331 -0
  115. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +47 -23
  116. data/lib/active_merchant/billing/gateways/merchant_one.rb +16 -20
  117. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  118. data/lib/active_merchant/billing/gateways/merchant_ware.rb +54 -60
  119. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +60 -44
  120. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +76 -23
  121. data/lib/active_merchant/billing/gateways/mercury.rb +73 -54
  122. data/lib/active_merchant/billing/gateways/metrics_global.rb +33 -43
  123. data/lib/active_merchant/billing/gateways/micropayment.rb +182 -0
  124. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +7 -7
  125. data/lib/active_merchant/billing/gateways/migs.rb +101 -37
  126. data/lib/active_merchant/billing/gateways/mit.rb +260 -0
  127. data/lib/active_merchant/billing/gateways/modern_payments.rb +3 -3
  128. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +30 -34
  129. data/lib/active_merchant/billing/gateways/moka.rb +290 -0
  130. data/lib/active_merchant/billing/gateways/monei.rb +422 -0
  131. data/lib/active_merchant/billing/gateways/moneris.rb +236 -72
  132. data/lib/active_merchant/billing/gateways/money_movers.rb +11 -13
  133. data/lib/active_merchant/billing/gateways/mundipagg.rb +363 -0
  134. data/lib/active_merchant/billing/gateways/nab_transact.rb +87 -68
  135. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +163 -0
  136. data/lib/active_merchant/billing/gateways/net_registry.rb +12 -12
  137. data/lib/active_merchant/billing/gateways/netaxept.rb +33 -34
  138. data/lib/active_merchant/billing/gateways/netbanx.rb +376 -0
  139. data/lib/active_merchant/billing/gateways/netbilling.rb +82 -43
  140. data/lib/active_merchant/billing/gateways/netpay.rb +10 -10
  141. data/lib/active_merchant/billing/gateways/network_merchants.rb +7 -11
  142. data/lib/active_merchant/billing/gateways/nmi.rb +279 -174
  143. data/lib/active_merchant/billing/gateways/ogone.rb +96 -50
  144. data/lib/active_merchant/billing/gateways/omise.rb +323 -0
  145. data/lib/active_merchant/billing/gateways/openpay.rb +58 -23
  146. data/lib/active_merchant/billing/gateways/opp.rb +394 -0
  147. data/lib/active_merchant/billing/gateways/optimal_payment.rb +87 -69
  148. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +5 -7
  149. data/lib/active_merchant/billing/gateways/orbital.rb +771 -328
  150. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +31 -32
  151. data/lib/active_merchant/billing/gateways/pagarme.rb +239 -0
  152. data/lib/active_merchant/billing/gateways/pago_facil.rb +12 -14
  153. data/lib/active_merchant/billing/gateways/pay_arc.rb +392 -0
  154. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  155. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +84 -68
  156. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  157. data/lib/active_merchant/billing/gateways/pay_junction.rb +37 -37
  158. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +206 -0
  159. data/lib/active_merchant/billing/gateways/pay_secure.rb +15 -17
  160. data/lib/active_merchant/billing/gateways/pay_trace.rb +404 -0
  161. data/lib/active_merchant/billing/gateways/paybox_direct.rb +85 -49
  162. data/lib/active_merchant/billing/gateways/payeezy.rb +458 -0
  163. data/lib/active_merchant/billing/gateways/payex.rb +39 -42
  164. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +67 -41
  165. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +11 -8
  166. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +3 -3
  167. data/lib/active_merchant/billing/gateways/payflow.rb +215 -46
  168. data/lib/active_merchant/billing/gateways/payflow_express.rb +64 -68
  169. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +2 -3
  170. data/lib/active_merchant/billing/gateways/payflow_uk.rb +5 -6
  171. data/lib/active_merchant/billing/gateways/payment_express.rb +78 -58
  172. data/lib/active_merchant/billing/gateways/paymentez.rb +353 -0
  173. data/lib/active_merchant/billing/gateways/paymill.rb +163 -75
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +55 -7
  175. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +1 -1
  176. data/lib/active_merchant/billing/gateways/paypal.rb +37 -18
  177. data/lib/active_merchant/billing/gateways/paypal_ca.rb +2 -2
  178. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +5 -5
  179. data/lib/active_merchant/billing/gateways/paypal_express.rb +12 -6
  180. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +3 -3
  181. data/lib/active_merchant/billing/gateways/paysafe.rb +412 -0
  182. data/lib/active_merchant/billing/gateways/payscout.rb +10 -13
  183. data/lib/active_merchant/billing/gateways/paystation.rb +96 -91
  184. data/lib/active_merchant/billing/gateways/payu_in.rb +249 -0
  185. data/lib/active_merchant/billing/gateways/payu_latam.rb +479 -0
  186. data/lib/active_merchant/billing/gateways/payway.rb +27 -27
  187. data/lib/active_merchant/billing/gateways/payway_dot_com.rb +253 -0
  188. data/lib/active_merchant/billing/gateways/pin.rb +113 -37
  189. data/lib/active_merchant/billing/gateways/plugnpay.rb +82 -82
  190. data/lib/active_merchant/billing/gateways/priority.rb +369 -0
  191. data/lib/active_merchant/billing/gateways/pro_pay.rb +325 -0
  192. data/lib/active_merchant/billing/gateways/psigate.rb +55 -44
  193. data/lib/active_merchant/billing/gateways/psl_card.rb +32 -40
  194. data/lib/active_merchant/billing/gateways/qbms.rb +86 -76
  195. data/lib/active_merchant/billing/gateways/quantum.rb +21 -23
  196. data/lib/active_merchant/billing/gateways/quickbooks.rb +377 -0
  197. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  198. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +297 -0
  199. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  200. data/lib/active_merchant/billing/gateways/quickpay.rb +10 -353
  201. data/lib/active_merchant/billing/gateways/qvalent.rb +305 -0
  202. data/lib/active_merchant/billing/gateways/rapyd.rb +258 -0
  203. data/lib/active_merchant/billing/gateways/realex.rb +154 -52
  204. data/lib/active_merchant/billing/gateways/redsys.rb +488 -161
  205. data/lib/active_merchant/billing/gateways/s5.rb +247 -0
  206. data/lib/active_merchant/billing/gateways/safe_charge.rb +298 -0
  207. data/lib/active_merchant/billing/gateways/sage.rb +404 -133
  208. data/lib/active_merchant/billing/gateways/sage_pay.rb +145 -109
  209. data/lib/active_merchant/billing/gateways/sallie_mae.rb +13 -15
  210. data/lib/active_merchant/billing/gateways/secure_net.rb +62 -54
  211. data/lib/active_merchant/billing/gateways/secure_pay.rb +32 -42
  212. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +36 -27
  213. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +14 -16
  214. data/lib/active_merchant/billing/gateways/securion_pay.rb +265 -0
  215. data/lib/active_merchant/billing/gateways/simetrik.rb +362 -0
  216. data/lib/active_merchant/billing/gateways/skip_jack.rb +52 -54
  217. data/lib/active_merchant/billing/gateways/smart_ps.rb +51 -60
  218. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +29 -29
  219. data/lib/active_merchant/billing/gateways/spreedly_core.rb +108 -43
  220. data/lib/active_merchant/billing/gateways/stripe.rb +536 -120
  221. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +516 -0
  222. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +19 -25
  223. data/lib/active_merchant/billing/gateways/telr.rb +273 -0
  224. data/lib/active_merchant/billing/gateways/tns.rb +16 -217
  225. data/lib/active_merchant/billing/gateways/trans_first.rb +148 -34
  226. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +612 -0
  227. data/lib/active_merchant/billing/gateways/transact_pro.rb +222 -0
  228. data/lib/active_merchant/billing/gateways/transax.rb +6 -8
  229. data/lib/active_merchant/billing/gateways/transnational.rb +1 -2
  230. data/lib/active_merchant/billing/gateways/trexle.rb +221 -0
  231. data/lib/active_merchant/billing/gateways/trust_commerce.rb +162 -89
  232. data/lib/active_merchant/billing/gateways/usa_epay.rb +5 -6
  233. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +332 -236
  234. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +185 -72
  235. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  236. data/lib/active_merchant/billing/gateways/verifi.rb +52 -53
  237. data/lib/active_merchant/billing/gateways/viaklix.rb +19 -31
  238. data/lib/active_merchant/billing/gateways/visanet_peru.rb +250 -0
  239. data/lib/active_merchant/billing/gateways/vpos.rb +220 -0
  240. data/lib/active_merchant/billing/gateways/webpay.rb +9 -9
  241. data/lib/active_merchant/billing/gateways/wepay.rb +108 -62
  242. data/lib/active_merchant/billing/gateways/wirecard.rb +52 -43
  243. data/lib/active_merchant/billing/gateways/wompi.rb +193 -0
  244. data/lib/active_merchant/billing/gateways/world_net.rb +345 -0
  245. data/lib/active_merchant/billing/gateways/worldpay.rb +725 -121
  246. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +208 -0
  247. data/lib/active_merchant/billing/gateways/worldpay_us.rb +79 -39
  248. data/lib/active_merchant/billing/gateways.rb +8 -11
  249. data/lib/active_merchant/billing/model.rb +2 -2
  250. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  251. data/lib/active_merchant/billing/payment_token.rb +1 -1
  252. data/lib/active_merchant/billing/rails.rb +1 -1
  253. data/lib/active_merchant/billing/response.rb +19 -13
  254. data/lib/active_merchant/billing/three_d_secure_eci_mapper.rb +27 -0
  255. data/lib/active_merchant/billing.rb +3 -0
  256. data/lib/active_merchant/connection.rb +196 -0
  257. data/lib/active_merchant/country.rb +13 -8
  258. data/lib/active_merchant/errors.rb +6 -0
  259. data/lib/active_merchant/net_http_ssl_connection.rb +11 -0
  260. data/lib/active_merchant/network_connection_retries.rb +78 -0
  261. data/lib/active_merchant/post_data.rb +26 -0
  262. data/lib/active_merchant/posts_data.rb +92 -0
  263. data/lib/active_merchant/version.rb +1 -1
  264. data/lib/active_merchant.rb +14 -59
  265. data/lib/activemerchant.rb +1 -1
  266. data/lib/certs/cacert.pem +3214 -0
  267. data/lib/support/gateway_support.rb +8 -10
  268. data/lib/support/outbound_hosts.rb +13 -10
  269. data/lib/support/ssl_verify.rb +9 -14
  270. data/lib/support/ssl_version.rb +86 -0
  271. metadata +136 -94
  272. checksums.yaml.gz.sig +0 -1
  273. data/lib/active_merchant/billing/gateways/app55.rb +0 -176
  274. data/lib/active_merchant/billing/gateways/barclays_epdq.rb +0 -314
  275. data/lib/active_merchant/billing/gateways/certo_direct.rb +0 -278
  276. data/lib/active_merchant/billing/gateways/ideal/ideal_base.rb +0 -246
  277. data/lib/active_merchant/billing/gateways/ideal/ideal_rabobank.pem +0 -13
  278. data/lib/active_merchant/billing/gateways/ideal/ideal_response.rb +0 -29
  279. data/lib/active_merchant/billing/gateways/ideal_rabobank.rb +0 -66
  280. data/lib/active_merchant/billing/gateways/moneris_us.rb +0 -291
  281. data/lib/active_merchant/billing/gateways/sage/sage_bankcard.rb +0 -87
  282. data/lib/active_merchant/billing/gateways/sage/sage_core.rb +0 -114
  283. data/lib/active_merchant/billing/gateways/sage/sage_vault.rb +0 -149
  284. data/lib/active_merchant/billing/gateways/sage/sage_virtual_check.rb +0 -102
  285. data/lib/active_merchant/billing/gateways/vindicia.rb +0 -385
  286. data/lib/active_merchant/offsite_payments_shim.rb +0 -19
  287. data.tar.gz.sig +0 -0
  288. metadata.gz.sig +0 -0
@@ -1,15 +1,16 @@
1
- require File.dirname(__FILE__) + '/payflow/payflow_common_api'
2
- require File.dirname(__FILE__) + '/payflow/payflow_response'
3
- require File.dirname(__FILE__) + '/payflow_express'
1
+ require 'nokogiri'
2
+ require 'active_merchant/billing/gateways/payflow/payflow_common_api'
3
+ require 'active_merchant/billing/gateways/payflow/payflow_response'
4
+ require 'active_merchant/billing/gateways/payflow_express'
4
5
 
5
6
  module ActiveMerchant #:nodoc:
6
7
  module Billing #:nodoc:
7
8
  class PayflowGateway < Gateway
8
9
  include PayflowCommonAPI
9
10
 
10
- RECURRING_ACTIONS = Set.new([:add, :modify, :cancel, :inquiry, :reactivate, :payment])
11
+ RECURRING_ACTIONS = Set.new(%i[add modify cancel inquiry reactivate payment])
11
12
 
12
- self.supported_cardtypes = [:visa, :master, :american_express, :jcb, :discover, :diners_club]
13
+ self.supported_cardtypes = %i[visa master american_express jcb discover diners_club]
13
14
  self.homepage_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_payflow-pro-overview-outside'
14
15
  self.display_name = 'PayPal Payflow Pro'
15
16
 
@@ -44,6 +45,26 @@ module ActiveMerchant #:nodoc:
44
45
  commit(build_reference_request(:credit, money, reference, options), options)
45
46
  end
46
47
 
48
+ def verify(payment, options = {})
49
+ if credit_card_type(payment) == 'Amex'
50
+ MultiResponse.run(:use_first_response) do |r|
51
+ r.process { authorize(100, payment, options) }
52
+ r.process(:ignore_result) { void(r.authorization, options) }
53
+ end
54
+ else
55
+ authorize(0, payment, options)
56
+ end
57
+ end
58
+
59
+ def store(payment, options = {})
60
+ raise ArgumentError, 'Store is not supported on Payflow gateways'
61
+ end
62
+
63
+ def verify_credentials
64
+ response = void('0')
65
+ response.params['result'] != '26'
66
+ end
67
+
47
68
  # Adds or modifies a recurring Payflow profile. See the Payflow Pro Recurring Billing Guide for more details:
48
69
  # https://www.paypal.com/en_US/pdf/PayflowPro_RecurringBilling_Guide.pdf
49
70
  #
@@ -61,30 +82,44 @@ module ActiveMerchant #:nodoc:
61
82
 
62
83
  options[:name] = credit_card.name if options[:name].blank? && credit_card
63
84
  request = build_recurring_request(options[:profile_id] ? :modify : :add, money, options) do |xml|
64
- add_credit_card(xml, credit_card) if credit_card
85
+ add_credit_card(xml, credit_card, options) if credit_card
86
+ add_stored_credential(xml, options[:stored_credential])
65
87
  end
66
- commit(request, options.merge(:request_type => :recurring))
88
+ commit(request, options.merge(request_type: :recurring))
67
89
  end
68
90
 
69
91
  def cancel_recurring(profile_id)
70
92
  ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
71
93
 
72
- request = build_recurring_request(:cancel, 0, :profile_id => profile_id)
73
- commit(request, options.merge(:request_type => :recurring))
94
+ request = build_recurring_request(:cancel, 0, profile_id: profile_id)
95
+ commit(request, options.merge(request_type: :recurring))
74
96
  end
75
97
 
76
98
  def recurring_inquiry(profile_id, options = {})
77
99
  ActiveMerchant.deprecated RECURRING_DEPRECATION_MESSAGE
78
100
 
79
- request = build_recurring_request(:inquiry, nil, options.update( :profile_id => profile_id ))
80
- commit(request, options.merge(:request_type => :recurring))
101
+ request = build_recurring_request(:inquiry, nil, options.update(profile_id: profile_id))
102
+ commit(request, options.merge(request_type: :recurring))
81
103
  end
82
104
 
83
105
  def express
84
106
  @express ||= PayflowExpressGateway.new(@options)
85
107
  end
86
108
 
109
+ def supports_scrubbing?
110
+ true
111
+ end
112
+
113
+ def scrub(transcript)
114
+ transcript.
115
+ gsub(%r((<CardNum>)[^<]*(</CardNum>)), '\1[FILTERED]\2').
116
+ gsub(%r((<CVNum>)[^<]*(</CVNum>)), '\1[FILTERED]\2').
117
+ gsub(%r((<AcctNum>)[^<]*(</AcctNum>)), '\1[FILTERED]\2').
118
+ gsub(%r((<Password>)[^<]*(</Password>)), '\1[FILTERED]\2')
119
+ end
120
+
87
121
  private
122
+
88
123
  def build_sale_or_authorization_request(action, money, funding_source, options)
89
124
  if funding_source.is_a?(String)
90
125
  build_reference_sale_or_authorization_request(action, money, funding_source, options)
@@ -104,25 +139,29 @@ module ActiveMerchant #:nodoc:
104
139
  xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
105
140
  xml.tag! 'InvNum', options[:order_id].to_s.gsub(/[^\w.]/, '') unless options[:order_id].blank?
106
141
  xml.tag! 'Description', options[:description] unless options[:description].blank?
142
+ xml.tag! 'OrderDesc', options[:order_desc] unless options[:order_desc].blank?
107
143
  xml.tag! 'Comment', options[:comment] unless options[:comment].blank?
108
- xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].blank?
144
+ xml.tag!('ExtData', 'Name' => 'COMMENT2', 'Value' => options[:comment2]) unless options[:comment2].blank?
109
145
  xml.tag! 'TaxAmt', options[:taxamt] unless options[:taxamt].blank?
110
146
  xml.tag! 'FreightAmt', options[:freightamt] unless options[:freightamt].blank?
111
147
  xml.tag! 'DutyAmt', options[:dutyamt] unless options[:dutyamt].blank?
112
148
  xml.tag! 'DiscountAmt', options[:discountamt] unless options[:discountamt].blank?
149
+ xml.tag! 'MerchDescr', options[:merch_descr] unless options[:merch_descr].blank?
113
150
 
114
151
  billing_address = options[:billing_address] || options[:address]
115
152
  add_address(xml, 'BillTo', billing_address, options) if billing_address
116
- add_address(xml, 'ShipTo', options[:shipping_address],options) if options[:shipping_address]
153
+ add_address(xml, 'ShipTo', options[:shipping_address], options) if options[:shipping_address]
117
154
 
118
155
  xml.tag! 'TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money)
119
156
  end
120
157
  xml.tag! 'Tender' do
121
158
  xml.tag! 'Card' do
122
- xml.tag! 'ExtData', 'Name' => 'ORIGID', 'Value' => reference
159
+ xml.tag! 'ExtData', 'Name' => 'ORIGID', 'Value' => reference
123
160
  end
124
161
  end
162
+ add_stored_credential(xml, options[:stored_credential])
125
163
  end
164
+ xml.tag! 'ExtData', 'Name' => 'BUTTONSOURCE', 'Value' => application_id unless application_id.blank?
126
165
  end
127
166
  xml.target!
128
167
  end
@@ -135,13 +174,16 @@ module ActiveMerchant #:nodoc:
135
174
  xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
136
175
  xml.tag! 'InvNum', options[:order_id].to_s.gsub(/[^\w.]/, '') unless options[:order_id].blank?
137
176
  xml.tag! 'Description', options[:description] unless options[:description].blank?
177
+ xml.tag! 'OrderDesc', options[:order_desc] unless options[:order_desc].blank?
138
178
  # Comment and Comment2 will show up in manager.paypal.com as Comment1 and Comment2
139
179
  xml.tag! 'Comment', options[:comment] unless options[:comment].blank?
140
- xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].blank?
180
+ xml.tag!('ExtData', 'Name' => 'COMMENT2', 'Value' => options[:comment2]) unless options[:comment2].blank?
141
181
  xml.tag! 'TaxAmt', options[:taxamt] unless options[:taxamt].blank?
142
182
  xml.tag! 'FreightAmt', options[:freightamt] unless options[:freightamt].blank?
143
183
  xml.tag! 'DutyAmt', options[:dutyamt] unless options[:dutyamt].blank?
144
184
  xml.tag! 'DiscountAmt', options[:discountamt] unless options[:discountamt].blank?
185
+ xml.tag! 'EMail', options[:email] unless options[:email].nil?
186
+ xml.tag! 'MerchDescr', options[:merch_descr] unless options[:merch_descr].blank?
145
187
 
146
188
  billing_address = options[:billing_address] || options[:address]
147
189
  add_address(xml, 'BillTo', billing_address, options) if billing_address
@@ -150,12 +192,78 @@ module ActiveMerchant #:nodoc:
150
192
  xml.tag! 'TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money)
151
193
  end
152
194
 
195
+ if %i(authorization purchase).include? action
196
+ add_mpi_3ds(xml, options[:three_d_secure]) if options[:three_d_secure]
197
+ end
198
+
153
199
  xml.tag! 'Tender' do
154
- add_credit_card(xml, credit_card)
200
+ add_credit_card(xml, credit_card, options)
155
201
  end
202
+ add_stored_credential(xml, options[:stored_credential])
156
203
  end
204
+ xml.tag! 'ExtData', 'Name' => 'BUTTONSOURCE', 'Value' => application_id unless application_id.blank?
205
+ end
206
+ add_level_two_three_fields(xml.target!, options)
207
+ end
208
+
209
+ def add_mpi_3ds(xml, three_d_secure_options)
210
+ # structure as per https://developer.paypal.com/api/nvp-soap/payflow/3d-secure-mpi/
211
+ authentication_id = three_d_secure_options[:authentication_id]
212
+ authentication_status = three_d_secure_options[:authentication_response_status]
213
+
214
+ eci = three_d_secure_options[:eci]
215
+ cavv = three_d_secure_options[:cavv]
216
+ xid = three_d_secure_options[:xid]
217
+ version = three_d_secure_options[:version]
218
+
219
+ # 3DS2 only
220
+ ds_transaction_id = three_d_secure_options[:ds_transaction_id] if version_2_or_newer?(three_d_secure_options)
221
+
222
+ xml.tag!('ExtData', 'Name' => 'AUTHENTICATION_ID', 'Value' => authentication_id) unless authentication_id.blank?
223
+ xml.tag!('ExtData', 'Name' => 'AUTHENTICATION_STATUS', 'Value' => authentication_status) unless authentication_status.blank?
224
+
225
+ xml.tag!('ExtData', 'Name' => 'CAVV', 'Value' => cavv) unless cavv.blank?
226
+ xml.tag!('ExtData', 'Name' => 'ECI', 'Value' => eci) unless eci.blank?
227
+ xml.tag!('ExtData', 'Name' => 'XID', 'Value' => xid) unless xid.blank?
228
+ xml.tag!('ExtData', 'Name' => 'THREEDSVERSION', 'Value' => version) unless version.blank?
229
+ xml.tag!('ExtData', 'Name' => 'DSTRANSACTIONID', 'Value' => ds_transaction_id) unless ds_transaction_id.blank?
230
+ end
231
+
232
+ def add_level_two_three_fields(xml_string, options)
233
+ if options[:level_two_fields] || options[:level_three_fields]
234
+ xml_doc = Nokogiri::XML.parse(xml_string)
235
+ %i[level_two_fields level_three_fields].each do |fields|
236
+ xml_string = add_fields(xml_doc, options[fields]) if options[fields]
237
+ end
238
+ end
239
+ xml_string
240
+ end
241
+
242
+ def check_fields(parent, fields, xml_doc)
243
+ fields.each do |k, v|
244
+ if v.is_a? String
245
+ new_node = Nokogiri::XML::Node.new(k, xml_doc)
246
+ new_node.add_child(v)
247
+ xml_doc.at_css(parent).add_child(new_node)
248
+ else
249
+ check_subparent_before_continuing(parent, k, xml_doc)
250
+ check_fields(k, v, xml_doc)
251
+ end
252
+ end
253
+ xml_doc
254
+ end
255
+
256
+ def check_subparent_before_continuing(parent, subparent, xml_doc)
257
+ unless xml_doc.at_css(subparent)
258
+ subparent_node = Nokogiri::XML::Node.new(subparent, xml_doc)
259
+ xml_doc.at_css(parent).add_child(subparent_node)
157
260
  end
158
- xml.target!
261
+ end
262
+
263
+ def add_fields(xml_doc, options_fields)
264
+ fields_to_add = JSON.parse(options_fields)
265
+ check_fields('Invoice', fields_to_add, xml_doc)
266
+ xml_doc.root.to_s
159
267
  end
160
268
 
161
269
  def build_check_request(action, money, check, options)
@@ -166,6 +274,8 @@ module ActiveMerchant #:nodoc:
166
274
  xml.tag! 'CustIP', options[:ip] unless options[:ip].blank?
167
275
  xml.tag! 'InvNum', options[:order_id].to_s.gsub(/[^\w.]/, '') unless options[:order_id].blank?
168
276
  xml.tag! 'Description', options[:description] unless options[:description].blank?
277
+ xml.tag! 'OrderDesc', options[:order_desc] unless options[:order_desc].blank?
278
+ xml.tag! 'MerchDescr', options[:merch_descr] unless options[:merch_descr].blank?
169
279
  xml.tag! 'BillTo' do
170
280
  xml.tag! 'Name', check.name
171
281
  end
@@ -178,12 +288,14 @@ module ActiveMerchant #:nodoc:
178
288
  xml.tag! 'ABA', check.routing_number
179
289
  end
180
290
  end
291
+ add_stored_credential(xml, options[:stored_credential])
181
292
  end
293
+ xml.tag! 'ExtData', 'Name' => 'BUTTONSOURCE', 'Value' => application_id unless application_id.blank?
182
294
  end
183
- xml.target!
295
+ add_level_two_three_fields(xml.target!, options)
184
296
  end
185
297
 
186
- def add_credit_card(xml, credit_card)
298
+ def add_credit_card(xml, credit_card, options = {})
187
299
  xml.tag! 'Card' do
188
300
  xml.tag! 'CardType', credit_card_type(credit_card)
189
301
  xml.tag! 'CardNum', credit_card.number
@@ -191,14 +303,76 @@ module ActiveMerchant #:nodoc:
191
303
  xml.tag! 'NameOnCard', credit_card.first_name
192
304
  xml.tag! 'CVNum', credit_card.verification_value if credit_card.verification_value?
193
305
 
194
- if requires_start_date_or_issue_number?(credit_card)
195
- xml.tag!('ExtData', 'Name' => 'CardStart', 'Value' => startdate(credit_card)) unless credit_card.start_month.blank? || credit_card.start_year.blank?
196
- xml.tag!('ExtData', 'Name' => 'CardIssue', 'Value' => format(credit_card.issue_number, :two_digits)) unless credit_card.issue_number.blank?
306
+ add_three_d_secure(options, xml)
307
+
308
+ xml.tag! 'ExtData', 'Name' => 'LASTNAME', 'Value' => credit_card.last_name
309
+ end
310
+ end
311
+
312
+ def add_stored_credential(xml, stored_credential)
313
+ return unless stored_credential
314
+
315
+ xml.tag! 'CardOnFile', add_card_on_file_type(stored_credential)
316
+ xml.tag! 'TxnId', stored_credential[:network_transaction_id] if stored_credential[:network_transaction_id]
317
+ end
318
+
319
+ def card_on_file_initiator(initator)
320
+ case initator
321
+ when 'merchant'
322
+ 'MIT'
323
+ when 'cardholder'
324
+ 'CIT'
325
+ end
326
+ end
327
+
328
+ def card_on_file_reason(stored_credential)
329
+ return 'I' if stored_credential[:initial_transaction] && stored_credential[:reason_type] == 'unscheduled'
330
+
331
+ case stored_credential[:reason_type]
332
+ when 'recurring', 'installment'
333
+ 'R'
334
+ when 'unscheduled'
335
+ 'U'
336
+ end
337
+ end
338
+
339
+ def add_card_on_file_type(stored_credential)
340
+ card_on_file_initiator(stored_credential[:initiator]).to_s + card_on_file_reason(stored_credential).to_s
341
+ end
342
+
343
+ def add_three_d_secure(options, xml)
344
+ if options[:three_d_secure]
345
+ three_d_secure = options[:three_d_secure]
346
+ xml.tag! 'BuyerAuthResult' do
347
+ authentication_status(three_d_secure, xml)
348
+ xml.tag! 'AuthenticationId', three_d_secure[:authentication_id] unless three_d_secure[:authentication_id].blank?
349
+ xml.tag! 'PAReq', three_d_secure[:pareq] unless three_d_secure[:pareq].blank?
350
+ xml.tag! 'ACSUrl', three_d_secure[:acs_url] unless three_d_secure[:acs_url].blank?
351
+ xml.tag! 'ECI', three_d_secure[:eci] unless three_d_secure[:eci].blank?
352
+ xml.tag! 'CAVV', three_d_secure[:cavv] unless three_d_secure[:cavv].blank?
353
+ xml.tag! 'XID', three_d_secure[:xid] unless three_d_secure[:xid].blank?
354
+ xml.tag! 'ThreeDSVersion', three_d_secure[:version] unless three_d_secure[:version].blank?
355
+ xml.tag! 'DSTransactionID', three_d_secure[:ds_transaction_id] unless three_d_secure[:ds_transaction_id].blank?
197
356
  end
198
- xml.tag! 'ExtData', 'Name' => 'LASTNAME', 'Value' => credit_card.last_name
199
357
  end
200
358
  end
201
359
 
360
+ def authentication_status(three_d_secure, xml)
361
+ status = if three_d_secure[:authentication_response_status].present?
362
+ three_d_secure[:authentication_response_status]
363
+ elsif three_d_secure[:directory_response_status].present?
364
+ three_d_secure[:directory_response_status]
365
+ end
366
+ if status.present?
367
+ xml.tag! 'Status', status
368
+ xml.tag! 'AuthenticationStatus', status if version_2_or_newer?(three_d_secure)
369
+ end
370
+ end
371
+
372
+ def version_2_or_newer?(three_d_secure)
373
+ three_d_secure[:version]&.start_with?('2')
374
+ end
375
+
202
376
  def credit_card_type(credit_card)
203
377
  return '' if card_brand(credit_card).blank?
204
378
 
@@ -206,8 +380,8 @@ module ActiveMerchant #:nodoc:
206
380
  end
207
381
 
208
382
  def expdate(creditcard)
209
- year = sprintf("%.4i", creditcard.year.to_s.sub(/^0+/, ''))
210
- month = sprintf("%.2i", creditcard.month.to_s.sub(/^0+/, ''))
383
+ year = sprintf('%.4i', creditcard.year.to_s.sub(/^0+/, ''))
384
+ month = sprintf('%.2i', creditcard.month.to_s.sub(/^0+/, ''))
211
385
 
212
386
  "#{year}#{month}"
213
387
  end
@@ -220,15 +394,13 @@ module ActiveMerchant #:nodoc:
220
394
  end
221
395
 
222
396
  def build_recurring_request(action, money, options)
223
- unless RECURRING_ACTIONS.include?(action)
224
- raise StandardError, "Invalid Recurring Profile Action: #{action}"
225
- end
397
+ raise StandardError, "Invalid Recurring Profile Action: #{action}" unless RECURRING_ACTIONS.include?(action)
226
398
 
227
399
  xml = Builder::XmlMarkup.new
228
400
  xml.tag! 'RecurringProfiles' do
229
401
  xml.tag! 'RecurringProfile' do
230
402
  xml.tag! action.to_s.capitalize do
231
- unless [:cancel, :inquiry].include?(action)
403
+ unless %i[cancel inquiry].include?(action)
232
404
  xml.tag! 'RPData' do
233
405
  xml.tag! 'Name', options[:name] unless options[:name].nil?
234
406
  xml.tag! 'TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money)
@@ -239,7 +411,7 @@ module ActiveMerchant #:nodoc:
239
411
  xml.tag! 'MaxFailPayments', options[:max_fail_payments] unless options[:max_fail_payments].nil?
240
412
 
241
413
  if initial_tx = options[:initial_transaction]
242
- requires!(initial_tx, [:type, :authorization, :purchase])
414
+ requires!(initial_tx, %i[type authorization purchase])
243
415
  requires!(initial_tx, :amount) if initial_tx[:type] == :purchase
244
416
 
245
417
  xml.tag! 'OptionalTrans', TRANSACTIONS[initial_tx[:type]]
@@ -247,7 +419,7 @@ module ActiveMerchant #:nodoc:
247
419
  end
248
420
 
249
421
  if action == :add
250
- xml.tag! 'Start', format_rp_date(options[:starting_at] || Date.today + 1 )
422
+ xml.tag! 'Start', format_rp_date(options[:starting_at] || Date.today + 1)
251
423
  else
252
424
  xml.tag! 'Start', format_rp_date(options[:starting_at]) unless options[:starting_at].nil?
253
425
  end
@@ -262,11 +434,9 @@ module ActiveMerchant #:nodoc:
262
434
  yield xml
263
435
  end
264
436
  end
265
- if action != :add
266
- xml.tag! "ProfileID", options[:profile_id]
267
- end
437
+ xml.tag! 'ProfileID', options[:profile_id] if action != :add
268
438
  if action == :inquiry
269
- xml.tag! "PaymentHistory", ( options[:history] ? 'Y' : 'N' )
439
+ xml.tag! 'PaymentHistory', (options[:history] ? 'Y' : 'N')
270
440
  end
271
441
  end
272
442
  end
@@ -274,22 +444,22 @@ module ActiveMerchant #:nodoc:
274
444
  end
275
445
 
276
446
  def get_pay_period(options)
277
- requires!(options, [:periodicity, :bimonthly, :monthly, :biweekly, :weekly, :yearly, :daily, :semimonthly, :quadweekly, :quarterly, :semiyearly])
447
+ requires!(options, %i[periodicity bimonthly monthly biweekly weekly yearly daily semimonthly quadweekly quarterly semiyearly])
278
448
  case options[:periodicity]
279
- when :weekly then 'Weekly'
280
- when :biweekly then 'Bi-weekly'
281
- when :semimonthly then 'Semi-monthly'
282
- when :quadweekly then 'Every four weeks'
283
- when :monthly then 'Monthly'
284
- when :quarterly then 'Quarterly'
285
- when :semiyearly then 'Semi-yearly'
286
- when :yearly then 'Yearly'
449
+ when :weekly then 'Weekly'
450
+ when :biweekly then 'Bi-weekly'
451
+ when :semimonthly then 'Semi-monthly'
452
+ when :quadweekly then 'Every four weeks'
453
+ when :monthly then 'Monthly'
454
+ when :quarterly then 'Quarterly'
455
+ when :semiyearly then 'Semi-yearly'
456
+ when :yearly then 'Yearly'
287
457
  end
288
458
  end
289
459
 
290
460
  def format_rp_date(time)
291
461
  case time
292
- when Time, Date then time.strftime("%m%d%Y")
462
+ when Time, Date then time.strftime('%m%d%Y')
293
463
  else
294
464
  time.to_s
295
465
  end
@@ -301,4 +471,3 @@ module ActiveMerchant #:nodoc:
301
471
  end
302
472
  end
303
473
  end
304
-
@@ -1,65 +1,62 @@
1
- require File.dirname(__FILE__) + '/payflow/payflow_common_api'
2
- require File.dirname(__FILE__) + '/payflow/payflow_express_response'
3
- require File.dirname(__FILE__) + '/paypal_express_common'
1
+ require 'active_merchant/billing/gateways/payflow/payflow_common_api'
2
+ require 'active_merchant/billing/gateways/payflow/payflow_express_response'
3
+ require 'active_merchant/billing/gateways/paypal_express_common'
4
4
 
5
5
  module ActiveMerchant #:nodoc:
6
6
  module Billing #:nodoc:
7
- # ==General Parameters
8
- # The following parameters are supported for #setup_authorization, #setup_purchase, #authorize and #purchase transactions. I've read
9
- # in the docs that they recommend you pass the exact same parameters to both setup and authorize/purchase.
10
- #
11
- # This information was gleaned from a mix of:
12
- # * PayFlow documentation
13
- # * for key value pairs: {Express Checkout for Payflow Pro (PDF)}[https://cms.paypal.com/cms_content/US/en_US/files/developer/PFP_ExpressCheckout_PP.pdf]
14
- # * XMLPay: {Payflow Pro XMLPay Developer's Guide (PDF)}[https://cms.paypal.com/cms_content/US/en_US/files/developer/PP_PayflowPro_XMLPay_Guide.pdf]
15
- # * previous ActiveMerchant code
16
- # * trial & error
17
- #
18
- # The following parameters are currently supported.
19
- # [<tt>:ip</tt>] (opt) Customer IP Address
20
- # [<tt>:order_id</tt>] (opt) An order or invoice number. This will be passed through to the Payflow backend at manager.paypal.com, and show up as "Supplier Reference #"
21
- # [<tt>:description</tt>] (opt) Order description, shown to buyer (after redirected to PayPal). If Order Line Items are used (see below), then the description is suppressed. This will not be passed through to the Payflow backend.
22
- # [<tt>:billing_address</tt>] (opt) See ActiveMerchant::Billing::Gateway for details
23
- # [<tt>:shipping_address</tt>] (opt) See ActiveMerchant::Billing::Gateway for details
24
- # [<tt>:currency</tt>] (req) Currency of transaction, will be set to USD by default for PayFlow Express if not specified
25
- # [<tt>:email</tt>] (opt) Email of buyer; used to pre-fill PayPal login screen
26
- # [<tt>:payer_id</tt>] (opt) Unique PayPal buyer account identification number, as returned by details_for request
27
- # [<tt>:token</tt>] (req for #authorize & #purchase) Token returned by setup transaction
28
- # [<tt>:no_shipping</tt>] (opt) Boolean for whether or not to display shipping address to buyer
29
- # [<tt>:address_override</tt>] (opt) Boolean. If true, display shipping address passed by parameters, rather than shipping address on file with PayPal
30
- # [<tt>:allow_note</tt>] (opt) Boolean for permitting buyer to add note during checkout. Note contents can be retrieved with details_for transaction
31
- # [<tt>:return_url</tt>] (req) URL to which the buyer’s browser is returned after choosing to pay.
32
- # [<tt>:cancel_return_url</tt>] (req) URL to which the buyer is returned if the buyer cancels the order.
33
- # [<tt>:notify_url</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
34
- # [<tt>:comment</tt>] (opt) Comment field which will be reported to Payflow backend (at manager.paypal.com) as Comment1
35
- # [<tt>:comment2</tt>] (opt) Comment field which will be reported to Payflow backend (at manager.paypal.com) as Comment2
36
- # [<tt>:discount</tt>] (opt) Total discounts in cents
37
- #
38
- # ==Line Items
39
- # Support for order line items is available, but has to be enabled on the PayFlow backend. This is what I was told by Todd Sieber at Technical Support:
40
- #
41
- # <em>You will need to call Payflow Support at 1-888-883-9770, choose option #2. Request that they update your account in "Pandora" under Product Settings >> PayPal Mark and update the Features Bitmap to 1111111111111112. This is 15 ones and a two.</em>
42
- #
43
- # See here[https://www.x.com/message/206214#206214] for the forum discussion (requires login to {x.com}[https://x.com]
44
- #
45
- # [<tt>:items</tt>] (opt) Array of Order Line Items hashes. These are shown to the buyer after redirect to PayPal.
46
- #
47
- #
48
- #
49
- # The following keys are supported for line items:
50
- # [<tt>:name</tt>] Name of line item
51
- # [<tt>:description</tt>] Description of line item
52
- # [<tt>:amount</tt>] Line Item Amount in Cents (as Integer)
53
- # [<tt>:quantity</tt>] Line Item Quantity (default to 1 if left blank)
54
- #
55
- # ====Customization of Payment Page
56
- # [<tt>:page_style</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
57
- # [<tt>:header_image</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
58
- # [<tt>:background_color</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
59
- # ====Additional options for old Checkout Experience, being phased out in 2010 and 2011
60
- # [<tt>:header_background_color</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
61
- # [<tt>:header_border_color</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
62
-
7
+ # ==General Parameters
8
+ # The following parameters are supported for #setup_authorization, #setup_purchase, #authorize and #purchase transactions. I've read
9
+ # in the docs that they recommend you pass the exact same parameters to both setup and authorize/purchase.
10
+ #
11
+ # This information was gleaned from a mix of:
12
+ # * {PayFlow documentation}[https://developer.paypal.com/docs/classic/payflow/integration-guide/]
13
+ # * previous ActiveMerchant code
14
+ # * trial & error
15
+ #
16
+ # The following parameters are currently supported.
17
+ # [<tt>:ip</tt>] (opt) Customer IP Address
18
+ # [<tt>:order_id</tt>] (opt) An order or invoice number. This will be passed through to the Payflow backend at manager.paypal.com, and show up as "Supplier Reference #"
19
+ # [<tt>:description</tt>] (opt) Order description, shown to buyer (after redirected to PayPal). If Order Line Items are used (see below), then the description is suppressed. This will not be passed through to the Payflow backend.
20
+ # [<tt>:billing_address</tt>] (opt) See ActiveMerchant::Billing::Gateway for details
21
+ # [<tt>:shipping_address</tt>] (opt) See ActiveMerchant::Billing::Gateway for details
22
+ # [<tt>:currency</tt>] (req) Currency of transaction, will be set to USD by default for PayFlow Express if not specified
23
+ # [<tt>:email</tt>] (opt) Email of buyer; used to pre-fill PayPal login screen
24
+ # [<tt>:payer_id</tt>] (opt) Unique PayPal buyer account identification number, as returned by details_for request
25
+ # [<tt>:token</tt>] (req for #authorize & #purchase) Token returned by setup transaction
26
+ # [<tt>:no_shipping</tt>] (opt) Boolean for whether or not to display shipping address to buyer
27
+ # [<tt>:address_override</tt>] (opt) Boolean. If true, display shipping address passed by parameters, rather than shipping address on file with PayPal
28
+ # [<tt>:allow_note</tt>] (opt) Boolean for permitting buyer to add note during checkout. Note contents can be retrieved with details_for transaction
29
+ # [<tt>:return_url</tt>] (req) URL to which the buyer’s browser is returned after choosing to pay.
30
+ # [<tt>:cancel_return_url</tt>] (req) URL to which the buyer is returned if the buyer cancels the order.
31
+ # [<tt>:notify_url</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
32
+ # [<tt>:comment</tt>] (opt) Comment field which will be reported to Payflow backend (at manager.paypal.com) as Comment1
33
+ # [<tt>:comment2</tt>] (opt) Comment field which will be reported to Payflow backend (at manager.paypal.com) as Comment2
34
+ # [<tt>:discount</tt>] (opt) Total discounts in cents
35
+ #
36
+ # ==Line Items
37
+ # Support for order line items is available, but has to be enabled on the PayFlow backend. This is what I was told by Todd Sieber at Technical Support:
38
+ #
39
+ # <em>You will need to call Payflow Support at 1-888-883-9770, choose option #2. Request that they update your account in "Pandora" under Product Settings >> PayPal Mark and update the Features Bitmap to 1111111111111112. This is 15 ones and a two.</em>
40
+ #
41
+ # See here[https://www.x.com/message/206214#206214] for the forum discussion (requires login to {x.com}[https://x.com]
42
+ #
43
+ # [<tt>:items</tt>] (opt) Array of Order Line Items hashes. These are shown to the buyer after redirect to PayPal.
44
+ #
45
+ #
46
+ #
47
+ # The following keys are supported for line items:
48
+ # [<tt>:name</tt>] Name of line item
49
+ # [<tt>:description</tt>] Description of line item
50
+ # [<tt>:amount</tt>] Line Item Amount in Cents (as Integer)
51
+ # [<tt>:quantity</tt>] Line Item Quantity (default to 1 if left blank)
52
+ #
53
+ # ====Customization of Payment Page
54
+ # [<tt>:page_style</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
55
+ # [<tt>:header_image</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
56
+ # [<tt>:background_color</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
57
+ # ====Additional options for old Checkout Experience, being phased out in 2010 and 2011
58
+ # [<tt>:header_background_color</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
59
+ # [<tt>:header_border_color</tt>] (opt) Your URL for receiving Instant Payment Notification (IPN) about this transaction.
63
60
 
64
61
  class PayflowExpressGateway < Gateway
65
62
  include PayflowCommonAPI
@@ -111,8 +108,9 @@ module ActiveMerchant #:nodoc:
111
108
  end
112
109
 
113
110
  private
111
+
114
112
  def build_get_express_details_request(token)
115
- xml = Builder::XmlMarkup.new :indent => 2
113
+ xml = Builder::XmlMarkup.new indent: 2
116
114
  xml.tag! 'GetExpressCheckout' do
117
115
  xml.tag! 'Authorization' do
118
116
  xml.tag! 'PayData' do
@@ -128,7 +126,7 @@ module ActiveMerchant #:nodoc:
128
126
  end
129
127
 
130
128
  def build_setup_express_sale_or_authorization_request(action, money, options = {})
131
- xml = Builder::XmlMarkup.new :indent => 2
129
+ xml = Builder::XmlMarkup.new indent: 2
132
130
  xml.tag! 'SetExpressCheckout' do
133
131
  xml.tag! action do
134
132
  add_pay_data xml, money, options
@@ -138,7 +136,7 @@ module ActiveMerchant #:nodoc:
138
136
  end
139
137
 
140
138
  def build_sale_or_authorization_request(action, money, options)
141
- xml = Builder::XmlMarkup.new :indent => 2
139
+ xml = Builder::XmlMarkup.new indent: 2
142
140
  xml.tag! 'DoExpressCheckout' do
143
141
  xml.tag! action do
144
142
  add_pay_data xml, money, options
@@ -157,7 +155,7 @@ module ActiveMerchant #:nodoc:
157
155
  # Comment, Comment2 should make it to the backend at manager.paypal.com, as with Payflow credit card transactions
158
156
  # but that doesn't seem to work (yet?). See: https://www.x.com/thread/51908?tstart=0
159
157
  xml.tag! 'Comment', options[:comment] unless options[:comment].nil?
160
- xml.tag!('ExtData', 'Name'=> 'COMMENT2', 'Value'=> options[:comment2]) unless options[:comment2].nil?
158
+ xml.tag!('ExtData', 'Name' => 'COMMENT2', 'Value' => options[:comment2]) unless options[:comment2].nil?
161
159
 
162
160
  billing_address = options[:billing_address] || options[:address]
163
161
  add_address(xml, 'BillTo', billing_address, options) if billing_address
@@ -178,11 +176,10 @@ module ActiveMerchant #:nodoc:
178
176
  end
179
177
  if items.any?
180
178
  xml.tag! 'ExtData', 'Name' => 'CURRENCY', 'Value' => options[:currency] || currency(money)
181
- xml.tag! 'ExtData', 'Name' => "ITEMAMT", 'Value' => amount(options[:subtotal] || money)
179
+ xml.tag! 'ExtData', 'Name' => 'ITEMAMT', 'Value' => amount(options[:subtotal] || money)
182
180
  end
183
181
  xml.tag! 'DiscountAmt', amount(options[:discount]) if options[:discount]
184
182
  xml.tag! 'TotalAmt', amount(money), 'Currency' => options[:currency] || currency(money)
185
-
186
183
  end
187
184
 
188
185
  xml.tag! 'Tender' do
@@ -192,7 +189,7 @@ module ActiveMerchant #:nodoc:
192
189
  end
193
190
 
194
191
  def add_paypal_details(xml, options)
195
- xml.tag! 'PayPal' do
192
+ xml.tag! 'PayPal' do
196
193
  xml.tag! 'EMail', options[:email] unless options[:email].blank?
197
194
  xml.tag! 'ReturnURL', options[:return_url] unless options[:return_url].blank?
198
195
  xml.tag! 'CancelURL', options[:cancel_return_url] unless options[:cancel_return_url].blank?
@@ -201,7 +198,7 @@ module ActiveMerchant #:nodoc:
201
198
  xml.tag! 'Token', options[:token] unless options[:token].blank?
202
199
  xml.tag! 'NoShipping', options[:no_shipping] ? '1' : '0'
203
200
  xml.tag! 'AddressOverride', options[:address_override] ? '1' : '0'
204
- xml.tag! 'ButtonSource', application_id.to_s.slice(0,32) unless application_id.blank?
201
+ xml.tag! 'ButtonSource', application_id.to_s.slice(0, 32) unless application_id.blank?
205
202
 
206
203
  # Customization of the payment page
207
204
  xml.tag! 'PageStyle', options[:page_style] unless options[:page_style].blank?
@@ -221,4 +218,3 @@ module ActiveMerchant #:nodoc:
221
218
  end
222
219
  end
223
220
  end
224
-