@setu/upi-deep-links
Advanced tools
Comparing version 1.3.0 to 2.1.0
135
package.json
{ | ||
"name": "@setu/upi-deep-links", | ||
"version": "1.3.0", | ||
"description": "NPM package to connect to Setu's UPI Deep Link APIs", | ||
"main": "src/setu.js", | ||
"scripts": { | ||
"start": "node src/setu.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@github.com/SetuHQ/node-upi-deep-links.git" | ||
}, | ||
"keywords": [ | ||
"setu", | ||
"upi" | ||
], | ||
"author": "Nithin Kashyap <nithin@setu.co>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/SetuHQ/node-upi-deep-links/issues" | ||
}, | ||
"homepage": "https://github.com/SetuHQ/node-upi-deep-links#readme", | ||
"dependencies": { | ||
"axios": "^0.21.4", | ||
"jsonwebtoken": "^8.5.1", | ||
"uuid": "^8.3.0" | ||
} | ||
"name": "@setu/upi-deep-links", | ||
"version": "2.1.0", | ||
"description": "NPM package to connect to Setu's UPI Deep Link APIs", | ||
"main": "build/main/index.js", | ||
"typings": "build/main/index.d.ts", | ||
"module": "build/module/index.js", | ||
"repository": "https://github.com/SetuHQ/node-upi-deep-links", | ||
"license": "MIT", | ||
"keywords": [ | ||
"setu", | ||
"upi" | ||
], | ||
"scripts": { | ||
"build": "run-p build:*", | ||
"build:main": "tsc -p tsconfig.json", | ||
"build:module": "tsc -p tsconfig.module.json", | ||
"fix": "run-s fix:*", | ||
"fix:prettier": "prettier \"src/**/*.ts\" --write", | ||
"fix:lint": "eslint src --ext .ts --fix", | ||
"test": "run-s build test:*", | ||
"test:lint": "eslint src --ext .ts", | ||
"test:prettier": "prettier \"src/**/*.ts\" --list-different", | ||
"test:unit": "nyc --silent ava", | ||
"check-cli": "run-s test diff-integration-tests check-integration-tests", | ||
"check-integration-tests": "run-s check-integration-test:*", | ||
"diff-integration-tests": "mkdir -p diff && rm -rf diff/test && cp -r test diff/test && rm -rf diff/test/test-*/.git && cd diff && git init --quiet && git add -A && git commit --quiet --no-verify --allow-empty -m 'WIP' && echo '\\n\\nCommitted most recent integration test output in the \"diff\" directory. Review the changes with \"cd diff && git diff HEAD\" or your preferred git diff viewer.'", | ||
"watch:build": "tsc -p tsconfig.json -w", | ||
"watch:test": "nyc --silent ava --watch", | ||
"cov": "run-s build test:unit cov:html cov:lcov && open-cli coverage/index.html", | ||
"cov:html": "nyc report --reporter=html", | ||
"cov:lcov": "nyc report --reporter=lcov", | ||
"cov:send": "run-s cov:lcov && codecov", | ||
"cov:check": "nyc report && nyc check-coverage --lines 80 --functions 90 --branches 90", | ||
"doc": "run-s doc:html && open-cli build/docs/index.html", | ||
"doc:html": "typedoc src/ --exclude **/*.spec.ts --out build/docs", | ||
"doc:json": "typedoc src/ --exclude **/*.spec.ts --json build/docs/typedoc.json", | ||
"doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs", | ||
"version": "standard-version", | ||
"reset-hard": "git clean -dfx && git reset --hard && npm i", | ||
"prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish" | ||
}, | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"devDependencies": { | ||
"@ava/typescript": "^1.1.1", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.1", | ||
"@types/jsonwebtoken": "^8.5.8", | ||
"@types/uuid": "^8.3.4", | ||
"@typescript-eslint/eslint-plugin": "^4.0.1", | ||
"@typescript-eslint/parser": "^4.0.1", | ||
"ava": "^3.12.1", | ||
"codecov": "^3.5.0", | ||
"cspell": "^4.1.0", | ||
"cz-conventional-changelog": "^3.0.1", | ||
"eslint": "^7.8.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-eslint-comments": "^3.2.0", | ||
"eslint-plugin-functional": "^3.0.2", | ||
"eslint-plugin-import": "^2.22.0", | ||
"gh-pages": "^3.1.0", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^15.1.0", | ||
"open-cli": "^6.0.1", | ||
"prettier": "^2.1.1", | ||
"standard-version": "^9.0.0", | ||
"ts-node": "^9.0.0", | ||
"typedoc": "^0.22.15", | ||
"typedoc-plugin-missing-exports": "^0.22.6", | ||
"typescript": "^4.0.2" | ||
}, | ||
"files": [ | ||
"build/main", | ||
"build/module", | ||
"!**/*.spec.*", | ||
"!**/*.json", | ||
"CHANGELOG.md", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"ava": { | ||
"failFast": true, | ||
"timeout": "90s", | ||
"typescript": { | ||
"rewritePaths": { | ||
"src/": "build/main/" | ||
} | ||
}, | ||
"files": [ | ||
"!build/module/**" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"nyc": { | ||
"extends": "@istanbuljs/nyc-config-typescript", | ||
"exclude": [ | ||
"**/*.spec.js" | ||
] | ||
}, | ||
"dependencies": { | ||
"axios": "^0.27.2", | ||
"axios-auth-refresh": "^3.2.2", | ||
"jsonwebtoken": "^8.5.1", | ||
"uuid": "^8.3.2" | ||
} | ||
} |
172
README.md
@@ -1,68 +0,166 @@ | ||
# Setu | ||
# Setu UPI Deeplinks: NodeJS SDK | ||
This package helps you use [Setu’s](https://setu.co/payments/upi-deeplinks) [DeepLink](https://docs.setu.co/collect/biller/upi-deep-links) APIs. | ||
`@setu/upi-deep-links` is a NodeJS SDK for accessing Setu’s [UPI Deeplinks](https://docs.setu.co/collect/biller/upi-deep-links) APIs. The SDK is designed with ease of access in mind, with full TypeScript support. | ||
[![version](https://img.shields.io/npm/v/@setu/upi-deep-links)](https://www.npmjs.org/package/@setu/upi-deep-links) | ||
[![Version](https://img.shields.io/npm/v/@setu/upi-deep-links?color=%2320014B)](https://www.npmjs.org/package/@setu/upi-deep-links) | ||
[![Downloads](https://img.shields.io/npm/dw/@setu/upi-deep-links?color=%23FEB452)](https://www.npmjs.org/package/@setu/upi-deep-links) | ||
[![Size](https://img.shields.io/bundlephobia/min/@setu/upi-deep-links?color=%2336A168)](https://bundlephobia.com/package/@setu/upi-deep-links) | ||
[![License](https://img.shields.io/npm/l/@setu/upi-deep-links?color=%23FE90A0)](LICENSE.md) | ||
The following functions are supported— | ||
<img src="docs/deeplinks.png" alt="SDK in action" width="100%"> | ||
1. Generate UPI payment link | ||
2. Check status of UPI payment link | ||
## Getting started | ||
## Installation | ||
[SDK documentation →](https://opensource.setu.co/node-upi-deep-links) | ||
[Full documentation →](https://docs.setu.co/payments/upi-deeplinks) | ||
[Product overview →](https://setu.co/payments/upi-deeplinks) | ||
### Installation | ||
- npm | ||
```bash | ||
npm install @setu/upi-deep-links | ||
``` | ||
npm install @setu/upi-deep-links | ||
(OR) | ||
- yarn | ||
```bash | ||
yarn add @setu/upi-deep-links | ||
``` | ||
--- | ||
## Configuration | ||
### Features | ||
``` | ||
const SetuUPIDeepLink = require("@setu/upi-deep-links") | ||
- Full support for latest UPI Deeplinks APIs | ||
- Type definitions for all inputs & outputs | ||
- Allows both [JWT](https://docs.setu.co/payments/upi-deeplinks/resources/jwt) & [OAuth](https://docs.setu.co/payments/upi-deeplinks/resources/oauth) authentication mechanisms | ||
- `SANDBOX` mode to test integration & `PRODUCTION` for live data | ||
- Internal mechanism for OAuth authentication to automatically re-fetch token when current one expires, and retry all failed requests. | ||
let setu = new SetuUPIDeepLink({ | ||
schemeId: "YOUR SCHEME ID", | ||
jwtSecret: "YOUR JWT SECRET", | ||
setuProductInstanceId: "YOUR PRODUCT INSTANCE ID", | ||
mode: "PRODUCTION | SANDBOX", | ||
authType: "OAUTH | JWT" | ||
## Examples | ||
### Setup | ||
```js | ||
import { SetuUPIDeepLink } from "@setu/upi-deep-links"; | ||
const upidl = SetuUPIDeepLink({ | ||
schemeID: "5bf4376b-6008-43c8-8ce0-a5ea196e3091", | ||
secret: "9975fd99-d5ed-416a-9963-5d113dc80582", | ||
productInstanceID: "861023031961584801", | ||
mode: "SANDBOX", | ||
authType: "JWT", | ||
}); | ||
``` | ||
--- | ||
## Usage | ||
### Generate UPI payment link | ||
``` | ||
let paymentLinkBody = { | ||
amountValue: Number, | ||
billerBillID: String, | ||
amountExactness: String, | ||
dueDate: String, // Optional | ||
payeeName: String, // Optional | ||
expiryDate: String, // Optional | ||
settlement: Object, // Optional | ||
validationRules: Object, // Optional | ||
transactionNote: String // Optional | ||
```ts | ||
const paymentLinkBody = { | ||
amountValue: 20000, // amount in paisa | ||
billerBillID: "918147077472", // Unique merchant platform identifier for bill | ||
amountExactness: "EXACT", | ||
// Optional fields | ||
settlement: { | ||
parts: [ | ||
{ | ||
account: { | ||
id: "987654321", | ||
ifsc: "KKBK0000001", | ||
}, | ||
remarks: "EXACT sample split", | ||
split: { | ||
unit: "INR", | ||
value: 10000, | ||
}, | ||
}, | ||
], | ||
primaryAccount: { | ||
id: "123456789", | ||
ifsc: "KKBK0000001", | ||
}, | ||
}, | ||
}; | ||
let data = await setu.createPaymentLink(paymentLinkBody); | ||
const data = await upiDL.createPaymentLink(paymentLinkBody); | ||
``` | ||
--- | ||
### Check status of UPI payment link | ||
```ts | ||
const data = await upiDL.checkPaymentStatus("891365293916423373"); | ||
``` | ||
let data = await setu.checkPaymentStatus("platformBillID"); | ||
### Trigger mock payment for UPI payment link (Sandbox only) | ||
```ts | ||
const data = await upidl.triggerMockPayment({ | ||
amountValue: 200, // amount in rupees | ||
platformBillID: "891365293916423373", | ||
vpa: "nareshlocal@kaypay", // Merchant VPA | ||
}); | ||
``` | ||
--- | ||
### Expire a UPI payment link | ||
```ts | ||
const data = await upiDL.expireBill("891365293916423373"); | ||
``` | ||
### Initiate refunds | ||
```ts | ||
const data = await upiDL.initiateRefund({ | ||
refunds: [ | ||
{ | ||
identifier: platformBillID, | ||
identifierType: "BILL_ID", | ||
refundType: "FULL", | ||
deductions: [ | ||
{ | ||
account: { | ||
id: "123456789", | ||
ifsc: "KKBK0000001", | ||
}, | ||
split: { | ||
unit: "INR", | ||
value: 10000, | ||
}, | ||
}, | ||
{ | ||
account: { | ||
id: "987654321", | ||
ifsc: "KKBK0000001", | ||
}, | ||
split: { | ||
unit: "INR", | ||
value: 10000, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
``` | ||
### Get refund batch status | ||
```ts | ||
const data = await upiDL.getRefundBatchStatus(initiateRefundResponse.batchID); | ||
``` | ||
### Get individual refund status | ||
```ts | ||
const data = await upiDL.getRefundStatus(getRefundBatchStatusResponse.refunds[0].id); | ||
``` | ||
## Contributing | ||
Have a look through existing [Issues](https://github.com/SetuHQ/node-upi-deep-links/issues) and [Pull Requests](https://github.com/SetuHQ/node-upi-deep-links/pulls) that you could help with. If you'd like to request a feature or report a bug, please [create a GitHub Issue](https://github.com/SetuHQ/node-upi-deep-links/issues) using the template provided. | ||
[See contribution guide →](.github/CONTRIBUTING.md) | ||
## License | ||
MIT. Have at it. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167
11252
4
25
4
0
2
1
1
2
+ Addedaxios-auth-refresh@^3.2.2
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@0.27.2(transitive)
+ Addedaxios-auth-refresh@3.3.6(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.27.2
Updateduuid@^8.3.2