@medipass/checkout-sdk 3.0.0 → 3.1.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.
@@ -1,5 +1,6 @@
1
1
  import { ENVS } from './constants';
2
2
  interface UpdatePaymentDetailsBase {
3
+ appId?: string;
3
4
  patientRefId: string;
4
5
  env: typeof ENVS[keyof typeof ENVS];
5
6
  onSuccess: () => void;
@@ -7,6 +8,7 @@ interface UpdatePaymentDetailsBase {
7
8
  onCancel: () => void;
8
9
  onClose: () => void;
9
10
  callbackOrigin: string;
11
+ sendSms?: boolean;
10
12
  }
11
13
  interface UpdatePaymentDetailsWithApiKey extends UpdatePaymentDetailsBase {
12
14
  apiKey: string;
@@ -17,5 +19,5 @@ interface UpdatePaymentDetailsWithToken extends UpdatePaymentDetailsBase {
17
19
  apiKey?: never;
18
20
  }
19
21
  export type UpdatePaymentDetails = UpdatePaymentDetailsWithApiKey | UpdatePaymentDetailsWithToken;
20
- declare const updatePaymentDetails: ({ apiKey, token, patientRefId, env, onSuccess, onFailure, onCancel, onClose, callbackOrigin, }: UpdatePaymentDetails) => Promise<void>;
22
+ declare const updatePaymentDetails: ({ appId, apiKey, token, patientRefId, env, onSuccess, onFailure, onCancel, onClose, callbackOrigin, sendSms, }: UpdatePaymentDetails) => Promise<void>;
21
23
  export default updatePaymentDetails;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/checkout-sdk",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "Medipass Checkout SDK",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -8,6 +8,7 @@ if (!coreSDK.hasInit) {
8
8
  }
9
9
 
10
10
  interface UpdatePaymentDetailsBase {
11
+ appId?: string;
11
12
  patientRefId: string;
12
13
  env: typeof ENVS[keyof typeof ENVS];
13
14
  onSuccess: () => void;
@@ -15,6 +16,7 @@ interface UpdatePaymentDetailsBase {
15
16
  onCancel: () => void;
16
17
  onClose: () => void;
17
18
  callbackOrigin: string;
19
+ sendSms?: boolean;
18
20
  }
19
21
 
20
22
  interface UpdatePaymentDetailsWithApiKey extends UpdatePaymentDetailsBase {
@@ -30,6 +32,7 @@ interface UpdatePaymentDetailsWithToken extends UpdatePaymentDetailsBase {
30
32
  export type UpdatePaymentDetails = UpdatePaymentDetailsWithApiKey | UpdatePaymentDetailsWithToken;
31
33
 
32
34
  const updatePaymentDetails = async ({
35
+ appId,
33
36
  apiKey,
34
37
  token,
35
38
  patientRefId,
@@ -39,6 +42,7 @@ const updatePaymentDetails = async ({
39
42
  onCancel,
40
43
  onClose,
41
44
  callbackOrigin,
45
+ sendSms = true,
42
46
  }: UpdatePaymentDetails) => {
43
47
  if (!apiKey && !token) throw new Error(ERROR_MESSAGES.NO_API_KEY_OR_NO_TOKEN);
44
48
  if (!patientRefId) throw new Error(ERROR_MESSAGES.NO_PATIENT_REF_ID);
@@ -46,7 +50,7 @@ const updatePaymentDetails = async ({
46
50
  if (!callbackOrigin) throw new Error(ERROR_MESSAGES.NO_CALLBACK_ORIGIN);
47
51
 
48
52
  let isSessionComplete = false;
49
- const sdkConfig: { env: typeof ENVS[keyof typeof ENVS] | 'staging' } = { env };
53
+ const sdkConfig: { env: typeof ENVS[keyof typeof ENVS] | 'staging'; appId?: string } = { env };
50
54
  if (env === ENVS.LOCAL) {
51
55
  sdkConfig.env = ENVS.DEV;
52
56
  }
@@ -54,6 +58,10 @@ const updatePaymentDetails = async ({
54
58
  sdkConfig.env = 'staging';
55
59
  }
56
60
 
61
+ if (appId) {
62
+ sdkConfig.appId = appId;
63
+ }
64
+
57
65
  // Set Medipass web-sdk config
58
66
  coreSDK.setConfig(sdkConfig);
59
67
 
@@ -115,7 +123,7 @@ const updatePaymentDetails = async ({
115
123
  myBusinessId,
116
124
  patientId,
117
125
  {
118
- sms: { sendToPatientRecordMobile: false, mobile: patient.mobile },
126
+ ...(sendSms && { sms: { sendToPatientRecordMobile: false, mobile: patient.mobile } }),
119
127
  callbackOrigin: callbackOrigin,
120
128
  },
121
129
  );