active_accountability_merchant 1.97.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +2948 -0
  3. data/CONTRIBUTORS +568 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +246 -0
  6. data/lib/active_merchant.rb +63 -0
  7. data/lib/active_merchant/billing.rb +15 -0
  8. data/lib/active_merchant/billing/apple_pay_payment_token.rb +22 -0
  9. data/lib/active_merchant/billing/avs_result.rb +96 -0
  10. data/lib/active_merchant/billing/base.rb +61 -0
  11. data/lib/active_merchant/billing/check.rb +80 -0
  12. data/lib/active_merchant/billing/compatibility.rb +117 -0
  13. data/lib/active_merchant/billing/credit_card.rb +406 -0
  14. data/lib/active_merchant/billing/credit_card_formatting.rb +23 -0
  15. data/lib/active_merchant/billing/credit_card_methods.rb +343 -0
  16. data/lib/active_merchant/billing/cvv_result.rb +38 -0
  17. data/lib/active_merchant/billing/gateway.rb +330 -0
  18. data/lib/active_merchant/billing/gateways.rb +14 -0
  19. data/lib/active_merchant/billing/gateways/adyen.rb +503 -0
  20. data/lib/active_merchant/billing/gateways/allied_wallet.rb +205 -0
  21. data/lib/active_merchant/billing/gateways/authorize_net.rb +1055 -0
  22. data/lib/active_merchant/billing/gateways/authorize_net_arb.rb +417 -0
  23. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +980 -0
  24. data/lib/active_merchant/billing/gateways/axcessms.rb +181 -0
  25. data/lib/active_merchant/billing/gateways/balanced.rb +256 -0
  26. data/lib/active_merchant/billing/gateways/bambora_apac.rb +226 -0
  27. data/lib/active_merchant/billing/gateways/bank_frick.rb +225 -0
  28. data/lib/active_merchant/billing/gateways/banwire.rb +116 -0
  29. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +384 -0
  30. data/lib/active_merchant/billing/gateways/barclays_epdq_extra_plus.rb +15 -0
  31. data/lib/active_merchant/billing/gateways/be2bill.rb +131 -0
  32. data/lib/active_merchant/billing/gateways/beanstream.rb +217 -0
  33. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +473 -0
  34. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +57 -0
  35. data/lib/active_merchant/billing/gateways/blue_pay.rb +522 -0
  36. data/lib/active_merchant/billing/gateways/blue_snap.rb +522 -0
  37. data/lib/active_merchant/billing/gateways/bogus.rb +186 -0
  38. data/lib/active_merchant/billing/gateways/borgun.rb +220 -0
  39. data/lib/active_merchant/billing/gateways/bpoint.rb +277 -0
  40. data/lib/active_merchant/billing/gateways/braintree.rb +19 -0
  41. data/lib/active_merchant/billing/gateways/braintree/braintree_common.rb +22 -0
  42. data/lib/active_merchant/billing/gateways/braintree_blue.rb +740 -0
  43. data/lib/active_merchant/billing/gateways/braintree_orange.rb +19 -0
  44. data/lib/active_merchant/billing/gateways/bridge_pay.rb +244 -0
  45. data/lib/active_merchant/billing/gateways/cams.rb +230 -0
  46. data/lib/active_merchant/billing/gateways/card_connect.rb +316 -0
  47. data/lib/active_merchant/billing/gateways/card_save.rb +22 -0
  48. data/lib/active_merchant/billing/gateways/card_stream.rb +367 -0
  49. data/lib/active_merchant/billing/gateways/cardknox.rb +327 -0
  50. data/lib/active_merchant/billing/gateways/cardprocess.rb +254 -0
  51. data/lib/active_merchant/billing/gateways/cashnet.rb +219 -0
  52. data/lib/active_merchant/billing/gateways/cc5.rb +198 -0
  53. data/lib/active_merchant/billing/gateways/cecabank.rb +249 -0
  54. data/lib/active_merchant/billing/gateways/cenpos.rb +327 -0
  55. data/lib/active_merchant/billing/gateways/checkout.rb +214 -0
  56. data/lib/active_merchant/billing/gateways/checkout_v2.rb +270 -0
  57. data/lib/active_merchant/billing/gateways/citrus_pay.rb +22 -0
  58. data/lib/active_merchant/billing/gateways/clearhaus.rb +220 -0
  59. data/lib/active_merchant/billing/gateways/commercegate.rb +142 -0
  60. data/lib/active_merchant/billing/gateways/conekta.rb +228 -0
  61. data/lib/active_merchant/billing/gateways/creditcall.rb +271 -0
  62. data/lib/active_merchant/billing/gateways/credorax.rb +382 -0
  63. data/lib/active_merchant/billing/gateways/ct_payment.rb +268 -0
  64. data/lib/active_merchant/billing/gateways/culqi.rb +277 -0
  65. data/lib/active_merchant/billing/gateways/cyber_source.rb +828 -0
  66. data/lib/active_merchant/billing/gateways/d_local.rb +226 -0
  67. data/lib/active_merchant/billing/gateways/data_cash.rb +305 -0
  68. data/lib/active_merchant/billing/gateways/decidir.rb +233 -0
  69. data/lib/active_merchant/billing/gateways/dibs.rb +199 -0
  70. data/lib/active_merchant/billing/gateways/digitzs.rb +292 -0
  71. data/lib/active_merchant/billing/gateways/ebanx.rb +296 -0
  72. data/lib/active_merchant/billing/gateways/efsnet.rb +215 -0
  73. data/lib/active_merchant/billing/gateways/elavon.rb +320 -0
  74. data/lib/active_merchant/billing/gateways/element.rb +356 -0
  75. data/lib/active_merchant/billing/gateways/epay.rb +285 -0
  76. data/lib/active_merchant/billing/gateways/evo_ca.rb +308 -0
  77. data/lib/active_merchant/billing/gateways/eway.rb +226 -0
  78. data/lib/active_merchant/billing/gateways/eway_managed.rb +290 -0
  79. data/lib/active_merchant/billing/gateways/eway_rapid.rb +563 -0
  80. data/lib/active_merchant/billing/gateways/exact.rb +224 -0
  81. data/lib/active_merchant/billing/gateways/ezic.rb +195 -0
  82. data/lib/active_merchant/billing/gateways/fat_zebra.rb +218 -0
  83. data/lib/active_merchant/billing/gateways/federated_canada.rb +159 -0
  84. data/lib/active_merchant/billing/gateways/finansbank.rb +22 -0
  85. data/lib/active_merchant/billing/gateways/first_giving.rb +142 -0
  86. data/lib/active_merchant/billing/gateways/first_pay.rb +182 -0
  87. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +451 -0
  88. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +485 -0
  89. data/lib/active_merchant/billing/gateways/flo2cash.rb +215 -0
  90. data/lib/active_merchant/billing/gateways/flo2cash_simple.rb +20 -0
  91. data/lib/active_merchant/billing/gateways/forte.rb +270 -0
  92. data/lib/active_merchant/billing/gateways/garanti.rb +259 -0
  93. data/lib/active_merchant/billing/gateways/global_collect.rb +336 -0
  94. data/lib/active_merchant/billing/gateways/global_transport.rb +194 -0
  95. data/lib/active_merchant/billing/gateways/hdfc.rb +206 -0
  96. data/lib/active_merchant/billing/gateways/hps.rb +350 -0
  97. data/lib/active_merchant/billing/gateways/iats_payments.rb +290 -0
  98. data/lib/active_merchant/billing/gateways/in_context_paypal_express.rb +15 -0
  99. data/lib/active_merchant/billing/gateways/inspire.rb +218 -0
  100. data/lib/active_merchant/billing/gateways/instapay.rb +162 -0
  101. data/lib/active_merchant/billing/gateways/ipp.rb +176 -0
  102. data/lib/active_merchant/billing/gateways/iridium.rb +468 -0
  103. data/lib/active_merchant/billing/gateways/itransact.rb +447 -0
  104. data/lib/active_merchant/billing/gateways/iveri.rb +251 -0
  105. data/lib/active_merchant/billing/gateways/jetpay.rb +402 -0
  106. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +437 -0
  107. data/lib/active_merchant/billing/gateways/komoju.rb +115 -0
  108. data/lib/active_merchant/billing/gateways/kushki.rb +219 -0
  109. data/lib/active_merchant/billing/gateways/latitude19.rb +411 -0
  110. data/lib/active_merchant/billing/gateways/linkpoint.rb +449 -0
  111. data/lib/active_merchant/billing/gateways/litle.rb +507 -0
  112. data/lib/active_merchant/billing/gateways/mastercard.rb +267 -0
  113. data/lib/active_merchant/billing/gateways/maxipago.rb +220 -0
  114. data/lib/active_merchant/billing/gateways/mercado_pago.rb +277 -0
  115. data/lib/active_merchant/billing/gateways/merchant_e_solutions.rb +194 -0
  116. data/lib/active_merchant/billing/gateways/merchant_one.rb +113 -0
  117. data/lib/active_merchant/billing/gateways/merchant_partners.rb +245 -0
  118. data/lib/active_merchant/billing/gateways/merchant_ware.rb +319 -0
  119. data/lib/active_merchant/billing/gateways/merchant_ware_version_four.rb +286 -0
  120. data/lib/active_merchant/billing/gateways/merchant_warrior.rb +210 -0
  121. data/lib/active_merchant/billing/gateways/mercury.rb +356 -0
  122. data/lib/active_merchant/billing/gateways/metrics_global.rb +303 -0
  123. data/lib/active_merchant/billing/gateways/micropayment.rb +183 -0
  124. data/lib/active_merchant/billing/gateways/migs.rb +332 -0
  125. data/lib/active_merchant/billing/gateways/migs/migs_codes.rb +100 -0
  126. data/lib/active_merchant/billing/gateways/modern_payments.rb +37 -0
  127. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +217 -0
  128. data/lib/active_merchant/billing/gateways/monei.rb +338 -0
  129. data/lib/active_merchant/billing/gateways/moneris.rb +377 -0
  130. data/lib/active_merchant/billing/gateways/moneris_us.rb +352 -0
  131. data/lib/active_merchant/billing/gateways/money_movers.rb +151 -0
  132. data/lib/active_merchant/billing/gateways/mundipagg.rb +293 -0
  133. data/lib/active_merchant/billing/gateways/nab_transact.rb +301 -0
  134. data/lib/active_merchant/billing/gateways/ncr_secure_pay.rb +165 -0
  135. data/lib/active_merchant/billing/gateways/net_registry.rb +199 -0
  136. data/lib/active_merchant/billing/gateways/netaxept.rb +180 -0
  137. data/lib/active_merchant/billing/gateways/netbanx.rb +294 -0
  138. data/lib/active_merchant/billing/gateways/netbilling.rb +232 -0
  139. data/lib/active_merchant/billing/gateways/netpay.rb +222 -0
  140. data/lib/active_merchant/billing/gateways/network_merchants.rb +241 -0
  141. data/lib/active_merchant/billing/gateways/nmi.rb +324 -0
  142. data/lib/active_merchant/billing/gateways/ogone.rb +478 -0
  143. data/lib/active_merchant/billing/gateways/omise.rb +324 -0
  144. data/lib/active_merchant/billing/gateways/openpay.rb +228 -0
  145. data/lib/active_merchant/billing/gateways/opp.rb +388 -0
  146. data/lib/active_merchant/billing/gateways/optimal_payment.rb +332 -0
  147. data/lib/active_merchant/billing/gateways/orbital.rb +1006 -0
  148. data/lib/active_merchant/billing/gateways/orbital/orbital_soft_descriptors.rb +47 -0
  149. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +206 -0
  150. data/lib/active_merchant/billing/gateways/pagarme.rb +246 -0
  151. data/lib/active_merchant/billing/gateways/pago_facil.rb +122 -0
  152. data/lib/active_merchant/billing/gateways/pay_conex.rb +245 -0
  153. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +280 -0
  154. data/lib/active_merchant/billing/gateways/pay_hub.rb +213 -0
  155. data/lib/active_merchant/billing/gateways/pay_junction.rb +390 -0
  156. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +188 -0
  157. data/lib/active_merchant/billing/gateways/pay_secure.rb +111 -0
  158. data/lib/active_merchant/billing/gateways/paybox_direct.rb +200 -0
  159. data/lib/active_merchant/billing/gateways/payeezy.rb +410 -0
  160. data/lib/active_merchant/billing/gateways/payex.rb +410 -0
  161. data/lib/active_merchant/billing/gateways/payflow.rb +383 -0
  162. data/lib/active_merchant/billing/gateways/payflow/payflow_common_api.rb +235 -0
  163. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +43 -0
  164. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +13 -0
  165. data/lib/active_merchant/billing/gateways/payflow_express.rb +220 -0
  166. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +14 -0
  167. data/lib/active_merchant/billing/gateways/payflow_uk.rb +20 -0
  168. data/lib/active_merchant/billing/gateways/payment_express.rb +369 -0
  169. data/lib/active_merchant/billing/gateways/paymentez.rb +300 -0
  170. data/lib/active_merchant/billing/gateways/paymill.rb +371 -0
  171. data/lib/active_merchant/billing/gateways/paypal.rb +128 -0
  172. data/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb +717 -0
  173. data/lib/active_merchant/billing/gateways/paypal/paypal_express_response.rb +65 -0
  174. data/lib/active_merchant/billing/gateways/paypal/paypal_recurring_api.rb +262 -0
  175. data/lib/active_merchant/billing/gateways/paypal_ca.rb +13 -0
  176. data/lib/active_merchant/billing/gateways/paypal_digital_goods.rb +44 -0
  177. data/lib/active_merchant/billing/gateways/paypal_express.rb +269 -0
  178. data/lib/active_merchant/billing/gateways/paypal_express_common.rb +30 -0
  179. data/lib/active_merchant/billing/gateways/payscout.rb +160 -0
  180. data/lib/active_merchant/billing/gateways/paystation.rb +207 -0
  181. data/lib/active_merchant/billing/gateways/payu_in.rb +248 -0
  182. data/lib/active_merchant/billing/gateways/payu_latam.rb +449 -0
  183. data/lib/active_merchant/billing/gateways/payway.rb +207 -0
  184. data/lib/active_merchant/billing/gateways/pin.rb +234 -0
  185. data/lib/active_merchant/billing/gateways/plugnpay.rb +284 -0
  186. data/lib/active_merchant/billing/gateways/pro_pay.rb +326 -0
  187. data/lib/active_merchant/billing/gateways/psigate.rb +227 -0
  188. data/lib/active_merchant/billing/gateways/psl_card.rb +296 -0
  189. data/lib/active_merchant/billing/gateways/qbms.rb +303 -0
  190. data/lib/active_merchant/billing/gateways/quantum.rb +276 -0
  191. data/lib/active_merchant/billing/gateways/quickbooks.rb +290 -0
  192. data/lib/active_merchant/billing/gateways/quickpay.rb +25 -0
  193. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +184 -0
  194. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v10.rb +301 -0
  195. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +226 -0
  196. data/lib/active_merchant/billing/gateways/qvalent.rb +289 -0
  197. data/lib/active_merchant/billing/gateways/realex.rb +374 -0
  198. data/lib/active_merchant/billing/gateways/redsys.rb +534 -0
  199. data/lib/active_merchant/billing/gateways/s5.rb +246 -0
  200. data/lib/active_merchant/billing/gateways/safe_charge.rb +262 -0
  201. data/lib/active_merchant/billing/gateways/sage.rb +448 -0
  202. data/lib/active_merchant/billing/gateways/sage_pay.rb +434 -0
  203. data/lib/active_merchant/billing/gateways/sallie_mae.rb +142 -0
  204. data/lib/active_merchant/billing/gateways/secure_net.rb +267 -0
  205. data/lib/active_merchant/billing/gateways/secure_pay.rb +200 -0
  206. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +292 -0
  207. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +104 -0
  208. data/lib/active_merchant/billing/gateways/securion_pay.rb +264 -0
  209. data/lib/active_merchant/billing/gateways/skip_jack.rb +450 -0
  210. data/lib/active_merchant/billing/gateways/smart_ps.rb +280 -0
  211. data/lib/active_merchant/billing/gateways/so_easy_pay.rb +194 -0
  212. data/lib/active_merchant/billing/gateways/spreedly_core.rb +306 -0
  213. data/lib/active_merchant/billing/gateways/stripe.rb +790 -0
  214. data/lib/active_merchant/billing/gateways/stripe_payment_intents.rb +267 -0
  215. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +152 -0
  216. data/lib/active_merchant/billing/gateways/telr.rb +274 -0
  217. data/lib/active_merchant/billing/gateways/tns.rb +22 -0
  218. data/lib/active_merchant/billing/gateways/trans_first.rb +239 -0
  219. data/lib/active_merchant/billing/gateways/trans_first_transaction_express.rb +608 -0
  220. data/lib/active_merchant/billing/gateways/transact_pro.rb +224 -0
  221. data/lib/active_merchant/billing/gateways/transax.rb +22 -0
  222. data/lib/active_merchant/billing/gateways/transnational.rb +9 -0
  223. data/lib/active_merchant/billing/gateways/trexle.rb +218 -0
  224. data/lib/active_merchant/billing/gateways/trust_commerce.rb +490 -0
  225. data/lib/active_merchant/billing/gateways/usa_epay.rb +25 -0
  226. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1620 -0
  227. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +355 -0
  228. data/lib/active_merchant/billing/gateways/vanco.rb +294 -0
  229. data/lib/active_merchant/billing/gateways/verifi.rb +225 -0
  230. data/lib/active_merchant/billing/gateways/viaklix.rb +176 -0
  231. data/lib/active_merchant/billing/gateways/visanet_peru.rb +245 -0
  232. data/lib/active_merchant/billing/gateways/webpay.rb +97 -0
  233. data/lib/active_merchant/billing/gateways/wepay.rb +237 -0
  234. data/lib/active_merchant/billing/gateways/wirecard.rb +432 -0
  235. data/lib/active_merchant/billing/gateways/world_net.rb +344 -0
  236. data/lib/active_merchant/billing/gateways/worldpay.rb +634 -0
  237. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +215 -0
  238. data/lib/active_merchant/billing/gateways/worldpay_us.rb +221 -0
  239. data/lib/active_merchant/billing/model.rb +30 -0
  240. data/lib/active_merchant/billing/network_tokenization_credit_card.rb +39 -0
  241. data/lib/active_merchant/billing/payment_token.rb +21 -0
  242. data/lib/active_merchant/billing/rails.rb +3 -0
  243. data/lib/active_merchant/billing/response.rb +92 -0
  244. data/lib/active_merchant/connection.rb +195 -0
  245. data/lib/active_merchant/country.rb +336 -0
  246. data/lib/active_merchant/empty.rb +20 -0
  247. data/lib/active_merchant/errors.rb +35 -0
  248. data/lib/active_merchant/net_http_ssl_connection.rb +10 -0
  249. data/lib/active_merchant/network_connection_retries.rb +80 -0
  250. data/lib/active_merchant/post_data.rb +25 -0
  251. data/lib/active_merchant/posts_data.rb +92 -0
  252. data/lib/active_merchant/version.rb +3 -0
  253. data/lib/activemerchant.rb +1 -0
  254. data/lib/certs/cacert.pem +3988 -0
  255. data/lib/support/gateway_support.rb +69 -0
  256. data/lib/support/outbound_hosts.rb +28 -0
  257. data/lib/support/ssl_verify.rb +92 -0
  258. data/lib/support/ssl_version.rb +87 -0
  259. metadata +435 -0
