@medipass/web-sdk 11.38.0 → 11.38.1-feature-typescript-claudia.1

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 (296) hide show
  1. package/.eslintrc.cjs +95 -0
  2. package/babel.config.js +2 -1
  3. package/lib/index.d.ts +262 -0
  4. package/lib/index.js +83 -3
  5. package/lib/{regions-ed54f163.js → regions-a0a28864.js} +2 -2
  6. package/lib/resources/accounts.d.ts +215 -0
  7. package/lib/resources/accounts.js +3 -3
  8. package/lib/resources/actions.d.ts +13 -0
  9. package/lib/resources/actions.js +3 -3
  10. package/lib/resources/api-keys.d.ts +24 -0
  11. package/lib/resources/api-keys.js +3 -3
  12. package/lib/resources/applications.d.ts +31 -0
  13. package/lib/resources/applications.js +3 -3
  14. package/lib/resources/attachments.d.ts +32 -0
  15. package/lib/resources/attachments.js +3 -3
  16. package/lib/resources/auth.d.ts +59 -0
  17. package/lib/resources/auth.js +3 -3
  18. package/lib/resources/bulk-submits.d.ts +17 -0
  19. package/lib/resources/bulk-submits.js +3 -3
  20. package/lib/resources/bulk-uploads.d.ts +26 -0
  21. package/lib/resources/bulk-uploads.js +3 -3
  22. package/lib/resources/business-profiles.d.ts +18 -0
  23. package/lib/resources/business-profiles.js +3 -3
  24. package/lib/resources/businesses.d.ts +132 -0
  25. package/lib/resources/businesses.js +3 -3
  26. package/lib/resources/claim-items.d.ts +31 -0
  27. package/lib/resources/claim-items.js +3 -3
  28. package/lib/resources/devices.d.ts +11 -0
  29. package/lib/resources/devices.js +3 -3
  30. package/lib/resources/doc-accounts.d.ts +32 -0
  31. package/lib/resources/doc-accounts.js +3 -3
  32. package/lib/resources/documents.d.ts +90 -0
  33. package/lib/resources/documents.js +3 -3
  34. package/lib/resources/emails.d.ts +14 -0
  35. package/lib/resources/emails.js +3 -3
  36. package/lib/resources/form-application-templates.d.ts +20 -0
  37. package/lib/resources/form-application-templates.js +3 -3
  38. package/lib/resources/form-applications.d.ts +27 -0
  39. package/lib/resources/form-applications.js +3 -3
  40. package/lib/resources/forms.d.ts +100 -0
  41. package/lib/resources/forms.js +3 -3
  42. package/lib/resources/funder-services.d.ts +8 -0
  43. package/lib/resources/funder-services.js +3 -3
  44. package/lib/resources/funder-settings.d.ts +8 -0
  45. package/lib/resources/funder-settings.js +3 -3
  46. package/lib/resources/funders.d.ts +5 -0
  47. package/lib/resources/funders.js +3 -3
  48. package/lib/resources/futures.d.ts +85 -0
  49. package/lib/resources/futures.js +3 -3
  50. package/lib/resources/health-fund-accounts.d.ts +78 -0
  51. package/lib/resources/health-fund-accounts.js +3 -3
  52. package/lib/resources/health-fund-settings.d.ts +39 -0
  53. package/lib/resources/health-fund-settings.js +3 -3
  54. package/lib/resources/healthfunds.d.ts +64 -0
  55. package/lib/resources/healthfunds.js +3 -3
  56. package/lib/resources/icditems.d.ts +14 -0
  57. package/lib/resources/icditems.js +3 -3
  58. package/lib/resources/invoice-scans.d.ts +26 -0
  59. package/lib/resources/invoice-scans.js +3 -3
  60. package/lib/resources/jhcs.d.ts +7 -0
  61. package/lib/resources/jhcs.js +3 -3
  62. package/lib/resources/kyc.d.ts +109 -0
  63. package/lib/resources/kyc.js +3 -3
  64. package/lib/resources/logs.d.ts +16 -0
  65. package/lib/resources/logs.js +3 -3
  66. package/lib/resources/members.d.ts +92 -0
  67. package/lib/resources/members.js +3 -3
  68. package/lib/resources/message-mappings.d.ts +9 -0
  69. package/lib/resources/message-mappings.js +3 -3
  70. package/lib/resources/minions.d.ts +40 -0
  71. package/lib/resources/minions.js +3 -3
  72. package/lib/resources/modalities.d.ts +19 -0
  73. package/lib/resources/modalities.js +3 -3
  74. package/lib/resources/notes.d.ts +17 -0
  75. package/lib/resources/notes.js +3 -3
  76. package/lib/resources/onboarding-applications.d.ts +52 -0
  77. package/lib/resources/onboarding-applications.js +3 -3
  78. package/lib/resources/onboarding-requests.d.ts +39 -0
  79. package/lib/resources/onboarding-requests.js +3 -3
  80. package/lib/resources/ops.d.ts +60 -0
  81. package/lib/resources/ops.js +3 -3
  82. package/lib/resources/organisations.d.ts +7 -0
  83. package/lib/resources/organisations.js +3 -3
  84. package/lib/resources/partners.d.ts +50 -0
  85. package/lib/resources/partners.js +3 -3
  86. package/lib/resources/patients.d.ts +44 -0
  87. package/lib/resources/patients.js +3 -3
  88. package/lib/resources/payments.d.ts +155 -0
  89. package/lib/resources/payments.js +3 -3
  90. package/lib/resources/pms.d.ts +43 -0
  91. package/lib/resources/pms.js +3 -3
  92. package/lib/resources/practice-profiles.d.ts +20 -0
  93. package/lib/resources/practice-profiles.js +3 -3
  94. package/lib/resources/practice-types.d.ts +6 -0
  95. package/lib/resources/practice-types.js +3 -3
  96. package/lib/resources/practices.d.ts +137 -0
  97. package/lib/resources/practices.js +3 -3
  98. package/lib/resources/products.d.ts +23 -0
  99. package/lib/resources/products.js +3 -3
  100. package/lib/resources/professional-categories.d.ts +23 -0
  101. package/lib/resources/professional-categories.js +3 -3
  102. package/lib/resources/provider-number-types.d.ts +16 -0
  103. package/lib/resources/provider-number-types.js +3 -3
  104. package/lib/resources/provider-registration-types.d.ts +15 -0
  105. package/lib/resources/provider-registration-types.js +3 -3
  106. package/lib/resources/provider-requests.d.ts +17 -0
  107. package/lib/resources/provider-requests.js +3 -3
  108. package/lib/resources/provider-types.d.ts +6 -0
  109. package/lib/resources/provider-types.js +3 -3
  110. package/lib/resources/ref-sources.d.ts +6 -0
  111. package/lib/resources/ref-sources.js +3 -3
  112. package/lib/resources/risk.d.ts +13 -0
  113. package/lib/resources/risk.js +3 -3
  114. package/lib/resources/rnas.d.ts +43 -0
  115. package/lib/resources/rnas.js +3 -3
  116. package/lib/resources/roles.d.ts +7 -0
  117. package/lib/resources/roles.js +3 -3
  118. package/lib/resources/self-checkout-sessions.d.ts +134 -0
  119. package/lib/resources/self-checkout-sessions.js +3 -3
  120. package/lib/resources/services.d.ts +88 -0
  121. package/lib/resources/services.js +3 -3
  122. package/lib/resources/settlements.d.ts +37 -0
  123. package/lib/resources/settlements.js +3 -3
  124. package/lib/resources/sign-up.d.ts +5 -0
  125. package/lib/resources/sign-up.js +3 -3
  126. package/lib/resources/specialties.d.ts +23 -0
  127. package/lib/resources/specialties.js +3 -3
  128. package/lib/resources/staff-profiles.d.ts +20 -0
  129. package/lib/resources/staff-profiles.js +3 -3
  130. package/lib/resources/staff.d.ts +242 -0
  131. package/lib/resources/staff.js +3 -3
  132. package/lib/resources/statistics.d.ts +56 -0
  133. package/lib/resources/statistics.js +3 -3
  134. package/lib/resources/subscriptions.d.ts +32 -0
  135. package/lib/resources/subscriptions.js +3 -3
  136. package/lib/resources/terminals.d.ts +71 -0
  137. package/lib/resources/terminals.js +3 -3
  138. package/lib/resources/transaction-export.d.ts +18 -0
  139. package/lib/resources/transaction-export.js +3 -3
  140. package/lib/resources/transactions.d.ts +466 -0
  141. package/lib/resources/transactions.js +3 -3
  142. package/lib/resources/triggers.d.ts +20 -0
  143. package/lib/resources/triggers.js +3 -3
  144. package/lib/resources/vendors.d.ts +9 -0
  145. package/lib/resources/vendors.js +3 -3
  146. package/lib/resources/verify.d.ts +9 -0
  147. package/lib/resources/verify.js +3 -3
  148. package/lib/resources/workers.d.ts +3 -0
  149. package/lib/resources/workers.js +3 -3
  150. package/lib/resources/workflow-exceptions.d.ts +5 -0
  151. package/lib/resources/workflow-exceptions.js +3 -3
  152. package/lib/services/aws.d.ts +54 -0
  153. package/lib/services/aws.js +3 -3
  154. package/lib/services/storage.d.ts +28 -0
  155. package/lib/services/storage.js +126 -18
  156. package/lib/services/version.d.ts +21 -0
  157. package/lib/services/version.js +3 -3
  158. package/lib/{staff-f19eb168.js → staff-96febcd8.js} +188 -581
  159. package/lib/types/documents.d.ts +115 -0
  160. package/lib/types/documents.js +2 -0
  161. package/lib/types/forms.d.ts +67 -0
  162. package/lib/types/forms.js +2 -0
  163. package/lib/types/index.d.ts +42 -0
  164. package/lib/types/index.js +2 -0
  165. package/lib/types/message-mappings.d.ts +18 -0
  166. package/lib/types/message-mappings.js +2 -0
  167. package/lib/types/notes.d.ts +5 -0
  168. package/lib/types/notes.js +2 -0
  169. package/lib/types/products.d.ts +34 -0
  170. package/lib/types/products.js +2 -0
  171. package/lib/types/professional-categories.d.ts +20 -0
  172. package/lib/types/professional-categories.js +2 -0
  173. package/lib/types/specialties.d.ts +22 -0
  174. package/lib/types/specialties.js +2 -0
  175. package/lib/types/subscriptions.d.ts +52 -0
  176. package/lib/types/subscriptions.js +2 -0
  177. package/lib/utils/application.d.ts +1 -0
  178. package/lib/utils/application.js +3 -3
  179. package/lib/utils/base-urls/core.d.ts +19 -0
  180. package/lib/utils/base-urls/index.d.ts +37 -0
  181. package/lib/utils/base-urls/risk.d.ts +17 -0
  182. package/lib/utils/does-param-exist.d.ts +2 -0
  183. package/lib/utils/get-axios-error.d.ts +2 -0
  184. package/lib/utils/param-error.d.ts +3 -0
  185. package/lib/utils/professions.d.ts +3 -0
  186. package/lib/utils/professions.js +3 -3
  187. package/lib/utils/regions.d.ts +1 -0
  188. package/lib/utils/regions.js +2 -2
  189. package/lib/utils/request.d.ts +3 -0
  190. package/lib/utils/request.js +3 -3
  191. package/lib/utils/staff.d.ts +8 -0
  192. package/lib/utils/staff.js +3 -3
  193. package/package.json +19 -9
  194. package/tsconfig.json +33 -0
  195. package/types/globals.d.ts +7 -0
  196. package/types/index.d.ts +1 -0
  197. package/.eslintrc +0 -3
  198. package/lib/_types/documents.js.flow +0 -118
  199. package/lib/_types/forms.js.flow +0 -57
  200. package/lib/_types/index.js.flow +0 -47
  201. package/lib/_types/message-mappings.js.flow +0 -22
  202. package/lib/_types/notes.js.flow +0 -7
  203. package/lib/_types/products.js.flow +0 -40
  204. package/lib/_types/professional-categories.js.flow +0 -25
  205. package/lib/_types/specialties.js.flow +0 -27
  206. package/lib/_types/subscriptions.js.flow +0 -58
  207. package/lib/index.js.flow +0 -438
  208. package/lib/resources/accounts.js.flow +0 -445
  209. package/lib/resources/actions.js.flow +0 -25
  210. package/lib/resources/api-keys.js.flow +0 -54
  211. package/lib/resources/applications.js.flow +0 -60
  212. package/lib/resources/attachments.js.flow +0 -75
  213. package/lib/resources/auth.js.flow +0 -185
  214. package/lib/resources/bulk-submits.js.flow +0 -43
  215. package/lib/resources/bulk-uploads.js.flow +0 -56
  216. package/lib/resources/business-profiles.js.flow +0 -45
  217. package/lib/resources/businesses.js.flow +0 -267
  218. package/lib/resources/claim-items.js.flow +0 -76
  219. package/lib/resources/devices.js.flow +0 -64
  220. package/lib/resources/doc-accounts.js.flow +0 -61
  221. package/lib/resources/documents.js.flow +0 -216
  222. package/lib/resources/emails.js.flow +0 -96
  223. package/lib/resources/form-application-templates.js.flow +0 -52
  224. package/lib/resources/form-applications.js.flow +0 -62
  225. package/lib/resources/forms.js.flow +0 -222
  226. package/lib/resources/funder-services.js.flow +0 -17
  227. package/lib/resources/funder-settings.js.flow +0 -58
  228. package/lib/resources/funders.js.flow +0 -15
  229. package/lib/resources/futures.js.flow +0 -154
  230. package/lib/resources/health-fund-accounts.js.flow +0 -198
  231. package/lib/resources/health-fund-settings.js.flow +0 -104
  232. package/lib/resources/healthfunds.js.flow +0 -139
  233. package/lib/resources/icditems.js.flow +0 -36
  234. package/lib/resources/invoice-scans.js.flow +0 -56
  235. package/lib/resources/jhcs.js.flow +0 -20
  236. package/lib/resources/kyc.js.flow +0 -216
  237. package/lib/resources/logs.js.flow +0 -32
  238. package/lib/resources/members.js.flow +0 -196
  239. package/lib/resources/message-mappings.js.flow +0 -25
  240. package/lib/resources/minions.js.flow +0 -96
  241. package/lib/resources/modalities.js.flow +0 -46
  242. package/lib/resources/notes.js.flow +0 -112
  243. package/lib/resources/onboarding-applications.js.flow +0 -142
  244. package/lib/resources/onboarding-requests.js.flow +0 -97
  245. package/lib/resources/ops.js.flow +0 -116
  246. package/lib/resources/organisations.js.flow +0 -15
  247. package/lib/resources/partners.js.flow +0 -118
  248. package/lib/resources/patients.js.flow +0 -102
  249. package/lib/resources/payments.js.flow +0 -523
  250. package/lib/resources/pms.js.flow +0 -102
  251. package/lib/resources/practice-profiles.js.flow +0 -51
  252. package/lib/resources/practice-types.js.flow +0 -14
  253. package/lib/resources/practices.js.flow +0 -314
  254. package/lib/resources/products.js.flow +0 -48
  255. package/lib/resources/professional-categories.js.flow +0 -56
  256. package/lib/resources/provider-number-types.js.flow +0 -32
  257. package/lib/resources/provider-registration-types.js.flow +0 -32
  258. package/lib/resources/provider-requests.js.flow +0 -46
  259. package/lib/resources/provider-types.js.flow +0 -14
  260. package/lib/resources/ref-sources.js.flow +0 -16
  261. package/lib/resources/risk.js.flow +0 -29
  262. package/lib/resources/rnas.js.flow +0 -108
  263. package/lib/resources/roles.js.flow +0 -12
  264. package/lib/resources/self-checkout-sessions.js.flow +0 -382
  265. package/lib/resources/services.js.flow +0 -219
  266. package/lib/resources/settlements.js.flow +0 -97
  267. package/lib/resources/sign-up.js.flow +0 -15
  268. package/lib/resources/specialties.js.flow +0 -46
  269. package/lib/resources/staff-profiles.js.flow +0 -51
  270. package/lib/resources/staff.js.flow +0 -583
  271. package/lib/resources/statistics.js.flow +0 -147
  272. package/lib/resources/subscriptions.js.flow +0 -81
  273. package/lib/resources/terminals.js.flow +0 -161
  274. package/lib/resources/transaction-export.js.flow +0 -48
  275. package/lib/resources/transactions.js.flow +0 -1097
  276. package/lib/resources/triggers.js.flow +0 -36
  277. package/lib/resources/vendors.js.flow +0 -28
  278. package/lib/resources/verify.js.flow +0 -14
  279. package/lib/resources/workers.js.flow +0 -10
  280. package/lib/resources/workflow-exceptions.js.flow +0 -17
  281. package/lib/services/__mocks__/storage.js.flow +0 -30
  282. package/lib/services/aws.js.flow +0 -339
  283. package/lib/services/storage.js.flow +0 -92
  284. package/lib/services/version.js.flow +0 -73
  285. package/lib/storage-16fd26f8.js +0 -1268
  286. package/lib/utils/application.js.flow +0 -23
  287. package/lib/utils/base-urls/core.js.flow +0 -18
  288. package/lib/utils/base-urls/index.js.flow +0 -7
  289. package/lib/utils/base-urls/risk.js.flow +0 -16
  290. package/lib/utils/does-param-exist.js.flow +0 -23
  291. package/lib/utils/get-axios-error.js.flow +0 -8
  292. package/lib/utils/param-error.js.flow +0 -8
  293. package/lib/utils/professions.js.flow +0 -66
  294. package/lib/utils/regions.js.flow +0 -21
  295. package/lib/utils/request.js.flow +0 -36
  296. package/lib/utils/staff.js.flow +0 -81
