thai-bank-transfer-qr 0.1.0 → 0.2.1

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.
Files changed (3) hide show
  1. package/README.md +3 -7
  2. package/index.js +2 -16
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -2,12 +2,11 @@
2
2
 
3
3
  Minimal, dependency-free Thai bank transfer QR payload builder (PromptPay / Tag 29 + CRC16-CCITT).
4
4
 
5
- - No merchant name or city tags (59/60) included.
6
- - Privacy: never publish real bank account numbers.
7
-
8
5
  ## Install
9
6
 
10
- Use directly in a monorepo or publish to npm.
7
+ ```bash
8
+ npm install thai-bank-transfer-qr
9
+ ```
11
10
 
12
11
  ## Usage
13
12
 
@@ -18,7 +17,6 @@ const payload = buildThaiQRBankTransfer({
18
17
  bankCode: "004", // example only
19
18
  accountNumber: "1234567890", // example only
20
19
  amount: 10,
21
- dynamic: false, // 11 static, 12 dynamic
22
20
  })
23
21
 
24
22
  console.log(payload)
@@ -30,8 +28,6 @@ console.log(payload)
30
28
  - bankCode: string (3 digits)
31
29
  - accountNumber: string (digits only)
32
30
  - amount: number|string (formatted to 2 decimals)
33
- - dynamic?: boolean (default true)
34
- - referenceId?: string (Tag 62 >> 05)
35
31
 
36
32
  Also exports: `tlv`, `crc16CCITT`.
37
33
 
package/index.js CHANGED
@@ -35,19 +35,9 @@ export function crc16CCITT(input) {
35
35
  * @param {string} options.bankCode 3-digit Thai bank code (e.g. "004")
36
36
  * @param {string} options.accountNumber Digits only
37
37
  * @param {number|string} options.amount Fixed THB amount
38
- * @param {boolean} [options.dynamic=true] Tag 01: 12=dynamic, 11=static
39
- * @param {string} [options.merchantName]
40
- * @param {string} [options.merchantCity]
41
- * @param {string} [options.referenceId]
42
38
  * @returns {string}
43
39
  */
44
- export function buildThaiQRBankTransfer({
45
- bankCode,
46
- accountNumber,
47
- amount,
48
- dynamic = true,
49
- referenceId,
50
- }) {
40
+ export function buildThaiQRBankTransfer({ bankCode, accountNumber, amount }) {
51
41
  if (!/^\d{3}$/.test(bankCode))
52
42
  throw new Error("bankCode must be 3 digits (e.g. 004)");
53
43
  if (!/^\d+$/.test(accountNumber))
@@ -64,18 +54,14 @@ export function buildThaiQRBankTransfer({
64
54
  tlv("00", "A000000677010111") + tlv("03", `${bankCode}${accountNumber}`)
65
55
  );
66
56
 
67
- // Optional Tag 62 → 05=Reference ID
68
- const tag62 = referenceId ? tlv("62", tlv("05", referenceId)) : "";
69
-
70
57
  const withoutCRC =
71
58
  tlv("00", "01") +
72
- tlv("01", dynamic ? "12" : "11") +
59
+ tlv("01", "11") +
73
60
  tag29 +
74
61
  tlv("52", "0000") +
75
62
  tlv("53", "764") +
76
63
  tlv("54", amt) +
77
64
  tlv("58", "TH") +
78
- tag62 +
79
65
  "6304";
80
66
 
81
67
  const crc = crc16CCITT(withoutCRC);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thai-bank-transfer-qr",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Thai bank transfer QR payload builder (PromptPay – Tag 29 + CRC16)",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -19,7 +19,7 @@
19
19
  "author": "thunthup",
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "https://github.com/thunthup/thai-bank-qr.git"
22
+ "url": "git+https://github.com/thunthup/thai-bank-qr.git"
23
23
  },
24
24
  "homepage": "https://github.com/thunthup/thai-bank-qr#readme",
25
25
  "bugs": {