@spreeloop/orange_money 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/.eslintrc.js +47 -0
  2. package/.prettierrc +6 -0
  3. package/README.md +192 -0
  4. package/babel.config.js +3 -0
  5. package/dist/logging/index.d.ts +2 -0
  6. package/dist/logging/index.d.ts.map +1 -0
  7. package/dist/logging/index.js +18 -0
  8. package/dist/logging/index.js.map +1 -0
  9. package/dist/logging/src/log_level.d.ts +24 -0
  10. package/dist/logging/src/log_level.d.ts.map +1 -0
  11. package/dist/logging/src/log_level.js +34 -0
  12. package/dist/logging/src/log_level.js.map +1 -0
  13. package/dist/logging/src/logging.d.ts +50 -0
  14. package/dist/logging/src/logging.d.ts.map +1 -0
  15. package/dist/logging/src/logging.js +87 -0
  16. package/dist/logging/src/logging.js.map +1 -0
  17. package/dist/logging/src/printer.d.ts +10 -0
  18. package/dist/logging/src/printer.d.ts.map +1 -0
  19. package/dist/logging/src/printer.js +3 -0
  20. package/dist/logging/src/printer.js.map +1 -0
  21. package/dist/main.js +3 -0
  22. package/dist/main.js.LICENSE.txt +1 -0
  23. package/dist/main.js.map +1 -0
  24. package/dist/orange_money/index.d.ts +2 -0
  25. package/dist/orange_money/index.d.ts.map +1 -0
  26. package/dist/orange_money/index.js +18 -0
  27. package/dist/orange_money/index.js.map +1 -0
  28. package/dist/orange_money/src/common/utils/https.d.ts +77 -0
  29. package/dist/orange_money/src/common/utils/https.d.ts.map +1 -0
  30. package/dist/orange_money/src/common/utils/https.js +240 -0
  31. package/dist/orange_money/src/common/utils/https.js.map +1 -0
  32. package/dist/orange_money/src/common/utils/https.spec.d.ts +2 -0
  33. package/dist/orange_money/src/common/utils/https.spec.d.ts.map +1 -0
  34. package/dist/orange_money/src/common/utils/https.spec.js +77 -0
  35. package/dist/orange_money/src/common/utils/https.spec.js.map +1 -0
  36. package/dist/orange_money/src/common/utils/logging_interface.d.ts +23 -0
  37. package/dist/orange_money/src/common/utils/logging_interface.d.ts.map +1 -0
  38. package/dist/orange_money/src/common/utils/logging_interface.js +3 -0
  39. package/dist/orange_money/src/common/utils/logging_interface.js.map +1 -0
  40. package/dist/orange_money/src/common/utils/operation_response.d.ts +16 -0
  41. package/dist/orange_money/src/common/utils/operation_response.d.ts.map +1 -0
  42. package/dist/orange_money/src/common/utils/operation_response.js +3 -0
  43. package/dist/orange_money/src/common/utils/operation_response.js.map +1 -0
  44. package/dist/orange_money/src/common/utils/utils.d.ts +6 -0
  45. package/dist/orange_money/src/common/utils/utils.d.ts.map +1 -0
  46. package/dist/orange_money/src/common/utils/utils.js +10 -0
  47. package/dist/orange_money/src/common/utils/utils.js.map +1 -0
  48. package/dist/orange_money/src/constants.d.ts +95 -0
  49. package/dist/orange_money/src/constants.d.ts.map +1 -0
  50. package/dist/orange_money/src/constants.js +111 -0
  51. package/dist/orange_money/src/constants.js.map +1 -0
  52. package/dist/orange_money/src/disbursements/implementations/disbursement_service.d.ts +63 -0
  53. package/dist/orange_money/src/disbursements/implementations/disbursement_service.d.ts.map +1 -0
  54. package/dist/orange_money/src/disbursements/implementations/disbursement_service.js +84 -0
  55. package/dist/orange_money/src/disbursements/implementations/disbursement_service.js.map +1 -0
  56. package/dist/orange_money/src/disbursements/implementations/src/live.d.ts +40 -0
  57. package/dist/orange_money/src/disbursements/implementations/src/live.d.ts.map +1 -0
  58. package/dist/orange_money/src/disbursements/implementations/src/live.js +61 -0
  59. package/dist/orange_money/src/disbursements/implementations/src/live.js.map +1 -0
  60. package/dist/orange_money/src/disbursements/implementations/src/sandbox.d.ts +40 -0
  61. package/dist/orange_money/src/disbursements/implementations/src/sandbox.d.ts.map +1 -0
  62. package/dist/orange_money/src/disbursements/implementations/src/sandbox.js +110 -0
  63. package/dist/orange_money/src/disbursements/implementations/src/sandbox.js.map +1 -0
  64. package/dist/orange_money/src/disbursements/operations/create_access_token.d.ts +28 -0
  65. package/dist/orange_money/src/disbursements/operations/create_access_token.d.ts.map +1 -0
  66. package/dist/orange_money/src/disbursements/operations/create_access_token.js +45 -0
  67. package/dist/orange_money/src/disbursements/operations/create_access_token.js.map +1 -0
  68. package/dist/orange_money/src/disbursements/operations/create_access_token.spec.d.ts +2 -0
  69. package/dist/orange_money/src/disbursements/operations/create_access_token.spec.d.ts.map +1 -0
  70. package/dist/orange_money/src/disbursements/operations/create_access_token.spec.js +106 -0
  71. package/dist/orange_money/src/disbursements/operations/create_access_token.spec.js.map +1 -0
  72. package/dist/orange_money/src/disbursements/operations/get_transfer_status.d.ts +114 -0
  73. package/dist/orange_money/src/disbursements/operations/get_transfer_status.d.ts.map +1 -0
  74. package/dist/orange_money/src/disbursements/operations/get_transfer_status.js +128 -0
  75. package/dist/orange_money/src/disbursements/operations/get_transfer_status.js.map +1 -0
  76. package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.d.ts +2 -0
  77. package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.d.ts.map +1 -0
  78. package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.js +148 -0
  79. package/dist/orange_money/src/disbursements/operations/get_transfer_status.spec.js.map +1 -0
  80. package/dist/orange_money/src/disbursements/operations/transfer.d.ts +45 -0
  81. package/dist/orange_money/src/disbursements/operations/transfer.d.ts.map +1 -0
  82. package/dist/orange_money/src/disbursements/operations/transfer.js +74 -0
  83. package/dist/orange_money/src/disbursements/operations/transfer.js.map +1 -0
  84. package/dist/orange_money/src/disbursements/operations/transfer.spec.d.ts +2 -0
  85. package/dist/orange_money/src/disbursements/operations/transfer.spec.d.ts.map +1 -0
  86. package/dist/orange_money/src/disbursements/operations/transfer.spec.js +178 -0
  87. package/dist/orange_money/src/disbursements/operations/transfer.spec.js.map +1 -0
  88. package/dist/orange_money/src/disbursements/routes/routes.d.ts +38 -0
  89. package/dist/orange_money/src/disbursements/routes/routes.d.ts.map +1 -0
  90. package/dist/orange_money/src/disbursements/routes/routes.js +53 -0
  91. package/dist/orange_money/src/disbursements/routes/routes.js.map +1 -0
  92. package/dist/orange_money/src/disbursements/utils/constants.d.ts +5 -0
  93. package/dist/orange_money/src/disbursements/utils/constants.d.ts.map +1 -0
  94. package/dist/orange_money/src/disbursements/utils/constants.js +9 -0
  95. package/dist/orange_money/src/disbursements/utils/constants.js.map +1 -0
  96. package/dist/orange_money/src/disbursements/utils/https.d.ts +74 -0
  97. package/dist/orange_money/src/disbursements/utils/https.d.ts.map +1 -0
  98. package/dist/orange_money/src/disbursements/utils/https.js +206 -0
  99. package/dist/orange_money/src/disbursements/utils/https.js.map +1 -0
  100. package/dist/orange_money/src/disbursements/utils/https.spec.d.ts +2 -0
  101. package/dist/orange_money/src/disbursements/utils/https.spec.d.ts.map +1 -0
  102. package/dist/orange_money/src/disbursements/utils/https.spec.js +77 -0
  103. package/dist/orange_money/src/disbursements/utils/https.spec.js.map +1 -0
  104. package/dist/orange_money/src/disbursements/utils/regex.d.ts +9 -0
  105. package/dist/orange_money/src/disbursements/utils/regex.d.ts.map +1 -0
  106. package/dist/orange_money/src/disbursements/utils/regex.js +12 -0
  107. package/dist/orange_money/src/disbursements/utils/regex.js.map +1 -0
  108. package/dist/orange_money/src/disbursements/utils/regex.spec.d.ts +2 -0
  109. package/dist/orange_money/src/disbursements/utils/regex.spec.d.ts.map +1 -0
  110. package/dist/orange_money/src/disbursements/utils/regex.spec.js +32 -0
  111. package/dist/orange_money/src/disbursements/utils/regex.spec.js.map +1 -0
  112. package/dist/orange_money/src/disbursements/utils/status.d.ts +53 -0
  113. package/dist/orange_money/src/disbursements/utils/status.d.ts.map +1 -0
  114. package/dist/orange_money/src/disbursements/utils/status.js +58 -0
  115. package/dist/orange_money/src/disbursements/utils/status.js.map +1 -0
  116. package/dist/orange_money/src/disbursements/utils/utils.d.ts +9 -0
  117. package/dist/orange_money/src/disbursements/utils/utils.d.ts.map +1 -0
  118. package/dist/orange_money/src/disbursements/utils/utils.js +26 -0
  119. package/dist/orange_money/src/disbursements/utils/utils.js.map +1 -0
  120. package/dist/orange_money/src/disbursements/utils/utils.spec.d.ts +2 -0
  121. package/dist/orange_money/src/disbursements/utils/utils.spec.d.ts.map +1 -0
  122. package/dist/orange_money/src/disbursements/utils/utils.spec.js +43 -0
  123. package/dist/orange_money/src/disbursements/utils/utils.spec.js.map +1 -0
  124. package/dist/orange_money/src/index.d.ts +8 -0
  125. package/dist/orange_money/src/index.d.ts.map +1 -0
  126. package/dist/orange_money/src/index.js +21 -0
  127. package/dist/orange_money/src/index.js.map +1 -0
  128. package/dist/orange_money/src/orange_money/orange_money.d.ts +58 -0
  129. package/dist/orange_money/src/orange_money/orange_money.d.ts.map +1 -0
  130. package/dist/orange_money/src/orange_money/orange_money.js +33 -0
  131. package/dist/orange_money/src/orange_money/orange_money.js.map +1 -0
  132. package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.d.ts +7 -0
  133. package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.d.ts.map +1 -0
  134. package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.js +16 -0
  135. package/dist/orange_money/src/orange_money/orange_money_fake/fake_result.js.map +1 -0
  136. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.d.ts +29 -0
  137. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.d.ts.map +1 -0
  138. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.js +67 -0
  139. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.js.map +1 -0
  140. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.d.ts +2 -0
  141. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.d.ts.map +1 -0
  142. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.js +51 -0
  143. package/dist/orange_money/src/orange_money/orange_money_fake/orange_money_fake_payment.spec.js.map +1 -0
  144. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.d.ts +105 -0
  145. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.d.ts.map +1 -0
  146. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.js +459 -0
  147. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.js.map +1 -0
  148. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.d.ts +2 -0
  149. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.d.ts.map +1 -0
  150. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.js +497 -0
  151. package/dist/orange_money/src/orange_money/orange_money_live/mobile_platfom/mobile_platform.spec.js.map +1 -0
  152. package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.d.ts +26 -0
  153. package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.d.ts.map +1 -0
  154. package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.js +26 -0
  155. package/dist/orange_money/src/orange_money/orange_money_live/orange_money_live_payment.js.map +1 -0
  156. package/dist/orange_money/src/payments/implementations/fake.d.ts +33 -0
  157. package/dist/orange_money/src/payments/implementations/fake.d.ts.map +1 -0
  158. package/dist/orange_money/src/payments/implementations/fake.js +110 -0
  159. package/dist/orange_money/src/payments/implementations/fake.js.map +1 -0
  160. package/dist/orange_money/src/payments/implementations/live.d.ts +45 -0
  161. package/dist/orange_money/src/payments/implementations/live.d.ts.map +1 -0
  162. package/dist/orange_money/src/payments/implementations/live.js +69 -0
  163. package/dist/orange_money/src/payments/implementations/live.js.map +1 -0
  164. package/dist/orange_money/src/payments/implementations/payment_service.d.ts +44 -0
  165. package/dist/orange_money/src/payments/implementations/payment_service.d.ts.map +1 -0
  166. package/dist/orange_money/src/payments/implementations/payment_service.js +44 -0
  167. package/dist/orange_money/src/payments/implementations/payment_service.js.map +1 -0
  168. package/dist/orange_money/src/payments/implementations/src/fake.d.ts +31 -0
  169. package/dist/orange_money/src/payments/implementations/src/fake.d.ts.map +1 -0
  170. package/dist/orange_money/src/payments/implementations/src/fake.js +62 -0
  171. package/dist/orange_money/src/payments/implementations/src/fake.js.map +1 -0
  172. package/dist/orange_money/src/payments/implementations/src/live.d.ts +29 -0
  173. package/dist/orange_money/src/payments/implementations/src/live.d.ts.map +1 -0
  174. package/dist/orange_money/src/payments/implementations/src/live.js +44 -0
  175. package/dist/orange_money/src/payments/implementations/src/live.js.map +1 -0
  176. package/dist/orange_money/src/payments/operations/create_access_token.d.ts +19 -0
  177. package/dist/orange_money/src/payments/operations/create_access_token.d.ts.map +1 -0
  178. package/dist/orange_money/src/payments/operations/create_access_token.js +51 -0
  179. package/dist/orange_money/src/payments/operations/create_access_token.js.map +1 -0
  180. package/dist/orange_money/src/payments/operations/create_access_token.spec.d.ts +2 -0
  181. package/dist/orange_money/src/payments/operations/create_access_token.spec.d.ts.map +1 -0
  182. package/dist/orange_money/src/payments/operations/create_access_token.spec.js +70 -0
  183. package/dist/orange_money/src/payments/operations/create_access_token.spec.js.map +1 -0
  184. package/dist/orange_money/src/payments/operations/create_pay_token.d.ts +12 -0
  185. package/dist/orange_money/src/payments/operations/create_pay_token.d.ts.map +1 -0
  186. package/dist/orange_money/src/payments/operations/create_pay_token.js +62 -0
  187. package/dist/orange_money/src/payments/operations/create_pay_token.js.map +1 -0
  188. package/dist/orange_money/src/payments/operations/create_pay_token.spec.d.ts +2 -0
  189. package/dist/orange_money/src/payments/operations/create_pay_token.spec.d.ts.map +1 -0
  190. package/dist/orange_money/src/payments/operations/create_pay_token.spec.js +91 -0
  191. package/dist/orange_money/src/payments/operations/create_pay_token.spec.js.map +1 -0
  192. package/dist/orange_money/src/payments/operations/get_access_token.d.ts +11 -0
  193. package/dist/orange_money/src/payments/operations/get_access_token.d.ts.map +1 -0
  194. package/dist/orange_money/src/payments/operations/get_access_token.js +47 -0
  195. package/dist/orange_money/src/payments/operations/get_access_token.js.map +1 -0
  196. package/dist/orange_money/src/payments/operations/get_access_token.spec.d.ts +2 -0
  197. package/dist/orange_money/src/payments/operations/get_access_token.spec.d.ts.map +1 -0
  198. package/dist/orange_money/src/payments/operations/get_access_token.spec.js +75 -0
  199. package/dist/orange_money/src/payments/operations/get_access_token.spec.js.map +1 -0
  200. package/dist/orange_money/src/payments/operations/get_pay_token.d.ts +12 -0
  201. package/dist/orange_money/src/payments/operations/get_pay_token.d.ts.map +1 -0
  202. package/dist/orange_money/src/payments/operations/get_pay_token.js +43 -0
  203. package/dist/orange_money/src/payments/operations/get_pay_token.js.map +1 -0
  204. package/dist/orange_money/src/payments/operations/get_pay_token.spec.d.ts +2 -0
  205. package/dist/orange_money/src/payments/operations/get_pay_token.spec.d.ts.map +1 -0
  206. package/dist/orange_money/src/payments/operations/get_pay_token.spec.js +75 -0
  207. package/dist/orange_money/src/payments/operations/get_pay_token.spec.js.map +1 -0
  208. package/dist/orange_money/src/payments/operations/get_payment_status.d.ts +23 -0
  209. package/dist/orange_money/src/payments/operations/get_payment_status.d.ts.map +1 -0
  210. package/dist/orange_money/src/payments/operations/get_payment_status.js +51 -0
  211. package/dist/orange_money/src/payments/operations/get_payment_status.js.map +1 -0
  212. package/dist/orange_money/src/payments/operations/get_payment_status.spec.d.ts +2 -0
  213. package/dist/orange_money/src/payments/operations/get_payment_status.spec.d.ts.map +1 -0
  214. package/dist/orange_money/src/payments/operations/get_payment_status.spec.js +102 -0
  215. package/dist/orange_money/src/payments/operations/get_payment_status.spec.js.map +1 -0
  216. package/dist/orange_money/src/payments/operations/initialize_om_payment.d.ts +22 -0
  217. package/dist/orange_money/src/payments/operations/initialize_om_payment.d.ts.map +1 -0
  218. package/dist/orange_money/src/payments/operations/initialize_om_payment.js +124 -0
  219. package/dist/orange_money/src/payments/operations/initialize_om_payment.js.map +1 -0
  220. package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.d.ts +2 -0
  221. package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.d.ts.map +1 -0
  222. package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.js +246 -0
  223. package/dist/orange_money/src/payments/operations/initialize_om_payment.spec.js.map +1 -0
  224. package/dist/orange_money/src/payments/operations/payment.d.ts +21 -0
  225. package/dist/orange_money/src/payments/operations/payment.d.ts.map +1 -0
  226. package/dist/orange_money/src/payments/operations/payment.js +204 -0
  227. package/dist/orange_money/src/payments/operations/payment.js.map +1 -0
  228. package/dist/orange_money/src/payments/operations/payment.spec.d.ts +2 -0
  229. package/dist/orange_money/src/payments/operations/payment.spec.d.ts.map +1 -0
  230. package/dist/orange_money/src/payments/operations/payment.spec.js +282 -0
  231. package/dist/orange_money/src/payments/operations/payment.spec.js.map +1 -0
  232. package/dist/orange_money/src/payments/payments.d.ts +57 -0
  233. package/dist/orange_money/src/payments/payments.d.ts.map +1 -0
  234. package/dist/orange_money/src/payments/payments.js +36 -0
  235. package/dist/orange_money/src/payments/payments.js.map +1 -0
  236. package/dist/orange_money/src/payments/routes/routes.d.ts +48 -0
  237. package/dist/orange_money/src/payments/routes/routes.d.ts.map +1 -0
  238. package/dist/orange_money/src/payments/routes/routes.js +61 -0
  239. package/dist/orange_money/src/payments/routes/routes.js.map +1 -0
  240. package/dist/orange_money/src/payments/utils/constants.d.ts +100 -0
  241. package/dist/orange_money/src/payments/utils/constants.d.ts.map +1 -0
  242. package/dist/orange_money/src/payments/utils/constants.js +117 -0
  243. package/dist/orange_money/src/payments/utils/constants.js.map +1 -0
  244. package/dist/orange_money/src/payments/utils/https.d.ts +43 -0
  245. package/dist/orange_money/src/payments/utils/https.d.ts.map +1 -0
  246. package/dist/orange_money/src/payments/utils/https.js +137 -0
  247. package/dist/orange_money/src/payments/utils/https.js.map +1 -0
  248. package/dist/orange_money/src/payments/utils/joi_schema.d.ts +71 -0
  249. package/dist/orange_money/src/payments/utils/joi_schema.d.ts.map +1 -0
  250. package/dist/orange_money/src/payments/utils/joi_schema.js +44 -0
  251. package/dist/orange_money/src/payments/utils/joi_schema.js.map +1 -0
  252. package/dist/orange_money/src/payments/utils/logging_interface.d.ts +23 -0
  253. package/dist/orange_money/src/payments/utils/logging_interface.d.ts.map +1 -0
  254. package/dist/orange_money/src/payments/utils/logging_interface.js +3 -0
  255. package/dist/orange_money/src/payments/utils/logging_interface.js.map +1 -0
  256. package/dist/orange_money/src/payments/utils/request_model.d.ts +75 -0
  257. package/dist/orange_money/src/payments/utils/request_model.d.ts.map +1 -0
  258. package/dist/orange_money/src/payments/utils/request_model.js +3 -0
  259. package/dist/orange_money/src/payments/utils/request_model.js.map +1 -0
  260. package/dist/orange_money/src/payments/utils/utils.d.ts +15 -0
  261. package/dist/orange_money/src/payments/utils/utils.d.ts.map +1 -0
  262. package/dist/orange_money/src/payments/utils/utils.js +27 -0
  263. package/dist/orange_money/src/payments/utils/utils.js.map +1 -0
  264. package/dist/orange_money/src/payments/utils/utils.spec.d.ts +2 -0
  265. package/dist/orange_money/src/payments/utils/utils.spec.d.ts.map +1 -0
  266. package/dist/orange_money/src/payments/utils/utils.spec.js +17 -0
  267. package/dist/orange_money/src/payments/utils/utils.spec.js.map +1 -0
  268. package/dist/orange_money/src/utils/logging_interface.d.ts +23 -0
  269. package/dist/orange_money/src/utils/logging_interface.d.ts.map +1 -0
  270. package/dist/orange_money/src/utils/logging_interface.js +3 -0
  271. package/dist/orange_money/src/utils/logging_interface.js.map +1 -0
  272. package/dist/orange_money/src/utils/requests_responses.d.ts +118 -0
  273. package/dist/orange_money/src/utils/requests_responses.d.ts.map +1 -0
  274. package/dist/orange_money/src/utils/requests_responses.js +31 -0
  275. package/dist/orange_money/src/utils/requests_responses.js.map +1 -0
  276. package/dist/orange_money/src/utils/resquest_params.d.ts +222 -0
  277. package/dist/orange_money/src/utils/resquest_params.d.ts.map +1 -0
  278. package/dist/orange_money/src/utils/resquest_params.js +57 -0
  279. package/dist/orange_money/src/utils/resquest_params.js.map +1 -0
  280. package/dist/orange_money/src/utils/utils.d.ts +65 -0
  281. package/dist/orange_money/src/utils/utils.d.ts.map +1 -0
  282. package/dist/orange_money/src/utils/utils.js +199 -0
  283. package/dist/orange_money/src/utils/utils.js.map +1 -0
  284. package/dist/orange_money/src/utils/utils.spec.d.ts +2 -0
  285. package/dist/orange_money/src/utils/utils.spec.d.ts.map +1 -0
  286. package/dist/orange_money/src/utils/utils.spec.js +17 -0
  287. package/dist/orange_money/src/utils/utils.spec.js.map +1 -0
  288. package/index.spec.ts +9 -0
  289. package/index.ts +1 -0
  290. package/jest.before-test.ts +3 -0
  291. package/jest.config.ts +54 -0
  292. package/package.json +52 -0
  293. package/src/disbursements/implementations/disbursement_service.ts +133 -0
  294. package/src/disbursements/implementations/src/live.ts +79 -0
  295. package/src/disbursements/implementations/src/sandbox.ts +124 -0
  296. package/src/disbursements/operations/create_access_token.spec.ts +87 -0
  297. package/src/disbursements/operations/create_access_token.ts +83 -0
  298. package/src/disbursements/operations/get_transfer_status.spec.ts +132 -0
  299. package/src/disbursements/operations/get_transfer_status.ts +265 -0
  300. package/src/disbursements/operations/transfer.spec.ts +158 -0
  301. package/src/disbursements/operations/transfer.ts +125 -0
  302. package/src/disbursements/routes/routes.ts +54 -0
  303. package/src/disbursements/utils/constants.ts +4 -0
  304. package/src/disbursements/utils/regex.spec.ts +39 -0
  305. package/src/disbursements/utils/regex.ts +10 -0
  306. package/src/disbursements/utils/status.ts +62 -0
  307. package/src/disbursements/utils/utils.spec.ts +42 -0
  308. package/src/disbursements/utils/utils.ts +24 -0
  309. package/src/index.ts +9 -0
  310. package/src/payments/implementations/fake.ts +133 -0
  311. package/src/payments/implementations/live.ts +87 -0
  312. package/src/payments/operations/get_access_token.spec.ts +60 -0
  313. package/src/payments/operations/get_access_token.ts +77 -0
  314. package/src/payments/operations/get_pay_token.spec.ts +65 -0
  315. package/src/payments/operations/get_pay_token.ts +66 -0
  316. package/src/payments/operations/get_payment_status.spec.ts +82 -0
  317. package/src/payments/operations/get_payment_status.ts +78 -0
  318. package/src/payments/operations/initialize_om_payment.spec.ts +234 -0
  319. package/src/payments/operations/initialize_om_payment.ts +191 -0
  320. package/src/payments/payments.ts +86 -0
  321. package/src/payments/routes/routes.ts +61 -0
  322. package/src/payments/utils/constants.ts +120 -0
  323. package/src/payments/utils/joi_schema.ts +117 -0
  324. package/src/payments/utils/request_model.ts +103 -0
  325. package/src/payments/utils/utils.ts +31 -0
  326. package/src/utils/https.spec.ts +101 -0
  327. package/src/utils/https.ts +266 -0
  328. package/src/utils/logging_interface.ts +25 -0
  329. package/src/utils/operation_response.ts +17 -0
  330. package/src/utils/utils.ts +5 -0
  331. package/tsconfig.build.json +4 -0
  332. package/tsconfig.dev.json +4 -0
  333. package/tsconfig.json +27 -0
