Skip to content

Commit

Permalink
Merge pull request #5 from CookieGMVN/1.3.0
Browse files Browse the repository at this point in the history
Version 1.3.0
  • Loading branch information
CookieGMVN authored Jan 12, 2024
2 parents 8b63b3c + c644304 commit acf9f40
Show file tree
Hide file tree
Showing 30 changed files with 3,695 additions and 322 deletions.
6 changes: 4 additions & 2 deletions dist/MB.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ class MB {
this.mbRequest(data);
}
const rId = this.getRefNo();
const headers = Object.assign(Global_1.defaultHeaders, data.json);
const headers = Global_1.defaultHeaders;
headers["X-Request-Id"] = rId;
headers["Deviceid"] = this.deviceId,
headers["Refno"] = rId;
const defaultBody = {
"sessionId": this.sessionId,
"refNo": rId,
Expand Down Expand Up @@ -216,7 +218,7 @@ class MB {
"fromDate": (0, moment_1.default)(data.fromDate, "D/M/YYYY").format("DD/MM/YYYY"),
"toDate": (0, moment_1.default)(data.toDate, "D/M/YYYY").format("DD/MM/YYYY"),
};
const historyData = await this.mbRequest({ path: "/retail-web-transactionservice/transaction/getTransactionAccountHistory", json: body });
const historyData = await this.mbRequest({ path: "/api/retail-transactionms/transactionms/get-account-transaction-history", json: body });
if (!historyData)
return;
const transactionHistories = [];
Expand Down
3 changes: 1 addition & 2 deletions dist/Test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
const MB_1 = __importDefault(require("./MB"));
(async () => {
const mb = new MB_1.default({ username: "", password: "" });
console.log(mb);
console.log(MB_1.default);
})();
11 changes: 11 additions & 0 deletions dist/Test.local.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const MB_1 = __importDefault(require("./MB"));
(async () => {
const mb = new MB_1.default({ username: "0974163549", password: "CookieGMVN2007@" });
const transactions = await mb.getTransactionsHistory({ accountNumber: "0974163549", fromDate: "1/11/2023", toDate: "12/1/2024" });
console.log(transactions);
})();
23 changes: 19 additions & 4 deletions dist/utils/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultTesseractConfig = exports.defaultHeaders = exports.generateDeviceId = exports.getTimeNow = void 0;
const moment_1 = __importDefault(require("moment"));
const randomstring_1 = require("randomstring");
/**
* A function that encode the time to the right format.
* @returns The time in right format.
*/
function getTimeNow() {
return (0, moment_1.default)().format("YYYYMMDDHHmmss" + (0, moment_1.default)().millisecond().toString().slice(0, -1));
}
exports.getTimeNow = getTimeNow;
/**
* A function for generating the device ID.
* @returns The device ID generated.
*/
function generateDeviceId() {
return "s1rmi184-mbib-0000-0000-" + getTimeNow();
return (0, randomstring_1.generate)({ length: 8, charset: "hex" }) + "-mbib-0000-0000-" + getTimeNow();
}
exports.generateDeviceId = generateDeviceId;
/**
* A const for default request headers.
*/
exports.defaultHeaders = {
'Cache-Control': 'no-cache',
'Accept': 'application/json, text/plain, */*',
'Authorization': 'Basic RU1CUkVUQUlMV0VCOlNEMjM0ZGZnMzQlI0BGR0AzNHNmc2RmNDU4NDNm',
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.4.10 (KHTML, like Gecko) Version/8.0.4 Safari/600.4.10",
"Origin": "https://online.mbbank.com.vn",
"Referer": "https://online.mbbank.com.vn/",
"Content-Type": "application/json; charset=UTF-8",
"Connection": "keep-alive",
"Elastic-Apm-Traceparent": "00-a05b1d8ae659c91d9254ab749abd3e90-e25b5955e860a55e-01",
};
/**
* Recommended Tesseract OCR config.
*/
exports.defaultTesseractConfig = {
lang: "eng",
oem: 1,
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions docs/classes/MB.default.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">default</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L14">MB.ts:14</a></li></ul></aside>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L14">MB.ts:14</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand Down Expand Up @@ -82,7 +82,7 @@ <h5><span class="tsd-kind-property">password</span><span class="tsd-signature-sy
<h4 class="tsd-returns-title">Returns <a href="MB.default.html" class="tsd-signature-type tsd-kind-class">default</a></h4>
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L50">MB.ts:50</a></li></ul></aside></li></ul></section></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L50">MB.ts:50</a></li></ul></aside></li></ul></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Properties</h2>
<section class="tsd-panel tsd-member"><a id="username" class="tsd-anchor"></a>
Expand All @@ -92,39 +92,39 @@ <h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code
</div>
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L19">MB.ts:19</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L19">MB.ts:19</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="password" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadonly">Readonly</code> <span>password</span><a href="#password" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">password</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<div class="tsd-comment tsd-typography"><p>Your MB account password.</p>
</div>
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L25">MB.ts:25</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L25">MB.ts:25</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-is-private"><a id="sessionId" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>session<wbr/>Id</span><a href="#sessionId" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">session<wbr/>Id</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<div class="tsd-comment tsd-typography"><p>MB-returned Session ID. Use it to validate the request.</p>
</div>
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L31">MB.ts:31</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L31">MB.ts:31</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-is-private"><a id="deviceId" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>device<wbr/>Id</span><a href="#deviceId" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">device<wbr/>Id</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = ...</span></div>
<div class="tsd-comment tsd-typography"><p>Your non-unique, time-based Device ID.</p>
</div>
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L37">MB.ts:37</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L37">MB.ts:37</a></li></ul></aside></section>
<section class="tsd-panel tsd-member"><a id="client" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>client</span><a href="#client" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<div class="tsd-signature"><span class="tsd-kind-property">client</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type ">Client</span><span class="tsd-signature-symbol"> = ...</span></div>
<div class="tsd-comment tsd-typography"><p>Undici client. Use it for sending the request to API.</p>
</div>
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L42">MB.ts:42</a></li></ul></aside></section></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L42">MB.ts:42</a></li></ul></aside></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-is-private"><a id="login" class="tsd-anchor"></a>
Expand All @@ -137,7 +137,7 @@ <h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4>
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L60">MB.ts:60</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L60">MB.ts:60</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-is-private"><a id="getRefNo" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>get<wbr/>Ref<wbr/>No</span><a href="#getRefNo" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<ul class="tsd-signatures tsd-is-private">
Expand All @@ -149,7 +149,7 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</s

<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L139">MB.ts:139</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L139">MB.ts:139</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-is-private"><a id="mbRequest" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>mb<wbr/>Request</span><a href="#mbRequest" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<ul class="tsd-signatures tsd-is-private">
Expand All @@ -169,7 +169,7 @@ <h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-property">headers</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">object</span></h5></li></ul></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L143">MB.ts:143</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L143">MB.ts:143</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member"><a id="getBalance" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>get<wbr/>Balance</span><a href="#getBalance" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<ul class="tsd-signatures">
Expand All @@ -181,7 +181,7 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise<

<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L187">MB.ts:187</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L189">MB.ts:189</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member"><a id="getTransactionsHistory" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>get<wbr/>Transactions<wbr/>History</span><a href="#getTransactionsHistory" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
<ul class="tsd-signatures">
Expand Down Expand Up @@ -221,7 +221,7 @@ <h4>Example</h4><p>If you want to get transactions history from account &quot;12
</code><button>Copy</button></pre>
</div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/MB.ts#L241">MB.ts:241</a></li></ul></aside></li></ul></section></section></div>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/MB.ts#L243">MB.ts:243</a></li></ul></aside></li></ul></section></section></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand Down Expand Up @@ -262,7 +262,8 @@ <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon
<li><a href="MB.default.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g></svg><span>default</span></a></li></ul></div></details></li>
<li><a href="../modules/typings_MBApi.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4"></use></svg><span>typings/MBApi</span></a></li>
<li><a href="../modules/typings_MBLogin.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4"></use></svg><span>typings/MBLogin</span></a></li>
<li><a href="../modules/typings_ReplaceColor.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4"></use></svg><span>typings/<wbr/>Replace<wbr/>Color</span></a></li></ul></nav></div></div></div>
<li><a href="../modules/typings_ReplaceColor.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4"></use></svg><span>typings/<wbr/>Replace<wbr/>Color</span></a></li>
<li><a href="../modules/utils_Global.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4"></use></svg><span>utils/<wbr/>Global</span></a></li></ul></nav></div></div></div>
<div class="tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
<div class="overlay"></div></body></html>
5 changes: 3 additions & 2 deletions docs/functions/typings_ReplaceColor.default.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<h5><span class="tsd-kind-parameter">data</span>: <a href="../interfaces/typings_ReplaceColor.replaceData.html" class="tsd-signature-type tsd-kind-interface">replaceData</a></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type ">Jimp</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/5f68769/src/typings/ReplaceColor.d.ts#L4">typings/ReplaceColor.d.ts:4</a></li></ul></aside></li></ul></section></div>
<li>Defined in <a href="https://github.com/CookieGMVN/MBBank/blob/7a296aa/src/typings/ReplaceColor.d.ts#L4">typings/ReplaceColor.d.ts:4</a></li></ul></aside></li></ul></section></div>
<div class="col-sidebar">
<div class="page-menu">
<div class="tsd-navigation settings">
Expand All @@ -54,7 +54,8 @@ <h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</op
<div class="tsd-accordion-details">
<ul class="tsd-nested-navigation">
<li><a href="typings_ReplaceColor.default.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g></svg><span>default</span></a></li>
<li><a href="../interfaces/typings_ReplaceColor.replaceData.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g></svg><span>replace<wbr/>Data</span></a></li></ul></div></details></li></ul></nav></div></div></div>
<li><a href="../interfaces/typings_ReplaceColor.replaceData.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g></svg><span>replace<wbr/>Data</span></a></li></ul></div></details></li>
<li><a href="../modules/utils_Global.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-4"></use></svg><span>utils/<wbr/>Global</span></a></li></ul></nav></div></div></div>
<div class="tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
<div class="overlay"></div></body></html>
Loading

0 comments on commit acf9f40

Please sign in to comment.