@@ -1,185 +0,0 @@
1
- // @flow
2
- import _omitBy from 'lodash/omitBy';
3
- import _isEmpty from 'lodash/isEmpty';
4
-
5
- import type { MedipassRequestOpts } from '../_types';
6
- import medipassWebSdk from '../index';
7
- import storage from '../services/storage';
8
- import doesParamExist from '../utils/does-param-exist';
9
- import request from '../utils/request';
10
- import * as members from './members';
11
-
12
- const PATH__AUTH = '/auth';
13
- const PATH__OTK = '/otk';
14
- const PATH__AUTH_TOKEN = '/auth/token';
15
- const pathImpersonateAccount = accountId => `/auth/impersonate/${accountId}`;
16
- const pathAuthy = (accountId: string) => `/accounts/${accountId}/authy`;
17
- const pathAuthyVerify = (accountId: string) => `/accounts/${accountId}/authy/verify`;
18
-
19
- const HEADER__SUPER_ADMIN = 'x-super-admin';
20
-
21
- const setupAccountResources = async (account: Object) => {
22
- storage.onboardingStatus.remove();
23
-
24
- medipassWebSdk.setAccount(account);
25
-
26
- // Check if the account has a member attached to it.
27
- const ownerMemberId = account.ownerMemberId;
28
- if (ownerMemberId) {
29
- const member = await members.getMember(ownerMemberId);
30
- medipassWebSdk.setMember(member);
31
- return { ...account, _member: member };
32
- }
33
-
34
- return account;
35
- };
36
-
37
- /**
38
- * Log in a user
39
- * @param {String} email - Email
40
- * @param {String} password - Password
41
- * @param {{ otkCode: ?String, accountType: String }} body - The request body
42
- * @param {{ ver: ?String }} opts - Additional options
43
- */
44
- export const login = async (
45
- email?: ?string,
46
- password?: ?string,
47
- body?: Object = {},
48
- opts?: MedipassRequestOpts = { asSuperAdmin: false }
49
- ): Promise<Object> => {
50
- const data = {
51
- email,
52
- ...body
53
- };
54
- if (password) {
55
- data.password = password;
56
- }
57
-
58
- // $FlowFixMe
59
- const res = await request({ ...opts, path: PATH__AUTH, getFullResponse: true }, { method: 'post', data });
60
- const isSuperAdmin = res.headers[HEADER__SUPER_ADMIN];
61
-
62
- if (opts.asSuperAdmin && !isSuperAdmin) {
63
- medipassWebSdk.clearTokens();
64
- throw { response: 'You need to be a super admin to log in!' }; // eslint-disable-line no-throw-literal
65
- }
66
-
67
- if (isSuperAdmin) {
68
- medipassWebSdk.isSuperAdmin = isSuperAdmin;
69
- storage.set('isSuperAdmin', isSuperAdmin);
70
- }
71
-
72
- const account = await setupAccountResources(res.data);
73
- return account;
74
- };
75
-
76
- /**
77
- * Login with token
78
- * @param {String} accountId - Account ID
79
- * @param {String} token - JWT
80
- */
81
- export const loginWithToken = async (token: string, accountId: string) => {
82
- medipassWebSdk.setToken(token);
83
- const account = await medipassWebSdk.accounts.getAccount(accountId);
84
- const newAccount = await setupAccountResources(account);
85
- return newAccount;
86
- };
87
-
88
- /**
89
- * Impersonate a user
90
- * @param {String} accountId - Account ID
91
- * @param {Object} opts - Additional options
92
- */
93
- export const impersonate = async (accountId: string, opts?: MedipassRequestOpts = {}) => {
94
- doesParamExist({ accountId }, opts.hyperMediaEndpoint);
95
- return request({ ...opts, getFullResponse: true, path: pathImpersonateAccount(accountId) }, { method: 'post' });
96
- };
97
-
98
- /**
99
- * Log out a user
100
- * @param {Object} opts - Additional options
101
- */
102
- export const logout = async (opts?: MedipassRequestOpts): Promise<Object> => {
103
- const res = await request({ ...opts, getFullResponse: true, path: PATH__AUTH }, { method: 'delete' });
104
- medipassWebSdk.removeStorage();
105
- return res;
106
- };
107
-
108
- /**
109
- * Object OTK
110
- * @param {String} email - Email address
111
- * @param {String} accountId - Account ID
112
- * @param {Object} opts - Additional options
113
- */
114
- export const requestOtk = async (
115
- email?: ?string,
116
- accountId?: ?string,
117
- requestBody?: ?Object,
118
- opts?: MedipassRequestOpts
119
- ): Promise<Object> => {
120
- const body = _omitBy(
121
- {
122
- email,
123
- accountId,
124
- ...requestBody
125
- },
126
- _isEmpty
127
- );
128
-
129
- const res = await request({ ...opts, getFullResponse: true, path: PATH__OTK }, { method: 'post', data: body });
130
- return res;
131
- };
132
-
133
- /**
134
- * Generate Authy
135
- * @param {String} accountId - Account ID
136
- * @param {Object} opts - Additional options
137
- */
138
- export const generateAuthy = async (accountId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
139
- doesParamExist({ accountId }, opts.hyperMediaEndpoint);
140
- const res = await request({ ...opts, path: pathAuthy(accountId), getFullResponse: true }, { method: 'post' });
141
- return res;
142
- };
143
-
144
- /**
145
- * Remove Authy
146
- * @param {String} accountId - Account ID
147
- * @param {Object} opts - Additional options
148
- */
149
- export const removeAuthy = async (accountId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
150
- doesParamExist({ accountId }, opts.hyperMediaEndpoint);
151
- const res = await request({ ...opts, path: pathAuthy(accountId), getFullResponse: true }, { method: 'delete' });
152
- return res;
153
- };
154
-
155
- /**
156
- * Verify Authy
157
- * @param {String} accountId - Account ID
158
- * @param {String} token - Authy Token
159
- * @param {Object} opts - Additional options
160
- */
161
- export const verifyAuthy = async (
162
- accountId: string,
163
- token: string,
164
- opts?: MedipassRequestOpts = {}
165
- ): Promise<Object> => {
166
- doesParamExist({ accountId }, opts.hyperMediaEndpoint);
167
- const res = await request(
168
- { ...opts, path: pathAuthyVerify(accountId), getFullResponse: true },
169
- { method: 'post', data: { token } }
170
- );
171
- return res;
172
- };
173
-
174
- /**
175
- * Create a short lived token
176
- * @param {String} apiKey - API Key
177
- * @param {Object} body - Request body
178
- * @param {Object} opts - Additional options
179
- */
180
- export const createShortLivedToken = async (apiKey: string, body: Object, opts?: MedipassRequestOpts = {}) => {
181
- doesParamExist({ apiKey }, opts.hyperMediaEndpoint);
182
- medipassWebSdk.setToken(`Bearer ${apiKey}`);
183
- const res = await request({ ...opts, path: PATH__AUTH_TOKEN }, { method: 'post', data: body });
184
- return res;
185
- };
@@ -1,43 +0,0 @@
1
- // @flow
2
-
3
- import request from '../utils/request';
4
- import doesParamExist from '../utils/does-param-exist';
5
- import type { MedipassRequestOpts } from '../_types';
6
-
7
- export const pathSubmitDraftInvoices = (businessId: string) => `/businesses/${businessId}/bulksubmits`;
8
- export const pathGetDraftProgressStatus = (businessId: string, bulkSubmitId: string) =>
9
- `/businesses/${businessId}/bulksubmits/${bulkSubmitId}`;
10
-
11
- /**
12
- * Bulk submission of one or more draft invoices.
13
- * @param {String} businessId - Business ID
14
- * @param {Object} body - Request body
15
- * @param {Object} opts - Additional options
16
- */
17
- export const submitDraftInvoices = async (
18
- businessId: string,
19
- body: Object,
20
- opts?: MedipassRequestOpts = {}
21
- ): Promise<Object> => {
22
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
23
- return request({ ...opts, path: pathSubmitDraftInvoices(businessId) }, { method: 'post', data: body });
24
- };
25
-
26
- /**
27
- * Get draft invocies progress status
28
- * @param {String} businessId - Business ID
29
- * @param {String} bulkSubmitId - Bulk Submit ID
30
- * @param {Object} opts - Additional options
31
- */
32
- export const getDraftProgressStatus = async (
33
- businessId: string,
34
- bulkSubmitId: string,
35
- query: Object,
36
- opts?: MedipassRequestOpts = {}
37
- ): Promise<Object> => {
38
- doesParamExist({ businessId, bulkSubmitId }, opts.hyperMediaEndpoint);
39
- return request(
40
- { ...opts, path: pathGetDraftProgressStatus(businessId, bulkSubmitId) },
41
- { method: 'get', params: query }
42
- );
43
- };
@@ -1,56 +0,0 @@
1
- // @flow
2
-
3
- import doesParamExist from '../utils/does-param-exist';
4
- import request from '../utils/request';
5
- import type { MedipassRequestOpts } from '../_types';
6
-
7
- export const pathBusinessBulkUploads = (businessId: string) => `/businesses/${businessId}/bulkuploads`;
8
- export const pathBusinessBulkUpload = (businessId: string, bulkUploadId: string) =>
9
- `/businesses/${businessId}/bulkuploads/${bulkUploadId}`;
10
- export const pathBusinessBulkUploadUrl = (businessId: string) => `/businesses/${businessId}/bulkuploads/uploadurl`;
11
-
12
- /**
13
- * Create a bulk upload from file
14
- * @param {string} businessId - Business ID
15
- * @param {Object} body - Request body
16
- * @param {Object} opts - Additional options
17
- */
18
- export const createBulkUpload = (
19
- businessId: string,
20
- body?: Object,
21
- opts?: MedipassRequestOpts = {}
22
- ): Promise<Object> => {
23
- doesParamExist({ businessId });
24
- return request({ ...opts, path: pathBusinessBulkUploads(businessId) }, { method: 'post', data: body });
25
- };
26
-
27
- /**
28
- * Get a bulk upload
29
- * @param {string} businessId - Business ID
30
- * @param {string} bulkUploadId - Bulk upload ID
31
- * @param {Object} body - Request body
32
- * @param {Object} opts - Additional options
33
- */
34
- export const getBulkUpload = (
35
- businessId: string,
36
- bulkUploadId: string,
37
- opts?: MedipassRequestOpts = {}
38
- ): Promise<Object> => {
39
- doesParamExist({ businessId, bulkUploadId });
40
- return request({ ...opts, path: pathBusinessBulkUpload(businessId, bulkUploadId) }, { method: 'get' });
41
- };
42
-
43
- /**
44
- * Get a bulk upload url
45
- * @param {string} businessId - Business ID
46
- * @param {Object} query - Query params
47
- * @param {Object} opts - Additional options
48
- */
49
- export const getBulkUploadUrl = (
50
- businessId: string,
51
- query?: Object,
52
- opts?: MedipassRequestOpts = {}
53
- ): Promise<Object> => {
54
- doesParamExist({ businessId });
55
- return request({ ...opts, path: pathBusinessBulkUploadUrl(businessId) }, { method: 'get', params: query });
56
- };
@@ -1,45 +0,0 @@
1
- // @flow
2
-
3
- import doesParamExist from '../utils/does-param-exist';
4
- import request from '../utils/request';
5
- import type { MedipassRequestOpts } from '../_types';
6
-
7
- export const pathLinkBusinessProfile = (businessProfileId: string) => `/businessprofiles/${businessProfileId}/link`;
8
- export const pathUnlinkBusinessProfile = (businessProfileId: string) => `/businessprofiles/${businessProfileId}/unlink`;
9
- export const pathOrganisationBusinessProfiles = (organisationId: string) =>
10
- `/organisations/${organisationId}/businessprofiles`;
11
-
12
- type BusinessProfilesQuery = {
13
- businessId?: string,
14
- unlinkedOnly?: boolean,
15
- from?: string,
16
- to?: string,
17
- sort?: string,
18
- searchText?: string,
19
- page?: number,
20
- limit?: number
21
- };
22
-
23
- export const getOrganisationBusinessProfiles = (
24
- organisationId: string,
25
- query?: BusinessProfilesQuery,
26
- opts?: MedipassRequestOpts = {}
27
- ): Promise<Object> => {
28
- doesParamExist({ organisationId }, opts.hyperMediaEndpoint);
29
- return request({ ...opts, path: pathOrganisationBusinessProfiles(organisationId) }, { method: 'get', params: query });
30
- };
31
-
32
- export const linkBusinessProfile = (
33
- businessProfileId: string,
34
- businessId: string,
35
- opts?: MedipassRequestOpts = {}
36
- ): Promise<Object> => {
37
- doesParamExist({ businessProfileId, businessId }, opts.hyperMediaEndpoint);
38
- const body = { businessId };
39
- return request({ ...opts, path: pathLinkBusinessProfile(businessProfileId) }, { method: 'put', data: body });
40
- };
41
-
42
- export const unlinkBusinessProfile = (businessProfileId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
43
- doesParamExist({ businessProfileId }, opts.hyperMediaEndpoint);
44
- return request({ ...opts, path: pathUnlinkBusinessProfile(businessProfileId) }, { method: 'put' });
45
- };
@@ -1,267 +0,0 @@
1
- // @flow
2
-
3
- import doesParamExist from '../utils/does-param-exist';
4
- import request from '../utils/request';
5
- import type { MedipassRequestOpts } from '../_types';
6
-
7
- const PATH__BUSINESSES = '/businesses';
8
- const PATH__MY_BUSINESSES = '/businesses/me';
9
- const pathBusiness = businessId => `/businesses/${businessId}`;
10
-
11
- const pathAccountsBusinesses = accountId => `/accounts/${accountId}/businesses`;
12
- const pathBusinessOnboardingQuestions = businessId => `/businesses/${businessId}/onboarding/emailquestions`;
13
- const pathBusinessSendEmails = businessId => `/businesses/${businessId}/sendemail`;
14
- const pathOrganisationBusiness = organisationId => `/organisations/${organisationId}/businesses`;
15
- const pathVerifyMedicare = businessId => `/businesses/${businessId}/medicare/verify`;
16
- // This can be removed once we migrate to the new medicare service
17
- const oldPathVerifyDVA = businessId => `/businesses/${businessId}/dva/pvv/verify`;
18
- const pathVerifyDVA = businessId => `/businesses/${businessId}/dva/verify`;
19
- const pathVerifyIcare = businessId => `/businesses/${businessId}/icare/verify`;
20
- const pathVerifyComcare = (businessId, staffId, providerSetItemId) =>
21
- `/businesses/${businessId}/staff/${staffId}/providersetitems/${providerSetItemId}/comcare/verify`;
22
- const pathCreateSupportNote = businessId => `/businesses/${businessId}/supportnotes`;
23
- const pathBsbDetails = businessId => `/businesses/${businessId}/bsbs`;
24
-
25
- /**
26
- * Create businesses
27
- * @param {Object} body - Request body
28
- * @param {Object} opts - Additional options
29
- */
30
- export const createBusiness = (body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
31
- return request({ ...opts, path: PATH__BUSINESSES }, { method: 'post', data: body });
32
- };
33
-
34
- /**
35
- * Create organisation businesses
36
- * @param {String} organisationId - Business ID
37
- * @param {Object} body - Request body
38
- * @param {Object} opts - Additional options
39
- */
40
- export const createOrganisationBusiness = (
41
- organisationId: string,
42
- body: Object,
43
- opts?: MedipassRequestOpts = {}
44
- ): Promise<Object> => {
45
- doesParamExist({ organisationId }, opts.hyperMediaEndpoint);
46
- return request({ ...opts, path: pathOrganisationBusiness(organisationId) }, { method: 'post', data: body });
47
- };
48
-
49
- /**
50
- * Delete business
51
- * @param {String} businessId - Business ID
52
- * @param {Object} opts - Additional options
53
- */
54
- export const deleteBusiness = (businessId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
55
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
56
- return request({ ...opts, path: pathBusiness(businessId) }, { method: 'delete' });
57
- };
58
-
59
- /**
60
- * Email business setup questions to support
61
- * @param {Object} businessId - Business ID
62
- * @param {Object} body - Request body
63
- * @param {Object} opts - Additional options
64
- */
65
- export const emailBusinessOnboardingQuestions = (
66
- businessId: string,
67
- body: Object,
68
- opts?: MedipassRequestOpts = {}
69
- ): Promise<Object> => {
70
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
71
- return request({ ...opts, path: pathBusinessOnboardingQuestions(businessId) }, { method: 'post', data: body });
72
- };
73
-
74
- /**
75
- * Get business
76
- * @param {String} businessId - Business ID
77
- * @param {Object} query - Query parameters
78
- * @param {Object} opts - Additional options
79
- */
80
- export const getBusiness = (
81
- businessId: string,
82
- query?: Object = {},
83
- opts?: MedipassRequestOpts = {}
84
- ): Promise<Object> => {
85
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
86
- return request({ ...opts, path: pathBusiness(businessId) }, { method: 'get', params: query });
87
- };
88
-
89
- /**
90
- * Get businesses
91
- * @param {Object} query - Query parameters
92
- * @param {Object} opts - Additional options
93
- */
94
- export const getBusinesses = (query?: Object = {}, opts?: MedipassRequestOpts = {}): Promise<Object> => {
95
- return request({ ...opts, path: PATH__BUSINESSES }, { method: 'get', params: query });
96
- };
97
-
98
- /**
99
- * Get businesses
100
- * @param {Object} query - Query parameters
101
- * @param {Object} opts - Additional options
102
- */
103
- export const getMyBusinesses = (query?: Object = {}, opts?: MedipassRequestOpts = {}): Promise<Object> => {
104
- return request({ ...opts, path: PATH__MY_BUSINESSES }, { method: 'get', params: query });
105
- };
106
-
107
- /**
108
- * Get business PDFs
109
- * @param {String} businessId - Business ID
110
- * @param {Object} body - Request body
111
- * @param {Object} opts - Additional options
112
- */
113
- export const getBusinessPDFs = (businessId: string, body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
114
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
115
- return request(
116
- { ...opts, path: `${pathBusiness(businessId)}/pdfs` },
117
- { method: 'post', data: body, responseType: 'arraybuffer' }
118
- );
119
- };
120
-
121
- /**
122
- * Get accounts businesses
123
- * @param {String} accountId - Organisation ID
124
- * @param {Object} query - Query parameters
125
- * @param {Object} opts - Additional options
126
- */
127
- export const getAccountsBusinesses = (
128
- accountId: string,
129
- query?: Object = {},
130
- opts?: MedipassRequestOpts = {}
131
- ): Promise<Object> => {
132
- doesParamExist({ accountId }, opts.hyperMediaEndpoint);
133
- return request({ ...opts, path: pathAccountsBusinesses(accountId) }, { method: 'get', params: query });
134
- };
135
-
136
- /**
137
- * Get organisation businesses
138
- * @param {String} organisationId - Organisation ID
139
- * @param {Object} query - Query parameters
140
- * @param {Object} opts - Additional options
141
- */
142
- export const getOrganisationBusinesses = (
143
- organisationId: string,
144
- query?: Object = {},
145
- opts?: MedipassRequestOpts = {}
146
- ): Promise<Object> => {
147
- doesParamExist({ organisationId }, opts.hyperMediaEndpoint);
148
- return request({ ...opts, path: pathOrganisationBusiness(organisationId) }, { method: 'get', params: query });
149
- };
150
-
151
- /**
152
- * Update businesses
153
- * @param {String} businessId - Business ID
154
- * @param {Object} body - Request body
155
- * @param {Object} opts - Additional options
156
- */
157
- export const updateBusiness = (businessId: string, body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
158
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
159
- return request({ ...opts, path: pathBusiness(businessId) }, { method: 'put', data: body });
160
- };
161
-
162
- /**
163
- * Verify Medicare
164
- * @param {String} businessId - Business ID
165
- * @param {Object} body - Request body
166
- * @param {Object} opts - Additional options
167
- */
168
- export const verifyMedicare = (businessId: string, body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
169
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
170
- return request({ ...opts, path: pathVerifyMedicare(businessId) }, { method: 'post', data: body });
171
- };
172
-
173
- /**
174
- * Old verify DVA - This can be removed once we migrate to the new medicare service
175
- * @param {String} businessId - Business ID
176
- * @param {Object} body - Request body
177
- * @param {Object} opts - Additional options
178
- */
179
- export const oldVerifyDVA = (businessId: string, body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
180
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
181
- return request({ ...opts, path: oldPathVerifyDVA(businessId) }, { method: 'post', data: body });
182
- };
183
-
184
- /**
185
- * Verify DVA
186
- * @param {String} businessId - Business ID
187
- * @param {Object} body - Request body
188
- * @param {Object} opts - Additional options
189
- */
190
- export const verifyDVA = (businessId: string, body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
191
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
192
- return request({ ...opts, path: pathVerifyDVA(businessId) }, { method: 'post', data: body });
193
- };
194
-
195
- /**
196
- * Verify icare
197
- * @param {String} businessId - Business ID
198
- * @param {Object} body - Request body
199
- * @param {Object} opts - Additional options
200
- */
201
- export const verifyIcare = (businessId: string, body: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
202
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
203
- return request({ ...opts, path: pathVerifyIcare(businessId) }, { method: 'post', data: body });
204
- };
205
-
206
- /**
207
- * Verify Comcare claim number
208
- * @param {String} businessId - Business ID
209
- * @param {String} staffId - Staff ID
210
- * @param {String} providerSetItemId - Provider set item ID
211
- * @param {Object} body - Request body
212
- * @param {Object} opts - Additional options
213
- */
214
- export const verifyComcare = (
215
- businessId: string,
216
- staffId: string,
217
- providerSetItemId: string,
218
- body: Object,
219
- opts?: MedipassRequestOpts = {}
220
- ): Promise<Object> => {
221
- doesParamExist({ businessId, staffId, providerSetItemId }, opts.hyperMediaEndpoint);
222
- return request(
223
- { ...opts, path: pathVerifyComcare(businessId, staffId, providerSetItemId) },
224
- { method: 'post', data: body }
225
- );
226
- };
227
-
228
- /**
229
- * Create business support note
230
- * @param {String} businessId - Business ID
231
- * @param {Object} body - Request body
232
- * @param {Object} opts - Additional options
233
- */
234
- export const createSupportNote = (
235
- businessId: string,
236
- body: Object,
237
- opts?: MedipassRequestOpts = {}
238
- ): Promise<Object> => {
239
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
240
- return request({ ...opts, path: pathCreateSupportNote(businessId) }, { method: 'post', data: body });
241
- };
242
-
243
- /**
244
- * Get bank state branch (BSB) details
245
- * @param {String} businessId - Business ID
246
- * @param {Object} body - Request body
247
- * @param {Object} opts - Additional options
248
- */
249
- export const getBsbDetails = (businessId: string, query: Object, opts?: MedipassRequestOpts = {}): Promise<Object> => {
250
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
251
- return request({ ...opts, path: pathBsbDetails(businessId) }, { method: 'get', params: query });
252
- };
253
-
254
- /**
255
- * Send email to business
256
- * @param {Object} businessId - Business ID
257
- * @param {Object} body - Request body
258
- * @param {Object} opts - Additional options
259
- */
260
- export const sendBusinessEmail = (
261
- businessId: string,
262
- body: Object,
263
- opts?: MedipassRequestOpts = {}
264
- ): Promise<Object> => {
265
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
266
- return request({ ...opts, path: pathBusinessSendEmails(businessId) }, { method: 'post', data: body });
267
- };
@@ -1,76 +0,0 @@
1
- // @flow
2
- import doesParamExist from '../utils/does-param-exist';
3
- import request from '../utils/request';
4
- import type { MedipassRequestOpts } from '../_types';
5
-
6
- const pathBusinessClaimItems = businessId => `/businesses/${businessId}/claimitems`;
7
- const pathBusinessClaimItem = (businessId, claimItemId) => `/businesses/${businessId}/claimitems/${claimItemId}`;
8
- const pathHealthFundClaimItems = healthFundId => `/healthfunds/${healthFundId}/claimitems`;
9
- const pathHealthFundClaimItem = (healthFundId, claimItemId) => `/healthfunds/${healthFundId}/claimitems/${claimItemId}`;
10
-
11
- /**
12
- * Get business claim items
13
- * @param {String} businessId - Business ID
14
- * @param {Object} query - Query parameters
15
- * @param {Object} opts - Additional options
16
- */
17
- export const getBusinessClaimItems = async (
18
- businessId: string,
19
- query?: Object = {},
20
- opts?: MedipassRequestOpts = {}
21
- ): Promise<Object> => {
22
- doesParamExist({ businessId }, opts.hyperMediaEndpoint);
23
- return request({ ...opts, path: pathBusinessClaimItems(businessId) }, { method: 'get', params: query });
24
- };
25
-
26
- /**
27
- * Get business claim item
28
- * @param {String} businessId - Business ID
29
- * @param {String} claimItemId - Claim item ID
30
- * @param {Object} query - Query parameters
31
- * @param {Object} opts - Additional options
32
- */
33
- export const getBusinessClaimItem = async (
34
- businessId: string,
35
- claimItemId: string,
36
- query?: Object = {},
37
- opts?: MedipassRequestOpts = {}
38
- ): Promise<Object> => {
39
- doesParamExist({ businessId, claimItemId }, opts.hyperMediaEndpoint);
40
- return request({ ...opts, path: pathBusinessClaimItem(businessId, claimItemId) }, { method: 'get', params: query });
41
- };
42
-
43
- /**
44
- * Get health fund claim items
45
- * @param {String} healthFundId - Health fund ID
46
- * @param {Object} query - Query parameters
47
- * @param {Object} opts - Additional options
48
- */
49
- export const getHealthFundClaimItems = async (
50
- healthFundId: string,
51
- query?: Object = {},
52
- opts?: MedipassRequestOpts = {}
53
- ): Promise<Object> => {
54
- doesParamExist({ healthFundId }, opts.hyperMediaEndpoint);
55
- return request({ ...opts, path: pathHealthFundClaimItems(healthFundId) }, { method: 'get', params: query });
56
- };
57
-
58
- /**
59
- * Get health fund claim item
60
- * @param {String} healthFundId - Health fund ID
61
- * @param {String} claimItemId - Health fund ID
62
- * @param {Object} query - Query parameters
63
- * @param {Object} opts - Additional options
64
- */
65
- export const getHealthFundClaimItem = async (
66
- healthFundId: string,
67
- claimItemId: string,
68
- query?: Object = {},
69
- opts?: MedipassRequestOpts = {}
70
- ): Promise<Object> => {
71
- doesParamExist({ healthFundId, claimItemId }, opts.hyperMediaEndpoint);
72
- return request(
73
- { ...opts, path: pathHealthFundClaimItem(healthFundId, claimItemId) },
74
- { method: 'get', params: query }
75
- );
76
- };