Search in sources :

Example 6 with GatewayResponse

use of org.hisp.dhis.sms.outbound.GatewayResponse in project dhis2-core by dhis2.

the class SmsGateway method wrapHttpStatus.

public OutboundMessageResponse wrapHttpStatus(HttpStatus httpStatus) {
    GatewayResponse gatewayResponse;
    OutboundMessageResponse status = new OutboundMessageResponse();
    if (OK_CODES.contains(httpStatus)) {
        gatewayResponse = GATEWAY_RESPONSE_MAP.get(httpStatus);
        status.setOk(true);
    } else {
        gatewayResponse = GATEWAY_RESPONSE_MAP.getOrDefault(httpStatus, GatewayResponse.FAILED);
        status.setOk(false);
    }
    status.setResponseObject(gatewayResponse);
    status.setDescription(gatewayResponse.getResponseMessage());
    return status;
}
Also used : GatewayResponse(org.hisp.dhis.sms.outbound.GatewayResponse) OutboundMessageResponse(org.hisp.dhis.outboundmessage.OutboundMessageResponse)

Aggregations

GatewayResponse (org.hisp.dhis.sms.outbound.GatewayResponse)6 OutboundMessageResponse (org.hisp.dhis.outboundmessage.OutboundMessageResponse)5 OutboundMessageResponseSummary (org.hisp.dhis.outboundmessage.OutboundMessageResponseSummary)2