Skip to content

Commit

Permalink
Dheeraj | Fix error response for SMS API (#165)
Browse files Browse the repository at this point in the history
* Dheeraj | Fix error response for SMS API

* Dheeraj | Fix Tests
  • Loading branch information
dheeraj-p committed Jan 20, 2021
1 parent b94e908 commit 5e7fe54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static in.projecteka.gateway.common.Constants.PATH_PATIENT_SHARE;
import static in.projecteka.gateway.common.Constants.X_CM_ID;
import static in.projecteka.gateway.common.Constants.X_HIP_ID;
import static in.projecteka.gateway.common.Constants.bridgeId;

@RestController
@AllArgsConstructor
Expand Down Expand Up @@ -66,7 +67,7 @@ public Mono<Void> sendSMSNotify(HttpEntity<String> requestEntity) {
.map(securityContext -> (Caller) securityContext.getAuthentication().getPrincipal())
.map(Caller::getClientId)
.flatMap(clientId ->
patientSMSNotifyRequestOrchestrator.handleThis(requestEntity, X_CM_ID, X_HIP_ID, clientId)
patientSMSNotifyRequestOrchestrator.handleThis(requestEntity, X_CM_ID, X_HIP_ID, bridgeId(clientId))
.subscriberContext(context -> context.put(API_CALLED, PATH_PATIENTS_SMS_NOTIFY)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import static in.projecteka.gateway.common.Constants.X_CM_ID;
import static in.projecteka.gateway.common.Constants.X_HIP_ID;
import static in.projecteka.gateway.common.Constants.bridgeId;
import static in.projecteka.gateway.common.Role.CM;
import static in.projecteka.gateway.common.Role.HIP;
import static in.projecteka.gateway.testcommon.TestBuilders.caller;
Expand Down Expand Up @@ -116,7 +117,7 @@ void shouldFireAndForgetForPatientProfileOnShare() {
void shouldFireAndForgetForHIPSmsNotification() {
var token = string();
var clientId = string();
when(patientSMSNotifyRequestOrchestrator.handleThis(any(), eq(X_CM_ID), eq(X_HIP_ID), eq(clientId))).thenReturn(empty());
when(patientSMSNotifyRequestOrchestrator.handleThis(any(), eq(X_CM_ID), eq(X_HIP_ID), eq(bridgeId(clientId)))).thenReturn(empty());
when(authenticator.verify(token))
.thenReturn(just(caller().clientId(clientId).roles(List.of(HIP)).build()));

Expand Down

0 comments on commit 5e7fe54

Please sign in to comment.