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,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  require 'rexml/document'
3
4
 
4
5
  module ActiveMerchant #:nodoc:
@@ -119,29 +120,26 @@ module ActiveMerchant #:nodoc:
119
120
  'KO' => 'N',
120
121
  'NO' => 'R' }
121
122
 
122
- SUCCESS_MESSAGE = "The transaction was successful"
123
+ SUCCESS_MESSAGE = 'The transaction was successful'
124
+
125
+ THREE_D_SECURE_DISPLAY_WAYS = { main_window: 'MAINW', # display the identification page in the main window (default value).
123
126
 
124
- THREE_D_SECURE_DISPLAY_WAYS = { :main_window => 'MAINW', # display the identification page in the main window
125
- # (default value).
126
- :pop_up => 'POPUP', # display the identification page in a pop-up window
127
- # and return to the main window at the end.
128
- :pop_ix => 'POPIX' } # display the identification page in a pop-up window
129
- # and remain in the pop-up window.
127
+ pop_up: 'POPUP', # display the identification page in a pop-up window and return to the main window at the end.
128
+ pop_ix: 'POPIX' } # display the identification page in a pop-up window and remain in the pop-up window.
130
129
 
131
- OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE = "Signature usage will be the default for a future release of ActiveMerchant. You should either begin using it, or update your configuration to explicitly disable it (signature_encryptor: none)"
130
+ OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE = 'Signature usage will be the default for a future release of ActiveMerchant. You should either begin using it, or update your configuration to explicitly disable it (signature_encryptor: none)'
132
131
  OGONE_STORE_OPTION_DEPRECATION_MESSAGE = "The 'store' option has been renamed to 'billing_id', and its usage is deprecated."
133
132
 
134
- self.test_url = "https://secure.ogone.com/ncol/test/"
135
- self.live_url = "https://secure.ogone.com/ncol/prod/"
133
+ self.test_url = 'https://secure.ogone.com/ncol/test/'
134
+ self.live_url = 'https://secure.ogone.com/ncol/prod/'
136
135
 
137
- self.supported_countries = ['BE', 'DE', 'FR', 'NL', 'AT', 'CH']
136
+ self.supported_countries = %w[BE DE FR NL AT CH]
138
137
  # also supports Airplus and UATP
139
- self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro]
138
+ self.supported_cardtypes = %i[visa master american_express diners_club discover jcb maestro]
140
139
  self.homepage_url = 'http://www.ogone.com/'
141
140
  self.display_name = 'Ogone'
142
141
  self.default_currency = 'EUR'
143
142
  self.money_format = :cents
144
- self.ssl_version = :TLSv1
145
143
 
146
144
  def initialize(options = {})
147
145
  requires!(options, :login, :user, :password)
@@ -151,12 +149,13 @@ module ActiveMerchant #:nodoc:
151
149
  # Verify and reserve the specified amount on the account, without actually doing the transaction.
152
150
  def authorize(money, payment_source, options = {})
153
151
  post = {}
152
+ action = payment_source.brand == 'mastercard' ? 'PAU' : 'RES'
154
153
  add_invoice(post, options)
155
154
  add_payment_source(post, payment_source, options)
156
155
  add_address(post, payment_source, options)
157
156
  add_customer_data(post, options)
158
157
  add_money(post, money, options)
159
- commit('RES', post)
158
+ commit(action, post)
160
159
  end
161
160
 
162
161
  # Verify and transfer the specified amount.
@@ -205,23 +204,43 @@ module ActiveMerchant #:nodoc:
205
204
  perform_reference_credit(money, reference, options)
206
205
  end
207
206
 
207
+ def verify(credit_card, options = {})
208
+ MultiResponse.run(:use_first_response) do |r|
209
+ r.process { authorize(100, credit_card, options) }
210
+ r.process(:ignore_result) { void(r.authorization, options) }
211
+ end
212
+ end
213
+
208
214
  # Store a credit card by creating an Ogone Alias
209
215
  def store(payment_source, options = {})
210
- options.merge!(:alias_operation => 'BYPSP') unless(options.has_key?(:billing_id) || options.has_key?(:store))
216
+ options[:alias_operation] = 'BYPSP' unless options.has_key?(:billing_id) || options.has_key?(:store)
211
217
  response = authorize(@options[:store_amount] || 1, payment_source, options)
212
218
  void(response.authorization) if response.success?
213
219
  response
214
220
  end
215
221
 