@@ -0,0 +1,100 @@
1
+ module ActiveMerchant
2
+ module Billing
3
+ module MigsCodes
4
+ TXN_RESPONSE_CODES = {
5
+ '?' => 'Response Unknown',
6
+ '0' => 'Transaction Successful',
7
+ '1' => 'Transaction Declined - Bank Error',
8
+ '2' => 'Bank Declined Transaction',
9
+ '3' => 'Transaction Declined - No Reply from Bank',
10
+ '4' => 'Transaction Declined - Expired Card',
11
+ '5' => 'Transaction Declined - Insufficient funds',
12
+ '6' => 'Transaction Declined - Error Communicating with Bank',
13
+ '7' => 'Payment Server Processing Error - Typically caused by invalid input data such as an invalid credit card number. Processing errors can also occur',
14
+ '8' => 'Transaction Declined - Transaction Type Not Supported',
15
+ '9' => 'Bank Declined Transaction (Do not contact Bank)',
16
+ 'A' => 'Transaction Aborted',
17
+ 'C' => 'Transaction Cancelled',
18
+ 'D' => 'Deferred Transaction',
19
+ 'E' => 'Issuer Returned a Referral Response',
20
+ 'F' => '3D Secure Authentication Failed',
21
+ 'I' => 'Card Security Code Failed',
22
+ 'L' => 'Shopping Transaction Locked (This indicates that there is another transaction taking place using the same shopping transaction number)',
23
+ 'N' => 'Cardholder is not enrolled in 3D Secure (Authentication Only)',
24
+ 'P' => 'Transaction is Pending',
25
+ 'R' => 'Retry Limits Exceeded, Transaction Not Processed',
26
+ 'S' => 'Duplicate OrderInfo used. (This is only relevant for Payment Servers that enforce the uniqueness of this field)',
27
+ 'U' => 'Card Security Code Failed'
28
+ }
29
+
30
+ ISSUER_RESPONSE_CODES = {
31
+ '00' => 'Approved',
32
+ '01' => 'Refer to Card Issuer',
33
+ '02' => 'Refer to Card Issuer',
34
+ '03' => 'Invalid Merchant',
35
+ '04' => 'Pick Up Card',
36
+ '05' => 'Do Not Honor',
37
+ '07' => 'Pick Up Card',
38
+ '12' => 'Invalid Transaction',
39
+ '14' => 'Invalid Card Number (No such Number)',
40
+ '15' => 'No Such Issuer',
41
+ '33' => 'Expired Card',
42
+ '34' => 'Suspected Fraud',
43
+ '36' => 'Restricted Card',
44
+ '39' => 'No Credit Account',
45
+ '41' => 'Card Reported Lost',
46
+ '43' => 'Stolen Card',
47
+ '51' => 'Insufficient Funds',
48
+ '54' => 'Expired Card',
49
+ '57' => 'Transaction Not Permitted',
50
+ '59' => 'Suspected Fraud',
51
+ '62' => 'Restricted Card',
52
+ '65' => 'Exceeds withdrawal frequency limit',
53
+ '91' => 'Cannot Contact Issuer'
54
+ }
55
+
56
+ VERIFIED_3D_CODES = {
57
+ 'Y' => 'The cardholder was successfully authenticated.',
58
+ 'E' => 'The cardholder is not enrolled.',
59
+ 'N' => 'The cardholder was not verified.',
60
+ 'U' => 'The cardholder\'s Issuer was unable to authenticate due to a system error at the Issuer.',
61
+ 'F' => 'An error exists in the format of the request from the merchant. For example, the request did not contain all required fields, or the format of some fields was invalid.',
62
+ 'A' => 'Authentication of your Merchant ID and Password to the Directory Server Failed (see "What does a Payment Authentication Status of "A" mean?" on page 85).',
63
+ 'D' => 'Error communicating with the Directory Server, for example, the Payment Server could not connect to the directory server or there was a versioning mismatch.',
64
+ 'C' => 'The card type is not supported for authentication.',
65
+ 'M' => 'This indicates that attempts processing was used. Verification is marked with status M - ACS attempts processing used. Payment is performed with authentication. Attempts is when a cardholder has successfully passed the directory server but decides not to continue with the authentication process and cancels.',
66
+ 'S' => 'The signature on the response received from the Issuer could not be validated. This should be considered a failure.',
67
+ 'T' => 'ACS timed out. The Issuer\'s ACS did not respond to the Authentication request within the time out period.',
68
+ 'P' => 'Error parsing input from Issuer.',
69
+ 'I' => 'Internal Payment Server system error. This could be caused by a temporary DB failure or an error in the security module or by some error in an internal system.'
70
+ }
71
+
72
+ class CreditCardType
73
+ attr_accessor :am_code, :migs_code, :migs_long_code, :name
74
+ def initialize(am_code, migs_code, migs_long_code, name)
75
+ @am_code = am_code
76
+ @migs_code = migs_code
77
+ @migs_long_code = migs_long_code
78
+ @name = name
79
+ end
80
+ end
81
+
82
+ CARD_TYPES = [
83
+ # The following are 4 different representations of credit card types
84
+ # am_code: The active merchant code
85
+ # migs_code: Used in response for purchase/authorize/status
86
+ # migs_long_code: Used to pre-select card for server_purchase_url
87
+ # name: The nice display name
88
+ %w(american_express AE Amex American\ Express),
89
+ %w(diners_club DC Dinersclub Diners\ Club),
90
+ %w(jcb JC JCB JCB\ Card),
91
+ %w(maestro MS Maestro Maestro\ Card),
92
+ %w(master MC Mastercard MasterCard),
93
+ %w(na PL PrivateLabelCard Private\ Label\ Card),
94
+ %w(visa VC Visa Visa\ Card')
95
+ ].map do |am_code, migs_code, migs_long_code, name|
96
+ CreditCardType.new(am_code, migs_code, migs_long_code, name)
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,37 @@
1
+ require 'active_merchant/billing/gateways/modern_payments_cim'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ class ModernPaymentsGateway < Gateway
6
+ self.supported_countries = ModernPaymentsCimGateway.supported_countries
7
+ self.supported_cardtypes = ModernPaymentsCimGateway.supported_cardtypes
8
+ self.homepage_url = ModernPaymentsCimGateway.homepage_url
9
+ self.display_name = ModernPaymentsCimGateway.display_name
10
+
11
+ self.abstract_class = true
12
+
13
+ def initialize(options = {})
14
+ requires!(options, :login, :password)
15
+ super
16
+ end
17
+
18
+ def purchase(money, credit_card, options = {})
19
+ customer_response = cim.create_customer(options)
20
+ return customer_response unless customer_response.success?
21
+
22
+ customer_id = customer_response.params['create_customer_result']
23
+
24
+ card_response = cim.modify_customer_credit_card(customer_id, credit_card)
25
+ return card_response unless card_response.success?
26
+
27
+ cim.authorize_credit_card_payment(customer_id, money)
28
+ end
29
+
30
+ private
31
+
32
+ def cim
33
+ @cim ||= ModernPaymentsCimGateway.new(@options)
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,217 @@
1
+ module ActiveMerchant #:nodoc:
2
+ module Billing #:nodoc:
3
+ class ModernPaymentsCimGateway < Gateway #:nodoc:
4
+ self.test_url = 'https://secure.modpay.com/netservices/test/ModpayTest.asmx'
5
+ self.live_url = 'https://secure.modpay.com/ws/modpay.asmx'
6
+
7
+ LIVE_XMLNS = 'https://secure.modpay.com/ws/'
8
+ TEST_XMLNS = 'https://secure.modpay.com/netservices/test/'
9
+
10
+ self.supported_countries = ['US']
11
+ self.supported_cardtypes = [:visa, :master, :american_express, :discover]
12
+ self.homepage_url = 'http://www.modpay.com'
13
+ self.display_name = 'Modern Payments'
14
+
15
+ SUCCESS_MESSAGE = 'Transaction accepted'
16
+ FAILURE_MESSAGE = 'Transaction failed'
17
+ ERROR_MESSAGE = 'Transaction error'
18
+
19
+ PAYMENT_METHOD = {
20
+ :check => 1,
21
+ :credit_card => 2
22
+ }
23
+
24
+ def initialize(options = {})
25
+ requires!(options, :login, :password)
26
+ super
27
+ end
28
+
29
+ def create_customer(options = {})
30
+ post = {}
31
+ add_customer_data(post, options)
32
+ add_address(post, options)
33
+
34
+ commit('CreateCustomer', post)
35
+ end
36
+
37
+ def modify_customer_credit_card(customer_id, credit_card)
38
+ raise ArgumentError, 'The customer_id cannot be blank' if customer_id.blank?
39
+
40
+ post = {}
41
+ add_customer_id(post, customer_id)
42
+ add_credit_card(post, credit_card)
43
+
44
+ commit('ModifyCustomerCreditCard', post)
45
+ end
46
+
47
+ def authorize_credit_card_payment(customer_id, amount)
48
+ raise ArgumentError, 'The customer_id cannot be blank' if customer_id.blank?
49
+
50
+ post = {}
51
+ add_customer_id(post, customer_id)
52
+ add_amount(post, amount)
53
+
54
+ commit('AuthorizeCreditCardPayment', post)
55
+ end
56
+
57
+ def create_payment(customer_id, amount, options = {})
58
+ raise ArgumentError, 'The customer_id cannot be blank' if customer_id.blank?
59
+
60
+ post = {}
61
+ add_customer_id(post, customer_id)
62
+ add_amount(post, amount)
63
+ add_payment_details(post, options)
64
+
65
+ commit('CreatePayment', post)
66
+ end
67
+
68
+ private
69
+
70
+ def add_payment_details(post, options)
71
+ post[:pmtDate] = (options[:payment_date] || Time.now.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
72
+ post[:pmtType] = PAYMENT_METHOD[options[:payment_method] || :credit_card]
73
+ end
74
+
75
+ def add_amount(post, money)
76
+ post[:pmtAmount] = amount(money)
77
+ end
78
+
79
+ def add_customer_id(post, customer_id)
80
+ post[:custId] = customer_id
81
+ end
82
+
83
+ def add_customer_data(post, options)
84
+ post[:acctNum] = options[:customer]
85
+ end
86
+
87
+ def add_address(post, options)
88
+ address = options[:billing_address] || options[:address] || {}
89
+
90
+ if name = address[:name]
91
+ post[:firstName], post[:lastName] = split_names(name)
92
+ else
93
+ post[:firstName] = address[:first_name]
94
+ post[:lastName] = address[:last_name]
95
+ end
96
+
97
+ post[:address] = address[:address1]
98
+ post[:city] = address[:city]
99
+ post[:state] = address[:state]
100
+ post[:zip] = address[:zip]
101
+ post[:phone] = address[:phone]
102
+ post[:fax] = address[:fax]
103
+ post[:email] = options[:email]
104
+ end
105
+
106
+ def add_credit_card(post, credit_card)
107
+ post[:ccName] = credit_card.name
108
+ post[:ccNum] = credit_card.number
109
+ post[:expMonth] = credit_card.month
110
+ post[:expYear] = credit_card.year
111
+ end
112
+
113
+ def build_request(action, params)
114
+ xml = Builder::XmlMarkup.new :indent => 2
115
+ xml.instruct!
116
+ xml.tag! 'env:Envelope',
117
+ { 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
118
+ 'xmlns:env' => 'http://schemas.xmlsoap.org/soap/envelope/',
119
+ 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance' } do
120
+
121
+ xml.tag! 'env:Body' do
122
+ xml.tag! action, { 'xmlns' => xmlns(action) } do
123
+ xml.tag! 'clientId', @options[:login]
124
+ xml.tag! 'clientCode', @options[:password]
125
+ params.each { |key, value| xml.tag! key, value }
126
+ end
127
+ end
128
+ end
129
+ xml.target!
130
+ end
131
+
132
+ def xmlns(action)
133
+ if test? && action == 'AuthorizeCreditCardPayment'
134
+ TEST_XMLNS
135
+ else
136
+ LIVE_XMLNS
137
+ end
138
+ end
139
+
140
+ def url(action)
141
+ if test? && action == 'AuthorizeCreditCardPayment'
142
+ self.test_url
143
+ else
144
+ self.live_url
145
+ end
146
+ end
147
+
148
+ def commit(action, params)
149
+ data = ssl_post(url(action), build_request(action, params),
150
+ { 'Content-Type' =>'text/xml; charset=utf-8',
151
+ 'SOAPAction' => "#{xmlns(action)}#{action}" }
152
+ )
153
+
154
+ response = parse(action, data)
155
+ Response.new(successful?(action, response), message_from(action, response), response,
156
+ :test => test?,
157
+ :authorization => authorization_from(action, response),
158
+ :avs_result => { :code => response[:avs_code] }
159
+ )
160
+ end
161
+
162
+ def authorization_from(action, response)
163
+ response[authorization_key(action)]
164
+ end
165
+
166
+ def authorization_key(action)
167
+ action == 'AuthorizeCreditCardPayment' ? :trans_id : "#{action.underscore}_result".to_sym
168
+ end
169
+
170
+ def successful?(action, response)
171
+ key = authorization_key(action)
172
+
173
+ if key == :trans_id
174
+ response[:approved] == 'true'
175
+ else
176
+ response[key].to_i > 0
177
+ end
178
+ end
179
+
180
+ def message_from(action, response)
181
+ if response[:faultcode]
182
+ ERROR_MESSAGE
183
+ elsif successful?(action, response)
184
+ SUCCESS_MESSAGE
185
+ else
186
+ FAILURE_MESSAGE
187
+ end
188
+ end
189
+
190
+ def parse(action, xml)
191
+ response = {}
192
+ response[:action] = action
193
+
194
+ xml = REXML::Document.new(xml)
195
+ if root = REXML::XPath.first(xml, "//#{action}Response")
196
+ root.elements.to_a.each do |node|
197
+ parse_element(response, node)
198
+ end
199
+ elsif root = REXML::XPath.first(xml, '//soap:Fault')
200
+ root.elements.to_a.each do |node|
201
+ response[node.name.underscore.to_sym] = node.text
202
+ end
203
+ end
204
+
205
+ response
206
+ end
207
+
208
+ def parse_element(response, node)
209
+ if node.has_elements?
210
+ node.elements.each { |e| parse_element(response, e) }
211
+ else
212
+ response[node.name.underscore.to_sym] = node.text.to_s.strip
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,338 @@
1
+ require 'nokogiri'
2
+
3
+ module ActiveMerchant #:nodoc:
4
+ module Billing #:nodoc:
5
+ #
6
+ # == Monei gateway
7
+ # This class implements Monei gateway for Active Merchant. For more information about Monei
8
+ # gateway please go to http://www.monei.net
9
+ #
10
+ # === Setup
11
+ # In order to set-up the gateway you need four paramaters: sender_id, channel_id, login and pwd.
12
+ # Request that data to Monei.
13
+ class MoneiGateway < Gateway
14
+ self.test_url = 'https://test.monei-api.net/payment/ctpe'
15
+ self.live_url = 'https://monei-api.net/payment/ctpe'
16
+
17
+ self.supported_countries = ['AD', 'AT', 'BE', 'BG', 'CA', 'CH', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FO', 'FR', 'GB', 'GI', 'GR', 'HU', 'IE', 'IL', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK', 'TR', 'US', 'VA']
18
+ self.default_currency = 'EUR'
19
+ self.supported_cardtypes = [:visa, :master, :maestro, :jcb, :american_express]
20
+
21
+ self.homepage_url = 'http://www.monei.net/'
22
+ self.display_name = 'Monei'
23
+
24
+ # Constructor
25
+ #
26
+ # options - Hash containing the gateway credentials, ALL MANDATORY
27
+ # :sender_id Sender ID
28
+ # :channel_id Channel ID
29
+ # :login User login
30
+ # :pwd User password
31
+ #
32
+ def initialize(options={})
33
+ requires!(options, :sender_id, :channel_id, :login, :pwd)
34
+ super
35
+ end
36
+
37
+ # Public: Performs purchase operation
38
+ #
39
+ # money - Amount of purchase
40
+ # credit_card - Credit card
41
+ # options - Hash containing purchase options
42
+ # :order_id Merchant created id for the purchase
43
+ # :billing_address Hash with billing address information
44
+ # :description Merchant created purchase description (optional)
45
+ # :currency Sale currency to override money object or default (optional)
46
+ #
47
+ # Returns Active Merchant response object
48
+ def purchase(money, credit_card, options={})
49
+ execute_new_order(:purchase, money, credit_card, options)
50
+ end
51
+
52
+ # Public: Performs authorization operation
53
+ #
54
+ # money - Amount to authorize
55
+ # credit_card - Credit card
56
+ # options - Hash containing authorization options
57
+ # :order_id Merchant created id for the authorization
58
+ # :billing_address Hash with billing address information
59
+ # :description Merchant created authorization description (optional)
60
+ # :currency Sale currency to override money object or default (optional)
61
+ #
62
+ # Returns Active Merchant response object
63
+ def authorize(money, credit_card, options={})
64
+ execute_new_order(:authorize, money, credit_card, options)
65
+ end
66
+
67
+ # Public: Performs capture operation on previous authorization
68
+ #
69
+ # money - Amount to capture
70
+ # authorization - Reference to previous authorization, obtained from response object returned by authorize
71
+ # options - Hash containing capture options
72
+ # :order_id Merchant created id for the authorization (optional)
73
+ # :description Merchant created authorization description (optional)
74
+ # :currency Sale currency to override money object or default (optional)
75
+ #
76
+ # Note: you should pass either order_id or description
77
+ #
78
+ # Returns Active Merchant response object
79
+ def capture(money, authorization, options={})
80
+ execute_dependant(:capture, money, authorization, options)
81
+ end
82
+
83
+ # Public: Refunds from previous purchase
84
+ #
85
+ # money - Amount to refund
86
+ # authorization - Reference to previous purchase, obtained from response object returned by purchase
87
+ # options - Hash containing refund options
88
+ # :order_id Merchant created id for the authorization (optional)
89
+ # :description Merchant created authorization description (optional)
90
+ # :currency Sale currency to override money object or default (optional)
91
+ #
92
+ # Note: you should pass either order_id or description
93
+ #
94
+ # Returns Active Merchant response object
95
+ def refund(money, authorization, options={})
96
+ execute_dependant(:refund, money, authorization, options)
97
+ end
98
+
99
+ # Public: Voids previous authorization
100
+ #
101
+ # authorization - Reference to previous authorization, obtained from response object returned by authorize
102
+ # options - Hash containing capture options
103
+ # :order_id Merchant created id for the authorization (optional)
104
+ #
105
+ # Returns Active Merchant response object
106
+ def void(authorization, options={})
107
+ execute_dependant(:void, nil, authorization, options)
108
+ end
109
+
110
+ # Public: Verifies credit card. Does this by doing a authorization of 1.00 Euro and then voiding it.
111
+ #
112
+ # credit_card - Credit card
113
+ # options - Hash containing authorization options
114
+ # :order_id Merchant created id for the authorization
115
+ # :billing_address Hash with billing address information
116
+ # :description Merchant created authorization description (optional)
117
+ # :currency Sale currency to override money object or default (optional)
118
+ #
119
+ # Returns Active Merchant response object of Authorization operation
120
+ def verify(credit_card, options={})
121
+ MultiResponse.run(:use_first_response) do |r|
122
+ r.process { authorize(100, credit_card, options) }
123
+ r.process(:ignore_result) { void(r.authorization, options) }
124
+ end
125
+ end
126
+
127
+ private
128
+
129
+ # Private: Execute purchase or authorize operation
130
+ def execute_new_order(action, money, credit_card, options)
131
+ request = build_request do |xml|
132
+ add_identification_new_order(xml, options)
133
+ add_payment(xml, action, money, options)
134
+ add_account(xml, credit_card)
135
+ add_customer(xml, credit_card, options)
136
+ add_three_d_secure(xml, options)
137
+ end
138
+
139
+ commit(request)
140
+ end
141
+
142
+ # Private: Execute operation that depends on authorization code from previous purchase or authorize operation
143
+ def execute_dependant(action, money, authorization, options)
144
+ request = build_request do |xml|
145
+ add_identification_authorization(xml, authorization, options)
146
+ add_payment(xml, action, money, options)
147
+ end
148
+
149
+ commit(request)
150
+ end
151
+
152
+ # Private: Build XML wrapping code yielding to code to fill the transaction information
153
+ def build_request
154
+ builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
155
+ xml.Request(:version => '1.0') do
156
+ xml.Header { xml.Security(:sender => @options[:sender_id]) }
157
+ xml.Transaction(:mode => test? ? 'CONNECTOR_TEST' : 'LIVE', :response => 'SYNC', :channel => @options[:channel_id]) do
158
+ xml.User(:login => @options[:login], :pwd => @options[:pwd])
159
+ yield xml
160
+ end
161
+ end
162
+ end
163
+ builder.to_xml
164
+ end
165
+
166
+ # Private: Add identification part to XML for new orders
167
+ def add_identification_new_order(xml, options)
168
+ requires!(options, :order_id)
169
+ xml.Identification do
170
+ xml.TransactionID options[:order_id]
171
+ end
172
+ end
173
+
174
+ # Private: Add identification part to XML for orders that depend on authorization from previous operation
175
+ def add_identification_authorization(xml, authorization, options)
176
+ xml.Identification do
177
+ xml.ReferenceID authorization
178
+ xml.TransactionID options[:order_id]
179
+ end
180
+ end
181
+
182
+ # Private: Add payment part to XML
183
+ def add_payment(xml, action, money, options)
184
+ code = tanslate_payment_code(action)
185
+
186
+ xml.Payment(:code => code) do
187
+ xml.Presentation do
188
+ xml.Amount amount(money)
189
+ xml.Currency options[:currency] || currency(money)
190
+ xml.Usage options[:description] || options[:order_id]
191
+ end unless money.nil?
192
+ end
193
+ end
194
+
195
+ # Private: Add account part to XML
196
+ def add_account(xml, credit_card)
197
+ xml.Account do
198
+ xml.Holder credit_card.name
199
+ xml.Number credit_card.number
200
+ xml.Brand credit_card.brand.upcase
201
+ xml.Expiry(:month => credit_card.month, :year => credit_card.year)
202
+ xml.Verification credit_card.verification_value
203
+ end
204
+ end
205
+
206
+ # Private: Add customer part to XML
207
+ def add_customer(xml, credit_card, options)
208
+ requires!(options, :billing_address)
209
+ address = options[:billing_address]
210
+ xml.Customer do
211
+ xml.Name do
212
+ xml.Given credit_card.first_name
213
+ xml.Family credit_card.last_name
214
+ end
215
+ xml.Address do
216
+ xml.Street address[:address1].to_s
217
+ xml.Zip address[:zip].to_s
218
+ xml.City address[:city].to_s
219
+ xml.State address[:state].to_s if address.has_key? :state
220
+ xml.Country address[:country].to_s
221
+ end
222
+ xml.Contact do
223
+ xml.Email options[:email] || 'noemail@monei.net'
224
+ xml.Ip options[:ip] || '0.0.0.0'
225
+ end
226
+ end
227
+ end
228
+
229
+ # Private : Convert ECI to ResultIndicator
230
+ # Possible ECI values:
231
+ # 02 or 05 - Fully Authenticated Transaction
232
+ # 00 or 07 - Non 3D Secure Transaction
233
+ # Possible ResultIndicator values:
234
+ # 01 = MASTER_3D_ATTEMPT
235
+ # 02 = MASTER_3D_SUCCESS
236
+ # 05 = VISA_3D_SUCCESS
237
+ # 06 = VISA_3D_ATTEMPT
238
+ # 07 = DEFAULT_E_COMMERCE
239
+ def eci_to_result_indicator(eci)
240
+ case eci
241
+ when '02', '05'
242
+ return eci
243
+ else
244
+ return '07'
245
+ end
246
+ end
247
+
248
+ # Private : Add the 3DSecure infos to XML
249
+ def add_three_d_secure(xml, options)
250
+ if options[:three_d_secure]
251
+ xml.Authentication(:type => '3DSecure') do
252
+ xml.ResultIndicator eci_to_result_indicator options[:three_d_secure][:eci]
253
+ xml.Parameter(:name => 'VERIFICATION_ID') { xml.text options[:three_d_secure][:cavv] }
254
+ xml.Parameter(:name => 'XID') { xml.text options[:three_d_secure][:xid] }
255
+ end
256
+ end
257
+ end
258
+
259
+ # Private: Parse XML response from Monei servers
260
+ def parse(body)
261
+ xml = Nokogiri::XML(body)
262
+ {
263
+ :unique_id => xml.xpath('//Response/Transaction/Identification/UniqueID').text,
264
+ :status => translate_status_code(xml.xpath('//Response/Transaction/Processing/Status/@code').text),
265
+ :reason => translate_status_code(xml.xpath('//Response/Transaction/Processing/Reason/@code').text),
266
+ :message => xml.xpath('//Response/Transaction/Processing/Return').text
267
+ }
268
+ end
269
+
270
+ # Private: Send XML transaction to Monei servers and create AM response
271
+ def commit(xml)
272
+ url = (test? ? test_url : live_url)
273
+
274
+ response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))
275
+
276
+ Response.new(
277
+ success_from(response),
278
+ message_from(response),
279
+ response,
280
+ authorization: authorization_from(response),
281
+ test: test?,
282
+ error_code: error_code_from(response)
283
+ )
284
+ end
285
+
286
+ # Private: Decide success from servers response
287
+ def success_from(response)
288
+ response[:status] == :success || response[:status] == :new
289
+ end
290
+
291
+ # Private: Get message from servers response
292
+ def message_from(response)
293
+ response[:message]
294
+ end
295
+
296
+ # Private: Get error code from servers response
297
+ def error_code_from(response)
298
+ success_from(response) ? nil : STANDARD_ERROR_CODE[:card_declined]
299
+ end
300
+
301
+ # Private: Get authorization code from servers response
302
+ def authorization_from(response)
303
+ response[:unique_id]
304
+ end
305
+
306
+ # Private: Encode POST parameters
307
+ def post_data(xml)
308
+ "load=#{CGI.escape(xml)}"
309
+ end
310
+
311
+ # Private: Translate Monei status code to native ruby symbols
312
+ def translate_status_code(code)
313
+ {
314
+ '00' => :success,
315
+ '40' => :neutral,
316
+ '59' => :waiting_bank,
317
+ '60' => :rejected_bank,
318
+ '64' => :waiting_risk,
319
+ '65' => :rejected_risk,
320
+ '70' => :rejected_validation,
321
+ '80' => :waiting,
322
+ '90' => :new
323
+ }[code]
324
+ end
325
+
326
+ # Private: Translate AM operations to Monei operations codes
327
+ def tanslate_payment_code(action)
328
+ {
329
+ :purchase => 'CC.DB',
330
+ :authorize => 'CC.PA',
331
+ :capture => 'CC.CP',
332
+ :refund => 'CC.RF',
333
+ :void => 'CC.RV'
334
+ }[action]
335
+ end
336
+ end
337
+ end
338
+ end