@natch-the-storage/heathershaw-platform-types 1.21.5 → 1.22.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.
@@ -312,15 +312,79 @@ export interface OrderAddress {
312
312
  address: Address;
313
313
  deliveryInstructions?: string;
314
314
  }
315
- export interface ChargeOrder {
315
+ /** Mimics the cardFields in the API, this is what the card field names should look like on the frontend */
316
+ export interface PaymentCardDetails {
316
317
  cardNumber: string;
317
318
  cardHolder: string;
318
319
  cardExpiry: string;
319
320
  cvv: string;
320
321
  customerIp?: string;
321
- orderUpdate?: Omit<OrderUpdate, 'id' | 'directUserProfileId' | 'partnerPharmacyProfileId' | 'patientRecordId'>;
322
- patientRecordUpdate?: Omit<PatientRecordUpdate, 'id'>;
323
- isStaff?: boolean;
322
+ }
323
+ /** Links to chargeUpdateFields in the API */
324
+ type chargeUpdateFields = {
325
+ orderUpdate?: Omit<OrderUpdate, 'id' | 'directUserProfileId' | 'partnerPharmacyProfileId' | 'patientRecordId' | 'paymentStatus' | 'paymentLinkToken' | 'paymentReferenceId'>;
326
+ patientRecordUpdate?: Pick<PatientRecordUpdate, 'addresses' | 'healthInfo'>;
327
+ };
328
+ /** Links to chargeOrderBodySchema in the API */
329
+ export type ScaSessionBodySchema = PaymentCardDetails;
330
+ /** Used for new ScaSession API endpoint, is the expected request body */
331
+ export type ScaSessionBody = {
332
+ amount: number;
333
+ patientRecordId: number;
334
+ cardNumber: string;
335
+ cardHolder: string;
336
+ cardExpiry: string;
337
+ cvv: string;
338
+ customerIp?: string;
339
+ };
340
+ /** Used for ChargeAndCreateOrder endpoint, for new payment flow */
341
+ export type ChargeAndCreateOrderBody = {
342
+ order: OrderCreate;
343
+ cardToken: string;
344
+ sca: ScaResult;
345
+ cardType?: string;
346
+ customerIp?: string;
347
+ };
348
+ /** Links to scaResultSchema in the API */
349
+ export type ScaResult = {
350
+ xid?: string | null;
351
+ cavv?: string | null;
352
+ par?: string | null;
353
+ ver?: string | null;
354
+ aav?: string | null;
355
+ ucaf?: string | null;
356
+ directoryServerTxnId?: string | null;
357
+ threedsVersion?: string | null;
358
+ };
359
+ export interface ChargeOrderLegacy {
360
+ cardNumber: string;
361
+ cardHolder: string;
362
+ cardExpiry: string;
363
+ cvv: string;
364
+ customerIp?: string;
365
+ }
366
+ /** Links to chargeOrderBodySchema in the API */
367
+ export type ChargeOrder = chargeUpdateFields & {
368
+ cardToken: string;
369
+ sca: ScaResult;
370
+ cardType?: string;
371
+ customerIp?: string;
372
+ };
373
+ /** Links to chargeOrderMotoBodySchema in the API */
374
+ export type ChargeOrderMotoBody = chargeUpdateFields & PaymentCardDetails;
375
+ /** Links to the openScaSession function in the API
376
+ * Is the shape of the response
377
+ */
378
+ export interface ScaSessionResponse {
379
+ accessToken: string;
380
+ verification: string;
381
+ cardToken: string;
382
+ cardType?: string;
383
+ reference: string;
384
+ amount: number;
385
+ currency: string;
386
+ username: string;
387
+ environment: string;
324
388
  }
325
389
  export interface PaperScriptReminder {
326
390
  id: number;
@@ -1223,7 +1287,16 @@ export declare const ApiRoutes: {
1223
1287
  createPaymentLinkToken: string;
1224
1288
  getByPaymentLinkToken: (token: string) => string;
1225
1289
  chargePaymentLink: (token: string) => string;
1290
+ /** Old chargeOrder flow */
1226
1291
  chargeOrder: (id: string) => string;
1292
+ paymentLinkScaSession: (token: string) => string;
1293
+ /** DEPRECATED Sca Session route for old payment flow */
1294
+ internalScaSession: (id: number) => string;
1295
+ adminMoto: (id: number) => string;
1296
+ /** New Sca Session route for updated payment flow */
1297
+ scaSession: string;
1298
+ /** New charge and create route for updated payment flow */
1299
+ chargeAndCreateOrder: string;
1227
1300
  };
1228
1301
  paperScriptReminders: {
1229
1302
  list: string;
@@ -504,7 +504,16 @@ export const ApiRoutes = {
504
504
  createPaymentLinkToken: '/api/orders/payment-links',
505
505
  getByPaymentLinkToken: (token) => `/api/orders/payment-links/${token}`,
506
506
  chargePaymentLink: (token) => `/api/orders/payment-links/${token}/charge`,
507
+ /** Old chargeOrder flow */
507
508
  chargeOrder: (id) => `/api/orders/${id}/charge`,
509
+ paymentLinkScaSession: (token) => `/api/orders/payment-links/${token}/sca-session`,
510
+ /** DEPRECATED Sca Session route for old payment flow */
511
+ internalScaSession: (id) => `/api/orders/${id}/sca-session`,
512
+ adminMoto: (id) => `/api/orders/${id}/charge/moto`,
513
+ /** New Sca Session route for updated payment flow */
514
+ scaSession: `/api/orders/sca-session`,
515
+ /** New charge and create route for updated payment flow */
516
+ chargeAndCreateOrder: `/api/orders/charge-and-create`,
508
517
  },
509
518
  paperScriptReminders: {
510
519
  list: '/api/paper-script-reminders',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natch-the-storage/heathershaw-platform-types",
3
- "version": "1.21.5",
3
+ "version": "1.22.1",
4
4
  "description": "Interfaces and routes to use on the client",
5
5
  "license": "ISC",
6
6
  "author": "Natch Surana",