Skip to content

Commit

Permalink
Merge pull request #649 from praekeltfoundation/feature-momza-ussd-pu…
Browse files Browse the repository at this point in the history
…blic-registration

Handle public reg with active postbirth messaging
  • Loading branch information
DevChima authored Jan 30, 2025
2 parents efd6b3e + eff9aa1 commit 6251a69
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
5 changes: 4 additions & 1 deletion go-app-ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ go.app = function() {
return self.states.create("state_public_subscription");
} else if(_.inRange(_.get(contact, "fields.prebirth_messaging"), 1, 7)) {
return self.states.create("state_clinic_subscription");
} else {
} else if(_.toUpper(_.get(contact, "fields.postbirth_messaging")) === "TRUE"){
return self.states.create("state_clinic_subscription");
}
else {
return self.states.create("state_pregnant");
}
}).catch(function(e) {
Expand Down
5 changes: 4 additions & 1 deletion src/ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ go.app = function() {
return self.states.create("state_public_subscription");
} else if(_.inRange(_.get(contact, "fields.prebirth_messaging"), 1, 7)) {
return self.states.create("state_clinic_subscription");
} else {
} else if(_.toUpper(_.get(contact, "fields.postbirth_messaging")) === "TRUE"){
return self.states.create("state_clinic_subscription");
}
else {
return self.states.create("state_pregnant");
}
}).catch(function(e) {
Expand Down
20 changes: 20 additions & 0 deletions test/ussd_public_rapidpro.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ describe("ussd_public app", function() {
})
.run();
});
it("should give the user compliment/complaint instructions if they're receiving postbirth messages", function() {
return tester
.setup(function(api) {
api.http.fixtures.add(
fixtures_rapidpro.get_contact({
urn: "whatsapp:27123456789",
exists: true,
fields: {postbirth_messaging: "TRUE"}
})
);
})
.start()
.check.interaction({
state: "state_clinic_subscription",
reply:
"Hello mom! You can reply to any MomConnect message with a question, compliment or complaint. Our team " +
"will get back to you as soon as they can."
})
.run();
});
it("should welcome the user if they don't have a subscription", function() {
return tester
.setup(function(api) {
Expand Down

0 comments on commit 6251a69

Please sign in to comment.