liqpay-nestjs 0.3.7 → 0.3.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/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # liqpay-nestjs
2
2
 
3
- NestJS module for LiqPay payments with typed request models, signed checkout payload generation, webhook callback parsing, and payment status lookups.
3
+ NestJS module for LiqPay payments with typed request models, signed checkout payload generation, webhook callback parsing, payment status lookups, and refund initiation.
4
4
 
5
5
  ## Features
6
6
 
7
7
  - NestJS module with `forRoot` and `forRootAsync`
8
- - `LiqpayService` with `payments` and `webhooks` helpers
8
+ - `LiqpayService` with `payments`, `refunds`, and `webhooks` helpers
9
9
  - Signed checkout builders for standard payment, hold, and subscription flows
10
10
  - HTML checkout button generation with LiqPay SDK markup
11
11
  - Typed payment status requests and normalized responses
12
+ - Refund initiation through `liqpay.refunds`
12
13
  - TypeScript types exported from the package root
13
14
 
14
15
  ## Requirements
@@ -117,6 +118,12 @@ export class PaymentsController {
117
118
  }
118
119
  ```
119
120
 
121
+ `LiqpayService` currently exposes three helper groups:
122
+
123
+ - `payments`
124
+ - `refunds`
125
+ - `webhooks`
126
+
120
127
  ## Typical Flow
121
128
 
122
129
  1. Register `LiqPayModule` with your public and private keys.
@@ -125,6 +132,7 @@ export class PaymentsController {
125
132
  4. Receive the LiqPay callback envelope at your `serverUrl` endpoint.
126
133
  5. Parse the callback with `liqpay.webhooks.parseCheckoutCallback(...)`.
127
134
  6. Query the current state later with `liqpay.payments.getStatus({ orderId })` when needed.
135
+ 7. Optionally trigger a refund with `liqpay.refunds.refund({ amount, orderId })`.
128
136
 
129
137
  ## Configuration
130
138
 
@@ -252,6 +260,37 @@ if (result.error) {
252
260
 
253
261
  This is the only payments helper that performs an HTTP request. The library fills `action: 'status'`, `version: 7`, and your configured `publicKey` automatically.
254
262
 
263
+ ## Refunds API
264
+
265
+ `LiqpayService.refunds` currently exposes one method: `refund(payload)`.
266
+
267
+ ### `refunds.refund(payload)`
268
+
269
+ Triggers a refund request for an existing order.
270
+
271
+ ```ts
272
+ await liqpay.refunds.refund({
273
+ amount: 50,
274
+ orderId: 'order-123',
275
+ })
276
+ ```
277
+
278
+ Payload shape:
279
+
280
+ ```ts
281
+ {
282
+ amount: number
283
+ orderId: string
284
+ }
285
+ ```
286
+
287
+ Notes:
288
+
289
+ - `amount` must be a positive number.
290
+ - `orderId` must reference the original merchant order.
291
+ - Refund-specific models exist in `src/core/types/refund`, but they are not exported from the package root.
292
+ - The current public refund helper does not expose a root-exported typed refund response contract.
293
+
255
294
  ## Webhooks API
256
295
 
257
296
  `LiqpayService.webhooks.parseCheckoutCallback(envelope)` validates the callback signature, decodes the Base64 payload, and parses it into `Promise<Result<CheckoutCallback>>`.
@@ -313,7 +352,7 @@ Useful optional fields include:
313
352
  - sender metadata such as `senderFirstName`, `senderLastName`, `senderAddress`, and `senderCountryCode`
314
353
  - product metadata such as `productName`, `productDescription`, `productCategory`, and `productUrl`
315
354
 
316
- The source repository keeps the full request and response models under `src/core/types` if you need exact field-level reference.
355
+ The source repository keeps the full request and response models under `src/core/types` if you need exact field-level reference, including refund models that are not currently re-exported from the package root.
317
356
 
318
357
  ## Type Exports
319
358
 
@@ -323,11 +362,15 @@ The package root exports TypeScript types for request and response modeling, for
323
362
  import type {
324
363
  CheckoutCallback,
325
364
  CheckoutInput,
365
+ Currency,
326
366
  LiqPayEnvelope,
327
367
  LiqPayError,
368
+ LiqPayRequest,
369
+ LiqPayResponse,
328
370
  PaymentStatusInput,
329
371
  PaymentStatusResponse,
330
372
  Result,
373
+ SplitRule,
331
374
  } from 'liqpay-nestjs'
332
375
  ```
333
376
 
@@ -339,6 +382,7 @@ It also exports these runtime values:
339
382
  - `UnitEnum`
340
383
 
341
384
  Note: the package root currently exports types, not Zod schema values. The schema implementations live in the source under `src/core/types`.
385
+ Refund-specific types are not currently re-exported from the package root.
342
386
 
343
387
  ## Result Contract and Error Handling
344
388
 
@@ -376,8 +420,4 @@ The package root exports:
376
420
  - `LiqPayOptions`
377
421
  - `LiqPayAsyncOptions`
378
422
 
379
- ## Build
380
-
381
- ```bash
382
- npm run build
383
- ```
423
+ Refund support is available through `LiqpayService.refunds`, but the package root does not currently export `RefundsService` or refund-specific request and response types.
@@ -1,8 +1,9 @@
1
1
  import type { LiqPayOptions } from './interfaces';
2
- import { PaymentsService, WebhooksService } from './services';
2
+ import { PaymentsService, RefundsService, WebhooksService } from './services';
3
3
  export declare class LiqpayService {
4
4
  private readonly options;
5
5
  readonly payments: PaymentsService;
6
6
  readonly webhooks: WebhooksService;
7
+ readonly refunds: RefundsService;
7
8
  constructor(options: LiqPayOptions);
8
9
  }
@@ -21,11 +21,13 @@ let LiqpayService = class LiqpayService {
21
21
  options;
22
22
  payments;
23
23
  webhooks;
24
+ refunds;
24
25
  constructor(options) {
25
26
  this.options = options;
26
27
  const client = new clients_1.LiqPayClient(options);
27
28
  this.payments = new services_1.PaymentsService(client);
28
29
  this.webhooks = new services_1.WebhooksService(client);
30
+ this.refunds = new services_1.RefundsService(client);
29
31
  }
30
32
  };
31
33
  exports.LiqpayService = LiqpayService;
@@ -1,2 +1,3 @@
1
1
  export * from './payments.service';
2
2
  export * from './webhooks.service';
3
+ export * from './refunds.service';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./payments.service"), exports);
18
18
  __exportStar(require("./webhooks.service"), exports);
19
+ __exportStar(require("./refunds.service"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "liqpay-nestjs",
3
3
  "description": "LiqPay integration module for NestJS with support for payments, callbacks, and configuration via DI.",
4
- "version": "0.3.7",
4
+ "version": "0.3.9",
5
5
  "type": "commonjs",
6
6
  "module": "dist/index.js",
7
7
  "main": "dist/index.js",