@@ -0,0 +1,266 @@
1
+ import * as axios from 'axios';
2
+ import { AxiosError } from 'axios';
3
+ import base64url from 'base64url';
4
+ import * as https from 'https';
5
+ import { LoggerInterface } from './logging_interface';
6
+
7
+ export enum RequestStatusCode {
8
+ unauthorized = 401,
9
+ expectationFailed = 417,
10
+ }
11
+
12
+ export type RequestResponse<T> = {
13
+ response?: {
14
+ data: T;
15
+ status: number;
16
+ };
17
+ error?: unknown;
18
+ };
19
+
20
+ /**
21
+ * Posts an http request to the given route.
22
+ * @param {Record<string, string | undefined> | string} data The data to be posted.
23
+ * @param {string} route The end point url.
24
+ * @param {Record<string, string>} headers The type content of request.
25
+ * @param {LoggerInterface} logger The logger to use when posting data.
26
+ * @return {Promise<unknown | undefined>} The server response.
27
+ */
28
+ export async function postRequest<T>({
29
+ data,
30
+ route,
31
+ headers,
32
+ logger,
33
+ rejectUnauthorized = true,
34
+ }: {
35
+ data?: Record<string, unknown> | string | null;
36
+ route: string;
37
+ logger: LoggerInterface;
38
+ headers?: Record<string, string>;
39
+ rejectUnauthorized?: boolean;
40
+ }): Promise<RequestResponse<T>> {
41
+ try {
42
+ logger.info(
43
+ `Request on the route ${route} is running with data : ${JSON.stringify({
44
+ headers,
45
+ data,
46
+ route,
47
+ })}`
48
+ );
49
+ const agent = new https.Agent({
50
+ rejectUnauthorized: rejectUnauthorized,
51
+ });
52
+ const response = await axios.default({
53
+ method: 'post',
54
+ url: route,
55
+ headers: headers,
56
+ data: data,
57
+ httpsAgent: agent,
58
+ });
59
+ logger.info(
60
+ `Request on the route ${route} completed successfully with data : ${JSON.stringify(
61
+ {
62
+ response: response.data,
63
+ status: response.status,
64
+ statusText: response.statusText,
65
+ }
66
+ )}`
67
+ );
68
+ return { response: { data: response.data, status: response.status } };
69
+ } catch (error) {
70
+ logger.warn(
71
+ `[Axios] failed to post request on the route: ${route} with data : ${JSON.stringify(
72
+ { headers, data, route }
73
+ )}`
74
+ );
75
+ const parsedError = parseAxiosError(error);
76
+ logger.warn(JSON.stringify(error));
77
+ if (error instanceof AxiosError) {
78
+ if (error.response) {
79
+ return {
80
+ response: {
81
+ status: error.response.status,
82
+ data: error.response.data,
83
+ },
84
+ error: parsedError,
85
+ };
86
+ }
87
+ }
88
+
89
+ return { error: parsedError };
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Gets an http request to the given route.
95
+ * @param {Record<string, string | undefined> | string} data The data to be posted.
96
+ * @param {string} route The end point url.
97
+ * @param {Record<string, string>} headers The type content of request.
98
+ * @param {LoggerInterface} logger The logger to use when getting data.
99
+ * @return {Promise<unknown | undefined>} The server response.
100
+ */
101
+ export async function getRequest<T>({
102
+ data,
103
+ route,
104
+ headers,
105
+ logger,
106
+ rejectUnauthorized = true,
107
+ }: {
108
+ data?: Record<string, string | undefined> | string;
109
+ route: string;
110
+ headers?: Record<string, string>;
111
+ logger: LoggerInterface;
112
+ rejectUnauthorized?: boolean;
113
+ }): Promise<RequestResponse<T>> {
114
+ try {
115
+ logger.info(
116
+ `Request on the route ${route} is running with data : ${JSON.stringify({
117
+ headers,
118
+ data,
119
+ route,
120
+ })}`
121
+ );
122
+ const agent = new https.Agent({
123
+ rejectUnauthorized: rejectUnauthorized,
124
+ });
125
+ const response = await axios.default({
126
+ method: 'get',
127
+ url: route,
128
+ headers: headers,
129
+ data: data,
130
+ httpsAgent: agent,
131
+ });
132
+ logger.info(
133
+ `Request on the route ${route} completed successfully with data : ${JSON.stringify(
134
+ {
135
+ response: response.data,
136
+ status: response.status,
137
+ statusText: response.statusText,
138
+ }
139
+ )}`
140
+ );
141
+ return { response: { data: response.data, status: response.status } };
142
+ } catch (error) {
143
+ logger.warn(
144
+ `[Axios] failed to get request on the route: ${route} with data : ${JSON.stringify(
145
+ { headers, data, route }
146
+ )}`
147
+ );
148
+ const parsedError = parseAxiosError(error);
149
+ logger.warn(JSON.stringify(error));
150
+ if (error instanceof AxiosError) {
151
+ if (error.response) {
152
+ return {
153
+ response: {
154
+ status: error.response.status,
155
+ data: error.response.data,
156
+ },
157
+ error: parsedError,
158
+ };
159
+ }
160
+ }
161
+
162
+ return { error: parsedError };
163
+ }
164
+ }
165
+
166
+ /**
167
+ * Parses an Axios error and returns a modified error object.
168
+ *
169
+ * @param {unknown} error - The error object to be parsed.
170
+ * @return {unknown} The modified error object.
171
+ */
172
+ export function parseAxiosError(error: unknown): unknown {
173
+ let err = error;
174
+ if (error instanceof AxiosError) {
175
+ if (error.response) {
176
+ err = {
177
+ responseError: {
178
+ data: error.response.data,
179
+ status: error.response.status,
180
+ statusText: error.response.statusText,
181
+ headers: error.response.headers,
182
+ },
183
+ requestBody: error.request.body,
184
+ };
185
+ } else if (error.request) {
186
+ err = {
187
+ requestFailed: {
188
+ headers: error.config?.headers,
189
+ data: error.config?.data,
190
+ },
191
+ };
192
+ } else {
193
+ err = {
194
+ configFailed: error.message,
195
+ };
196
+ }
197
+ }
198
+ return err;
199
+ }
200
+
201
+ /**
202
+ * Generates a hash using the given key and secret.
203
+ *
204
+ * @param {string} key - The key to be hashed.
205
+ * @param {string} secret - The secret to be hashed.
206
+ * @return {string} - The generated hash.
207
+ */
208
+ export function hash(key: string, secret: string): string {
209
+ const toHash = `${key}:${secret}`;
210
+ if (!global.btoa) {
211
+ return Buffer.from(toHash).toString('base64');
212
+ }
213
+ return global.btoa(toHash);
214
+ }
215
+
216
+ /**
217
+ * Encode the body of the request.
218
+ * @param {Record<string, string>} bodyRequest the body request.
219
+ * @return {string} the encoded body request result.
220
+ */
221
+ export function encodeTheBodyOfRequest(
222
+ bodyRequest: Record<string, string>
223
+ ): string {
224
+ const formBody = [];
225
+ for (const key in bodyRequest) {
226
+ if ({}.hasOwnProperty.call(bodyRequest, key)) {
227
+ const encodedKey = encodeURIComponent(key);
228
+ const encodedValue = encodeURIComponent(bodyRequest[key]);
229
+ formBody.push(encodedKey + '=' + encodedValue);
230
+ }
231
+ }
232
+ return formBody.join('&');
233
+ }
234
+
235
+ // Encode to base64
236
+ export const encodeToBase64 = (
237
+ apiUsername: string,
238
+ apiPassword: string
239
+ ): string => {
240
+ return base64url(`${apiUsername}:${apiPassword}`);
241
+ };
242
+
243
+ /**
244
+ * Encode the data to w3 x form encoded url.
245
+ * @param {Record<string, string>} data the data to encode.
246
+ * @return {string} the encoded value.
247
+ */
248
+ export function encodeDataToXFormUrl(data: Record<string, string>): string {
249
+ const segments: string[] = [];
250
+ for (const key in data) {
251
+ if (Object.hasOwnProperty.call(data, key)) {
252
+ const encodedKey = encodeURIComponent(key);
253
+ const encodedValue = encodeURIComponent(data[key]);
254
+ segments.push(`${encodedKey}=${encodedValue}`);
255
+ }
256
+ }
257
+ return segments.join('&');
258
+ }
259
+
260
+ /**
261
+ * Checks if the code is a successful code response.
262
+ * @param {num} code .
263
+ * @return {boolean} true if the code is valid.
264
+ */
265
+ export const isSuccessfulCodeResponse = (code: number): boolean =>
266
+ code >= 200 && code < 300;
@@ -0,0 +1,25 @@
1
+ export interface LoggerInterface {
2
+ /**
3
+ * Logs a debug level message.
4
+ * @param {string[]} args
5
+ */
6
+ log(...args: string[]): void;
7
+
8
+ /**
9
+ * Logs an info level message.
10
+ * @param {string[]} args
11
+ */
12
+ info(...args: string[]): void;
13
+
14
+ /**
15
+ * Logs a waning level message.
16
+ * @param {string[]} args
17
+ */
18
+ warn(...args: string[]): void;
19
+
20
+ /**
21
+ * Logs an error level message.
22
+ * @param {string[]} args
23
+ */
24
+ error(...args: string[]): void;
25
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Data return to user when requesting an operation.
3
+ */
4
+ export type OperationResponse<T, T2 = unknown, R = unknown> = Promise<
5
+ SuccessfulOperationResponse<T, T2> | FailedOperationResponse<R>
6
+ >;
7
+ type SuccessfulOperationResponse<T, T2 = unknown> = {
8
+ data: T;
9
+ raw: T2;
10
+ error?: never;
11
+ };
12
+
13
+ type FailedOperationResponse<R = unknown> = {
14
+ data?: never;
15
+ raw?: unknown;
16
+ error: R;
17
+ };
@@ -0,0 +1,5 @@
1
+ export enum TargetEnvironment {
2
+ sandbox = 'dev',
3
+ prod = 'prod',
4
+ fake = 'fake',
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["**/*.spec.ts"]
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "include": [".eslintrc.js", "index.spec.ts", "jest.config.ts", "jest.before-test.ts", "babel.config.js"],
3
+ "exclude": []
4
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
4
+ "module": "commonjs", /* Specify what module code is generated. */
5
+ "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
6
+ "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
7
+ "declarationMap": true, /* Create sourcemaps for d.ts files. */
8
+ "sourceMap": true, /* Create source map files for emitted JavaScript files. */
9
+ "outDir": "dist", /* Specify an output folder for all emitted files. */
10
+ "removeComments": false, /* Disable emitting comments. */
11
+ "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
12
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
13
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
14
+ "strict": true, /* Enable all strict type-checking options. */
15
+ "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
16
+ "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
17
+ "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
18
+ "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
19
+ "skipLibCheck": true, /* Skip type checking all .d.ts files. */
20
+ "baseUrl": ".",
21
+ "paths": {
22
+ "@spreeloop-core/logging": ["../logging"]
23
+ }
24
+ },
25
+ "include": ["src", "index.ts"],
26
+ "exclude": []
27
+ }