├── .gitignore ├── .vscode └── settings.json ├── README.md ├── helpers └── authentication │ └── GetAccessToken.js ├── index.js ├── package-lock.json ├── package.json └── utils ├── AccountTransfers ├── AccountToAccount.js └── CardToAccount.js ├── Wallet ├── CreateSubWallet.js └── GetWalletBalance.js ├── WalletFunding ├── AccountToWallet.js ├── CardToWallet.js └── PayWithInternetBanking.js ├── WalletTransfers ├── BulkWalletToAccount.js ├── WalletToAccountTransfer.js └── WalletToWallet.js ├── index.js ├── resources ├── Banks.js ├── CardEnquiry.js ├── CardTokenization.js ├── Report.js └── ValidateAccountNumber.js └── transactions ├── GetTotalChargeToCard.js ├── PreviousCardToAccount.js ├── PreviousWalletToAccount.js ├── RetryFailedTransaction.js └── TransStatusCardToAccount.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | // Controls the font family. 4 | "editor.fontLigatures": true, 5 | "editor.fontFamily": "Fira Code" 6 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # moneywave-nodejs 2 | A Client library for moneywave API 3 | 4 | ### Installation 5 | ```js 6 | npm install moneywave-nodejs 7 | ``` 8 | ### Usage 9 | ```js 10 | //require the library, pass your merchant apiKey and secret 11 | const moneywave = require('moneywave-nodejs')('apiKey', 'secret'); 12 | 13 | //make a call to the utils/method 14 | //Utils can be either a resource or a transaction 15 | let body = { 16 | "firstname": "Umar", 17 | "lastname": "Abdullahi", 18 | "phonenumber": "+2348133221100", 19 | "email": "umar@gmail.com", 20 | "recipient_bank": "DIAMOND BANK", 21 | "recipient_account_number": "0213092331", 22 | "card_no": "5689103345821829", 23 | "cvv": "222", 24 | "expiry_year": "2020", 25 | "expiry_month": "02", 26 | "apiKey": "nhvewq9039fjdfhg1290djjd", 27 | "amount": 50000, 28 | "fee": 100, 29 | "redirecturl": "http://localhost:8080/", 30 | "medium": "web" 31 | }; 32 | //transfer 33 | moneywave.CardToAccount.transfer(body, function(error, body){ 34 | if(!error) 35 | { 36 | //doSomething 37 | }else{ 38 | //doSomething 39 | } 40 | }); 41 | ``` 42 | 43 | ### Utils - Resource 44 | | {Resource}.{method} | parameters | 45 | |--------------------------------------|------------------------------------| 46 | | **Card.tokenize** |`['card_no', 'expiry_year', 'expiry_month', 'cvv']`| 47 | | **Banks.get** | no parameters | 48 | | **WalletBalance.get** | no parameters | 49 | | **PreviousCardToAccount.get** | no parameters | 50 | | **PreviousWalletToAccount.get** | `['ref']` | 51 | 52 | ### Utils - Transaction 53 | | {Transaction}.{method} | parameters | 54 | |--------------------------------------|------------------------------------| 55 | | **FailedTransaction.retry** | `['id', 'recipient_account_number', 'recipient_bank']`| 56 | | **ValidateAccountNumber.validate** | `['account_number', 'bank_code']` | 57 | | **BulkWalletToAccout.transfer** | `['lock', 'amount', 'recipients', 'currency', 'senderName', 'ref']`| 58 | | | | | 59 | | **CardToAccount.transfer** | `['firstname', 'lastname', 'phonenumber', 'email', 'recipient_bank','recipient_account_number', 'card_no', 'cvv', 'expiry_year', 'expiry_month','apiKey','amount', 'fee', 'redirecturl', 'medium']`| 60 | | **CardToAccount.validate** | `['transactionRef', 'authType', 'authValue']`| 61 | | **CardToAccount.validateVerve** | `['transactionRef', 'otp']` | 62 | | | | | 63 | | **CardToWallet.transfer** | `['firstname', 'lastname', 'phonenumber', 'email', 'recipient', 'card_no', 'cvv', 'expiry_year', 'expiry_month', 'apiKey', 'amount', 'fee', 'redirecturl', 'medium']`| 64 | | **TotalChargeToCard.get** | `['amount', 'fee']` | 65 | | **WalletToAccountTransfer.transfer** | `['lock', 'amount', 'bankcode', 'accountNumber', 'currency', 'senderName', 'ref']`| 66 | 67 | This was built according to the documentation on https://moneywave.flutterwave.com/api 68 | 69 | ### Heads Up 70 | Please star the repo and feel free to report any issue. Thank you! 71 | -------------------------------------------------------------------------------- /helpers/authentication/GetAccessToken.js: -------------------------------------------------------------------------------- 1 | const request = require('request'), 2 | base_url = 'https://moneywave.herokuapp.com'; 3 | 4 | let getToken = (api_key, secret, callback) => { 5 | const encodedURI = encodeURI([base_url, "/v1/merchant/verify"].join('')); 6 | let options = { 7 | method: 'POST', 8 | uri: encodedURI, 9 | body: { 10 | apiKey: api_key, 11 | secret: secret 12 | }, 13 | json: true 14 | }; 15 | 16 | request(options, function(error, response, body){ 17 | 18 | let res; 19 | 20 | if(!error) 21 | { 22 | if(body.status) 23 | { 24 | res = {"token": body.token}; 25 | return callback(res); 26 | }else{ 27 | res = {"error": body}; 28 | return callback(res); 29 | } 30 | } 31 | res = {"error":error}; 32 | return callback(res); 33 | }); 34 | } 35 | 36 | module.exports = getToken; -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * MoneyWave API Wrapper 3 | * @author CodebyOmar (Umar Abdullahi) 4 | */ 5 | 6 | const request = require('request') 7 | ,root = 'https://moneywave.herokuapp.com' 8 | ,getAccessToken = require('./helpers/authentication/GetAccessToken') 9 | ,utils = require('./utils/index'); 10 | 11 | function Moneywave(apiKey, secret) 12 | { 13 | if(!(this instanceof Moneywave)){ return new Moneywave(apiKey, secret); } 14 | 15 | let tokenRequest = getAccessToken(apiKey, secret, function(response){ 16 | if(response.token) 17 | { 18 | Moneywave.prototype.token = response.token; 19 | Moneywave.prototype.importUtils(); 20 | }else{ 21 | throw new Error(response.error); 22 | } 23 | }.bind(this)); 24 | 25 | } 26 | 27 | Moneywave.prototype = { 28 | implement: (params) => { 29 | let self = this; 30 | 31 | return function() { 32 | //check for token 33 | if(typeof Moneywave.prototype.token === "undefined") 34 | { 35 | throw new Error("Token is required! - check validity of API key or secret"); 36 | } 37 | 38 | //function that converts arguments into array 39 | function toArray(obj) 40 | { 41 | let newArray = new Array(obj.length); 42 | 43 | for(let i=0; i < obj.length; ++i) 44 | { 45 | newArray[i] = obj[i]; 46 | } 47 | return newArray; 48 | } 49 | 50 | //convert to array 51 | let args = toArray(arguments); 52 | let l = args.length; 53 | //check for callback in args and retrive it 54 | let callback = l > 0 && typeof args.slice(l-1)[0] === "function" ? args.splice(l-1)[0] : "undefined"; 55 | 56 | let body, qs; 57 | 58 | //method checking 59 | let method = params.method in {'get':'', 'post':''} 60 | ? params.method 61 | : (function(){ throw new Error("Method Not Allowed - Utils declaration error!")}) 62 | 63 | let endpoint = [root, params.endpoint].join(''); 64 | 65 | //checking for required params 66 | if(params.params) 67 | { 68 | let requiredParams = params.params; 69 | 70 | //get body of request 71 | let body = args.length === 2 ? args[1] : args[0]; 72 | requiredParams.filter(function(item, index, array) { 73 | if(item.indexOf("*") === -1) 74 | { 75 | //not required 76 | return; 77 | } 78 | item = item.replace("*", ""); 79 | 80 | if(!(item in body)) 81 | { 82 | throw new Error("Required parameter omitted -" + item); 83 | } 84 | return; 85 | 86 | }); 87 | } 88 | 89 | //get params e.g. {id} from args and pull out array 90 | let paramsInEndpoint = endpoint.match(/{[^}]+}/g) 91 | if(paramsInEndpoint) 92 | { 93 | l = paramsInEndpoint.length; 94 | //check number of params in endpoint 95 | if(l > 0) 96 | { 97 | //confirm if utils declaration is good 98 | if(!Array.isArray(params.args)) 99 | { 100 | //throw error 101 | throw new Error("Utils declaration error!"); 102 | } 103 | } 104 | 105 | 106 | //confirm user passed params to method and replace in endpoint 107 | let match, index; 108 | for(let i = 0;i < l;i++) 109 | { 110 | match = paramsInEndpoint[i].replace(/\w/g, ''); 111 | index = params.args.indexOf(match); 112 | if(index != -1) 113 | { 114 | if(!args[index]) 115 | { 116 | throw new Error("Utils declaration error!"); 117 | } 118 | 119 | endpoint = endpoint.replace(new RegExp(paramsInEndpoint[i]), args[index]); 120 | args.splice(index, 1); 121 | } 122 | } 123 | } 124 | 125 | //Add post body 126 | if(args[0]) 127 | { 128 | if(method === 'post') 129 | { 130 | //body 131 | body = args[0]; 132 | } 133 | else if(method === 'get'){ 134 | //query string 135 | qs = args[0]; 136 | } 137 | } 138 | 139 | //finally make request 140 | let options = { 141 | url: endpoint, 142 | json: true, 143 | method: method.toUpperCase(), 144 | headers: { 145 | 'Authorization': Moneywave.prototype.token 146 | } 147 | } 148 | 149 | //append body to options if available 150 | if(body){ options.body = body; } 151 | //append query string to options if available 152 | if(qs){ options.qs = qs; } 153 | 154 | request(options, function(error, response, body){ 155 | 156 | //return body 157 | if(callback) 158 | { 159 | //check for error from API 160 | if(!body.status) 161 | { 162 | error = body; 163 | body = null; 164 | } 165 | 166 | return callback(error, body); 167 | } 168 | }); 169 | 170 | } 171 | }, 172 | 173 | importUtils: () => { 174 | let anon; 175 | // Looping over all utils 176 | for (let j in utils) { 177 | // Creating a surrogate function 178 | anon = function(){}; 179 | // Looping over the properties of each resource 180 | for(let i in utils[j]) { 181 | anon.prototype[i] = Moneywave.prototype.implement(utils[j][i]); 182 | } 183 | Moneywave.prototype[j] = new anon(); 184 | } 185 | } 186 | }; 187 | 188 | module.exports = Moneywave; -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moneywave-nodejs", 3 | "version": "1.2.12", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "ajv": { 8 | "version": "5.5.2", 9 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", 10 | "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", 11 | "requires": { 12 | "co": "^4.6.0", 13 | "fast-deep-equal": "^1.0.0", 14 | "fast-json-stable-stringify": "^2.0.0", 15 | "json-schema-traverse": "^0.3.0" 16 | } 17 | }, 18 | "asn1": { 19 | "version": "0.2.3", 20 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", 21 | "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" 22 | }, 23 | "assert-plus": { 24 | "version": "1.0.0", 25 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 26 | "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" 27 | }, 28 | "asynckit": { 29 | "version": "0.4.0", 30 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 31 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 32 | }, 33 | "aws-sign2": { 34 | "version": "0.7.0", 35 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 36 | "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" 37 | }, 38 | "aws4": { 39 | "version": "1.7.0", 40 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", 41 | "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" 42 | }, 43 | "bcrypt-pbkdf": { 44 | "version": "1.0.2", 45 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 46 | "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", 47 | "optional": true, 48 | "requires": { 49 | "tweetnacl": "^0.14.3" 50 | } 51 | }, 52 | "caseless": { 53 | "version": "0.12.0", 54 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 55 | "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" 56 | }, 57 | "co": { 58 | "version": "4.6.0", 59 | "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", 60 | "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" 61 | }, 62 | "combined-stream": { 63 | "version": "1.0.6", 64 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", 65 | "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", 66 | "requires": { 67 | "delayed-stream": "~1.0.0" 68 | } 69 | }, 70 | "core-util-is": { 71 | "version": "1.0.2", 72 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 73 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 74 | }, 75 | "dashdash": { 76 | "version": "1.14.1", 77 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 78 | "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", 79 | "requires": { 80 | "assert-plus": "^1.0.0" 81 | } 82 | }, 83 | "delayed-stream": { 84 | "version": "1.0.0", 85 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 86 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 87 | }, 88 | "ecc-jsbn": { 89 | "version": "0.1.1", 90 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", 91 | "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", 92 | "optional": true, 93 | "requires": { 94 | "jsbn": "~0.1.0" 95 | } 96 | }, 97 | "extend": { 98 | "version": "3.0.2", 99 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 100 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 101 | }, 102 | "extsprintf": { 103 | "version": "1.3.0", 104 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 105 | "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" 106 | }, 107 | "fast-deep-equal": { 108 | "version": "1.1.0", 109 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", 110 | "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" 111 | }, 112 | "fast-json-stable-stringify": { 113 | "version": "2.0.0", 114 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", 115 | "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" 116 | }, 117 | "forever-agent": { 118 | "version": "0.6.1", 119 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 120 | "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" 121 | }, 122 | "form-data": { 123 | "version": "2.3.2", 124 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", 125 | "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", 126 | "requires": { 127 | "asynckit": "^0.4.0", 128 | "combined-stream": "1.0.6", 129 | "mime-types": "^2.1.12" 130 | } 131 | }, 132 | "getpass": { 133 | "version": "0.1.7", 134 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 135 | "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", 136 | "requires": { 137 | "assert-plus": "^1.0.0" 138 | } 139 | }, 140 | "har-schema": { 141 | "version": "2.0.0", 142 | "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", 143 | "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" 144 | }, 145 | "har-validator": { 146 | "version": "5.0.3", 147 | "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", 148 | "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", 149 | "requires": { 150 | "ajv": "^5.1.0", 151 | "har-schema": "^2.0.0" 152 | } 153 | }, 154 | "http-signature": { 155 | "version": "1.2.0", 156 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", 157 | "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", 158 | "requires": { 159 | "assert-plus": "^1.0.0", 160 | "jsprim": "^1.2.2", 161 | "sshpk": "^1.7.0" 162 | } 163 | }, 164 | "is-typedarray": { 165 | "version": "1.0.0", 166 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 167 | "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" 168 | }, 169 | "isstream": { 170 | "version": "0.1.2", 171 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 172 | "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" 173 | }, 174 | "jsbn": { 175 | "version": "0.1.1", 176 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 177 | "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", 178 | "optional": true 179 | }, 180 | "json-schema": { 181 | "version": "0.2.3", 182 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", 183 | "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" 184 | }, 185 | "json-schema-traverse": { 186 | "version": "0.3.1", 187 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", 188 | "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" 189 | }, 190 | "json-stringify-safe": { 191 | "version": "5.0.1", 192 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 193 | "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" 194 | }, 195 | "jsprim": { 196 | "version": "1.4.1", 197 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", 198 | "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", 199 | "requires": { 200 | "assert-plus": "1.0.0", 201 | "extsprintf": "1.3.0", 202 | "json-schema": "0.2.3", 203 | "verror": "1.10.0" 204 | } 205 | }, 206 | "mime-db": { 207 | "version": "1.35.0", 208 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", 209 | "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" 210 | }, 211 | "mime-types": { 212 | "version": "2.1.19", 213 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", 214 | "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", 215 | "requires": { 216 | "mime-db": "~1.35.0" 217 | } 218 | }, 219 | "oauth-sign": { 220 | "version": "0.8.2", 221 | "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", 222 | "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" 223 | }, 224 | "performance-now": { 225 | "version": "2.1.0", 226 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 227 | "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" 228 | }, 229 | "punycode": { 230 | "version": "1.4.1", 231 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", 232 | "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" 233 | }, 234 | "qs": { 235 | "version": "6.5.2", 236 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", 237 | "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" 238 | }, 239 | "request": { 240 | "version": "2.87.0", 241 | "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", 242 | "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", 243 | "requires": { 244 | "aws-sign2": "~0.7.0", 245 | "aws4": "^1.6.0", 246 | "caseless": "~0.12.0", 247 | "combined-stream": "~1.0.5", 248 | "extend": "~3.0.1", 249 | "forever-agent": "~0.6.1", 250 | "form-data": "~2.3.1", 251 | "har-validator": "~5.0.3", 252 | "http-signature": "~1.2.0", 253 | "is-typedarray": "~1.0.0", 254 | "isstream": "~0.1.2", 255 | "json-stringify-safe": "~5.0.1", 256 | "mime-types": "~2.1.17", 257 | "oauth-sign": "~0.8.2", 258 | "performance-now": "^2.1.0", 259 | "qs": "~6.5.1", 260 | "safe-buffer": "^5.1.1", 261 | "tough-cookie": "~2.3.3", 262 | "tunnel-agent": "^0.6.0", 263 | "uuid": "^3.1.0" 264 | } 265 | }, 266 | "safe-buffer": { 267 | "version": "5.1.2", 268 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 269 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 270 | }, 271 | "safer-buffer": { 272 | "version": "2.1.2", 273 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 274 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 275 | }, 276 | "sshpk": { 277 | "version": "1.14.2", 278 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", 279 | "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", 280 | "requires": { 281 | "asn1": "~0.2.3", 282 | "assert-plus": "^1.0.0", 283 | "bcrypt-pbkdf": "^1.0.0", 284 | "dashdash": "^1.12.0", 285 | "ecc-jsbn": "~0.1.1", 286 | "getpass": "^0.1.1", 287 | "jsbn": "~0.1.0", 288 | "safer-buffer": "^2.0.2", 289 | "tweetnacl": "~0.14.0" 290 | } 291 | }, 292 | "tough-cookie": { 293 | "version": "2.3.4", 294 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", 295 | "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", 296 | "requires": { 297 | "punycode": "^1.4.1" 298 | } 299 | }, 300 | "tunnel-agent": { 301 | "version": "0.6.0", 302 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 303 | "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", 304 | "requires": { 305 | "safe-buffer": "^5.0.1" 306 | } 307 | }, 308 | "tweetnacl": { 309 | "version": "0.14.5", 310 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 311 | "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", 312 | "optional": true 313 | }, 314 | "uuid": { 315 | "version": "3.3.2", 316 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", 317 | "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" 318 | }, 319 | "verror": { 320 | "version": "1.10.0", 321 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 322 | "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", 323 | "requires": { 324 | "assert-plus": "^1.0.0", 325 | "core-util-is": "1.0.2", 326 | "extsprintf": "^1.2.0" 327 | } 328 | } 329 | } 330 | } 331 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moneywave-nodejs", 3 | "version": "1.2.12", 4 | "description": "MoneyWave API Wrapper", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/CodebyOmar/moneywave-Nodejs.git" 12 | }, 13 | "keywords": [ 14 | "API", 15 | "Transactions", 16 | "MoneyWave", 17 | "FlutterWave" 18 | ], 19 | "author": "codebyomar", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/CodebyOmar/moneywave-Nodejs/issues" 23 | }, 24 | "homepage": "https://github.com/CodebyOmar/moneywave-Nodejs#readme", 25 | "dependencies": { 26 | "request": "^2.81.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /utils/AccountTransfers/AccountToAccount.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/transfer'; 4 | 5 | module.exports = { 6 | /** 7 | * Transfer cash from bank account to another bank account (supported by access bank only) 8 | * @params "firstname","lastname","email","phonenumber","recipient_bank","recipient_account_number", 9 | * "charge_with", "recipient","sender_account_number", "sender_bank","apiKey","amount","narration","fee", 10 | * "medium","redirect_url" 11 | */ 12 | 13 | transfer: { 14 | method: 'post', 15 | endpoint: root, 16 | params: ["firstname","lastname","email","phonenumber","recipient_bank","recipient_account_number","charge_with","recipient", 17 | "sender_account_number", "sender_bank","apiKey","amount","narration","fee","medium","redirect_url"] 18 | }, 19 | 20 | validate: { 21 | method: 'post', 22 | endpoint: [root, '/charge/auth/account'].join(''), 23 | params: ["transactionRef", "authType", "authValue"] 24 | } 25 | } -------------------------------------------------------------------------------- /utils/AccountTransfers/CardToAccount.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/transfer'; 4 | 5 | module.exports = { 6 | /** 7 | * transfer cash from a card to a bank account 8 | * @params firstname, lastname, phonenumber, email, recipient_bank, recipient_account_number, 9 | * card_no, cvv, pin(optional required when using VERVE card), expiry_year, expiry_month, 10 | * charge_auth(optional required where card is a local Mastercard), apiKey, amount, fee, 11 | * narration(optional), redirecturl, medium 12 | */ 13 | charge: { 14 | method: 'post', 15 | endpoint: root, 16 | params: ['firstname', 'lastname', 'phonenumber', 'email', 'recipient_bank', 'recipient_account_number', 'card_no', 'cvv', 17 | 'expiry_year', 'expiry_month', 'apiKey', 'amount', 'fee', 'redirecturl', 'medium'] 18 | }, 19 | 20 | chargeLocalCard: { 21 | method: 'post', 22 | endpoint: root, 23 | params: ['firstname', 'lastname', 'phonenumber', 'email', 'recipient_bank', 'recipient_account_number', 'card_no', 'cvv', 24 | 'expiry_year', 'pin', 'charge_auth', 'expiry_month', 'apiKey', 'amount', 'fee', 'redirecturl', 'medium'] 25 | }, 26 | 27 | validate: { 28 | method: 'post', 29 | endpoint: [root, '/charge/auth/card'].join(''), 30 | params: ['transactionRef', 'otp'] 31 | } 32 | }; -------------------------------------------------------------------------------- /utils/Wallet/CreateSubWallet.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const root = '/v1/wallet'; 4 | 5 | module.exports = { 6 | /** 7 | * Create a new sub-wallet 8 | * "name","lock_code","user_ref","currency" 9 | */ 10 | create: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ["name","lock_code","user_ref","currency"] 14 | } 15 | } -------------------------------------------------------------------------------- /utils/Wallet/GetWalletBalance.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/wallet'; 4 | 5 | module.exports = { 6 | /** 7 | * get wallet balance 8 | */ 9 | get: { 10 | method: 'get', 11 | endpoint: root 12 | } 13 | }; -------------------------------------------------------------------------------- /utils/WalletFunding/AccountToWallet.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const root = '/v1/transfer'; 4 | 5 | module.exports = { 6 | /**@params "firstname","lastname","email","phonenumber","charge_with","recipient","sender_account_number", 7 | * "sender_bank","apiKey","amount","fee","medium","redirect_url" 8 | */ 9 | 10 | transfer: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ["firstname","lastname","email","phonenumber","charge_with","recipient","sender_account_number", 14 | "sender_bank","apiKey","amount","fee","medium","redirect_url"] 15 | }, 16 | 17 | validate: { 18 | method: 'post', 19 | endpoint: [root, "/charge/auth/account"].join(''), 20 | params: ["transactionRef","authType", "authValue"] 21 | } 22 | } -------------------------------------------------------------------------------- /utils/WalletFunding/CardToWallet.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = "/v1/transfer"; 4 | 5 | module.exports = { 6 | /** 7 | * tranfer funds from card to wallet 8 | * @params firstname, lastname, phonenumber, email, recipient, card_no, cvv, expiry_year, pin 9 | * expiry_month, charge_auth, apiKey, amount, fee, redirecturl, medium 10 | */ 11 | charge: { 12 | method: 'post', 13 | endpoint: root, 14 | params: ['firstname', 'lastname', 'phonenumber', 'email', 'recipient', 'card_no', 'cvv', 'expiry_year', 15 | 'expiry_month', 'apiKey', 'amount', 'fee', 'redirecturl', 'medium'] 16 | }, 17 | 18 | chargeLocalCard: { 19 | method: 'post', 20 | endpoint: root, 21 | params: ['firstname', 'lastname', 'phonenumber', 'email', 'recipient', 'card_no', 'cvv', 'pin','expiry_year', 22 | 'expiry_month', 'charge_auth','apiKey', 'amount', 'fee', 'redirecturl', 'medium'] 23 | } 24 | }; -------------------------------------------------------------------------------- /utils/WalletFunding/PayWithInternetBanking.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const root = 'v1/transfer'; 4 | 5 | module.exports = { 6 | /**@params "amount","apiKey","charge_with","charge_auth", "firstname", "lastname", "phonenumber", "email", 7 | * "medium","sender_bank","recipient","redirect_url" 8 | */ 9 | 10 | transfer: { 11 | method:'post', 12 | endpoint: root, 13 | params:["amount","apiKey","charge_with","charge_auth", "firstname", "lastname", "phonenumber", "email", 14 | "medium","sender_bank","recipient","redirect_url"] 15 | } 16 | } -------------------------------------------------------------------------------- /utils/WalletTransfers/BulkWalletToAccount.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/disburse/queue'; 4 | 5 | module.exports = { 6 | /** 7 | * transfer funds from wallet to more than one bank acount 8 | * @params lock, instantQueue, recipients[], name , currency, senderName, ref 9 | */ 10 | transfer: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ['lock', 'recipients', 'currency', 'senderName', 'ref', 'name', 'instantQueue'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/WalletTransfers/WalletToAccountTransfer.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/disburse'; 4 | 5 | module.exports = { 6 | /** 7 | * transfer from wallet to a single account 8 | * @params lock, amount, bankcode, accountNumber, currency, senderName, ref 9 | */ 10 | transfer: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ['lock', 'amount', 'bankcode', 'accountNumber', 'currency', 'senderName', 'ref'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/WalletTransfers/WalletToWallet.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const root = '/v1/wallet/transfer'; 4 | 5 | module.exports = { 6 | /** transfer funds from wallet to wallet 7 | * @params "sourceWallet","recipientWallet","amount","currency","lock" 8 | */ 9 | 10 | transfer: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ["sourceWallet","recipientWallet","amount","currency","lock" ] 14 | } 15 | } -------------------------------------------------------------------------------- /utils/index.js: -------------------------------------------------------------------------------- 1 | const AccountToAccount = require('./AccountTransfers/AccountToAccount') 2 | ,CardToAccount = require('./AccountTransfers/CardToAccount') 3 | ,CardTokenization = require('./resources/CardTokenization') 4 | ,Banks = require('./resources/Banks') 5 | ,CardEnquiry = require('./resources/CardEnquiry') 6 | ,Report = require('./resources/Report') 7 | ,ValidateAccountNumber = require('./resources/ValidateAccountNumber') 8 | ,GetTotalChargeToCard = require('./transactions/GetTotalChargeToCard') 9 | ,PreviousCardToAccount = require('./transactions/PreviousCardToAccount') 10 | ,PreviousWalletToAccount = require('./transactions/PreviousWalletToAccount') 11 | ,RetryFailedTransaction = require('./transactions/RetryFailedTransaction') 12 | ,TranStatusCardToAccount = require('./transactions/TransStatusCardToAccount') 13 | ,CreateSubwallet = require('./Wallet/CreateSubWallet') 14 | ,GetWalletBalance = require('./Wallet/GetWalletBalance') 15 | ,AccountToWallet = require('./WalletFunding/AccountToWallet') 16 | ,CardToWallet = require('./WalletFunding/CardToWallet') 17 | ,PayWithInternetBanking = require('./WalletFunding/PayWithInternetBanking') 18 | ,BulkWalletToAccountTransfer = require('./WalletTransfers/BulkWalletToAccount') 19 | ,WalletToAccountTransfer = require('./WalletTransfers/WalletToAccountTransfer') 20 | ,WalletToWallet = require('./WalletTransfers/WalletToWallet'); 21 | 22 | module.exports = { 23 | "AccountToAccount":AccountToAccount, 24 | "CardToAccount":CardToAccount, 25 | "CardTokenization":CardTokenization, 26 | "Banks":Banks, 27 | "CardEnquiry":CardEnquiry, 28 | "Report":Report, 29 | "ValidateAccountNumber":ValidateAccountNumber, 30 | "GetTotalChargeToCard":GetTotalChargeToCard, 31 | "PreviousCardToAccount":PreviousCardToAccount, 32 | "PreviousWalletToAccount":PreviousWalletToAccount, 33 | "RetryFailedTransaction":RetryFailedTransaction, 34 | "TranStatusCardToAccount":TranStatusCardToAccount, 35 | "CreateSubwallet":CreateSubwallet, 36 | "GetWalletBalance":GetWalletBalance, 37 | "AccountToWallet":AccountToWallet, 38 | "CardToWallet":CardToWallet, 39 | "PayWithInternetBanking":PayWithInternetBanking, 40 | "BulkWalletToAccountTransfer":BulkWalletToAccountTransfer, 41 | "WalletToAccountTransfer":WalletToAccountTransfer, 42 | "WalletToWallet":WalletToWallet 43 | }; -------------------------------------------------------------------------------- /utils/resources/Banks.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/banks'; 4 | 5 | module.exports = { 6 | /** 7 | * get a list of all banks and thier codes 8 | * @params no params 9 | */ 10 | get: { 11 | method: 'post', 12 | endpoint: root 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /utils/resources/CardEnquiry.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const root = '/v1/user/card/check'; 4 | 5 | module.exports = { 6 | /** 7 | * Get details of any card 8 | * @params cardNumber 9 | */ 10 | 11 | check: { 12 | method: 'post', 13 | endpoint: root, 14 | params: ['cardNumber'] 15 | } 16 | } -------------------------------------------------------------------------------- /utils/resources/CardTokenization.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/transfer/charge/tokenize/card'; 4 | 5 | module.exports = { 6 | /** 7 | * get token to use in intiating tranfers 8 | * @params card_no, expiry_year, expiry_month, cvv 9 | */ 10 | tokenize: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ['card_no', 'expiry_year', 'expiry_month', 'cvv'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/resources/Report.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const root = '/v1/report/transactions'; 4 | 5 | module.exports = { 6 | /** 7 | * Retrieves all transaction on a wallet {failed|pending|completed} 8 | * "status","date","type","currency","amount" 9 | */ 10 | 11 | transactions:{ 12 | method: 'post', 13 | endpoint: root, 14 | params: ["status","date","type","currency","amount"] 15 | } 16 | } -------------------------------------------------------------------------------- /utils/resources/ValidateAccountNumber.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = "/v1/resolve/account"; 4 | 5 | module.exports = { 6 | /** 7 | * validate account number 8 | * @param account_number, bank_code 9 | */ 10 | validate: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ['account_number', 'bank_code'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/transactions/GetTotalChargeToCard.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/get-charge'; 4 | 5 | module.exports = { 6 | /** 7 | * Get the total amount you will be charge for a transaction 8 | * @param amount, fee 9 | */ 10 | get:{ 11 | method: 'post', 12 | endpoint: root, 13 | params: ['amount', 'fee'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/transactions/PreviousCardToAccount.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = "/v1/transfer/{id}"; 4 | 5 | module.exports = { 6 | /** 7 | * get your previoud card to account transfer 8 | * @args id 9 | */ 10 | get: { 11 | method: 'post', 12 | endpoint: root, 13 | args: ['id'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/transactions/PreviousWalletToAccount.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/disburse/status'; 4 | 5 | module.exports = { 6 | /** 7 | * get the previous wallet to accout transfer 8 | * @param ref 9 | */ 10 | get: { 11 | method:'post', 12 | endpoint: root, 13 | params: ['ref'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/transactions/RetryFailedTransaction.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const root = '/v1/transfer/disburse/retry'; 4 | 5 | module.exports = { 6 | /** 7 | * retry a failed transaction 8 | * @params id, recipient_account_number, recipient_bank 9 | */ 10 | retry: { 11 | method: 'post', 12 | endpoint: root, 13 | params: ['id', 'recipient_account_number', 'recipient_bank'] 14 | } 15 | }; -------------------------------------------------------------------------------- /utils/transactions/TransStatusCardToAccount.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const root = '/v1/transfer/charge/status'; 4 | 5 | module.exports = { 6 | /** 7 | * Check transactions status 8 | * @params "ref" 9 | */ 10 | 11 | check : { 12 | method: 'post', 13 | endpoint: root, 14 | params: ['ref'] 15 | } 16 | } --------------------------------------------------------------------------------