bankopenapi 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -34,7 +34,12 @@ const boa = new BankOpenAPI(); // đọc BANKOPENAPI_API_KEY
34
34
 
35
35
  // 1. Khách đặt đơn: tạo yêu cầu thanh toán
36
36
  const pr = await boa.paymentRequests.create(
37
- { amount: 150000, orderId: 'DH1028', description: 'Đơn hàng DH1028' },
37
+ {
38
+ amount: 150000,
39
+ orderId: 'DH1028',
40
+ description: 'Đơn hàng DH1028',
41
+ returnUrl: 'https://shop.vn/don-hang/DH1028', // không bắt buộc: trang thanh toán có nút quay lại, trả xong tự chuyển về
42
+ },
38
43
  { idempotencyKey: 'order-DH1028' }, // bấm hai lần cũng chỉ tạo một yêu cầu
39
44
  );
40
45
 
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.1.0";
1
+ export declare const VERSION = "0.2.0";
2
2
  export declare const DEFAULT_BASE_URL = "https://app.bankopenapi.com/api/v1";
3
3
  export interface ClientOptions {
4
4
  /** API key `boa_live_…` (tiền thật) hoặc `boa_test_…` (Sandbox). Mặc định đọc biến môi trường `BANKOPENAPI_API_KEY` */
package/dist/cjs/core.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.APIClient = exports.DEFAULT_BASE_URL = exports.VERSION = void 0;
4
4
  const errors_ts_1 = require("./errors.js");
5
- exports.VERSION = '0.1.0';
5
+ exports.VERSION = '0.2.0';
6
6
  exports.DEFAULT_BASE_URL = 'https://app.bankopenapi.com/api/v1';
7
7
  function readEnv(name) {
8
8
  const g = globalThis;
@@ -27,6 +27,11 @@ export interface PaymentRequestCreateParams {
27
27
  expiresInMinutes?: number;
28
28
  /** Tài khoản nhận tiền `ba_…`. Mặc định: tài khoản liên kết gần nhất */
29
29
  bankAccountId?: string;
30
+ /**
31
+ * Link quay lại website của bạn (vd. trang đơn hàng): trang `hostedUrl` có nút "Quay lại" và tự chuyển về sau khi trả
32
+ * xong. Phải là `https://` (sandbox cho thêm `http://`), tối đa 2048 ký tự
33
+ */
34
+ returnUrl?: string;
30
35
  }
31
36
  export interface PaymentRequestListParams extends PageParams {
32
37
  /** open: chờ thanh toán; paid: đã thanh toán; attention: thiếu hoặc thừa tiền; closed: hết hạn hoặc đã hủy */
@@ -55,6 +55,8 @@ export interface PaymentRequest {
55
55
  } | null;
56
56
  /** Trang thanh toán của BankOpenAPI để gửi cho người trả (QR, thông tin chuyển khoản, tự cập nhật khi tiền về) */
57
57
  hostedUrl: string;
58
+ /** Link quay lại website người bán sau khi trả xong (đặt lúc tạo); null nếu không đặt */
59
+ returnUrl: string | null;
58
60
  paymentLinkId: string | null;
59
61
  expiresAt: string;
60
62
  paidAt: string | null;
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.1.0";
1
+ export declare const VERSION = "0.2.0";
2
2
  export declare const DEFAULT_BASE_URL = "https://app.bankopenapi.com/api/v1";
3
3
  export interface ClientOptions {
4
4
  /** API key `boa_live_…` (tiền thật) hoặc `boa_test_…` (Sandbox). Mặc định đọc biến môi trường `BANKOPENAPI_API_KEY` */
package/dist/esm/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { APIConnectionError, APITimeoutError, BankOpenAPIError, errorForStatus } from "./errors.js";
2
- export const VERSION = '0.1.0';
2
+ export const VERSION = '0.2.0';
3
3
  export const DEFAULT_BASE_URL = 'https://app.bankopenapi.com/api/v1';
4
4
  function readEnv(name) {
5
5
  const g = globalThis;
@@ -27,6 +27,11 @@ export interface PaymentRequestCreateParams {
27
27
  expiresInMinutes?: number;
28
28
  /** Tài khoản nhận tiền `ba_…`. Mặc định: tài khoản liên kết gần nhất */
29
29
  bankAccountId?: string;
30
+ /**
31
+ * Link quay lại website của bạn (vd. trang đơn hàng): trang `hostedUrl` có nút "Quay lại" và tự chuyển về sau khi trả
32
+ * xong. Phải là `https://` (sandbox cho thêm `http://`), tối đa 2048 ký tự
33
+ */
34
+ returnUrl?: string;
30
35
  }
31
36
  export interface PaymentRequestListParams extends PageParams {
32
37
  /** open: chờ thanh toán; paid: đã thanh toán; attention: thiếu hoặc thừa tiền; closed: hết hạn hoặc đã hủy */
@@ -55,6 +55,8 @@ export interface PaymentRequest {
55
55
  } | null;
56
56
  /** Trang thanh toán của BankOpenAPI để gửi cho người trả (QR, thông tin chuyển khoản, tự cập nhật khi tiền về) */
57
57
  hostedUrl: string;
58
+ /** Link quay lại website người bán sau khi trả xong (đặt lúc tạo); null nếu không đặt */
59
+ returnUrl: string | null;
58
60
  paymentLinkId: string | null;
59
61
  expiresAt: string;
60
62
  paidAt: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bankopenapi",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Thư viện chính thức của BankOpenAPI cho Node.js, Next.js, Cloudflare Workers, Bun: tạo yêu cầu thanh toán chuyển khoản, VietQR, verify webhook báo có. Official BankOpenAPI SDK for Vietnamese bank-transfer payments.",
5
5
  "keywords": [
6
6
  "bankopenapi",