Skip to content

Instantly share code, notes, and snippets.

@BransonGitomeh
Last active May 30, 2020 21:52
Show Gist options
  • Save BransonGitomeh/1f3f8d52d40d826cd7b59441dee2c56d to your computer and use it in GitHub Desktop.
Save BransonGitomeh/1f3f8d52d40d826cd7b59441dee2c56d to your computer and use it in GitHub Desktop.
const moment = require("moment")
//login
const user_login_input = {
"username": "test",
"password": "test"
}
const user_login_output = {
"status": 1, // or 0 if failed,
"token": "bearer:jwt_token"
}
//register
const user_register_input = {
"names": "test test test",
"phone": "254711000000",
"plot":"1",
"email":"[email protected]"
}
//register
const user_register_output = {
"status":1 //0 if failed
}
//register
const user_register_input = {
"names": "test test test",
"phone": "254711000000"
}
//completed payments
const new2 = {}
var test = [
{
"Name": "Amount",
"Value": 1
},
{
"Name": "MpesaReceiptNumber",
"Value": "NL81J5Z2DR"
},
{
"Name": "TransactionDate",
"Value": 20191208222016
},
{
"Name": "PhoneNumber",
"Value": 254711657108
},
{
"Name": "Account",
"Value": "0711657108"
},
{
"Name": "Reason",
"Value": "funeral"
}
]
test.map(t => {
if(t.Name == "TransactionDate"){
new2[t.Name.toLowerCase()] = moment(t.Value).format("DD/MM/YYYY, h:mm:ss a");
return;
}
new2[t.Name.toLowerCase()] = t.Value
})
console.log(JSON.stringify(new2, null, '\t'))
const payments = [{
"type":"mpesa", //direct_deposit //cash // cheque //required
"amount": 1, //required
"mpesareceiptnumber": "NL81J5Z2DR", //only if type is mpesa
"checknumber": "NL81J5Z2DR____", //only if type is cheque
"direct_deposit_number": "12344", //only if type is deposit
"transactiondate": "01/11/2609, 3:57:02 pm",
"phonenumber": 254711657108,
"account": "0711657108",
"reason": "funeral"
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment