oro-sdk-apis 1.8.5 → 1.11.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,4 +1,4 @@
1
- import { PracticeAccount, Uuid } from '../models';
1
+ import { ConsultRequestMetadata, PracticeAccount, Uuid } from '../models';
2
2
  import { Assignment, PlanType, Practice, PracticeConfigKind, PracticeConfigs, PracticeInvoice, PracticePayment, PracticePaymentIntent, PracticePlan, PracticePlanPrices, PracticeWorkflow, PracticeWorkflowWithTagSpecialty, Practitioner, PractitionerLicense, PractitionerPreference, PractitionerQuota, PractitionerRole, WorkflowType } from '../models/practice';
3
3
  import { APIService } from './api';
4
4
  export declare class PracticeService {
@@ -62,7 +62,18 @@ export declare class PracticeService {
62
62
  * @returns a hashed email
63
63
  */
64
64
  getPaymentIntentHashedEmail(email: string): string;
65
- practiceCreatePaymentsIntent(practiceUuid: Uuid, planId: number, userEmail: string, isoLocality?: string, url_subdomain?: string, promotionCode?: string): Promise<PracticePaymentIntent>;
65
+ /**
66
+ * Creates a PracticePaymentIntent
67
+ * @param practiceUuid the uuid of the practice
68
+ * @param planId the plan id to use
69
+ * @param userEmail the email address of the user
70
+ * @param isoLocality (optional) the desired locality
71
+ * @param url_subdomain (optional) the url of the sub domain (@bruno-morel need you to document that)
72
+ * @param promotionCode (optional) promotion code to apply
73
+ * @param consultRequest (optional) consult request to use. If defined, when payment service call our hooks in practice, it will try to create a consult with these infos.
74
+ * @returns
75
+ */
76
+ practiceCreatePaymentsIntent(practiceUuid: Uuid, planId: number, userEmail: string, isoLocality?: string, url_subdomain?: string, promotionCode?: string, consultRequest?: ConsultRequestMetadata): Promise<PracticePaymentIntent>;
66
77
  practiceGetPaymentsIntent(practiceUuid: Uuid, paymentIntentId: number): Promise<PracticePaymentIntent>;
67
78
  practiceUpdatePaymentsIntent(practiceUuid: string, idPraticePaymentIntent: number, practicePaymentIntent: PracticePaymentIntent, userEmail: string, promotionCode?: string): Promise<PracticePaymentIntent>;
68
79
  /**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.5",
2
+ "version": "1.11.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -44,6 +44,7 @@ export interface WhoAmIResponse {
44
44
  export interface IdentityCreateRequest {
45
45
  practiceUuid: Uuid
46
46
  email: string
47
+ emailConfirmed?: boolean //In any env that aren't production, you can skip the email verification. Useful to write tests for instance.
47
48
  password: Base64String
48
49
  publicKey: Base64String
49
50
  recoveryPassword: Base64String
@@ -149,6 +149,7 @@ export type PracticeConfigPractitionerChatbox = PracticeConfig<
149
149
  {
150
150
  planAddedMessage?: { [languageISO639_3: string]: string }
151
151
  planUpdatedMessage?: { [languageISO639_3: string]: string }
152
+ examsUpdatedMessage?: { [languageISO639_3: string]: string }
152
153
  }
153
154
  >
154
155
 
@@ -290,6 +291,16 @@ export interface PracticePaymentIntent {
290
291
  dateUpdateAt?: Date
291
292
  }
292
293
 
294
+ /**
295
+ * This interface is used as metadata when creating Stripe Invoice.
296
+ * It will be used to create the consult when stripe use our hook.
297
+ */
298
+ export interface ConsultRequestMetadata {
299
+ tagSpecialtyRequired: string
300
+ isoLocalityRequired?: string
301
+ isoLanguageRequired: string
302
+ }
303
+
293
304
  export interface Assignment {
294
305
  id?: number ///optional for insertion
295
306
  uuidPractice: string
@@ -427,4 +438,4 @@ export interface PracticeInvoice {
427
438
  subtotal: number
428
439
  currency: string
429
440
  discount: number
430
- }
441
+ }
@@ -1,6 +1,6 @@
1
1
  import { Buffer } from 'buffer/'
2
2
  import { sha256 } from 'hash.js'
3
- import { PracticeAccount, Uuid } from '../models'
3
+ import { ConsultRequestMetadata, PracticeAccount, Uuid } from '../models'
4
4
  import {
5
5
  Assignment,
6
6
  PlanType,
@@ -178,13 +178,25 @@ export class PracticeService {
178
178
  return Buffer.from(sha256().update(email.toLowerCase()).digest('hex'), 'hex').toString('base64')
179
179
  }
180
180
 
181
+ /**
182
+ * Creates a PracticePaymentIntent
183
+ * @param practiceUuid the uuid of the practice
184
+ * @param planId the plan id to use
185
+ * @param userEmail the email address of the user
186
+ * @param isoLocality (optional) the desired locality
187
+ * @param url_subdomain (optional) the url of the sub domain (@bruno-morel need you to document that)
188
+ * @param promotionCode (optional) promotion code to apply
189
+ * @param consultRequest (optional) consult request to use. If defined, when payment service call our hooks in practice, it will try to create a consult with these infos.
190
+ * @returns
191
+ */
181
192
  public practiceCreatePaymentsIntent(
182
193
  practiceUuid: Uuid,
183
194
  planId: number,
184
195
  userEmail: string,
185
196
  isoLocality?: string,
186
197
  url_subdomain?: string,
187
- promotionCode?: string
198
+ promotionCode?: string,
199
+ consultRequest?: ConsultRequestMetadata
188
200
  ): Promise<PracticePaymentIntent> {
189
201
  return this.api.post<PracticePaymentIntent>(
190
202
  `${this.baseURL}/v1/practices/${practiceUuid}/payments/intents/`,
@@ -192,6 +204,7 @@ export class PracticeService {
192
204
  idPlan: planId,
193
205
  hashUserEmail: userEmail ? this.getPaymentIntentHashedEmail(userEmail) : undefined,
194
206
  isoLocality,
207
+ consultRequest,
195
208
  },
196
209
  { params: { url_subdomain, promotionCode } }
197
210
  )
@@ -225,12 +238,9 @@ export class PracticeService {
225
238
  * @param practiceUuid UUID of the practice to get the invoice from
226
239
  * @param invoiceId ID of the invoice in stripe
227
240
  */
228
- public getInvoice(
229
- practiceUuid: Uuid,
230
- invoiceId: string
231
- ): Promise<PracticeInvoice> {
241
+ public getInvoice(practiceUuid: Uuid, invoiceId: string): Promise<PracticeInvoice> {
232
242
  return this.api.get<PracticeInvoice>(
233
- `${this.baseURL}/v1/practices/${practiceUuid}/payments/invoices/${invoiceId}`,
243
+ `${this.baseURL}/v1/practices/${practiceUuid}/payments/invoices/${invoiceId}`
234
244
  )
235
245
  }
236
246
 
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 ORO Health Inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.