verify-payet 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# ver-pay
|
|
2
|
+
|
|
3
|
+
NPM package for verifying payment receipts across multiple Ethiopian banks.
|
|
4
|
+
|
|
5
|
+
## Supported banks
|
|
6
|
+
|
|
7
|
+
- `cbe`
|
|
8
|
+
- `cbebirr`
|
|
9
|
+
- `dashen`
|
|
10
|
+
- `abyssinia`
|
|
11
|
+
- `awash`
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install ver-pay
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { verifyPayment } from "ver-pay";
|
|
23
|
+
|
|
24
|
+
const result = await verifyPayment({
|
|
25
|
+
bank: "cbe",
|
|
26
|
+
transactionId: "TX123",
|
|
27
|
+
account: "100012345678",
|
|
28
|
+
transactionReference: "ABC123",
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (result.success) {
|
|
32
|
+
console.log("Verified", result.amount, result.reference);
|
|
33
|
+
} else {
|
|
34
|
+
console.error("Verification failed", result.error || result.reason);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Advanced usage (custom adapters)
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createPaymentVerifier, type BankAdapter } from "ver-pay";
|
|
42
|
+
|
|
43
|
+
class MyBankAdapter implements BankAdapter {
|
|
44
|
+
async verify() {
|
|
45
|
+
return { success: true, reference: "MY-REF" };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const verifier = createPaymentVerifier();
|
|
50
|
+
verifier.registerAdapter("mybank", new MyBankAdapter());
|
|
51
|
+
|
|
52
|
+
const result = await verifier.verifyPayment({
|
|
53
|
+
bank: "mybank",
|
|
54
|
+
transactionId: "TX-1",
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## API
|
|
59
|
+
|
|
60
|
+
### `verifyPayment(request)`
|
|
61
|
+
|
|
62
|
+
Request type:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
{
|
|
66
|
+
bank: string;
|
|
67
|
+
transactionId?: string;
|
|
68
|
+
account?: string;
|
|
69
|
+
transactionReference?: string;
|
|
70
|
+
receiptNumber?: string;
|
|
71
|
+
phoneNumber?: string;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### `createPaymentVerifier(customAdapters?)`
|
|
76
|
+
|
|
77
|
+
Returns a `PaymentVerifier` instance with:
|
|
78
|
+
|
|
79
|
+
- `verifyPayment(request)`
|
|
80
|
+
- `registerAdapter(bank, adapter)`
|
|
81
|
+
- `getSupportedBanks()`
|
|
82
|
+
|
|
83
|
+
## Build and test
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm build
|
|
87
|
+
pnpm test
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Publish to npm
|
|
91
|
+
|
|
92
|
+
1. Login: `npm login`
|
|
93
|
+
2. Bump version: `npm version patch`
|
|
94
|
+
3. Publish: `npm publish --access public`
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "verify-payet",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "NPM package for verifying payment receipts across Ethiopian banks",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"dev": "nodemon --exec ts-node src/server.ts",
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"start": "node dist/server.js",
|
|
20
|
+
"test": "node --test -r ts-node/register src/bankManager.test.ts",
|
|
21
|
+
"release:patch": "pnpm run build && pnpm run test && npm version patch && npm publish --access public"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"payment",
|
|
25
|
+
"verification",
|
|
26
|
+
"bank",
|
|
27
|
+
"receipts",
|
|
28
|
+
"ethiopia"
|
|
29
|
+
],
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"packageManager": "pnpm@10.15.1",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"axios": "^1.12.2",
|
|
35
|
+
"cheerio": "^1.1.2",
|
|
36
|
+
"cors": "^2.8.5",
|
|
37
|
+
"express": "^5.1.0",
|
|
38
|
+
"node-fetch": "^2.7.0",
|
|
39
|
+
"pdf-parse": "^1.1.1",
|
|
40
|
+
"puppeteer": "^24.22.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/cheerio": "^1.0.0",
|
|
44
|
+
"@types/cors": "^2.8.19",
|
|
45
|
+
"@types/express": "^5.0.3",
|
|
46
|
+
"@types/node": "^24.6.0",
|
|
47
|
+
"@types/node-fetch": "^2.6.13",
|
|
48
|
+
"@types/pdf-parse": "^1.1.5",
|
|
49
|
+
"nodemon": "^3.1.10",
|
|
50
|
+
"ts-node": "^10.9.2",
|
|
51
|
+
"ts-node-dev": "^2.0.0",
|
|
52
|
+
"typescript": "^5.9.2"
|
|
53
|
+
}
|
|
54
|
+
}
|