Skip to content

Instantly share code, notes, and snippets.

View chaiwa-berian's full-sized avatar

Berian chaiwa-berian

View GitHub Profile
@chaiwa-berian
chaiwa-berian / Step 1: Create API User.MD
Last active May 4, 2024 13:31
Testing MTN MoMo Collection API in Sandbox using Postman

A. Checklist

  • To create an API User, you need the following things in place: X-Reference-Id and Ocp-Apim-Subscription-Key

1. X-Reference-Id

  • This is used as User ID since the Sandbox is a Mock Environment so we kinda create our own ids and send them over to the sandbox so it can uniquely identify the user
  • Get the value for this here: https://www.uuidgenerator.net/api/version4
  • Remember to keep this safely as we will use it when configuring our POST request
  • Lets say you have your X-Reference-Id as: 9f92971b-cd2e-4feb-9053-0b14d53ac4f5

2. Ocp-Apim-Subscription-Key

  • Get this from the Primary or Secondary Key of your Collections | Enable remote collection of bills, fees or taxes subscription.
@chaiwa-berian
chaiwa-berian / db_initialization.js
Last active October 23, 2019 12:50
Initializing tables with default records via nodejs and mongoose
//refs to models
let User = require('../../app/common/models/user_models/user_model');
let UserRolePermission = require('../../app/common/models/user_models/user_role_permission_model');
let UserRole = require('../../app/common/models/user_models/user_role_model');
//=========================work starts here==================
let users_initialized;
let permissions_initialized;
let roles_initialized;
async function usersInitialized() {
@chaiwa-berian
chaiwa-berian / ApiResponse.java
Last active May 16, 2019 14:42 — forked from AkshayChordiya/ApiResponse.java
LiveData adapter for Retrofit
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@chaiwa-berian
chaiwa-berian / one_line_of_code_server
Created August 2, 2018 18:28
Nodejs Server in one line of code
require('http').createServer((req,res)=>res.end("Hey!")).listen(3000,'127.0.0.1');