Skip to content

Commit

Permalink
removed repeated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Buhle79 committed Oct 16, 2023
1 parent 48a8eb6 commit 3df876c
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions go-app-ussd_tb_check.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,6 @@
var go = {};
go;

go.Engage = function() {
var vumigo = require('vumigo_v02');
var events = vumigo.events;
var Eventable = events.Eventable;
var _ = require('lodash');
var url = require('url');

var Engage = Eventable.extend(function(self, json_api, base_url, token) {
self.json_api = json_api;
self.base_url = base_url;
self.json_api.defaults.headers.Authorization = ['Bearer ' + token];
self.json_api.defaults.headers['Content-Type'] = ['application/json'];

self.contact_check = function(msisdn, block) {
return self.json_api.post(url.resolve(self.base_url, 'v1/contacts'), {
data: {
blocking: block ? 'wait' : 'no_wait',
contacts: [msisdn]
}
}).then(function(response) {
var existing = _.filter(response.data.contacts, function(obj) {
return obj.status === "valid";
});
return !_.isEmpty(existing);
});
};

self.LANG_MAP = {zul_ZA: "en",
xho_ZA: "en",
afr_ZA: "af",
eng_ZA: "en",
nso_ZA: "en",
tsn_ZA: "en",
sot_ZA: "en",
tso_ZA: "en",
ssw_ZA: "en",
ven_ZA: "en",
nbl_ZA: "en",
set_ZA: "en",
};
});



return Engage;
}();

go.RapidPro = function() {
var vumigo = require('vumigo_v02');
var url_utils = require('url');
Expand Down

0 comments on commit 3df876c

Please sign in to comment.