From 564f9c1caefac1a9acd1c134b09f7d6194ff16dd Mon Sep 17 00:00:00 2001 From: restuwahyu13 Date: Fri, 5 Feb 2021 19:58:27 +0700 Subject: [PATCH] add utility typescript for specific return value for function --- Dockerfile | 6 ++-- README.md | 2 +- package-lock.json | 75 +----------------------------------------- package.json | 10 +++--- src/lib/apiConfig.ts | 10 +++--- src/lib/coreApi.ts | 12 ++++--- src/lib/httpClient.ts | 4 ++- src/lib/iris.ts | 30 ++++++++--------- src/lib/snap.ts | 6 ++-- src/lib/transaction.ts | 18 +++++----- src/types/snap.ts | 4 +-- 11 files changed, 52 insertions(+), 125 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9a4693f..d540e83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ## BUILD STAGE ONE -FROM node:12-alpine as midtrans-node +FROM node:14-alpine as midtrans-node COPY package*.json \ .coveralls.yml \ .editorconfig \ @@ -21,7 +21,7 @@ RUN apk add make \ ## BUILD STAGE TWO FROM midtrans-node -WORKDIR /app -COPY --from=midtrans-node ./ /app +WORKDIR /usr/src/app +COPY --from=midtrans-node ./ /usr/src/app RUN make build CMD docker images \ No newline at end of file diff --git a/README.md b/README.md index 00ae9c6..f127384 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Midtrans Node -[![Build Status](https://travis-ci.org/restuwahyu13/midtrans-node.svg?branch=main)](https://travis-ci.org/restuwahyu13/midtrans-node) [![Coverage Status](https://coveralls.io/repos/github/restuwahyu13/nodejs-midtrans-client/badge.svg?branch=main)](https://coveralls.io/github/restuwahyu13/nodejs-midtrans-client?branch=main) ![node-current](https://img.shields.io/node/v/midtrans-node-client?style=flat-square) ![npm](https://img.shields.io/npm/dm/midtrans-node-client) ![npm](https://img.shields.io/npm/dt/midtrans-node-client) ![npm bundle size](https://img.shields.io/bundlephobia/min/midtrans-node-client) ![npm bundle size (version)](https://img.shields.io/bundlephobia/minzip/midtrans-node-client) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/midtrans-node-client?style=flat-square) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/restuwahyu13/midtrans-node/blob/main/CONTRIBUTING.md) +[![Build Status](https://travis-ci.org/restuwahyu13/midtrans-node.svg?branch=main)](https://travis-ci.org/restuwahyu13/midtrans-node) [![Coverage Status](https://coveralls.io/repos/github/restuwahyu13/nodejs-midtrans-client/badge.svg?branch=main)](https://coveralls.io/github/restuwahyu13/nodejs-midtrans-client?branch=main) ![node-current](https://img.shields.io/node/v/midtrans-node-client?style=flat-square) ![npm](https://img.shields.io/npm/dm/midtrans-node-client) ![npm bundle size](https://img.shields.io/bundlephobia/min/midtrans-node-client) ![npm bundle size (version)](https://img.shields.io/bundlephobia/minzip/midtrans-node-client) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/midtrans-node-client?style=flat-square) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/restuwahyu13/midtrans-node/blob/main/CONTRIBUTING.md) - [Installation](#installation) - [API Documentation](#api-documentation) diff --git a/package-lock.json b/package-lock.json index ef5973a..7440416 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "midtrans-node-client", - "version": "0.0.1-rc", + "version": "0.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -757,22 +757,6 @@ "@babel/types": "^7.3.0" } }, - "@types/eslint": { - "version": "7.2.6", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.6.tgz", - "integrity": "sha512-I+1sYH+NPQ3/tVqCeUSBwTE/0heyvtXqpIopUUArlBm0Kpocb8FbMa3AZ/ASKIFpN3rnEx932TTXDbt9OXsNDw==", - "dev": true, - "requires": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "@types/estree": { - "version": "0.0.45", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.45.tgz", - "integrity": "sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g==", - "dev": true - }, "@types/graceful-fs": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.4.tgz", @@ -1859,12 +1843,6 @@ } } }, - "delay": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/delay/-/delay-4.4.1.tgz", - "integrity": "sha512-aL3AhqtfhOlT/3ai6sWXeqwnw63ATNpnUiN4HL7x9q+My5QtHlO3OIkasmug9LKzpheLdmUKGRKnYXYAS7FQkQ==", - "dev": true - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -4362,12 +4340,6 @@ "object-visit": "^1.0.0" } }, - "memorystream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", - "dev": true - }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -4959,17 +4931,6 @@ "type-fest": "^0.8.1" } }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -5715,17 +5676,6 @@ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", "dev": true }, - "streambox-collection": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/streambox-collection/-/streambox-collection-0.0.2.tgz", - "integrity": "sha512-xP2g3ASzFGvtqEuxKAL7G9JooXUcPcIlP1prf0QJaM+bE3fXwVaesf2D2xTaXosxmGjPjjq4sPvoklUzzU6QtA==", - "dev": true, - "requires": { - "delay": "^4.4.0", - "memorystream": "^0.3.1", - "readable-stream": "^3.6.0" - } - }, "string-length": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.1.tgz", @@ -5767,23 +5717,6 @@ "define-properties": "^1.1.3" } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "requires": { - "safe-buffer": "~5.2.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - } - } - }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", @@ -6189,12 +6122,6 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true - }, "uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", diff --git a/package.json b/package.json index 246e36e..ce38479 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "midtrans-node-client", - "version": "0.0.1", + "version": "0.0.2", "description": "Unoffficial Midtrans Payment API Client for Node JS | Alternative for Midtrans Official Module", "main": "./dist/index.js", "files": [ @@ -10,11 +10,10 @@ "clean": "rimraf dist", "compiler": "npm run clean && tsc --pretty", "build": "npm run compiler", - "start": "ts-node index.ts", "test": "jest", "test:watch": "jest --watchAll", - "test:coverage": "jest --coverage --no-cache", - "test:coveralls": "jest --coverage --no-cache && coveralls < coverage/lcov.info", + "test:coverage": "jest --coverage", + "test:coveralls": "jest --coverage && coveralls < coverage/lcov.info", "lint": "eslint src/**/*.{ts,spec.ts,test.ts} --fix", "format": "prettier src/**/*.{ts,spec.ts,test.ts} --write", "lint:fix": "npm run format && npm run lint" @@ -36,6 +35,7 @@ "npm": ">=6" }, "keywords": [ + "midtrans-node-client", "payment", "payment gateway", "midtrans", @@ -53,7 +53,6 @@ }, "devDependencies": { "@types/axios": "^0.14.0", - "@types/eslint": "^7.2.6", "@types/jest": "^26.0.20", "@types/lodash": "^4.14.167", "@types/node": "^14.14.20", @@ -72,7 +71,6 @@ "jest": "^26.6.3", "prettier": "^2.2.1", "rimraf": "^3.0.2", - "streambox-collection": "0.0.2", "ts-jest": "^26.4.4", "ts-node": "^9.1.1", "typescript": "^4.1.3" diff --git a/src/lib/apiConfig.ts b/src/lib/apiConfig.ts index bb6c3a1..114969b 100644 --- a/src/lib/apiConfig.ts +++ b/src/lib/apiConfig.ts @@ -32,7 +32,7 @@ export class ApiConfig { * @return {Object} object contains isProduction, serverKey, clientKey */ - public get(): ApiConfigGetter { + public get(): ReturnType<() => ApiConfigGetter> { const currentConfig: ApiConfigOptions = { isProduction: this.isProduction, serverKey: this.serverKey, @@ -46,7 +46,7 @@ export class ApiConfig { * @param {Object} options - object contains isProduction, serverKey, clientKey] */ - public set>(options: T | Record): void { + public set>(options: T | Record): ReturnType<() => void> { const currentConfig: ApiConfigOptions = { isProduction: this.isProduction, serverKey: this.serverKey, @@ -65,7 +65,7 @@ export class ApiConfig { * @return {String} core api base url */ - public getCoreApiBaseUrl(): string { + public getCoreApiBaseUrl(): ReturnType<() => string> { return this.isProduction ? ApiConfig.CORE_PRODUCTION_BASE_URL : ApiConfig.CORE_SANDBOX_BASE_URL } @@ -73,7 +73,7 @@ export class ApiConfig { * @return {String} snap api base url */ - public getSnapApiBaseUrl(): string { + public getSnapApiBaseUrl(): ReturnType<() => string> { return this.isProduction ? ApiConfig.SNAP_PRODUCTION_BASE_URL : ApiConfig.SNAP_SANDBOX_BASE_URL } @@ -81,7 +81,7 @@ export class ApiConfig { * @return {String} Iris api base url */ - public getIrisApiBaseUrl(): string { + public getIrisApiBaseUrl(): ReturnType<() => string> { return this.isProduction ? ApiConfig.IRIS_PRODUCTION_BASE_URL : ApiConfig.IRIS_SANDBOX_BASE_URL } } diff --git a/src/lib/coreApi.ts b/src/lib/coreApi.ts index 4ebb202..4fef10b 100644 --- a/src/lib/coreApi.ts +++ b/src/lib/coreApi.ts @@ -39,7 +39,7 @@ export class CoreApi { public charge>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getCoreApiBaseUrl() + '/charge' const res = parameter return this.httpClient.request({ @@ -57,7 +57,9 @@ export class CoreApi { * @return {Promise} - Promise contains Object from JSON decoded response */ - public capture>(parameter: T | Record): Promise> { + public capture>( + parameter: T | Record + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getCoreApiBaseUrl() + '/capture' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -75,7 +77,7 @@ export class CoreApi { public cardRegister>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getCoreApiBaseUrl() + '/card/register' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -93,7 +95,7 @@ export class CoreApi { public cardToken>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getCoreApiBaseUrl() + '/token' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -109,7 +111,7 @@ export class CoreApi { * @return {Promise} - Promise contains Object from JSON decoded response */ - public cardPointInquiry(tokenId: string): Promise> { + public cardPointInquiry(tokenId: string): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getCoreApiBaseUrl() + '/point_inquiry/' + tokenId return this.httpClient.request({ requestUrl: this.apiUrl, diff --git a/src/lib/httpClient.ts b/src/lib/httpClient.ts index 63beb9f..0e03024 100644 --- a/src/lib/httpClient.ts +++ b/src/lib/httpClient.ts @@ -32,7 +32,9 @@ export class HttpClient { this.requestParam = {} } - public request>(options: T | Record): Promise> { + public request>( + options: T | Record + ): ReturnType<() => Promise>> { const headers = this.headers let requestBody = this.requestBody diff --git a/src/lib/iris.ts b/src/lib/iris.ts index 39cb9a9..e57d811 100644 --- a/src/lib/iris.ts +++ b/src/lib/iris.ts @@ -38,7 +38,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public ping(): Promise> { + public ping(): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/ping' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -56,7 +56,7 @@ export class Iris { public createBeneficiaries>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/beneficiaries' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -76,7 +76,7 @@ export class Iris { public updateBeneficiaries>( aliasName: string, parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/beneficiaries/' + aliasName return this.httpClient.request({ requestUrl: this.apiUrl, @@ -91,7 +91,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public getBeneficiaries(): Promise> { + public getBeneficiaries(): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/beneficiaries' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -109,7 +109,7 @@ export class Iris { public createPayouts>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/payouts' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -127,7 +127,7 @@ export class Iris { public approvePayouts>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/payouts/approve' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -145,7 +145,7 @@ export class Iris { public rejectPayouts>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/payouts/reject' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -161,7 +161,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public getPayoutDetails(referenceNo: string): Promise> { + public getPayoutDetails(referenceNo: string): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/payouts/' + referenceNo return this.httpClient.request({ requestUrl: this.apiUrl, @@ -178,7 +178,7 @@ export class Iris { public getTransactionHistory>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/statements' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -193,7 +193,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public getTopupChannels(): Promise> { + public getTopupChannels(): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/channels' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -208,7 +208,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public getBalance(): Promise> { + public getBalance(): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/balance' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -223,7 +223,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public getFacilitatorBankAccounts(): Promise> { + public getFacilitatorBankAccounts(): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/bank_accounts' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -239,7 +239,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public getFacilitatorBalance(bankAccountId: string): Promise> { + public getFacilitatorBalance(bankAccountId: string): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/bank_accounts/' + bankAccountId + '/balance' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -254,7 +254,7 @@ export class Iris { * @return {Promise} - Promise contains Object from JSON decoded response */ - public getBeneficiaryBanks(): Promise> { + public getBeneficiaryBanks(): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/beneficiary_banks' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -272,7 +272,7 @@ export class Iris { public validateBankAccount>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getIrisApiBaseUrl() + '/account_validation' return this.httpClient.request({ requestUrl: this.apiUrl, diff --git a/src/lib/snap.ts b/src/lib/snap.ts index a71959c..2533351 100644 --- a/src/lib/snap.ts +++ b/src/lib/snap.ts @@ -30,7 +30,7 @@ export class Snap { public createTransaction>( parameter: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.apiConfig.getSnapApiBaseUrl() + '/transactions' return this.httpClient.request({ requestUrl: this.apiUrl, @@ -52,7 +52,7 @@ export class Snap { public createTransactionToken>( parameter: T | Record - ): Promise { + ): ReturnType<() => Promise> { this.requestPayload = parameter === null || parameter === undefined ? parameter @@ -69,7 +69,7 @@ export class Snap { public createTransactionRedirectUrl>( parameter: T | Record - ): Promise { + ): ReturnType<() => Promise> { this.requestPayload = parameter === null || parameter === undefined ? parameter diff --git a/src/lib/transaction.ts b/src/lib/transaction.ts index f806687..2e2c3a2 100644 --- a/src/lib/transaction.ts +++ b/src/lib/transaction.ts @@ -21,7 +21,7 @@ export class Transaction { * @return Promise */ - public status(transactionId: string): Promise> { + public status(transactionId: string): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/status' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -37,7 +37,7 @@ export class Transaction { * @return Promise */ - public statusb2b(transactionId: string): Promise> { + public statusb2b(transactionId: string): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/statusb2b' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -53,7 +53,7 @@ export class Transaction { * @return Promise */ - public approve(transactionId: string): Promise> { + public approve(transactionId: string): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/approve' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -69,7 +69,7 @@ export class Transaction { * @return Promise */ - public deny(transactionId: string): Promise> { + public deny(transactionId: string): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/deny' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -85,7 +85,7 @@ export class Transaction { * @return Promise */ - public cancel(transactionId: string): Promise> { + public cancel(transactionId: string): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/cancel' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -101,7 +101,7 @@ export class Transaction { * @return Promise */ - public expire(transactionId: string): Promise> { + public expire(transactionId: string): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/expire' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -121,7 +121,7 @@ export class Transaction { public refund>( transactionId: string, parameter?: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/refund' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -141,7 +141,7 @@ export class Transaction { public refundDirect>( transactionId: string, parameter?: T | Record - ): Promise> { + ): ReturnType<() => Promise>> { this.apiUrl = this.parent.apiConfig.getCoreApiBaseUrl() + '/' + transactionId + '/refund/online/direct' return this.parent.httpClient.request({ requestUrl: this.apiUrl, @@ -157,7 +157,7 @@ export class Transaction { * @return Promise */ - public notification(notification: Record): Promise { + public notification(notification: Record): ReturnType<() => Promise> { let self = this return new Promise(function (resolve, reject) { if (typeof notification === 'string') { diff --git a/src/types/snap.ts b/src/types/snap.ts index 32413dd..9b30c08 100644 --- a/src/types/snap.ts +++ b/src/types/snap.ts @@ -40,9 +40,7 @@ type ItemDetailsOptions = { readonly brand?: string readonly category?: string readonly merchant_name?: string - /** - * @descript For BCA Klikpay - */ + // For BCA Klikpay readonly tenor?: number readonly code_plan?: number readonly mid?: number