Skip to content

Commit

Permalink
Merge pull request #639 from praekeltfoundation/capi-chw-and-public-s…
Browse files Browse the repository at this point in the history
…tatus

Public reg: send status_id
  • Loading branch information
erikh360 authored Jul 23, 2024
2 parents 275b51d + bf0dda0 commit 696e58d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion go-app-ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ go.app = function() {
.send_whatsapp_template_message(msisdn, template_name)
.then(function(data) {
self.im.user.set_answer("preferred_channel", data.preferred_channel);
self.im.user.set_answer("status_id", data.status_id);
if (data.preferred_channel == "SMS") {
return self.rapidpro.get_global_flag("sms_registrations_enabled")
.then(function(sms_registration_enabled) {
Expand Down Expand Up @@ -528,7 +529,7 @@ go.app = function() {
mha: 6,
swt: self.im.user.get_answer("preferred_channel") === "SMS" ? "1" : "7",
preferred_channel: self.im.user.get_answer("preferred_channel"),

status_id: self.im.user.answers.status_id,
};

return self.rapidpro
Expand Down
3 changes: 2 additions & 1 deletion src/ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ go.app = function() {
.send_whatsapp_template_message(msisdn, template_name)
.then(function(data) {
self.im.user.set_answer("preferred_channel", data.preferred_channel);
self.im.user.set_answer("status_id", data.status_id);
if (data.preferred_channel == "SMS") {
return self.rapidpro.get_global_flag("sms_registrations_enabled")
.then(function(sms_registration_enabled) {
Expand Down Expand Up @@ -309,7 +310,7 @@ go.app = function() {
mha: 6,
swt: self.im.user.get_answer("preferred_channel") === "SMS" ? "1" : "7",
preferred_channel: self.im.user.get_answer("preferred_channel"),

status_id: self.im.user.answers.status_id,
};

return self.rapidpro
Expand Down
14 changes: 10 additions & 4 deletions test/ussd_public_rapidpro.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ describe("ussd_public app", function() {
"+27123456789",
"test-welcome-template",
null,
"Whatsapp"
"Whatsapp",
"status-id-uuid"
)
);
api.http.fixtures.add(
Expand All @@ -505,7 +506,8 @@ describe("ussd_public app", function() {
"registered_by": "+27123456789",
"mha": 6,
"swt": "7",
"preferred_channel": "Whatsapp"
"preferred_channel": "Whatsapp",
"status_id": "status-id-uuid"
}
)
);
Expand Down Expand Up @@ -602,7 +604,8 @@ describe("ussd_public app", function() {
"+27123456789",
"test-welcome-template",
null,
"Whatsapp"
"Whatsapp",
"status-id-uuid"
)
);
api.http.fixtures.add(
Expand All @@ -618,7 +621,8 @@ describe("ussd_public app", function() {
"registered_by": "+27123456789",
"mha": 6,
"swt": "7",
"preferred_channel": "Whatsapp"
"preferred_channel": "Whatsapp",
"status_id": "status-id-uuid"
}
)
);
Expand Down Expand Up @@ -821,6 +825,7 @@ describe("ussd_public app", function() {
mha: 6,
swt: "1",
preferred_channel: "SMS",
status_id: "status-id-uuid"
}
)
);
Expand Down Expand Up @@ -870,6 +875,7 @@ describe("ussd_public app", function() {
mha: 6,
swt: "7",
preferred_channel: "Whatsapp",
status_id: "status-id-uuid"
}
)
);
Expand Down

0 comments on commit 696e58d

Please sign in to comment.