Skip to content

Commit

Permalink
Added log for SMS sending (distributor) and also corrected test drive…
Browse files Browse the repository at this point in the history
…r notification call
  • Loading branch information
sanjiva committed Nov 16, 2019
1 parent 6264fce commit f29856f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions distributor/src/distributor/messenger.bal
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function sendSMS(string message, string resultId) {
log:printInfo("Sending SMS for " + resultId);
}
foreach string targetMobile in currentMobileSubscribers {
log:printInfo("Sending SMS for " + resultId + " to " + targetMobile);
var response = twilioClient->sendSms(sourceMobile, targetMobile, message);
if response is error {
log:printError("Message sending failed for \'" + targetMobile + "\' due to error:" +
Expand Down
6 changes: 3 additions & 3 deletions testdriver/src/testdriver/sendresults.bal
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,16 @@ function sendResult (http:Client hc, string electionCode, string resType, string
http:Response hr;

// sent alert
string params = "?level=" + <string>result.level;
string params = "/?level=" + <string>result.level;
if result.ed_name is string {
params += "&ed_name=" + check encoding:encodeUriComponent(<string>result.ed_name, "UTF-8");
if result.pd_name is string {
params += "&pd_name=" + check encoding:encodeUriComponent(<string>result.pd_name, "UTF-8");
}
}
hr = check hc->post ("/result/notification/" + electionCode + "/" + resType + "/" + resCode + "/?level=" + <string>result.level, <json>{});
hr = check hc->post ("/result/notification/" + electionCode + "/" + resType + "/" + resCode + params, <json>{});
if hr.statusCode != http:STATUS_ACCEPTED {
io:println("Error while posting result notification to: /result/notification/" + electionCode + "/" + resType + "/" + resCode);
io:println("Error while posting result notification to: /result/notification/" + electionCode + "/" + resType + "/" + resCode + params);
io:println("\tstatus=", hr.statusCode, ", contentType=", hr.getContentType(), " payload=", hr.getTextPayload());
return error ("Unable to post notification for " + resCode);
}
Expand Down

0 comments on commit f29856f

Please sign in to comment.