From 4f5b46aa1b597549b242b320746c196ea1e5d36f Mon Sep 17 00:00:00 2001 From: Mugendi Gitonga Date: Thu, 30 May 2024 11:08:09 +0300 Subject: [PATCH 1/4] Approval flag for send money --- example.js | 20 ++++++++++++-------- package.json | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/example.js b/example.js index 787d157..83cedc1 100644 --- a/example.js +++ b/example.js @@ -67,10 +67,12 @@ wallets // How to send money M-PESA (B2C, B2B, BANK, INTASEND P2P) // Learn more from our API reference on provider types and fields here - https://developers.intasend.com/reference/send-money_initiate_create let payouts = intasend.payouts(); +var req_approval = "YES" payouts .initiate({ provider: 'MPESA-B2B', currency: 'KES', + requires_approval: req_approval, // Set to 'NO' if you want the transaction to go through without calling the approve method transactions: [ { name: 'ABC', @@ -84,14 +86,16 @@ payouts .then((resp) => { console.log(`Payouts response: ${JSON.stringify(resp)}`); // Approve payouts - payouts - .approve(resp) - .then((resp) => { - console.log(`Payouts approve: ${JSON.stringify(resp)}`); - }) - .catch((err) => { - console.error(`Payouts approve error: ${err}`); - }); + if (req_approval === 'YES'){ + payouts + .approve(resp) + .then((resp) => { + console.log(`Payouts approve: ${JSON.stringify(resp)}`); + }) + .catch((err) => { + console.error(`Payouts approve error: ${err}`); + }); + } }) .catch((err) => { console.error(`Payouts error: ${err}`); diff --git a/package.json b/package.json index 72499b3..179db7d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "intasend-node", "description": "IntaSend official NodeJS SDK", - "version": "1.0.7", + "version": "1.0.8", "main": "intasend.js", "license": "MIT", "repository": "https://github.com/IntaSend/intasend-node.git", From fd29eed538ba12adfcca4a0c5e02611901050b7b Mon Sep 17 00:00:00 2001 From: Mugendi Gitonga Date: Thu, 30 May 2024 11:17:57 +0300 Subject: [PATCH 2/4] Yarn fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d79b69d..7637e31 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ## Installation - yarn install intasend-node + yarn add intasend-node or using NPM From cf1d90935a6104d8c19fd180f523001d02f1f5a4 Mon Sep 17 00:00:00 2001 From: Mugendi Gitonga Date: Wed, 5 Jun 2024 09:53:15 +0300 Subject: [PATCH 3/4] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d3ce89..68fac79 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "intasend-node", "description": "IntaSend official NodeJS SDK", - "version": "1.0.8", + "version": "1.1.0", "main": "./dist/intasend.js", "types": "./dist/intasend.d.ts", "files": [ From e32d02c5d5d9be1d5e9b16ae615edf334e00bf1e Mon Sep 17 00:00:00 2001 From: Mugendi Gitonga Date: Wed, 16 Oct 2024 10:02:58 +0300 Subject: [PATCH 4/4] Node updates: 1. Version 2. Example --- package.json | 7 +++++-- src/example.js | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 68fac79..7142a3a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "intasend-node", "description": "IntaSend official NodeJS SDK", - "version": "1.1.0", + "version": "1.1.2", "main": "./dist/intasend.js", "types": "./dist/intasend.d.ts", "files": [ @@ -11,7 +11,10 @@ "build": "tsc" }, "license": "GNU Affero General Public License v3.0", - "repository": "https://github.com/IntaSend/intasend-node.git", + "repository": { + "type": "git", + "url": "git+https://github.com/IntaSend/intasend-node.git" + }, "devDependencies": { "@types/node": "^18.7.18", "typescript": "^5.4.5" diff --git a/src/example.js b/src/example.js index 83cedc1..96633b9 100644 --- a/src/example.js +++ b/src/example.js @@ -86,16 +86,16 @@ payouts .then((resp) => { console.log(`Payouts response: ${JSON.stringify(resp)}`); // Approve payouts - if (req_approval === 'YES'){ - payouts - .approve(resp) - .then((resp) => { - console.log(`Payouts approve: ${JSON.stringify(resp)}`); - }) - .catch((err) => { - console.error(`Payouts approve error: ${err}`); - }); - } + // if (req_approval === 'YES'){ + // payouts + // .approve(resp) + // .then((resp) => { + // console.log(`Payouts approve: ${JSON.stringify(resp)}`); + // }) + // .catch((err) => { + // console.error(`Payouts approve error: ${err}`); + // }); + // } }) .catch((err) => { console.error(`Payouts error: ${err}`);