Skip to content

Commit

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

CHW reg: send status id
  • Loading branch information
erikh360 authored Jul 23, 2024
2 parents 696e58d + cc57a92 commit d8542d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion go-app-ussd_chw_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,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 @@ -734,7 +735,8 @@ go.app = function() {
).format(),
passport_origin: self.im.user.answers.state_passport_country,
passport_number: self.im.user.answers.state_passport_no,
preferred_channel: self.im.user.answers.preferred_channel
preferred_channel: self.im.user.answers.preferred_channel,
status_id: self.im.user.answers.status_id
};
return self.rapidpro
.start_flow(self.im.config.flow_uuid, null, "whatsapp:" + _.trim(msisdn, "+"), data)
Expand Down
4 changes: 3 additions & 1 deletion src/ussd_chw_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,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 @@ -562,7 +563,8 @@ go.app = function() {
).format(),
passport_origin: self.im.user.answers.state_passport_country,
passport_number: self.im.user.answers.state_passport_no,
preferred_channel: self.im.user.answers.preferred_channel
preferred_channel: self.im.user.answers.preferred_channel,
status_id: self.im.user.answers.status_id
};
return self.rapidpro
.start_flow(self.im.config.flow_uuid, null, "whatsapp:" + _.trim(msisdn, "+"), data)
Expand Down
8 changes: 6 additions & 2 deletions test/ussd_chw_rapidpro.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,8 @@ describe("ussd_chw app", function() {
id_type: "sa_id",
sa_id_number: "9001020005087",
dob: "1990-01-02T00:00:00Z",
preferred_channel: "SMS"
preferred_channel: "SMS",
status_id: "status-id-uuid"
}
)
);
Expand Down Expand Up @@ -825,7 +826,8 @@ describe("ussd_chw app", function() {
id_type: "sa_id",
sa_id_number: "9001020005087",
dob: "1990-01-02T00:00:00Z",
preferred_channel: "WhatsApp"
preferred_channel: "WhatsApp",
status_id: "status-id-uuid"
}
)
);
Expand All @@ -852,6 +854,7 @@ describe("ussd_chw app", function() {
state_id_type: "state_sa_id_no",
state_sa_id_no: "9001020005087",
preferred_channel: "WhatsApp",
status_id: "status-id-uuid"
})
.setup(function(api) {
api.http.fixtures.add(
Expand All @@ -869,6 +872,7 @@ describe("ussd_chw app", function() {
sa_id_number: "9001020005087",
dob: "1990-01-02T00:00:00Z",
preferred_channel: "WhatsApp",
status_id: "status-id-uuid"
}
)
);
Expand Down

0 comments on commit d8542d8

Please sign in to comment.