@@ -386,53 +386,92 @@ export const createABHAAddress = async (abhaAddress) => {
386
386
}
387
387
}
388
388
389
- export const searchHealthId = async ( healthId ) => {
389
+ export const searchAbhaAddress = async ( abhaAddress ) => {
390
390
const data = {
391
- "healthId " : healthId
391
+ "abhaAddress " : abhaAddress
392
392
} ;
393
393
try {
394
- const response = await axios . post ( Constants . hipServiceUrl + Constants . searchHealthId , data , Constants . headers ) ;
394
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . searchAbhaAddress , data , Constants . headers ) ;
395
395
return response ;
396
396
}
397
397
catch ( error ) {
398
- if ( error . response !== undefined )
399
- return error . response . data ;
400
- else
401
- return Constants . serviceUnavailableError ;
398
+ return parseAPIError ( error ) ;
402
399
}
403
400
}
404
-
405
- export const healthIdAuthInit = async ( healthId , authMode ) => {
401
+ export const abhaAddressRequestOtp = async ( abhaAddress , authMode ) => {
406
402
const data = {
407
- "healthId " : healthId ,
403
+ "abhaAddress " : abhaAddress ,
408
404
"authMethod" : authMode ,
409
405
} ;
410
406
try {
411
- const response = await axios . post ( Constants . hipServiceUrl + Constants . healthIdAuthInit , data , Constants . headers ) ;
407
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . abhaAddressVerificationRequestOtp , data , Constants . headers ) ;
412
408
return response ;
413
409
}
414
410
catch ( error ) {
415
- if ( error . response !== undefined )
416
- return error . response . data ;
417
- else
418
- return Constants . serviceUnavailableError ;
411
+ return parseAPIError ( error ) ;
419
412
}
420
413
} ;
421
414
422
- export const healthIdConfirmOtp = async ( otp , authMode ) => {
415
+ export const abhaAddressVerifyOtp = async ( otp ) => {
423
416
const data = {
424
417
"otp" : otp ,
418
+ } ;
419
+ try {
420
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . abhaAddressVerificationVerifyOtp , data , Constants . headers ) ;
421
+ return response ;
422
+ }
423
+ catch ( error ) {
424
+ return parseAPIError ( error ) ;
425
+ }
426
+ } ;
427
+
428
+ export const getAbhaAddressProfile = async ( ) => {
429
+ try {
430
+ const response = await axios . get ( Constants . hipServiceUrl + Constants . abhaAddressVerificationGetProfile , Constants . headers ) ;
431
+ return response ;
432
+ }
433
+ catch ( error ) {
434
+ return parseAPIError ( error ) ;
435
+ }
436
+ } ;
437
+
438
+ export const getAbhaAddresCard = async ( ) => {
439
+ try {
440
+ const response = await axios . get ( Constants . hipServiceUrl + Constants . abhaAddressVerificationGetCard , {
441
+ responseType : 'arraybuffer'
442
+ } ) ;
443
+ return response ;
444
+ }
445
+ catch ( error ) {
446
+ return parseAPIError ( error ) ;
447
+ }
448
+ }
449
+
450
+
451
+ export const abhaNumberRequestOtp = async ( abhaNumber , authMode ) => {
452
+ const data = {
453
+ "abhaNumber" : abhaNumber ,
425
454
"authMethod" : authMode ,
426
455
} ;
427
456
try {
428
- const response = await axios . post ( Constants . hipServiceUrl + Constants . healthIdConfirmOtp , data , Constants . headers ) ;
457
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . verificationRequestOtp , data , Constants . headers ) ;
429
458
return response ;
430
459
}
431
460
catch ( error ) {
432
- if ( error . response !== undefined )
433
- return error . response . data ;
434
- else
435
- return Constants . serviceUnavailableError ;
461
+ return parseAPIError ( error ) ;
462
+ }
463
+ } ;
464
+
465
+ export const abhaNumberVerifyOtp = async ( otp ) => {
466
+ const data = {
467
+ "otp" : otp ,
468
+ } ;
469
+ try {
470
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . verificationVerifyOtp , data , Constants . headers ) ;
471
+ return response ;
472
+ }
473
+ catch ( error ) {
474
+ return parseAPIError ( error ) ;
436
475
}
437
476
} ;
438
477
@@ -464,17 +503,14 @@ export const updateHealthId = async (healthId) => {
464
503
465
504
export const mobileGenerateOtp = async ( mobileNumber ) => {
466
505
const data = {
467
- "mobile " : mobileNumber
506
+ "mobileNumber " : mobileNumber
468
507
} ;
469
508
try {
470
- const response = await axios . post ( Constants . hipServiceUrl + Constants . generateMobileOtp , data , Constants . headers ) ;
509
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . verificationRequestOtp , data , Constants . headers ) ;
471
510
return response ;
472
511
}
473
512
catch ( error ) {
474
- if ( error . response !== undefined )
475
- return error . response . data ;
476
- else
477
- return Constants . serviceUnavailableError ;
513
+ return parseAPIError ( error ) ;
478
514
}
479
515
} ;
480
516
@@ -484,30 +520,34 @@ export const mobileVerifyOtp = async (otp) => {
484
520
"otp" : otp
485
521
} ;
486
522
try {
487
- const response = await axios . post ( Constants . hipServiceUrl + Constants . verifyMobileOtp , data , Constants . headers ) ;
523
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . verificationVerifyOtp , data , Constants . headers ) ;
488
524
return response ;
489
525
}
490
526
catch ( error ) {
491
- if ( error . response !== undefined )
492
- return error . response . data ;
493
- else
494
- return Constants . serviceUnavailableError ;
527
+ return parseAPIError ( error ) ;
495
528
}
496
529
} ;
497
530
498
- export const getPatientProfile = async ( healthId ) => {
531
+ export const verifyAbhaAccount = async ( abhaNumber ) => {
499
532
const data = {
500
- "healthId " : healthId
533
+ "abhaNumber " : abhaNumber
501
534
} ;
502
535
try {
503
- const response = await axios . post ( Constants . hipServiceUrl + Constants . getPatientProfileInfo , data , Constants . headers ) ;
536
+ const response = await axios . post ( Constants . hipServiceUrl + Constants . verifyAbhaAccount , data , Constants . headers ) ;
504
537
return response ;
505
538
}
506
539
catch ( error ) {
507
- if ( error . response !== undefined )
508
- return error . response . data ;
509
- else
510
- return Constants . serviceUnavailableError ;
540
+ return parseAPIError ( error ) ;
541
+ }
542
+ } ;
543
+
544
+ export const getPatientProfile = async ( ) => {
545
+ try {
546
+ const response = await axios . get ( Constants . hipServiceUrl + Constants . getPatientProfileInfo , Constants . headers ) ;
547
+ return response ;
548
+ }
549
+ catch ( error ) {
550
+ return parseAPIError ( error ) ;
511
551
}
512
552
} ;
513
553
0 commit comments