18
18
*/
19
19
package org .fineract .messagegateway .sms .api ;
20
20
21
+
21
22
import org .fineract .messagegateway .constants .MessageGatewayConstants ;
22
23
import org .fineract .messagegateway .exception .MessageGatewayException ;
23
24
import org .fineract .messagegateway .sms .data .DeliveryStatusData ;
25
+ import org .fineract .messagegateway .sms .domain .OutboundMessages ;
24
26
import org .fineract .messagegateway .sms .domain .SMSBridge ;
25
- import org .fineract .messagegateway .sms .domain .SMSMessage ;
26
27
import org .fineract .messagegateway .sms .exception .ProviderNotDefinedException ;
27
28
import org .fineract .messagegateway .sms .exception .SMSBridgeNotFoundException ;
28
- import org .fineract .messagegateway .sms .providers .SMSProvider ;
29
+ import org .fineract .messagegateway .sms .providers .Provider ;
29
30
import org .fineract .messagegateway .sms .providers .impl .telerivet .TelerivetMessageProvider ;
30
31
import org .fineract .messagegateway .sms .repository .SMSBridgeRepository ;
31
32
import org .fineract .messagegateway .sms .repository .SmsOutboundMessageRepository ;
@@ -76,7 +77,7 @@ public SmsApiResource(final SMSMessageService smsMessageService) {
76
77
@ RequestMapping (method = RequestMethod .POST , consumes = {"application/json" }, produces = {"application/json" })
77
78
public ResponseEntity <Void > sendShortMessages (@ RequestHeader (MessageGatewayConstants .TENANT_IDENTIFIER_HEADER ) final String tenantId ,
78
79
@ RequestHeader (MessageGatewayConstants .TENANT_APPKEY_HEADER ) final String appKey ,
79
- @ RequestBody final List <SMSMessage > payload ) {
80
+ @ RequestBody final List <OutboundMessages > payload ) {
80
81
logger .info ("Payload " + payload .get (0 ).getMessage ());
81
82
this .smsMessageService .sendShortMessage (tenantId , appKey , payload );
82
83
return new ResponseEntity <>(HttpStatus .ACCEPTED );
@@ -85,7 +86,7 @@ public ResponseEntity<Void> sendShortMessages(@RequestHeader(MessageGatewayConst
85
86
public ResponseEntity <Void > sendShortMessagesToProvider (@ RequestHeader (MessageGatewayConstants .TENANT_IDENTIFIER_HEADER ) final String tenantId ,
86
87
@ RequestHeader (MessageGatewayConstants .TENANT_APPKEY_HEADER ) final String appKey ,
87
88
@ RequestHeader (MessageGatewayConstants .X_ORCHESTRATOR ) final String orchestrator ,
88
- @ RequestBody final List <SMSMessage > payload ) {
89
+ @ RequestBody final List <OutboundMessages > payload ) {
89
90
logger .info ("Payload " + payload .get (0 ).getMessage ());
90
91
this .smsMessageService .sendShortMessageToProvider (tenantId , appKey , payload ,orchestrator );
91
92
return new ResponseEntity <>(HttpStatus .ACCEPTED );
@@ -101,13 +102,13 @@ public ResponseEntity<Collection<DeliveryStatusData>> getDeliveryStatus(@Request
101
102
logger .info ("Delivery status is still pending, fetching message status manually " );
102
103
SMSBridge bridge = smsBridgeRepository .findByIdAndTenantId (deliveryStatusData .getBridgeId (),
103
104
deliveryStatusData .getTenantId ());
104
- SMSProvider provider = null ;
105
+ Provider provider = null ;
105
106
try {
106
107
if (bridge == null ) {
107
108
throw new SMSBridgeNotFoundException (deliveryStatusData .getBridgeId ());
108
109
}
109
110
logger .info ("Finding provider for fetching message status....{}" , bridge .getProviderKey ());
110
- provider = (SMSProvider ) this .applicationContext .getBean (bridge .getProviderKey ());
111
+ provider = (Provider ) this .applicationContext .getBean (bridge .getProviderKey ());
111
112
if (provider == null )
112
113
throw new ProviderNotDefinedException ();
113
114
provider .updateStatusByMessageId (bridge , deliveryStatusData .getExternalId (),orchestrator );
@@ -124,11 +125,11 @@ public ResponseEntity<Collection<DeliveryStatusData>> getDeliveryStatus(@Request
124
125
125
126
}
126
127
@ RequestMapping (value = "/details/{internalId}" , method = RequestMethod .GET , consumes = {"application/json" }, produces = {"application/json" })
127
- public ResponseEntity <SMSMessage > getMessageDetails (@ RequestHeader (MessageGatewayConstants .TENANT_IDENTIFIER_HEADER ) final String tenantId ,
128
- @ RequestHeader (MessageGatewayConstants .TENANT_APPKEY_HEADER ) final String appKey ,
129
- @ PathVariable Long internalId ) throws MessageGatewayException {
128
+ public ResponseEntity <OutboundMessages > getMessageDetails (@ RequestHeader (MessageGatewayConstants .TENANT_IDENTIFIER_HEADER ) final String tenantId ,
129
+ @ RequestHeader (MessageGatewayConstants .TENANT_APPKEY_HEADER ) final String appKey ,
130
+ @ PathVariable Long internalId ) throws MessageGatewayException {
130
131
131
- SMSMessage smsMessages = this .smsOutboundMessageRepository .findByInternalId (internalId );
132
+ OutboundMessages smsMessages = this .smsOutboundMessageRepository .findByInternalId (internalId );
132
133
return new ResponseEntity <>(smsMessages , HttpStatus .OK );
133
134
}
134
135
}
0 commit comments