liqpay-nestjs 0.3.8 → 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 +44 -21
- package/package.json +1 -1
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,
|
|
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, including the
|
|
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
|
|
|
@@ -343,17 +382,7 @@ It also exports these runtime values:
|
|
|
343
382
|
- `UnitEnum`
|
|
344
383
|
|
|
345
384
|
Note: the package root currently exports types, not Zod schema values. The schema implementations live in the source under `src/core/types`.
|
|
346
|
-
|
|
347
|
-
## Refunds Status
|
|
348
|
-
|
|
349
|
-
The repository currently contains refund-related source files under `src/core/types/refund`, `src/core/clients/refunds.client.ts`, and `src/nest/services/refunds.service.ts`.
|
|
350
|
-
|
|
351
|
-
That refund code is not part of the current public package API:
|
|
352
|
-
|
|
353
|
-
- `LiqpayService` does not expose a `refunds` property
|
|
354
|
-
- the package root does not export `RefundInput`, `RefundRequest`, `RefundResponse`, or `RefundsService`
|
|
355
|
-
|
|
356
|
-
This README documents the public API that consumers can actually import from `liqpay-nestjs` today.
|
|
385
|
+
Refund-specific types are not currently re-exported from the package root.
|
|
357
386
|
|
|
358
387
|
## Result Contract and Error Handling
|
|
359
388
|
|
|
@@ -391,10 +420,4 @@ The package root exports:
|
|
|
391
420
|
- `LiqPayOptions`
|
|
392
421
|
- `LiqPayAsyncOptions`
|
|
393
422
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
## Build
|
|
397
|
-
|
|
398
|
-
```bash
|
|
399
|
-
npm run build
|
|
400
|
-
```
|
|
423
|
+
Refund support is available through `LiqpayService.refunds`, but the package root does not currently export `RefundsService` or refund-specific request and response types.
|
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.
|
|
4
|
+
"version": "0.3.9",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"main": "dist/index.js",
|