222
+ def supports_scrubbing?
223
+ true
224
+ end
225
+
226
+ def scrub(transcript)
227
+ transcript.
228
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
229
+ gsub(%r((&?cardno=)[^&]*)i, '\1[FILTERED]').
230
+ gsub(%r((&?cvc=)[^&]*)i, '\1[FILTERED]').
231
+ gsub(%r((&?pswd=)[^&]*)i, '\1[FILTERED]')
232
+ end
233
+
216
234
  private
217
235
 
218
236
  def reference_from(authorization)
219
- authorization.split(";").first
237
+ authorization.split(';').first
220
238
  end
221
239
 
222
240
  def reference_transaction?(identifier)
223
241
  return false unless identifier.is_a?(String)
224
- _, action = identifier.split(";")
242
+
243
+ _, action = identifier.split(';')
225
244
  !action.nil?
226
245
  end
227
246
 
@@ -267,11 +286,13 @@ module ActiveMerchant #:nodoc:
267
286
  THREE_D_SECURE_DISPLAY_WAYS[:main_window]
268
287
  add_pair post, 'WIN3DS', win_3ds
269
288
 
270
- add_pair post, 'HTTP_ACCEPT', options[:http_accept] || "*/*"
289
+ add_pair post, 'HTTP_ACCEPT', options[:http_accept] || '*/*'
271
290
  add_pair post, 'HTTP_USER_AGENT', options[:http_user_agent] if options[:http_user_agent]
272
291
  add_pair post, 'ACCEPTURL', options[:accept_url] if options[:accept_url]
273
292
  add_pair post, 'DECLINEURL', options[:decline_url] if options[:decline_url]
274
293
  add_pair post, 'EXCEPTIONURL', options[:exception_url] if options[:exception_url]
294
+ add_pair post, 'CANCELURL', options[:cancel_url] if options[:cancel_url]
295
+ add_pair post, 'PARAMVAR', options[:paramvar] if options[:paramvar]
275
296
  add_pair post, 'PARAMPLUS', options[:paramplus] if options[:paramplus]
276
297
  add_pair post, 'COMPLUS', options[:complus] if options[:complus]
277
298
  add_pair post, 'LANGUAGE', options[:language] if options[:language]
@@ -281,8 +302,8 @@ module ActiveMerchant #:nodoc:
281
302
  add_pair post, 'ECI', eci.to_s
282
303
  end
283
304
 
284
- def add_alias(post, _alias, alias_operation = nil)
285
- add_pair post, 'ALIAS', _alias
305
+ def add_alias(post, alias_name, alias_operation = nil)
306
+ add_pair post, 'ALIAS', alias_name
286
307
  add_pair post, 'ALIASOPERATION', alias_operation unless alias_operation.nil?
287
308
  end
288
309
 
@@ -302,6 +323,7 @@ module ActiveMerchant #:nodoc:
302
323
 
303
324
  def add_address(post, creditcard, options)
304
325
  return unless options[:billing_address]
326
+
305
327
  add_pair post, 'Owneraddress', options[:billing_address][:address1]
306
328
  add_pair post, 'OwnerZip', options[:billing_address][:zip]
307
329
  add_pair post, 'ownertown', options[:billing_address][:city]
@@ -312,12 +334,13 @@ module ActiveMerchant #:nodoc:
312
334
  def add_invoice(post, options)
313
335
  add_pair post, 'orderID', options[:order_id] || generate_unique_id[0...30]
314
336
  add_pair post, 'COM', options[:description]
337
+ add_pair post, 'ORIG', options[:origin] if options[:origin]
315
338
  end
316
339
 
317
340
  def add_creditcard(post, creditcard)
318
341
  add_pair post, 'CN', creditcard.name
319
342
  add_pair post, 'CARDNO', creditcard.number
320
- add_pair post, 'ED', "%02d%02s" % [creditcard.month, creditcard.year.to_s[-2..-1]]
343
+ add_pair post, 'ED', '%02d%02s' % [creditcard.month, creditcard.year.to_s[-2..-1]]
321
344
  add_pair post, 'CVC', creditcard.verification_value
322
345
  end
323
346
 
@@ -327,14 +350,15 @@ module ActiveMerchant #:nodoc:
327
350
 
328
351
  # Add HTML_ANSWER element (3-D Secure specific to the response's params)
329
352
  # Note: HTML_ANSWER is not an attribute so we add it "by hand" to the response
