Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public reg: send status_id #639

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Public reg: send status_id
  • Loading branch information
erikh360 committed Jul 23, 2024
commit bf0dda06bb35bc2030ee610868f61da78b48e9b1
3 changes: 2 additions & 1 deletion go-app-ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
@@ -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) {
@@ -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
3 changes: 2 additions & 1 deletion src/ussd_public_rapidpro.js
Original file line number Diff line number Diff line change
@@ -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) {
@@ -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
14 changes: 10 additions & 4 deletions test/ussd_public_rapidpro.test.js
Original file line number Diff line number Diff line change
@@ -489,7 +489,8 @@ describe("ussd_public app", function() {
"+27123456789",
"test-welcome-template",
null,
"Whatsapp"
"Whatsapp",
"status-id-uuid"
)
);
api.http.fixtures.add(
@@ -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"
}
)
);
@@ -602,7 +604,8 @@ describe("ussd_public app", function() {
"+27123456789",
"test-welcome-template",
null,
"Whatsapp"
"Whatsapp",
"status-id-uuid"
)
);
api.http.fixtures.add(
@@ -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"
}
)
);
@@ -821,6 +825,7 @@ describe("ussd_public app", function() {
mha: 6,
swt: "1",
preferred_channel: "SMS",
status_id: "status-id-uuid"
}
)
);
@@ -870,6 +875,7 @@ describe("ussd_public app", function() {
mha: 6,
swt: "7",
preferred_channel: "Whatsapp",
status_id: "status-id-uuid"
}
)
);
Loading