@laranex/myanmar-payments 4.0.0-dev.8 → 4.0.0-dev.9
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/CHANGELOG.md
CHANGED
|
@@ -32,3 +32,4 @@ Initial release. The version number matches the other Laranex Myanmar payments p
|
|
|
32
32
|
- `Amount.equals()` compares by value, ignoring leading zeros too (`'01000'` equals `Amount.kyat(1000)`); text that is not plain digits with an optional fraction is never equal.
|
|
33
33
|
- `CallbackRequest.rawBody` holds the exact bytes received (a string body is encoded as UTF-8), next to `body` as text, like Python's `raw_body` and Go's `Body`.
|
|
34
34
|
- `WaveMoneyPaymentData` takes optional `merchantName` and `timeToLiveSeconds`, which override the configured `merchantName` and `timeToLiveSeconds` for one payment (request hash included); a blank `merchantName` or a `timeToLiveSeconds` that is not a whole number greater than 0 throws `InvalidPaymentDataError`, like the PHP SDK.
|
|
35
|
+
- `KbzPayPaymentData.timeoutMinutes` is renamed to `timeToLiveSeconds` and takes seconds, like Wave Money: 60 to 7200, in whole minutes (a multiple of 60), because KBZ's `timeout_express` counts minutes (`1800` is sent as `30m`). Upgrading: multiply the old value by 60.
|
|
@@ -58,8 +58,11 @@ export interface KbzPayPaymentData {
|
|
|
58
58
|
callbackUrl: string;
|
|
59
59
|
/** The product name shown to the customer. */
|
|
60
60
|
title?: string | undefined;
|
|
61
|
-
/**
|
|
62
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Seconds the customer has to pay before the order expires, 60 to 7200 in whole minutes (a multiple
|
|
63
|
+
* of 60). KBZ counts minutes, so 1800 is sent as `30m`. KBZ defaults to 7200 (120 minutes).
|
|
64
|
+
*/
|
|
65
|
+
timeToLiveSeconds?: number | undefined;
|
|
63
66
|
/** Free text KBZ sends back unchanged in the callback, at most 512 characters once URL-encoded. */
|
|
64
67
|
callbackInfo?: string | undefined;
|
|
65
68
|
}
|
|
@@ -93,7 +93,8 @@ class KbzPay {
|
|
|
93
93
|
.max('callbackUrl', callbackUrl, 512)
|
|
94
94
|
.when(callbackUrl.includes('?'), 'callbackUrl', 'The callbackUrl field must not contain a query string.')
|
|
95
95
|
.string('title', data.title)
|
|
96
|
-
.between('
|
|
96
|
+
.between('timeToLiveSeconds', data.timeToLiveSeconds, 60, 7200)
|
|
97
|
+
.when(Number.isInteger(data.timeToLiveSeconds) && data.timeToLiveSeconds % 60 !== 0, 'timeToLiveSeconds', 'The timeToLiveSeconds field must be a multiple of 60.')
|
|
97
98
|
.string('callbackInfo', data.callbackInfo)
|
|
98
99
|
.max('callbackInfo', typeof data.callbackInfo === 'string' ? (0, crypto_js_1.queryEscape)(data.callbackInfo) : undefined, 512)
|
|
99
100
|
.validate();
|
|
@@ -126,9 +127,9 @@ class KbzPay {
|
|
|
126
127
|
return new results_js_1.QrPayment({
|
|
127
128
|
orderId: data.orderId,
|
|
128
129
|
qrString: qrCode,
|
|
129
|
-
expiresAt: data.
|
|
130
|
+
expiresAt: data.timeToLiveSeconds === undefined
|
|
130
131
|
? undefined
|
|
131
|
-
: new Date(Date.now() + data.
|
|
132
|
+
: new Date(Date.now() + data.timeToLiveSeconds * 1000),
|
|
132
133
|
reference: order.prepayId,
|
|
133
134
|
raw: (0, json_js_1.toPlainObject)(order.response),
|
|
134
135
|
});
|
|
@@ -199,8 +200,8 @@ class KbzPay {
|
|
|
199
200
|
if (data.title) {
|
|
200
201
|
biz.title = data.title;
|
|
201
202
|
}
|
|
202
|
-
if (data.
|
|
203
|
-
biz.timeout_express = `${data.
|
|
203
|
+
if (data.timeToLiveSeconds !== undefined) {
|
|
204
|
+
biz.timeout_express = `${data.timeToLiveSeconds / 60}m`;
|
|
204
205
|
}
|
|
205
206
|
if (data.callbackInfo) {
|
|
206
207
|
biz.callback_info = (0, crypto_js_1.queryEscape)(data.callbackInfo);
|
|
@@ -58,8 +58,11 @@ export interface KbzPayPaymentData {
|
|
|
58
58
|
callbackUrl: string;
|
|
59
59
|
/** The product name shown to the customer. */
|
|
60
60
|
title?: string | undefined;
|
|
61
|
-
/**
|
|
62
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Seconds the customer has to pay before the order expires, 60 to 7200 in whole minutes (a multiple
|
|
63
|
+
* of 60). KBZ counts minutes, so 1800 is sent as `30m`. KBZ defaults to 7200 (120 minutes).
|
|
64
|
+
*/
|
|
65
|
+
timeToLiveSeconds?: number | undefined;
|
|
63
66
|
/** Free text KBZ sends back unchanged in the callback, at most 512 characters once URL-encoded. */
|
|
64
67
|
callbackInfo?: string | undefined;
|
|
65
68
|
}
|
|
@@ -90,7 +90,8 @@ export class KbzPay {
|
|
|
90
90
|
.max('callbackUrl', callbackUrl, 512)
|
|
91
91
|
.when(callbackUrl.includes('?'), 'callbackUrl', 'The callbackUrl field must not contain a query string.')
|
|
92
92
|
.string('title', data.title)
|
|
93
|
-
.between('
|
|
93
|
+
.between('timeToLiveSeconds', data.timeToLiveSeconds, 60, 7200)
|
|
94
|
+
.when(Number.isInteger(data.timeToLiveSeconds) && data.timeToLiveSeconds % 60 !== 0, 'timeToLiveSeconds', 'The timeToLiveSeconds field must be a multiple of 60.')
|
|
94
95
|
.string('callbackInfo', data.callbackInfo)
|
|
95
96
|
.max('callbackInfo', typeof data.callbackInfo === 'string' ? queryEscape(data.callbackInfo) : undefined, 512)
|
|
96
97
|
.validate();
|
|
@@ -123,9 +124,9 @@ export class KbzPay {
|
|
|
123
124
|
return new QrPayment({
|
|
124
125
|
orderId: data.orderId,
|
|
125
126
|
qrString: qrCode,
|
|
126
|
-
expiresAt: data.
|
|
127
|
+
expiresAt: data.timeToLiveSeconds === undefined
|
|
127
128
|
? undefined
|
|
128
|
-
: new Date(Date.now() + data.
|
|
129
|
+
: new Date(Date.now() + data.timeToLiveSeconds * 1000),
|
|
129
130
|
reference: order.prepayId,
|
|
130
131
|
raw: toPlainObject(order.response),
|
|
131
132
|
});
|
|
@@ -196,8 +197,8 @@ export class KbzPay {
|
|
|
196
197
|
if (data.title) {
|
|
197
198
|
biz.title = data.title;
|
|
198
199
|
}
|
|
199
|
-
if (data.
|
|
200
|
-
biz.timeout_express = `${data.
|
|
200
|
+
if (data.timeToLiveSeconds !== undefined) {
|
|
201
|
+
biz.timeout_express = `${data.timeToLiveSeconds / 60}m`;
|
|
201
202
|
}
|
|
202
203
|
if (data.callbackInfo) {
|
|
203
204
|
biz.callback_info = queryEscape(data.callbackInfo);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@laranex/myanmar-payments",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.9",
|
|
4
4
|
"description": "Node.js SDK for Myanmar payment gateways: KBZ Pay, Wave Money, AYA Pay, Yoma MMQR and CyberSource. Typed requests and results, exact amounts, no runtime dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"laranex",
|