330
- if html_answer = REXML::XPath.first(xml_root, "//HTML_ANSWER")
331
- response["HTML_ANSWER"] = html_answer.text
353
+ if html_answer = REXML::XPath.first(xml_root, '//HTML_ANSWER')
354
+ response['HTML_ANSWER'] = html_answer.text
332
355
  end
333
356
 
334
357
  response
335
358
  end
336
359
 
337
360
  def commit(action, parameters)
361
+ add_pair parameters, 'RTIMEOUT', @options[:timeout] if @options[:timeout]
338
362
  add_pair parameters, 'PSPID', @options[:login]
339
363
  add_pair parameters, 'USERID', @options[:user]
340
364
  add_pair parameters, 'PSWD', @options[:password]
@@ -342,27 +366,27 @@ module ActiveMerchant #:nodoc:
342
366
  response = parse(ssl_post(url(parameters['PAYID']), post_data(action, parameters)))
343
367
 
344
368
  options = {
345
- :authorization => [response["PAYID"], action].join(";"),
346
- :test => test?,
347
- :avs_result => { :code => AVS_MAPPING[response["AAVCheck"]] },
348
- :cvv_result => CVV_MAPPING[response["CVCCheck"]]
369
+ authorization: [response['PAYID'], action].join(';'),
370
+ test: test?,
371
+ avs_result: { code: AVS_MAPPING[response['AAVCheck']] },
372
+ cvv_result: CVV_MAPPING[response['CVCCheck']]
349
373
  }
350
374
  OgoneResponse.new(successful?(response), message_from(response), response, options)
351
375
  end
352
376
 
353
377
  def url(payid)
354
- (test? ? test_url : live_url) + (payid ? "maintenancedirect.asp" : "orderdirect.asp")
378
+ (test? ? test_url : live_url) + (payid ? 'maintenancedirect.asp' : 'orderdirect.asp')
355
379
  end
356
380
 
357
381
  def successful?(response)
358
- response["NCERROR"] == "0"
382
+ response['NCERROR'] == '0'
359
383
  end
360
384
 
361
385
  def message_from(response)
362
386
  if successful?(response)
363
387
  SUCCESS_MESSAGE
364
388
  else
365
- format_error_message(response["NCERRORPLUS"])
389
+ format_error_message(response['NCERRORPLUS'])
366
390
  end
367
391
  end
368
392
 
@@ -370,9 +394,9 @@ module ActiveMerchant #:nodoc:
370
394
  raw_message = message.to_s.strip
371
395
  case raw_message
372
396
  when /\|/
373
- raw_message.split("|").join(", ").capitalize
397
+ raw_message.split('|').join(', ').capitalize
374
398
  when /\//
375
- raw_message.split("/").first.to_s.capitalize
399
+ raw_message.split('/').first.to_s.capitalize
376
400
  else
377
401
  raw_message.to_s.capitalize
378
402
  end
@@ -386,27 +410,49 @@ module ActiveMerchant #:nodoc:
386
410
 
387
411
  def add_signature(parameters)
388
412
  if @options[:signature].blank?
389
- ActiveMerchant.deprecated(OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE) unless(@options[:signature_encryptor] == "none")
390
- return
413
+ ActiveMerchant.deprecated(OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE) unless @options[:signature_encryptor] == 'none'
414
+ return
391
415
  end
392
416
 
393
- sha_encryptor = case @options[:signature_encryptor]
394
- when 'sha256'
395
- Digest::SHA256
396
- when 'sha512'
397
- Digest::SHA512
398
- else
399
- Digest::SHA1
400
- end
401
-
402
- string_to_digest = if @options[:signature_encryptor]
403
- parameters.sort { |a, b| a[0].upcase <=> b[0].upcase }.map { |k, v| "#{k.upcase}=#{v}" }.join(@options[:signature])
404
- else
405
- %w[orderID amount currency CARDNO PSPID Operation ALIAS].map { |key| parameters[key] }.join
406
- end
407
- string_to_digest << @options[:signature]
417
+ add_pair parameters, 'SHASign', calculate_signature(parameters, @options[:signature_encryptor], @options[:signature])
418
+ end
419
+
420
+ def calculate_signature(signed_parameters, algorithm, secret)
421
+ return legacy_calculate_signature(signed_parameters, secret) unless algorithm
422
+
423
+ sha_encryptor =
424
+ case algorithm
425
+ when 'sha256'
426
+ Digest::SHA256
427
+ when 'sha512'
428
+ Digest::SHA512
429
+ when 'sha1'
430
+ Digest::SHA1
431
+ else
432
+ raise "Unknown signature algorithm #{algorithm}"
433
+ end
408
434
 
