@mmpay/aya-mmqr 1.0.13 → 1.0.14
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/bun.lock +5 -1
- package/dist/cjs/index.js +9 -9
- package/dist/esm/index.js +2 -2
- package/package.json +7 -8
- package/src/index.ts +2 -2
- package/tsconfig.json +1 -1
package/bun.lock
CHANGED
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "@mmpay/aya-mmqr",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@types/
|
|
8
|
+
"@types/bun": "^1.4.3",
|
|
9
9
|
"dotenv": "^17.2.2",
|
|
10
10
|
"typescript": "^5.4.0",
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
"packages": {
|
|
15
|
+
"@types/bun": ["@types/bun@1.4.3", "", { "dependencies": { "bun-types": "1.4.3" } }, "sha512-N67Pqy8JXbAY/j0tNraS3V5mubGvc6rrrNDmDCtZLlFzccbUJPDb0tvgUBC5q4m8ybkP93Jcn1QB+RYQ6PvBhw=="],
|
|
16
|
+
|
|
15
17
|
"@types/node": ["@types/node@26.6.5", "", { "dependencies": { "undici-types": "~8.9.0" } }, "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg=="],
|
|
16
18
|
|
|
19
|
+
"bun-types": ["bun-types@1.4.3", "", { "dependencies": { "@types/node": "*", "undici-types": "*" } }, "sha512-tinRJNGOmUN+tEAsn2y2e942n9JHRHR42iUYzDH75NmhJqVBokGSQkkfSFdNWwsANIdrK6ACH9t01M452YyTwg=="],
|
|
20
|
+
|
|
17
21
|
"dotenv": ["dotenv@17.4.2", "", {}, "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw=="],
|
|
18
22
|
|
|
19
23
|
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
package/dist/cjs/index.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.AYAPayMerchantApi = AYAPayMerchantApi;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const buffer_1 = require("buffer");
|
|
8
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
9
9
|
/**
|
|
10
10
|
* @AYAPayMerchantApi
|
|
11
11
|
* @param {InstanceOptions} options
|
|
@@ -50,7 +50,7 @@ class AYAPayMerchantClass {
|
|
|
50
50
|
*/
|
|
51
51
|
basicToken() {
|
|
52
52
|
const rawString = `${this.#consumerKey}:${this.#consumerSecret}`;
|
|
53
|
-
const buffer =
|
|
53
|
+
const buffer = buffer_1.Buffer.from(rawString);
|
|
54
54
|
const base64String = buffer.toString('base64');
|
|
55
55
|
return base64String;
|
|
56
56
|
}
|
|
@@ -294,9 +294,9 @@ class AYAPayMerchantClass {
|
|
|
294
294
|
try {
|
|
295
295
|
if (!options.paymentResult)
|
|
296
296
|
throw new Error("paymentResult is missing or undefined");
|
|
297
|
-
const cipherRaw =
|
|
298
|
-
const key =
|
|
299
|
-
const decipher =
|
|
297
|
+
const cipherRaw = buffer_1.Buffer.from(options.paymentResult, 'base64');
|
|
298
|
+
const key = buffer_1.Buffer.from(this.#decryptionKey);
|
|
299
|
+
const decipher = crypto_1.default.createDecipheriv('aes-256-ecb', key, null);
|
|
300
300
|
let decrypted = decipher.update(cipherRaw, undefined, 'utf8');
|
|
301
301
|
decrypted += decipher.final('utf8');
|
|
302
302
|
const result = JSON.parse(decrypted);
|
|
@@ -315,9 +315,9 @@ class AYAPayMerchantClass {
|
|
|
315
315
|
try {
|
|
316
316
|
if (!options.refundResult)
|
|
317
317
|
throw new Error("refundResult is missing or undefined");
|
|
318
|
-
const cipherRaw =
|
|
319
|
-
const key =
|
|
320
|
-
const decipher =
|
|
318
|
+
const cipherRaw = buffer_1.Buffer.from(options.refundResult, 'base64');
|
|
319
|
+
const key = buffer_1.Buffer.from(this.#decryptionKey);
|
|
320
|
+
const decipher = crypto_1.default.createDecipheriv('aes-256-ecb', key, null);
|
|
321
321
|
let decrypted = decipher.update(cipherRaw, undefined, 'utf8');
|
|
322
322
|
decrypted += decipher.final('utf8');
|
|
323
323
|
const result = JSON.parse(decrypted);
|
package/dist/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmpay/aya-mmqr",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "MMQR, AYA Pay - Integration Package By MyanMyanPay",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MMQR",
|
|
@@ -30,22 +30,21 @@
|
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/nawing/AYA-Pay-Merchant-API#readme",
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": "^26.6.5",
|
|
34
33
|
"bun": ">=1.4.3"
|
|
35
34
|
},
|
|
36
35
|
"scripts": {
|
|
37
36
|
"clean": "rm -rf dist",
|
|
37
|
+
"check": "tsc --noEmit",
|
|
38
38
|
"build:esm": "tsc -p tsconfig.json",
|
|
39
39
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
40
|
-
"build": "
|
|
41
|
-
"test": "
|
|
42
|
-
"
|
|
43
|
-
"prepublishOnly": "npm run build"
|
|
40
|
+
"build": "bun run clean && bun run check && bun run build:esm && bun run build:cjs",
|
|
41
|
+
"test": "bun test",
|
|
42
|
+
"prepublishOnly": "bun run build"
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
45
|
+
"@types/bun": "^1.4.3",
|
|
46
46
|
"dotenv": "^17.2.2",
|
|
47
|
-
"typescript": "^5.4.0"
|
|
48
|
-
"@types/node": "^26.0.0"
|
|
47
|
+
"typescript": "^5.4.0"
|
|
49
48
|
},
|
|
50
49
|
"publishConfig": {
|
|
51
50
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Buffer} from '
|
|
2
|
-
import crypto from '
|
|
1
|
+
import {Buffer} from 'buffer';
|
|
2
|
+
import crypto from 'crypto';
|
|
3
3
|
|
|
4
4
|
import {CallbackDecoded, CallbackEncoded, getTokenResponse, loginResponse, PaymentCreateRequest, PaymentCreateResponse, PaymentStatusRequest, PaymentStatusResponse} from './types';
|
|
5
5
|
|