@medipass/web-sdk 11.38.1-feature-eclipse-reporting.0 → 11.38.1-feature-typescript-claudia.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.
- package/.eslintrc.cjs +95 -0
- package/babel.config.js +2 -1
- package/lib/index.d.ts +262 -0
- package/lib/index.js +83 -3
- package/lib/{regions-7b23080d.js → regions-a0a28864.js} +2 -2
- package/lib/resources/accounts.d.ts +215 -0
- package/lib/resources/accounts.js +3 -3
- package/lib/resources/actions.d.ts +13 -0
- package/lib/resources/actions.js +3 -3
- package/lib/resources/api-keys.d.ts +24 -0
- package/lib/resources/api-keys.js +3 -3
- package/lib/resources/applications.d.ts +31 -0
- package/lib/resources/applications.js +3 -3
- package/lib/resources/attachments.d.ts +32 -0
- package/lib/resources/attachments.js +3 -3
- package/lib/resources/auth.d.ts +59 -0
- package/lib/resources/auth.js +3 -3
- package/lib/resources/bulk-submits.d.ts +17 -0
- package/lib/resources/bulk-submits.js +3 -3
- package/lib/resources/bulk-uploads.d.ts +26 -0
- package/lib/resources/bulk-uploads.js +3 -3
- package/lib/resources/business-profiles.d.ts +18 -0
- package/lib/resources/business-profiles.js +3 -3
- package/lib/resources/businesses.d.ts +132 -0
- package/lib/resources/businesses.js +3 -3
- package/lib/resources/claim-items.d.ts +31 -0
- package/lib/resources/claim-items.js +3 -3
- package/lib/resources/devices.d.ts +11 -0
- package/lib/resources/devices.js +3 -3
- package/lib/resources/doc-accounts.d.ts +32 -0
- package/lib/resources/doc-accounts.js +3 -3
- package/lib/resources/documents.d.ts +90 -0
- package/lib/resources/documents.js +3 -3
- package/lib/resources/emails.d.ts +14 -0
- package/lib/resources/emails.js +3 -3
- package/lib/resources/form-application-templates.d.ts +20 -0
- package/lib/resources/form-application-templates.js +3 -3
- package/lib/resources/form-applications.d.ts +27 -0
- package/lib/resources/form-applications.js +3 -3
- package/lib/resources/forms.d.ts +100 -0
- package/lib/resources/forms.js +3 -3
- package/lib/resources/funder-services.d.ts +8 -0
- package/lib/resources/funder-services.js +3 -3
- package/lib/resources/funder-settings.d.ts +8 -0
- package/lib/resources/funder-settings.js +3 -3
- package/lib/resources/funders.d.ts +5 -0
- package/lib/resources/funders.js +3 -3
- package/lib/resources/futures.d.ts +85 -0
- package/lib/resources/futures.js +3 -3
- package/lib/resources/health-fund-accounts.d.ts +78 -0
- package/lib/resources/health-fund-accounts.js +3 -3
- package/lib/resources/health-fund-settings.d.ts +39 -0
- package/lib/resources/health-fund-settings.js +3 -3
- package/lib/resources/healthfunds.d.ts +64 -0
- package/lib/resources/healthfunds.js +3 -3
- package/lib/resources/icditems.d.ts +14 -0
- package/lib/resources/icditems.js +3 -3
- package/lib/resources/invoice-scans.d.ts +26 -0
- package/lib/resources/invoice-scans.js +3 -3
- package/lib/resources/jhcs.d.ts +7 -0
- package/lib/resources/jhcs.js +3 -3
- package/lib/resources/kyc.d.ts +109 -0
- package/lib/resources/kyc.js +3 -3
- package/lib/resources/logs.d.ts +16 -0
- package/lib/resources/logs.js +3 -3
- package/lib/resources/members.d.ts +92 -0
- package/lib/resources/members.js +3 -3
- package/lib/resources/message-mappings.d.ts +9 -0
- package/lib/resources/message-mappings.js +3 -3
- package/lib/resources/minions.d.ts +40 -0
- package/lib/resources/minions.js +3 -3
- package/lib/resources/modalities.d.ts +19 -0
- package/lib/resources/modalities.js +3 -3
- package/lib/resources/notes.d.ts +17 -0
- package/lib/resources/notes.js +3 -3
- package/lib/resources/onboarding-applications.d.ts +52 -0
- package/lib/resources/onboarding-applications.js +3 -3
- package/lib/resources/onboarding-requests.d.ts +39 -0
- package/lib/resources/onboarding-requests.js +3 -3
- package/lib/resources/ops.d.ts +60 -0
- package/lib/resources/ops.js +3 -3
- package/lib/resources/organisations.d.ts +7 -0
- package/lib/resources/organisations.js +3 -3
- package/lib/resources/partners.d.ts +50 -0
- package/lib/resources/partners.js +3 -3
- package/lib/resources/patients.d.ts +44 -0
- package/lib/resources/patients.js +3 -3
- package/lib/resources/payments.d.ts +155 -0
- package/lib/resources/payments.js +3 -3
- package/lib/resources/pms.d.ts +43 -0
- package/lib/resources/pms.js +3 -3
- package/lib/resources/practice-profiles.d.ts +20 -0
- package/lib/resources/practice-profiles.js +3 -3
- package/lib/resources/practice-types.d.ts +6 -0
- package/lib/resources/practice-types.js +3 -3
- package/lib/resources/practices.d.ts +137 -0
- package/lib/resources/practices.js +3 -3
- package/lib/resources/products.d.ts +23 -0
- package/lib/resources/products.js +3 -3
- package/lib/resources/professional-categories.d.ts +23 -0
- package/lib/resources/professional-categories.js +3 -3
- package/lib/resources/provider-number-types.d.ts +16 -0
- package/lib/resources/provider-number-types.js +3 -3
- package/lib/resources/provider-registration-types.d.ts +15 -0
- package/lib/resources/provider-registration-types.js +3 -3
- package/lib/resources/provider-requests.d.ts +17 -0
- package/lib/resources/provider-requests.js +3 -3
- package/lib/resources/provider-types.d.ts +6 -0
- package/lib/resources/provider-types.js +3 -3
- package/lib/resources/ref-sources.d.ts +6 -0
- package/lib/resources/ref-sources.js +3 -3
- package/lib/resources/risk.d.ts +13 -0
- package/lib/resources/risk.js +3 -3
- package/lib/resources/rnas.d.ts +43 -0
- package/lib/resources/rnas.js +3 -3
- package/lib/resources/roles.d.ts +7 -0
- package/lib/resources/roles.js +3 -3
- package/lib/resources/self-checkout-sessions.d.ts +134 -0
- package/lib/resources/self-checkout-sessions.js +3 -3
- package/lib/resources/services.d.ts +88 -0
- package/lib/resources/services.js +3 -3
- package/lib/resources/settlements.d.ts +37 -0
- package/lib/resources/settlements.js +3 -3
- package/lib/resources/sign-up.d.ts +5 -0
- package/lib/resources/sign-up.js +3 -3
- package/lib/resources/specialties.d.ts +23 -0
- package/lib/resources/specialties.js +3 -3
- package/lib/resources/staff-profiles.d.ts +20 -0
- package/lib/resources/staff-profiles.js +3 -3
- package/lib/resources/staff.d.ts +242 -0
- package/lib/resources/staff.js +3 -3
- package/lib/resources/statistics.d.ts +56 -0
- package/lib/resources/statistics.js +3 -3
- package/lib/resources/subscriptions.d.ts +32 -0
- package/lib/resources/subscriptions.js +3 -3
- package/lib/resources/terminals.d.ts +71 -0
- package/lib/resources/terminals.js +3 -3
- package/lib/resources/transaction-export.d.ts +18 -0
- package/lib/resources/transaction-export.js +3 -3
- package/lib/resources/transactions.d.ts +466 -0
- package/lib/resources/transactions.js +3 -3
- package/lib/resources/triggers.d.ts +20 -0
- package/lib/resources/triggers.js +3 -3
- package/lib/resources/vendors.d.ts +9 -0
- package/lib/resources/vendors.js +3 -3
- package/lib/resources/verify.d.ts +9 -0
- package/lib/resources/verify.js +3 -3
- package/lib/resources/workers.d.ts +3 -0
- package/lib/resources/workers.js +3 -3
- package/lib/resources/workflow-exceptions.d.ts +5 -0
- package/lib/resources/workflow-exceptions.js +3 -3
- package/lib/services/aws.d.ts +54 -0
- package/lib/services/aws.js +3 -3
- package/lib/services/storage.d.ts +28 -0
- package/lib/services/storage.js +126 -18
- package/lib/services/version.d.ts +21 -0
- package/lib/services/version.js +3 -3
- package/lib/{staff-1ec3d500.js → staff-96febcd8.js} +345 -738
- package/lib/types/documents.d.ts +115 -0
- package/lib/types/documents.js +2 -0
- package/lib/types/forms.d.ts +67 -0
- package/lib/types/forms.js +2 -0
- package/lib/types/index.d.ts +42 -0
- package/lib/types/index.js +2 -0
- package/lib/types/message-mappings.d.ts +18 -0
- package/lib/types/message-mappings.js +2 -0
- package/lib/types/notes.d.ts +5 -0
- package/lib/types/notes.js +2 -0
- package/lib/types/products.d.ts +34 -0
- package/lib/types/products.js +2 -0
- package/lib/types/professional-categories.d.ts +20 -0
- package/lib/types/professional-categories.js +2 -0
- package/lib/types/specialties.d.ts +22 -0
- package/lib/types/specialties.js +2 -0
- package/lib/types/subscriptions.d.ts +52 -0
- package/lib/types/subscriptions.js +2 -0
- package/lib/utils/application.d.ts +1 -0
- package/lib/utils/application.js +3 -3
- package/lib/utils/base-urls/core.d.ts +19 -0
- package/lib/utils/base-urls/index.d.ts +37 -0
- package/lib/utils/base-urls/risk.d.ts +17 -0
- package/lib/utils/does-param-exist.d.ts +2 -0
- package/lib/utils/get-axios-error.d.ts +2 -0
- package/lib/utils/param-error.d.ts +3 -0
- package/lib/utils/professions.d.ts +3 -0
- package/lib/utils/professions.js +3 -3
- package/lib/utils/regions.d.ts +1 -0
- package/lib/utils/regions.js +2 -2
- package/lib/utils/request.d.ts +3 -0
- package/lib/utils/request.js +3 -3
- package/lib/utils/staff.d.ts +8 -0
- package/lib/utils/staff.js +3 -3
- package/package.json +19 -9
- package/tsconfig.json +33 -0
- package/.eslintrc +0 -3
- package/lib/_types/documents.js.flow +0 -118
- package/lib/_types/forms.js.flow +0 -57
- package/lib/_types/index.js.flow +0 -47
- package/lib/_types/message-mappings.js.flow +0 -22
- package/lib/_types/notes.js.flow +0 -7
- package/lib/_types/products.js.flow +0 -40
- package/lib/_types/professional-categories.js.flow +0 -25
- package/lib/_types/specialties.js.flow +0 -27
- package/lib/_types/subscriptions.js.flow +0 -58
- package/lib/index.js.flow +0 -438
- package/lib/resources/accounts.js.flow +0 -445
- package/lib/resources/actions.js.flow +0 -25
- package/lib/resources/api-keys.js.flow +0 -54
- package/lib/resources/applications.js.flow +0 -60
- package/lib/resources/attachments.js.flow +0 -75
- package/lib/resources/auth.js.flow +0 -185
- package/lib/resources/bulk-submits.js.flow +0 -43
- package/lib/resources/bulk-uploads.js.flow +0 -56
- package/lib/resources/business-profiles.js.flow +0 -45
- package/lib/resources/businesses.js.flow +0 -267
- package/lib/resources/claim-items.js.flow +0 -76
- package/lib/resources/devices.js.flow +0 -64
- package/lib/resources/doc-accounts.js.flow +0 -61
- package/lib/resources/documents.js.flow +0 -216
- package/lib/resources/emails.js.flow +0 -96
- package/lib/resources/form-application-templates.js.flow +0 -52
- package/lib/resources/form-applications.js.flow +0 -62
- package/lib/resources/forms.js.flow +0 -222
- package/lib/resources/funder-services.js.flow +0 -17
- package/lib/resources/funder-settings.js.flow +0 -58
- package/lib/resources/funders.js.flow +0 -15
- package/lib/resources/futures.js.flow +0 -154
- package/lib/resources/health-fund-accounts.js.flow +0 -198
- package/lib/resources/health-fund-settings.js.flow +0 -104
- package/lib/resources/healthfunds.js.flow +0 -139
- package/lib/resources/icditems.js.flow +0 -36
- package/lib/resources/invoice-scans.js.flow +0 -56
- package/lib/resources/jhcs.js.flow +0 -20
- package/lib/resources/kyc.js.flow +0 -216
- package/lib/resources/logs.js.flow +0 -32
- package/lib/resources/members.js.flow +0 -196
- package/lib/resources/message-mappings.js.flow +0 -25
- package/lib/resources/minions.js.flow +0 -96
- package/lib/resources/modalities.js.flow +0 -46
- package/lib/resources/notes.js.flow +0 -112
- package/lib/resources/onboarding-applications.js.flow +0 -142
- package/lib/resources/onboarding-requests.js.flow +0 -97
- package/lib/resources/ops.js.flow +0 -116
- package/lib/resources/organisations.js.flow +0 -15
- package/lib/resources/partners.js.flow +0 -118
- package/lib/resources/patients.js.flow +0 -102
- package/lib/resources/payments.js.flow +0 -523
- package/lib/resources/pms.js.flow +0 -102
- package/lib/resources/practice-profiles.js.flow +0 -51
- package/lib/resources/practice-types.js.flow +0 -14
- package/lib/resources/practices.js.flow +0 -314
- package/lib/resources/products.js.flow +0 -48
- package/lib/resources/professional-categories.js.flow +0 -56
- package/lib/resources/provider-number-types.js.flow +0 -32
- package/lib/resources/provider-registration-types.js.flow +0 -32
- package/lib/resources/provider-requests.js.flow +0 -46
- package/lib/resources/provider-types.js.flow +0 -14
- package/lib/resources/ref-sources.js.flow +0 -16
- package/lib/resources/risk.js.flow +0 -29
- package/lib/resources/rnas.js.flow +0 -108
- package/lib/resources/roles.js.flow +0 -12
- package/lib/resources/self-checkout-sessions.js.flow +0 -382
- package/lib/resources/services.js.flow +0 -219
- package/lib/resources/settlements.js.flow +0 -97
- package/lib/resources/sign-up.js.flow +0 -15
- package/lib/resources/specialties.js.flow +0 -46
- package/lib/resources/staff-profiles.js.flow +0 -51
- package/lib/resources/staff.js.flow +0 -583
- package/lib/resources/statistics.js.flow +0 -147
- package/lib/resources/subscriptions.js.flow +0 -81
- package/lib/resources/terminals.js.flow +0 -161
- package/lib/resources/transaction-export.js.flow +0 -48
- package/lib/resources/transactions.js.flow +0 -1097
- package/lib/resources/triggers.js.flow +0 -36
- package/lib/resources/vendors.js.flow +0 -28
- package/lib/resources/verify.js.flow +0 -14
- package/lib/resources/workers.js.flow +0 -10
- package/lib/resources/workflow-exceptions.js.flow +0 -17
- package/lib/services/__mocks__/storage.js.flow +0 -30
- package/lib/services/aws.js.flow +0 -339
- package/lib/services/storage.js.flow +0 -92
- package/lib/services/version.js.flow +0 -73
- package/lib/storage-4b403caa.js +0 -1300
- package/lib/utils/application.js.flow +0 -23
- package/lib/utils/base-urls/core.js.flow +0 -18
- package/lib/utils/base-urls/index.js.flow +0 -7
- package/lib/utils/base-urls/risk.js.flow +0 -16
- package/lib/utils/does-param-exist.js.flow +0 -23
- package/lib/utils/get-axios-error.js.flow +0 -8
- package/lib/utils/param-error.js.flow +0 -8
- package/lib/utils/professions.js.flow +0 -66
- package/lib/utils/regions.js.flow +0 -21
- package/lib/utils/request.js.flow +0 -36
- package/lib/utils/staff.js.flow +0 -81
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
import braintreeClient from 'braintree-web/client';
|
|
3
|
-
import braintreeGooglePayment from 'braintree-web/google-payment';
|
|
4
|
-
import braintreeApplePay from 'braintree-web/apple-pay';
|
|
5
|
-
import pify from '@medipass/pify';
|
|
6
|
-
import env from '@medipass/utils/get-env';
|
|
7
|
-
import { ERROR_MESSAGES, PAYMENT_PROVIDERS } from '@medipass/utils/constants';
|
|
8
|
-
import * as sentry from '@medipass/utils/sentry';
|
|
9
|
-
import _get from 'lodash/get';
|
|
10
|
-
|
|
11
|
-
import request from '../utils/request';
|
|
12
|
-
import doesParamExist from '../utils/does-param-exist';
|
|
13
|
-
import * as patients from './patients';
|
|
14
|
-
|
|
15
|
-
import type { MedipassRequestOpts } from '../_types';
|
|
16
|
-
|
|
17
|
-
const PATH__PAYMENTS = '/payments';
|
|
18
|
-
const pathAccountPaymentMethods = accountId => `/accounts/${accountId}/paymentmethods`;
|
|
19
|
-
const pathAccountPaymentMethod = (accountId, paymentMethodId) =>
|
|
20
|
-
`/accounts/${accountId}/paymentmethods/${paymentMethodId}`;
|
|
21
|
-
const pathBusinessPaymentsClientTokens = businessId => `/businesses/${businessId}/payments/clienttoken`;
|
|
22
|
-
const pathBusinessPaymentMethods = businessId => `/businesses/${businessId}/paymentmethods`;
|
|
23
|
-
const pathBusinessPaymentMethod = (businessId, paymentMethodId) =>
|
|
24
|
-
`/businesses/${businessId}/paymentmethods/${paymentMethodId}`;
|
|
25
|
-
const pathBusinessPatientPaymentMethods = (businessId, patientId) =>
|
|
26
|
-
`/businesses/${businessId}/patients/${patientId}/paymentmethods`;
|
|
27
|
-
const pathBusinessPatientPaymentMethodsByRefId = (businessId, refId) =>
|
|
28
|
-
`/businesses/${businessId}/patients/refid/${refId}/paymentmethods`;
|
|
29
|
-
const pathBusinessPatientPaymentMethod = (businessId, patientId, paymentMethodId) =>
|
|
30
|
-
`/businesses/${businessId}/patients/${patientId}/paymentmethods/${paymentMethodId}`;
|
|
31
|
-
const pathBusinessSalesClientToken = businessId => `/businesses/${businessId}/sales/clienttoken`;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Create an account's payment method
|
|
35
|
-
* @param {String} accountId - Account ID
|
|
36
|
-
* @param {Object} opts - Additional options
|
|
37
|
-
* @returns {Object} The device data
|
|
38
|
-
*/
|
|
39
|
-
export const createAccountPaymentMethod = async (
|
|
40
|
-
accountId: string,
|
|
41
|
-
nonce: string,
|
|
42
|
-
source: string,
|
|
43
|
-
opts?: MedipassRequestOpts = {}
|
|
44
|
-
): Promise<Object> => {
|
|
45
|
-
doesParamExist({ accountId, nonce, source }, opts.hyperMediaEndpoint);
|
|
46
|
-
return request({ ...opts, path: pathAccountPaymentMethods(accountId) }, { method: 'post', data: { nonce, source } });
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Get a business' payment methods
|
|
51
|
-
* @param {String} businessId - Business ID
|
|
52
|
-
* @param {Object} opts - Additional options
|
|
53
|
-
* @returns {Object} The device data
|
|
54
|
-
*/
|
|
55
|
-
export const createBusinessPaymentMethod = async (
|
|
56
|
-
businessId: string,
|
|
57
|
-
nonce: string,
|
|
58
|
-
source: string,
|
|
59
|
-
opts?: MedipassRequestOpts = {}
|
|
60
|
-
): Promise<Object> => {
|
|
61
|
-
doesParamExist({ businessId, nonce, source }, opts.hyperMediaEndpoint);
|
|
62
|
-
return request(
|
|
63
|
-
{ ...opts, path: pathBusinessPaymentMethods(businessId) },
|
|
64
|
-
{ method: 'post', data: { nonce, source } }
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Create a business patient payment method
|
|
70
|
-
* @param {String} accountId - Account ID
|
|
71
|
-
* @param {String} patientId - Patient ID
|
|
72
|
-
* @param {Object} opts - Additional options
|
|
73
|
-
* @returns {Object} The device data
|
|
74
|
-
*/
|
|
75
|
-
export const createBusinessPatientPaymentMethod = async (
|
|
76
|
-
businessId: string,
|
|
77
|
-
patientId: string,
|
|
78
|
-
nonce: string,
|
|
79
|
-
source: string,
|
|
80
|
-
opts?: MedipassRequestOpts = {}
|
|
81
|
-
): Promise<Object> => {
|
|
82
|
-
doesParamExist({ businessId, patientId, nonce, source }, opts.hyperMediaEndpoint);
|
|
83
|
-
return request(
|
|
84
|
-
{ ...opts, path: pathBusinessPatientPaymentMethods(businessId, patientId) },
|
|
85
|
-
{ method: 'post', data: { nonce, source } }
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Delete an account's payment method
|
|
91
|
-
* @param {String} accountId - Account ID
|
|
92
|
-
* @param {String} paymentMethodId - Account ID
|
|
93
|
-
* @param {Object} opts - Additional options
|
|
94
|
-
* @returns {Object} The device data
|
|
95
|
-
*/
|
|
96
|
-
export const deleteAccountPaymentMethod = async (
|
|
97
|
-
accountId: string,
|
|
98
|
-
paymentMethodId: string,
|
|
99
|
-
opts?: MedipassRequestOpts = {}
|
|
100
|
-
): Promise<Object> => {
|
|
101
|
-
doesParamExist({ accountId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
102
|
-
return request({ ...opts, path: pathAccountPaymentMethod(accountId, paymentMethodId) }, { method: 'delete' });
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Delete a business' payment method
|
|
107
|
-
* @param {String} businessId - Business ID
|
|
108
|
-
* @param {String} paymentMethodId - Payment Method ID
|
|
109
|
-
* @param {Object} opts - Additional options
|
|
110
|
-
* @returns {Object} The device data
|
|
111
|
-
*/
|
|
112
|
-
export const deleteBusinessPaymentMethod = async (
|
|
113
|
-
businessId: string,
|
|
114
|
-
paymentMethodId: string,
|
|
115
|
-
opts?: MedipassRequestOpts = {}
|
|
116
|
-
): Promise<Object> => {
|
|
117
|
-
doesParamExist({ businessId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
118
|
-
return request({ ...opts, path: pathBusinessPaymentMethod(businessId, paymentMethodId) }, { method: 'delete' });
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Delete a business patient payment method
|
|
123
|
-
* @param {String} businessId - Business ID
|
|
124
|
-
* @param {String} patientId - Patient ID
|
|
125
|
-
* @param {String} paymentMethodId - Payment Method ID
|
|
126
|
-
* @param {Object} opts - Additional options
|
|
127
|
-
* @returns {Object} The device data
|
|
128
|
-
*/
|
|
129
|
-
export const deleteBusinessPatientPaymentMethod = async (
|
|
130
|
-
businessId: string,
|
|
131
|
-
patientId: string,
|
|
132
|
-
paymentMethodId: string,
|
|
133
|
-
opts?: MedipassRequestOpts = {}
|
|
134
|
-
): Promise<Object> => {
|
|
135
|
-
doesParamExist({ businessId, patientId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
136
|
-
return request(
|
|
137
|
-
{ ...opts, path: pathBusinessPatientPaymentMethod(businessId, patientId, paymentMethodId) },
|
|
138
|
-
{ method: 'delete' }
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Get an account's payment methods
|
|
144
|
-
* @param {String} accountId - Account ID
|
|
145
|
-
* @param {Object} opts - Additional options
|
|
146
|
-
* @returns {Object} The device data
|
|
147
|
-
*/
|
|
148
|
-
export const getAccountPaymentMethods = async (accountId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
|
|
149
|
-
doesParamExist({ accountId }, opts.hyperMediaEndpoint);
|
|
150
|
-
return request({ ...opts, path: pathAccountPaymentMethods(accountId) }, { method: 'get' });
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Get a business' payment methods
|
|
155
|
-
* @param {String} businessId - Business ID
|
|
156
|
-
* @param {Object} opts - Additional options
|
|
157
|
-
* @returns {Object} The device data
|
|
158
|
-
*/
|
|
159
|
-
export const getBusinessPaymentMethods = async (
|
|
160
|
-
businessId: string,
|
|
161
|
-
opts?: MedipassRequestOpts = {}
|
|
162
|
-
): Promise<Object> => {
|
|
163
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
164
|
-
return request({ ...opts, path: pathBusinessPaymentMethods(businessId) }, { method: 'get' });
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Get a business patient payment methods
|
|
169
|
-
* @param {String} businessId - Business ID
|
|
170
|
-
* @param {Object} opts - Additional options
|
|
171
|
-
* @returns {Object} The payment methods data
|
|
172
|
-
*/
|
|
173
|
-
export const getBusinessPatientPaymentMethods = async (
|
|
174
|
-
businessId: string,
|
|
175
|
-
patientId: string,
|
|
176
|
-
opts?: MedipassRequestOpts = {}
|
|
177
|
-
): Promise<Object> => {
|
|
178
|
-
doesParamExist({ businessId, patientId }, opts.hyperMediaEndpoint);
|
|
179
|
-
return request({ ...opts, path: pathBusinessPatientPaymentMethods(businessId, patientId) }, { method: 'get' });
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Get a business patient payment methods by ref id
|
|
184
|
-
* @param {String} businessId - Business ID
|
|
185
|
-
* @param {String} refId - Patient ref ID
|
|
186
|
-
* @param {Object} opts - Additional options
|
|
187
|
-
* @returns {Object} The payment methods data
|
|
188
|
-
*/
|
|
189
|
-
export const getBusinessPatientPaymentMethodsByRefId = async (
|
|
190
|
-
businessId: string,
|
|
191
|
-
refId: string,
|
|
192
|
-
opts?: MedipassRequestOpts = {}
|
|
193
|
-
): Promise<Object> => {
|
|
194
|
-
doesParamExist({ businessId, refId }, opts.hyperMediaEndpoint);
|
|
195
|
-
|
|
196
|
-
return request({ ...opts, path: pathBusinessPatientPaymentMethodsByRefId(businessId, refId) }, { method: 'get' });
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Get an account's payment method
|
|
201
|
-
* @param {String} accountId - Account ID
|
|
202
|
-
* @param {String} paymentMethodId - Account ID
|
|
203
|
-
* @param {Object} opts - Additional options
|
|
204
|
-
* @returns {Object} The device data
|
|
205
|
-
*/
|
|
206
|
-
export const getAccountPaymentMethod = async (
|
|
207
|
-
accountId: string,
|
|
208
|
-
paymentMethodId: string,
|
|
209
|
-
opts?: MedipassRequestOpts = {}
|
|
210
|
-
): Promise<Object> => {
|
|
211
|
-
doesParamExist({ accountId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
212
|
-
return request({ ...opts, path: pathAccountPaymentMethod(accountId, paymentMethodId) }, { method: 'get' });
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Get a business payment method
|
|
217
|
-
* @param {String} businessId - Business ID
|
|
218
|
-
* @param {String} paymentMethodId - Payment Method ID
|
|
219
|
-
* @param {Object} opts - Additional options
|
|
220
|
-
* @returns {Object} The device data
|
|
221
|
-
*/
|
|
222
|
-
export const getBusinessPaymentMethod = async (
|
|
223
|
-
businessId: string,
|
|
224
|
-
paymentMethodId: string,
|
|
225
|
-
opts?: MedipassRequestOpts = {}
|
|
226
|
-
): Promise<Object> => {
|
|
227
|
-
doesParamExist({ businessId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
228
|
-
return request({ ...opts, path: pathBusinessPaymentMethod(businessId, paymentMethodId) }, { method: 'get' });
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Get a business patient payment method
|
|
233
|
-
* @param {String} businessId - Business ID
|
|
234
|
-
* @param {String} patientID - Patient ID
|
|
235
|
-
* @param {String} paymentMethodId - Payment Method ID
|
|
236
|
-
* @param {Object} opts - Additional options
|
|
237
|
-
* @returns {Object} The device data
|
|
238
|
-
*/
|
|
239
|
-
export const getBusinessPatientPaymentMethod = async (
|
|
240
|
-
businessId: string,
|
|
241
|
-
patientId: string,
|
|
242
|
-
paymentMethodId: string,
|
|
243
|
-
opts?: MedipassRequestOpts = {}
|
|
244
|
-
): Promise<Object> => {
|
|
245
|
-
doesParamExist({ businessId, patientId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
246
|
-
return request(
|
|
247
|
-
{ ...opts, path: pathBusinessPatientPaymentMethod(businessId, patientId, paymentMethodId) },
|
|
248
|
-
{ method: 'get' }
|
|
249
|
-
);
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Get business client token
|
|
254
|
-
* @param {String} businessId - Business ID
|
|
255
|
-
* @param {String} source - Source of payment
|
|
256
|
-
* @param {Object} opts - Additional options
|
|
257
|
-
* @returns {Object} The device data
|
|
258
|
-
*/
|
|
259
|
-
export const getBusinessClientToken = async (
|
|
260
|
-
businessId: string,
|
|
261
|
-
source: string,
|
|
262
|
-
opts?: MedipassRequestOpts = {}
|
|
263
|
-
): Promise<Object> => {
|
|
264
|
-
doesParamExist({ businessId, source }, opts.hyperMediaEndpoint);
|
|
265
|
-
return request(
|
|
266
|
-
{ ...opts, path: pathBusinessPaymentsClientTokens(businessId) },
|
|
267
|
-
{ method: 'get', params: { source } }
|
|
268
|
-
);
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Get business sales client token
|
|
273
|
-
* @param {String} businessId - Business ID
|
|
274
|
-
* @param {Object} opts - Additional options
|
|
275
|
-
* @returns {Object} The device data
|
|
276
|
-
*/
|
|
277
|
-
export const getBusinessSalesClientToken = async (
|
|
278
|
-
businessId: string,
|
|
279
|
-
opts?: MedipassRequestOpts = {}
|
|
280
|
-
): Promise<Object> => {
|
|
281
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
282
|
-
return request({ ...opts, path: pathBusinessSalesClientToken(businessId) }, { method: 'get' });
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* Get client token
|
|
287
|
-
* @param {String} source - Source of payment
|
|
288
|
-
* @param {Object} opts - Additional options
|
|
289
|
-
* @returns {Object} The device data
|
|
290
|
-
*/
|
|
291
|
-
export const getClientToken = async (
|
|
292
|
-
source: string,
|
|
293
|
-
opts?: MedipassRequestOpts = { tokenType: 'account' }
|
|
294
|
-
): Promise<Object> => {
|
|
295
|
-
doesParamExist({ source }, opts.hyperMediaEndpoint);
|
|
296
|
-
return request(
|
|
297
|
-
{ ...opts, path: `${PATH__PAYMENTS}/clienttoken` },
|
|
298
|
-
{ method: 'get', params: { source }, tokenType: opts.tokenType }
|
|
299
|
-
);
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
* Update an account's payment method
|
|
304
|
-
* @param {String} accountId - Account ID
|
|
305
|
-
* @param {String} paymentMethodId - Account ID
|
|
306
|
-
* @param {Object} opts - Additional options
|
|
307
|
-
* @returns {Object} The device data
|
|
308
|
-
*/
|
|
309
|
-
export const updateAccountPaymentMethod = async (
|
|
310
|
-
accountId: string,
|
|
311
|
-
paymentMethodId: string,
|
|
312
|
-
body: Object,
|
|
313
|
-
opts?: MedipassRequestOpts = {}
|
|
314
|
-
): Promise<Object> => {
|
|
315
|
-
doesParamExist({ accountId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
316
|
-
return request(
|
|
317
|
-
{ ...opts, path: pathAccountPaymentMethod(accountId, paymentMethodId) },
|
|
318
|
-
{ data: body, method: 'put' }
|
|
319
|
-
);
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Update a business' payment method
|
|
324
|
-
* @param {String} businessId - Business ID
|
|
325
|
-
* @param {String} paymentMethodId - Account ID
|
|
326
|
-
* @param {Object} opts - Additional options
|
|
327
|
-
* @returns {Object} The device data
|
|
328
|
-
*/
|
|
329
|
-
export const updateBusinessPaymentMethod = async (
|
|
330
|
-
businessId: string,
|
|
331
|
-
paymentMethodId: string,
|
|
332
|
-
body: Object,
|
|
333
|
-
opts?: MedipassRequestOpts = {}
|
|
334
|
-
): Promise<Object> => {
|
|
335
|
-
doesParamExist({ businessId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
336
|
-
return request(
|
|
337
|
-
{ ...opts, path: pathBusinessPaymentMethod(businessId, paymentMethodId) },
|
|
338
|
-
{ data: body, method: 'put' }
|
|
339
|
-
);
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Update a business patient payment method
|
|
344
|
-
* @param {String} businessId - Business ID
|
|
345
|
-
* @param {String} paymentMethodId - Account ID
|
|
346
|
-
* @param {Object} opts - Additional options
|
|
347
|
-
* @returns {Object} The device data
|
|
348
|
-
*/
|
|
349
|
-
export const updateBusinessPatientPaymentMethod = async (
|
|
350
|
-
businessId: string,
|
|
351
|
-
patientId: string,
|
|
352
|
-
paymentMethodId: string,
|
|
353
|
-
body: Object,
|
|
354
|
-
opts?: MedipassRequestOpts = {}
|
|
355
|
-
): Promise<Object> => {
|
|
356
|
-
doesParamExist({ businessId, patientId, paymentMethodId }, opts.hyperMediaEndpoint);
|
|
357
|
-
return request(
|
|
358
|
-
{ ...opts, path: pathBusinessPatientPaymentMethod(businessId, patientId, paymentMethodId) },
|
|
359
|
-
{ data: body, method: 'put' }
|
|
360
|
-
);
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
//////////////////////////////////////////////////////////////
|
|
364
|
-
|
|
365
|
-
export const getPaymentGatewayError = (sessionResponse: Object) => {
|
|
366
|
-
if (sessionResponse && sessionResponse.status === 'fields_in_error') {
|
|
367
|
-
return ERROR_MESSAGES.PAYMENT_GATEWAY_FIELDS;
|
|
368
|
-
} else if (sessionResponse && sessionResponse.status === 'system_error') {
|
|
369
|
-
sentry.logError(sessionResponse);
|
|
370
|
-
return ERROR_MESSAGES.PAYMENT_GATEWAY_ERROR;
|
|
371
|
-
}
|
|
372
|
-
return null;
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Get a business nonce
|
|
377
|
-
* @param {Object} body - Request body
|
|
378
|
-
* @param {Object} opts - Additional options
|
|
379
|
-
*/
|
|
380
|
-
export const getNonce = async (
|
|
381
|
-
{
|
|
382
|
-
amount,
|
|
383
|
-
businessId,
|
|
384
|
-
cardNumber: _cardNumber,
|
|
385
|
-
expiry,
|
|
386
|
-
cvc,
|
|
387
|
-
paymentProvider = PAYMENT_PROVIDERS.PAYMENT_CARD,
|
|
388
|
-
isSales = true,
|
|
389
|
-
isSelfCheckoutSession,
|
|
390
|
-
source = 'mastercard'
|
|
391
|
-
}: Object,
|
|
392
|
-
opts?: MedipassRequestOpts = {}
|
|
393
|
-
): Promise<Object> => {
|
|
394
|
-
const cardNumber = _cardNumber ? _cardNumber.replace(/\s/g, '') : '';
|
|
395
|
-
const cardExpiryMonth = expiry ? expiry.split('/')[0].trim() : '';
|
|
396
|
-
const cardExpiryYear = expiry ? expiry.split('/')[1].trim() : '';
|
|
397
|
-
const cardSecurityCode = cvc;
|
|
398
|
-
|
|
399
|
-
let clientToken;
|
|
400
|
-
if (businessId && isSales) {
|
|
401
|
-
// $FlowFixMe
|
|
402
|
-
clientToken = await getBusinessSalesClientToken(businessId, isSelfCheckoutSession ? { tokenType: 'session' } : {});
|
|
403
|
-
} else if (businessId) {
|
|
404
|
-
// $FlowFixMe
|
|
405
|
-
clientToken = await getBusinessClientToken(
|
|
406
|
-
businessId,
|
|
407
|
-
source,
|
|
408
|
-
isSelfCheckoutSession ? { tokenType: 'session' } : {}
|
|
409
|
-
);
|
|
410
|
-
} else {
|
|
411
|
-
// $FlowFixMe
|
|
412
|
-
clientToken = await getClientToken(source, isSelfCheckoutSession ? { tokenType: 'session' } : {});
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (!clientToken.source) clientToken.source = source;
|
|
416
|
-
|
|
417
|
-
if (clientToken.source === 'mastercard') {
|
|
418
|
-
// $FlowFixMe
|
|
419
|
-
const paymentSession = HostedForm; // eslint-disable-line no-undef
|
|
420
|
-
if (!paymentSession) {
|
|
421
|
-
throw new Error(ERROR_MESSAGES.PAYMENT_GATEWAY_ERROR);
|
|
422
|
-
}
|
|
423
|
-
paymentSession.setMerchant(clientToken.merchantId);
|
|
424
|
-
const updateSessionResponse = await pify(paymentSession.updateSession, { errorFirst: false })(
|
|
425
|
-
clientToken.clientToken,
|
|
426
|
-
{
|
|
427
|
-
cardNumber,
|
|
428
|
-
cardExpiryMonth,
|
|
429
|
-
cardExpiryYear,
|
|
430
|
-
cardSecurityCode
|
|
431
|
-
}
|
|
432
|
-
);
|
|
433
|
-
if (getPaymentGatewayError(updateSessionResponse)) {
|
|
434
|
-
throw new Error(getPaymentGatewayError(updateSessionResponse));
|
|
435
|
-
}
|
|
436
|
-
return {
|
|
437
|
-
...clientToken,
|
|
438
|
-
nonce: clientToken.clientToken,
|
|
439
|
-
sourceResponse: updateSessionResponse
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
if (clientToken.source === 'braintree') {
|
|
443
|
-
const clientInstance = await braintreeClient.create({ authorization: clientToken.clientToken });
|
|
444
|
-
let sourceResponse = {};
|
|
445
|
-
|
|
446
|
-
if (paymentProvider === PAYMENT_PROVIDERS.PAYMENT_CARD) {
|
|
447
|
-
sourceResponse = await clientInstance.request({
|
|
448
|
-
endpoint: 'payment_methods/credit_cards',
|
|
449
|
-
method: 'post',
|
|
450
|
-
data: {
|
|
451
|
-
creditCard: {
|
|
452
|
-
number: cardNumber,
|
|
453
|
-
expirationDate: `${cardExpiryMonth}/${cardExpiryYear}`,
|
|
454
|
-
cvv: cvc,
|
|
455
|
-
options: {
|
|
456
|
-
validate: false
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
return {
|
|
462
|
-
...clientToken,
|
|
463
|
-
nonce: _get(sourceResponse, 'creditCards[0].nonce'),
|
|
464
|
-
sourceResponse: sourceResponse
|
|
465
|
-
};
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
if (paymentProvider === PAYMENT_PROVIDERS.GOOGLE_PAY && amount && _get(window, 'google.payments.api')) {
|
|
469
|
-
const paymentsClient = new window.google.payments.api.PaymentsClient({
|
|
470
|
-
environment: env.ENV_NAME === 'prod' || env.ENV_NAME === 'pre-prod' ? 'PRODUCTION' : 'TEST'
|
|
471
|
-
});
|
|
472
|
-
const googlePaymentInstance = await braintreeGooglePayment.create({
|
|
473
|
-
client: clientInstance,
|
|
474
|
-
googlePayVersion: 2,
|
|
475
|
-
googleMerchantId: env.GOOGLE_MERCHANT_ID
|
|
476
|
-
});
|
|
477
|
-
const response = await paymentsClient.isReadyToPay({
|
|
478
|
-
apiVersion: 2,
|
|
479
|
-
apiVersionMinor: 0,
|
|
480
|
-
allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods
|
|
481
|
-
});
|
|
482
|
-
if (response.result) {
|
|
483
|
-
const paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
|
|
484
|
-
transactionInfo: {
|
|
485
|
-
currencyCode: 'AUD',
|
|
486
|
-
totalPriceStatus: 'FINAL',
|
|
487
|
-
totalPrice: amount.replace('$', '')
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
const cardPaymentMethod = paymentDataRequest.allowedPaymentMethods[0];
|
|
491
|
-
cardPaymentMethod.parameters.billingAddressRequired = false;
|
|
492
|
-
|
|
493
|
-
const paymentData = await paymentsClient.loadPaymentData(paymentDataRequest);
|
|
494
|
-
sourceResponse = await googlePaymentInstance.parseResponse(paymentData);
|
|
495
|
-
|
|
496
|
-
return {
|
|
497
|
-
...clientToken,
|
|
498
|
-
nonce: sourceResponse.nonce,
|
|
499
|
-
sourceResponse: sourceResponse
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
if (paymentProvider === PAYMENT_PROVIDERS.APPLE_PAY) {
|
|
504
|
-
const applePayInstance = await braintreeApplePay.create({ client: clientInstance });
|
|
505
|
-
const paymentRequest = applePayInstance.createPaymentRequest({
|
|
506
|
-
total: {
|
|
507
|
-
label: 'Medipass Payment',
|
|
508
|
-
amount: amount.replace('$', '')
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
const canMakeApplePayment = await window.ApplePaySession.canMakePaymentsWithActiveCard(
|
|
512
|
-
applePayInstance.merchantIdentifier
|
|
513
|
-
);
|
|
514
|
-
return {
|
|
515
|
-
...clientToken,
|
|
516
|
-
applePayInstance,
|
|
517
|
-
canMakeApplePayment,
|
|
518
|
-
paymentRequest
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
return clientToken;
|
|
523
|
-
};
|
|
@@ -1,102 +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
|
-
const pathBusinessPmsPractices = businessId => `/businesses/${businessId}/pmspractices`;
|
|
8
|
-
const pathBusinessPmsServices = businessId => `/businesses/${businessId}/pmsservices`;
|
|
9
|
-
const pathBusinessPmsStaffMembers = businessId => `/businesses/${businessId}/pmsstaff`;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Get business PMS practices
|
|
13
|
-
* @param {String} businessId - Business ID
|
|
14
|
-
* @param {String} query - Query parameters
|
|
15
|
-
* @param {Object} opts - Additional options
|
|
16
|
-
*/
|
|
17
|
-
export const getBusinessPMSPractices = async (
|
|
18
|
-
businessId: string,
|
|
19
|
-
query?: Object = {},
|
|
20
|
-
opts?: MedipassRequestOpts = {}
|
|
21
|
-
): Promise<Object> => {
|
|
22
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
23
|
-
return request({ ...opts, path: pathBusinessPmsPractices(businessId) }, { method: 'get', params: query });
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get business PMS services
|
|
28
|
-
* @param {String} businessId - Business ID
|
|
29
|
-
* @param {String} query - Query parameters
|
|
30
|
-
* @param {Object} opts - Additional options
|
|
31
|
-
*/
|
|
32
|
-
export const getBusinessPMSServices = async (
|
|
33
|
-
businessId: string,
|
|
34
|
-
query?: Object = {},
|
|
35
|
-
opts?: MedipassRequestOpts = {}
|
|
36
|
-
): Promise<Object> => {
|
|
37
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
38
|
-
return request({ ...opts, path: pathBusinessPmsServices(businessId) }, { method: 'get', params: query });
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Get business PMS staff
|
|
43
|
-
* @param {String} businessId - Business ID
|
|
44
|
-
* @param {String} query - Query parameters
|
|
45
|
-
* @param {Object} opts - Additional options
|
|
46
|
-
*/
|
|
47
|
-
export const getBusinessPMSStaffMembers = async (
|
|
48
|
-
businessId: string,
|
|
49
|
-
query?: Object = {},
|
|
50
|
-
opts?: MedipassRequestOpts = {}
|
|
51
|
-
): Promise<Object> => {
|
|
52
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
53
|
-
return request({ ...opts, path: pathBusinessPmsStaffMembers(businessId) }, { method: 'get', params: query });
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Import business PMS practice
|
|
58
|
-
* @param {String} businessId - Business ID
|
|
59
|
-
* @param {String} body - Request body
|
|
60
|
-
* @param {Object} opts - Additional options
|
|
61
|
-
*/
|
|
62
|
-
export const importBusinessPMSPractice = async (
|
|
63
|
-
businessId: string,
|
|
64
|
-
body: Object,
|
|
65
|
-
opts?: MedipassRequestOpts = {}
|
|
66
|
-
): Promise<Object> => {
|
|
67
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
68
|
-
return request({ ...opts, path: `${pathBusinessPmsPractices(businessId)}/import` }, { method: 'post', data: body });
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Import business PMS service
|
|
73
|
-
* @param {String} businessId - Business ID
|
|
74
|
-
* @param {String} body - Request body
|
|
75
|
-
* @param {Object} opts - Additional options
|
|
76
|
-
*/
|
|
77
|
-
export const importBusinessPMSService = async (
|
|
78
|
-
businessId: string,
|
|
79
|
-
body: Object,
|
|
80
|
-
opts?: MedipassRequestOpts = {}
|
|
81
|
-
): Promise<Object> => {
|
|
82
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
83
|
-
return request({ ...opts, path: `${pathBusinessPmsServices(businessId)}/import` }, { method: 'post', data: body });
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Import business PMS staff member
|
|
88
|
-
* @param {String} businessId - Business ID
|
|
89
|
-
* @param {String} body - Request body
|
|
90
|
-
* @param {Object} opts - Additional options
|
|
91
|
-
*/
|
|
92
|
-
export const importBusinessPMSStaffMember = async (
|
|
93
|
-
businessId: string,
|
|
94
|
-
body: Object,
|
|
95
|
-
opts?: MedipassRequestOpts = {}
|
|
96
|
-
): Promise<Object> => {
|
|
97
|
-
doesParamExist({ businessId }, opts.hyperMediaEndpoint);
|
|
98
|
-
return request(
|
|
99
|
-
{ ...opts, path: `${pathBusinessPmsStaffMembers(businessId)}/import` },
|
|
100
|
-
{ method: 'post', data: body }
|
|
101
|
-
);
|
|
102
|
-
};
|
|
@@ -1,51 +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 pathLinkPracticeProfile = (practiceProfileId: string) => `/practiceprofiles/${practiceProfileId}/link`;
|
|
8
|
-
export const pathOrganisationPracticeProfiles = (organisationId: string) =>
|
|
9
|
-
`/organisations/${organisationId}/practiceprofiles`;
|
|
10
|
-
export const pathPracticeProfile = (practiceProfileId: string) => `/practiceprofiles/${practiceProfileId}`;
|
|
11
|
-
export const pathUnlinkPracticeProfile = (practiceProfileId: string) => `/practiceprofiles/${practiceProfileId}/unlink`;
|
|
12
|
-
|
|
13
|
-
type PracticeProfilesQuery = {
|
|
14
|
-
practiceId?: string,
|
|
15
|
-
unlinkedOnly?: boolean,
|
|
16
|
-
from?: string,
|
|
17
|
-
to?: string,
|
|
18
|
-
sort?: string,
|
|
19
|
-
searchText?: string,
|
|
20
|
-
page?: number,
|
|
21
|
-
limit?: number
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const getOrganisationPracticeProfiles = (
|
|
25
|
-
organisationId: string,
|
|
26
|
-
query?: PracticeProfilesQuery,
|
|
27
|
-
opts?: MedipassRequestOpts = {}
|
|
28
|
-
): Promise<Object> => {
|
|
29
|
-
doesParamExist({ organisationId }, opts.hyperMediaEndpoint);
|
|
30
|
-
return request({ ...opts, path: pathOrganisationPracticeProfiles(organisationId) }, { method: 'get', params: query });
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const getPracticeProfile = (practiceProfileId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
|
|
34
|
-
doesParamExist({ practiceProfileId }, opts.hyperMediaEndpoint);
|
|
35
|
-
return request({ ...opts, path: pathPracticeProfile(practiceProfileId) }, { method: 'get' });
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const linkPracticeProfile = (
|
|
39
|
-
practiceProfileId: string,
|
|
40
|
-
practiceId: string,
|
|
41
|
-
opts?: MedipassRequestOpts = {}
|
|
42
|
-
): Promise<Object> => {
|
|
43
|
-
doesParamExist({ practiceProfileId, practiceId }, opts.hyperMediaEndpoint);
|
|
44
|
-
const body = { practiceId };
|
|
45
|
-
return request({ ...opts, path: pathLinkPracticeProfile(practiceProfileId) }, { method: 'put', data: body });
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const unlinkPracticeProfile = (practiceProfileId: string, opts?: MedipassRequestOpts = {}): Promise<Object> => {
|
|
49
|
-
doesParamExist({ practiceProfileId }, opts.hyperMediaEndpoint);
|
|
50
|
-
return request({ ...opts, path: pathUnlinkPracticeProfile(practiceProfileId) }, { method: 'put' });
|
|
51
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
|
-
import request from '../utils/request';
|
|
4
|
-
import type { MedipassRequestOpts } from '../_types';
|
|
5
|
-
|
|
6
|
-
const PATH__PRACTICE_TYPES = '/practicetypes';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Get practice types
|
|
10
|
-
* @param {Object} opts - Additional options
|
|
11
|
-
*/
|
|
12
|
-
export const getPracticeTypes = async (opts?: MedipassRequestOpts = {}): Promise<Object> => {
|
|
13
|
-
return request({ ...opts, path: PATH__PRACTICE_TYPES }, { method: 'get' });
|
|
14
|
-
};
|