409
- add_pair parameters, 'SHASign', sha_encryptor.hexdigest(string_to_digest).upcase
435
+ filtered_params = signed_parameters.select { |_k, v| !v.blank? }
436
+ sha_encryptor.hexdigest(
437
+ filtered_params.sort_by { |k, _v| k.upcase }.map { |k, v| "#{k.upcase}=#{v}#{secret}" }.join('')
438
+ ).upcase
439
+ end
440
+
441
+ def legacy_calculate_signature(parameters, secret)
442
+ Digest::SHA1.hexdigest(
443
+ (
444
+ %w(
445
+ orderID
446
+ amount
447
+ currency
448
+ CARDNO
449
+ PSPID
450
+ Operation
451
+ ALIAS
452
+ ).map { |key| parameters[key] } +
453
+ [secret]
454
+ ).join('')
455
+ ).upcase
410
456
  end
411
457
 
412
458
  def add_pair(post, key, value)
@@ -0,0 +1,323 @@
1
+ require 'active_merchant/billing/rails'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ class OmiseGateway < Gateway
6
+ API_URL = 'https://api.omise.co/'
7
+ VAULT_URL = 'https://vault.omise.co/'
8
+
9
+ STANDARD_ERROR_CODE_MAPPING = {
10
+ 'invalid_security_code' => STANDARD_ERROR_CODE[:invalid_cvc],
11
+ 'failed_capture' => STANDARD_ERROR_CODE[:card_declined]
12
+ }
13
+
14
+ self.live_url = self.test_url = API_URL
15
+
16
+ # Currency supported by Omise
17
+ # * Thai Baht with Satang, 50000 (THB500.00)
18
+ # * Japanese Yen, 500 (JPY500)
19
+ self.default_currency = 'THB'
20
+ self.money_format = :cents
21
+
22
+ # Country supported by Omise
23
+ # * Thailand
24
+ self.supported_countries = %w(TH JP)
25
+
26
+ # Credit cards supported by Omise
27
+ # * VISA
28
+ # * MasterCard
29
+ # * JCB
30
+ self.supported_cardtypes = %i[visa master jcb]
31
+
32
+ # Omise main page
33
+ self.homepage_url = 'https://www.omise.co/'
34
+ self.display_name = 'Omise'
35
+
36
+ # Creates a new OmiseGateway.
37
+ #
38
+ # Omise requires public_key for token creation.
39
+ # And it requires secret_key for other transactions.
40
+ # These keys can be found in https://dashboard.omise.co/test/api-keys
41
+ #
42
+ # ==== Options
43
+ #
44
+ # * <tt>:public_key</tt> -- Omise's public key (REQUIRED).
45
+ # * <tt>:secret_key</tt> -- Omise's secret key (REQUIRED).
46
+ # * <tt>:api_version</tt> -- Omise's API Version (OPTIONAL), default version is '2014-07-27'
47
+ # See version at page https://dashboard.omise.co/api-version/edit
48
+
49
+ def initialize(options = {})
50
+ requires!(options, :public_key, :secret_key)
51
+ @public_key = options[:public_key]
52
+ @secret_key = options[:secret_key]
53
+ @api_version = options[:api_version]
54
+ super
55
+ end
56
+
57
+ # Perform a purchase (with auto capture)
58
+ #
59
+ # ==== Parameters
60
+ #
61
+ # * <tt>money</tt> -- The purchasing amount in Thai Baht Satang
62
+ # * <tt>payment_method</tt> -- The CreditCard object
63
+ # * <tt>options</tt> -- An optional parameters, such as token from Omise.js
64
+ #
65
+ # ==== Options
66
+ # * <tt>token_id</tt> -- token id, use Omise.js library to retrieve a token id
67
+ # if this is passed as an option, it will ignore tokenizing via Omisevaultgateway object
68
+ #
69
+ # === Example
70
+ # To create a charge on a card
71
+ #
72
+ # purchase(money, Creditcard_object)
73
+ #
74
+ # To create a charge on a token
75
+ #
76
+ # purchase(money, nil, { :token_id => token_id, ... })
77
+ #
78
+ # To create a charge on a customer
79
+ #
80
+ # purchase(money, nil, { :customer_id => customer_id })
81
+
82
+ def purchase(money, payment_method, options = {})
83
+ create_charge(money, payment_method, options)
84
+ end
85
+
86
+ # Authorize a charge.
87
+ #
88
+ # ==== Parameters
89
+ #
90
+ # * <tt>money</tt> -- The purchasing amount in Thai Baht Satang
91
+ # * <tt>payment_method</tt> -- The CreditCard object
92
+ # * <tt>options</tt> -- An optional parameters, such as token or capture
93
+
94
+ def authorize(money, payment_method, options = {})
95
+ options[:capture] = 'false'
96
+ create_charge(money, payment_method, options)
97
+ end
98
+
99
+ # Capture an authorized charge.
100
+ #
101
+ # ==== Parameters
102
+ #
103
+ # * <tt>money</tt> -- An amount in Thai Baht Satang
104
+ # * <tt>charge_id</tt> -- The CreditCard object
105
+ # * <tt>options</tt> -- An optional parameters, such as token or capture
106
+
107
+ def capture(money, charge_id, options = {})
108
+ post = {}
109
+ add_amount(post, money, options)
110
+ commit(:post, "charges/#{CGI.escape(charge_id)}/capture", post, options)
111
+ end
112
+
113
+ # Refund a charge.
114
+ #
115
+ # ==== Parameters
116
+ #
117
+ # * <tt>money</tt> -- An amount of money to charge in Satang.
118
+ # * <tt>charge_id</tt> -- The CreditCard object
119
+ # * <tt>options</tt> -- An optional parameters, such as token or capture
120
+
121
+ def refund(money, charge_id, options = {})
122
+ options[:amount] = money if money
123
+ commit(:post, "charges/#{CGI.escape(charge_id)}/refunds", options)
124
+ end
125
+
126
+ # Store a card details as customer
127
+ #
128
+ # ==== Parameters
129
+ #
130
+ # * <tt>payment_method</tt> -- The CreditCard.
131
+ # * <tt>options</tt> -- Optional Customer information:
132
+ # 'email' (A customer email)
133
+ # 'description' (A customer description)
134
+
135
+ def store(payment_method, options = {})
136
+ post, card_params = {}, {}
137
+ add_customer_data(post, options)
138
+ add_token(card_params, payment_method, options)
139
+ commit(:post, 'customers', post.merge(card_params), options)
140
+ end
141
+
142
+ # Delete a customer and all associated credit cards.
143
+ #
144
+ # ==== Parameters
145
+ #
146
+ # * <tt>customer_id</tt> -- The Customer identifier (REQUIRED).
147
+
148
+ def unstore(customer_id, options = {})
149
+ commit(:delete, "customers/#{CGI.escape(customer_id)}")
150
+ end
151
+
152
+ # Enable scrubbing sensitive information
153
+ def supports_scrubbing?
154
+ true
155
+ end
156
+
157
+ # Scrub sensitive information out of HTTP transcripts
158
+ #
159
+ # ==== Parameters
160
+ #
161
+ # * <tt>transcript</tt> -- The HTTP transcripts
162
+
163
+ def scrub(transcript)
164
+ transcript.
165
+ gsub(/(Authorization: Basic )\w+/i, '\1[FILTERED]').
166
+ gsub(/(\\"number\\":)\\"\d+\\"/, '\1[FILTERED]').
167
+ gsub(/(\\"security_code\\":)\\"\d+\\"/, '\1[FILTERED]')
168
+ end
169
+
170
+ private
171
+
172
+ def create_charge(money, payment_method, options)
173
+ post = {}
174
+ add_token(post, payment_method, options)
175
+ add_amount(post, money, options)
176
+ add_customer(post, options)
177
+ post[:capture] = options[:capture] if options[:capture]
178
+ commit(:post, 'charges', post, options)
179
+ end
180
+
181
+ def headers(options = {})
182
+ key = options[:key] || @secret_key
183
+ {
184
+ 'Content-Type' => 'application/json;utf-8',
185
+ 'Omise-Version' => @api_version || '2014-07-27',
186
+ 'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION} Ruby/#{RUBY_VERSION}",
187
+ 'Authorization' => 'Basic ' + Base64.encode64(key.to_s + ':').strip,
188
+ 'Accept-Encoding' => 'utf-8'
189
+ }
190
+ end
191
+
192
+ def url_for(endpoint)
193
+ (endpoint == 'tokens' ? VAULT_URL : API_URL) + endpoint
194
+ end
195
+
196
+ def post_data(parameters)
197
+ parameters.present? ? parameters.to_json : nil
198
+ end
199
+
200
+ def https_request(method, endpoint, parameters = nil, options = {})
201
+ raw_response = response = nil
202
+ begin
203
+ raw_response = ssl_request(method, url_for(endpoint), post_data(parameters), headers(options))
204
+ response = parse(raw_response)
205
+ rescue ResponseError => e
206
+ raw_response = e.response.body
207
+ response = parse(raw_response)
208
+ rescue JSON::ParserError
209
+ response = json_error(raw_response)
210
+ end
211
+ response
212
+ end
213
+
214
+ def parse(body)
215
+ JSON.parse(body)
216
+ end
217
+
218
+ def json_error(raw_response)
219
+ msg = 'Invalid response received from Omise API. Please contact support@omise.co if you continue to receive this message.'
220
+ msg += "The raw response returned by the API was #{raw_response.inspect})"
221
+ { message: msg }
222
+ end
223
+
224
+ def commit(method, endpoint, params = nil, options = {})
225
+ response = https_request(method, endpoint, params, options)
226
+ Response.new(
227
+ successful?(response),
228
+ message_from(response),
229
+ response,
230
+ {
231
+ authorization: authorization_from(response),
232
+ test: test?,
233
+ error_code: successful?(response) ? nil : standard_error_code_mapping(response)
234
+ }
235
+ )
236
+ end
237
+
238
+ def standard_error_code_mapping(response)
239
+ STANDARD_ERROR_CODE_MAPPING[error_code_from(response)] || message_to_standard_error_code_from(response)
240
+ end
241
+
242
+ def error_code_from(response)
243
+ error?(response) ? response['code'] : response['failure_code']
244
+ end
245
+
246
+ def message_to_standard_error_code_from(response)
247
+ message = response['message'] if response['code'] == 'invalid_card'
248
+ case message
249
+ when /brand not supported/
250
+ STANDARD_ERROR_CODE[:invalid_number]
251
+ when /number is invalid/
252
+ STANDARD_ERROR_CODE[:incorrect_number]
253
+ when /expiration date cannot be in the past/
254
+ STANDARD_ERROR_CODE[:expired_card]
255
+ when /expiration \w+ is invalid/
256
+ STANDARD_ERROR_CODE[:invalid_expiry_date]
257
+ else
258
+ STANDARD_ERROR_CODE[:processing_error]
259
+ end
260
+ end
261
+
262
+ def message_from(response)
263
+ if successful?(response)
264
+ 'Success'
265
+ else
266
+ response['message'] || response['failure_message']
267
+ end
268
+ end
269
+
270
+ def authorization_from(response)
271
+ response['id'] if successful?(response)
272
+ end
273
+
274
+ def successful?(response)
275
+ !error?(response) && response['failure_code'].nil?
276
+ end
277
+
278
+ def error?(response)
279
+ response.key?('object') && (response['object'] == 'error')
280
+ end
281
+
282
+ def get_token(post, credit_card)
283
+ add_creditcard(post, credit_card) if credit_card
284
+ commit(:post, 'tokens', post, { key: @public_key })
285
+ end
286
+
287
+ def add_token(post, credit_card, options = {})
288
+ if options[:token_id].present?
289
+ post[:card] = options[:token_id]
290
+ else
291
+ response = get_token(post, credit_card)
292
+ response.authorization ? (post[:card] = response.authorization) : response
293
+ end
294
+ end
295
+
296
+ def add_creditcard(post, payment_method)
297
+ card = {
298
+ number: payment_method.number,
299
+ name: payment_method.name,
300
+ security_code: payment_method.verification_value,
301
+ expiration_month: payment_method.month,
302
+ expiration_year: payment_method.year
303
+ }
304
+ post[:card] = card
305
+ end
306
+
307
+ def add_customer(post, options = {})
308
+ post[:customer] = options[:customer_id] if options[:customer_id]
309
+ end
310
+
311
+ def add_customer_data(post, options = {})
312
+ post[:description] = options[:description] if options[:description]
313
+ post[:email] = options[:email] if options[:email]
314
+ end
315
+
316
+ def add_amount(post, money, options)
317
+ post[:amount] = amount(money)
318
+ post[:currency] = (options[:currency] || currency(money))
319
+ post[:description] = options[:description] if options.key?(:description)
320
+ end
321
+ end
322
+ end
323
+ end