@payos/node
Advanced tools
+10
-0
| # Changelog | ||
| ## 2.0.3 (2025-09-11) | ||
| ### Features | ||
| * **client:** add orderCode and paymentLinkId as params for method `PayOS.paymentRequests.invoices.get` and `PayOS.paymentRequests.invoices.download` | ||
| ### Bug fixes | ||
| * **client:** correct version of SDK in user-agent info | ||
| ## 2.0.2 (2025-08-29) | ||
@@ -4,0 +14,0 @@ |
+2
-2
@@ -46,4 +46,4 @@ "use strict"; | ||
| const values_1 = require("./utils/values"); | ||
| const version_1 = require("./version"); | ||
| const BASE_URL = 'https://api-merchant.payos.vn'; | ||
| const VERSION = '2.0.0-rc.1'; | ||
| /** | ||
@@ -105,3 +105,3 @@ * API client for interacting with payOS Merchant API. | ||
| getUserAgent() { | ||
| return `${this.constructor.name}/JS ${VERSION}`; | ||
| return `${this.constructor.name}/JS ${version_1.VERSION}`; | ||
| } | ||
@@ -108,0 +108,0 @@ buildHeaders(additionalHeaders) { |
@@ -6,5 +6,5 @@ import { FileDownloadResponse } from '../../../../core/api-response'; | ||
| /** | ||
| * Retrieve invoices of a payment link. | ||
| * Retrieve invoices of a payment link by payment link ID. | ||
| * | ||
| * @param {InvoiceRetrieveParams} params Params required to retrieve invoices. | ||
| * @param {InvoiceRetrieveParamsByPaymentLinkId} params Params required to retrieve invoices. | ||
| * @param {string} params.paymentLinkId Payment link ID. | ||
@@ -14,8 +14,17 @@ * @param {RequestOptions} options Additional options. | ||
| */ | ||
| get(params: InvoiceRetrieveParams, options?: RequestOptions): Promise<InvoicesInfo>; | ||
| get(params: InvoiceRetrieveParamsByPaymentLinkId, options?: RequestOptions): Promise<InvoicesInfo>; | ||
| /** | ||
| * Download an invoice in PDF format. | ||
| * Retrieve invoices of a payment link by order code. | ||
| * | ||
| * @param {InvoiceRetrieveParamsByOrderCode} params Params required to retrieve invoices. | ||
| * @param {number} params.orderCode Order code. | ||
| * @param {RequestOptions} options Additional options. | ||
| * @returns {Promise<InvoicesInfo>} A promise resolve to `InvoicesInfo` object contain invoices of current payment link. | ||
| */ | ||
| get(params: InvoiceRetrieveParamsByOrderCode, options?: RequestOptions): Promise<InvoicesInfo>; | ||
| /** | ||
| * Download an invoice in PDF format by payment link ID. | ||
| * | ||
| * @param {string} invoiceId Invoice ID. | ||
| * @param {InvoiceDownloadParams} params Params required to download invoice. | ||
| * @param {InvoiceDownloadParamsByPaymentLinkId} params Params required to download invoice. | ||
| * @param {string} params.paymentLinkId Payment link ID. | ||
@@ -25,3 +34,13 @@ * @param {RequestOptions} options Additional options. | ||
| */ | ||
| download(invoiceId: string, params: InvoiceDownloadParams, options?: RequestOptions): Promise<FileDownloadResponse>; | ||
| download(invoiceId: string, params: InvoiceDownloadParamsByPaymentLinkId, options?: RequestOptions): Promise<FileDownloadResponse>; | ||
| /** | ||
| * Download an invoice in PDF format by order code. | ||
| * | ||
| * @param {string} invoiceId Invoice ID. | ||
| * @param {InvoiceDownloadParamsByOrderCode} params Params required to download invoice. | ||
| * @param {number} params.orderCode Order code. | ||
| * @param {RequestOptions} options Additional options. | ||
| * @returns {Promise<FileDownloadResponse>} The invoice file in PDF format. | ||
| */ | ||
| download(invoiceId: string, params: InvoiceDownloadParamsByOrderCode, options?: RequestOptions): Promise<FileDownloadResponse>; | ||
| } | ||
@@ -40,7 +59,15 @@ export type Invoice = { | ||
| }; | ||
| export type InvoiceRetrieveParams = { | ||
| export type InvoiceRetrieveParamsByPaymentLinkId = { | ||
| paymentLinkId: string; | ||
| }; | ||
| export type InvoiceDownloadParams = { | ||
| export type InvoiceRetrieveParamsByOrderCode = { | ||
| orderCode: number; | ||
| }; | ||
| export type InvoiceRetrieveParams = InvoiceRetrieveParamsByPaymentLinkId | InvoiceRetrieveParamsByOrderCode; | ||
| export type InvoiceDownloadParamsByPaymentLinkId = { | ||
| paymentLinkId: string; | ||
| }; | ||
| export type InvoiceDownloadParamsByOrderCode = { | ||
| orderCode: number; | ||
| }; | ||
| export type InvoiceDownloadParams = InvoiceDownloadParamsByPaymentLinkId | InvoiceDownloadParamsByOrderCode; |
@@ -6,13 +6,5 @@ "use strict"; | ||
| class Invoices extends resource_1.APIResource { | ||
| /** | ||
| * Retrieve invoices of a payment link. | ||
| * | ||
| * @param {InvoiceRetrieveParams} params Params required to retrieve invoices. | ||
| * @param {string} params.paymentLinkId Payment link ID. | ||
| * @param {RequestOptions} options Additional options. | ||
| * @returns {Promise<InvoicesInfo>} A promise resolve to `InvoicesInfo` object contain invoices of current payment link. | ||
| */ | ||
| async get(params, options) { | ||
| const { paymentLinkId } = params; | ||
| const data = await this._client.get(`/v2/payment-requests/${paymentLinkId}/invoices`, { | ||
| const id = 'paymentLinkId' in params ? params.paymentLinkId : params.orderCode; | ||
| const data = await this._client.get(`/v2/payment-requests/${id}/invoices`, { | ||
| signatureOpts: { response: 'body' }, | ||
@@ -23,15 +15,6 @@ ...options, | ||
| } | ||
| /** | ||
| * Download an invoice in PDF format. | ||
| * | ||
| * @param {string} invoiceId Invoice ID. | ||
| * @param {InvoiceDownloadParams} params Params required to download invoice. | ||
| * @param {string} params.paymentLinkId Payment link ID. | ||
| * @param {RequestOptions} options Additional options. | ||
| * @returns {Promise<FileDownloadResponse>} The invoice file in PDF format. | ||
| */ | ||
| async download(invoiceId, params, options) { | ||
| const { paymentLinkId } = params; | ||
| const id = 'paymentLinkId' in params ? params.paymentLinkId : params.orderCode; | ||
| const fileResponse = await this._client.downloadFile({ | ||
| path: `/v2/payment-requests/${paymentLinkId}/invoices/${invoiceId}/download`, | ||
| path: `/v2/payment-requests/${id}/invoices/${invoiceId}/download`, | ||
| method: 'GET', | ||
@@ -38,0 +21,0 @@ ...options, |
+1
-1
@@ -1,1 +0,1 @@ | ||
| export declare const VERSION = "2.0.2"; | ||
| export declare const VERSION = "2.0.3"; |
+1
-1
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.VERSION = void 0; | ||
| exports.VERSION = "2.0.2"; | ||
| exports.VERSION = "2.0.3"; |
+1
-1
| { | ||
| "name": "@payos/node", | ||
| "version": "2.0.2", | ||
| "version": "2.0.3", | ||
| "description": "payOS Node SDK", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
123072
0.91%2712
0.37%