liqpay-nestjs 0.3.1 → 0.3.3

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,15 +1,15 @@
1
1
  # liqpay-nestjs
2
2
 
3
- NestJS module for LiqPay payments with DI-friendly configuration, signed checkout helpers, typed request and response models, and webhook callback parsing.
3
+ NestJS module for LiqPay payments with typed request builders, signed checkout payload generation, webhook callback parsing, and payment status lookups.
4
4
 
5
5
  ## Features
6
6
 
7
7
  - NestJS module with `forRoot` and `forRootAsync`
8
- - `LiqpayService` with payment and webhook helpers
9
- - Signed checkout URL and checkout form generation
10
- - Typed payment status requests
11
- - Callback signature validation and payload parsing
12
- - Exported Zod schemas and TypeScript types from the package root
8
+ - `LiqpayService` with `payments` and `webhooks` helpers
9
+ - Signed builders for `pay`, `hold`, and `subscribe` checkout flows
10
+ - HTML pay button generation with LiqPay SDK markup
11
+ - Zod schemas and TypeScript types exported from the package root
12
+ - Callback signature verification and camelCase response parsing
13
13
 
14
14
  ## Requirements
15
15
 
@@ -45,7 +45,7 @@ import { LiqPayModule } from 'liqpay-nestjs'
45
45
  export class AppModule {}
46
46
  ```
47
47
 
48
- ### Register the module asynchronously
48
+ ### Register asynchronously
49
49
 
50
50
  ```ts
51
51
  import { Module } from '@nestjs/common'
@@ -71,91 +71,145 @@ import { LiqPayModule } from 'liqpay-nestjs'
71
71
  export class AppModule {}
72
72
  ```
73
73
 
74
- ### Inject and use `LiqpayService`
74
+ ### Use `LiqpayService`
75
75
 
76
76
  ```ts
77
- import { Controller, Get, Query } from '@nestjs/common'
78
- import { CheckoutRequest, LiqpayService } from 'liqpay-nestjs'
77
+ import { Body, Controller, Get, Param, Post } from '@nestjs/common'
78
+ import { CheckoutInput, LiqPayEnvelope, LiqpayService } from 'liqpay-nestjs'
79
79
 
80
80
  @Controller('payments')
81
81
  export class PaymentsController {
82
82
  constructor(private readonly liqpay: LiqpayService) {}
83
83
 
84
- @Get('checkout-url')
85
- getCheckoutUrl(@Query('orderId') orderId: string) {
86
- const payload: CheckoutRequest = {
87
- action: 'pay',
84
+ @Post('checkout')
85
+ createCheckout() {
86
+ const payload: CheckoutInput = {
88
87
  amount: 199,
89
88
  currency: 'UAH',
90
- description: 'Order payment',
91
- orderId,
89
+ description: 'Order #123',
90
+ orderId: 'order-123',
92
91
  }
93
92
 
93
+ const checkout = this.liqpay.payments.pay(payload)
94
+
94
95
  return {
95
- url: this.liqpay.payments.getCheckoutUrl(payload),
96
+ url: checkout.url,
97
+ data: checkout.data,
98
+ signature: checkout.signature,
96
99
  }
97
100
  }
101
+
102
+ @Get(':orderId/status')
103
+ getStatus(@Param('orderId') orderId: string) {
104
+ return this.liqpay.payments.getPaymentStatus(orderId)
105
+ }
106
+
107
+ @Post('webhook')
108
+ async webhook(@Body() envelope: LiqPayEnvelope) {
109
+ return await this.liqpay.webhooks.parseCheckoutCallback(envelope)
110
+ }
98
111
  }
99
112
  ```
100
113
 
101
114
  ## Typical Flow
102
115
 
103
- 1. Register `LiqPayModule` with your public and private keys.
104
- 2. Create a checkout URL or checkout form from a `CheckoutRequest`.
105
- 3. Point `serverUrl` to a Nest endpoint that receives the LiqPay callback envelope.
106
- 4. Parse the callback with `liqpay.webhooks.parseCheckoutCallback(...)`.
107
- 5. Optionally confirm the final state with `liqpay.payments.getPaymentStatus(orderId)`.
116
+ 1. Register `LiqPayModule` with your keys and optional default callback URLs.
117
+ 2. Build a checkout payload with `liqpay.payments.pay(...)`, `hold(...)`, or `subscribe(...)`.
118
+ 3. Redirect the user to the returned `url`, or render your own form using `data` and `signature`.
119
+ 4. Receive the LiqPay callback envelope at your `serverUrl` endpoint.
120
+ 5. Parse the callback with `liqpay.webhooks.parseCheckoutCallback(...)`.
121
+ 6. Confirm the final state later with `liqpay.payments.getPaymentStatus(orderId)` if needed.
108
122
 
109
123
  ## Configuration
110
124
 
111
- Both `LiqPayModule.forRoot(...)` and `LiqPayModule.forRootAsync(...)` resolve to the same options shape.
125
+ `LiqPayModule.forRoot(...)` and `LiqPayModule.forRootAsync(...)` both use the same options shape.
112
126
 
113
- | Option | Type | Required | Description |
114
- | ------------ | --------- | -------- | ------------------------------------------------------------------------------------ |
115
- | `publicKey` | `string` | Yes | LiqPay public key. |
116
- | `privateKey` | `string` | Yes | LiqPay private key used for request signing. |
117
- | `resultUrl` | `string` | No | Default redirect URL after checkout. Can be overridden per request. |
118
- | `serverUrl` | `string` | No | Default callback URL for LiqPay server notifications. Can be overridden per request. |
119
- | `isGlobal` | `boolean` | No | Registers the Nest module as global when set to `true`. Defaults to `false`. |
127
+ | Option | Type | Required | Description |
128
+ | ------------ | --------- | -------- | -------------------------------------------------------------------------------------- |
129
+ | `publicKey` | `string` | Yes | LiqPay public key. |
130
+ | `privateKey` | `string` | Yes | LiqPay private key used for signing requests. |
131
+ | `resultUrl` | `string` | No | Default redirect URL after checkout. Can be overridden per checkout payload. |
132
+ | `serverUrl` | `string` | No | Default callback URL for LiqPay notifications. Can be overridden per checkout payload. |
133
+ | `isGlobal` | `boolean` | No | Registers the Nest module as global when `true`. Defaults to `false`. |
120
134
 
121
- The async registration path validates the resolved options at runtime and throws if `publicKey` or `privateKey` are missing or not strings.
135
+ The async registration provider validates the resolved options and throws if `publicKey` or `privateKey` are missing or not strings.
122
136
 
123
- ## LiqpayService API
137
+ ## Payments API
124
138
 
125
- `LiqpayService` exposes two sub-services:
139
+ `LiqpayService.payments` exposes five methods.
126
140
 
127
- - `payments`
128
- - `webhooks`
141
+ | Method | Purpose | Return type |
142
+ | -------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------------------- |
143
+ | `pay(payload)` | Builds a signed checkout payload for a standard payment. | `CheckoutRequest & { url: string; data: string; signature: string }` |
144
+ | `hold(payload)` | Builds a signed checkout payload for a hold operation. | `CheckoutRequest & { url: string; data: string; signature: string }` |
145
+ | `subscribe(payload)` | Builds a signed checkout payload for recurring payments. | `CheckoutRequest & { url: string; data: string; signature: string }` |
146
+ | `getPayButton(payload, buttonText?, buttonColor?)` | Returns HTML for a LiqPay pay button. | `string` |
147
+ | `getPaymentStatus(orderId)` | Calls the LiqPay status API. | `Promise<Result<PaymentStatusResponse>>` |
129
148
 
130
- ### `payments.getCheckoutUrl(payload)`
149
+ ### `payments.pay(payload)`
131
150
 
132
- Builds a signed LiqPay checkout URL.
151
+ Use `pay(...)` for a normal payment flow.
133
152
 
134
153
  ```ts
135
- const url = liqpay.payments.getCheckoutUrl({
136
- action: 'pay',
154
+ import { CheckoutInput } from 'liqpay-nestjs'
155
+
156
+ const payload: CheckoutInput = {
137
157
  amount: 100,
138
158
  currency: 'UAH',
139
159
  description: 'Order #123',
140
160
  orderId: 'order-123',
161
+ }
162
+
163
+ const checkout = liqpay.payments.pay(payload)
164
+
165
+ console.log(checkout.url)
166
+ console.log(checkout.data)
167
+ console.log(checkout.signature)
168
+ ```
169
+
170
+ Returned fields:
171
+
172
+ - `url`: ready-to-use LiqPay checkout URL
173
+ - `data`: Base64-encoded request payload
174
+ - `signature`: request signature generated from your private key
175
+ - all resolved request fields including `action`, `version`, `publicKey`, and inherited `resultUrl` / `serverUrl`
176
+
177
+ ### `payments.hold(payload)`
178
+
179
+ `hold(...)` has the same return shape as `pay(...)`, but the generated request uses action `hold`.
180
+
181
+ ```ts
182
+ const holdCheckout = liqpay.payments.hold({
183
+ amount: 100,
184
+ currency: 'UAH',
185
+ description: 'Funds hold for order #123',
186
+ orderId: 'order-123',
141
187
  })
142
188
  ```
143
189
 
144
- Notes:
190
+ ### `payments.subscribe(payload)`
191
+
192
+ `subscribe(...)` has the same return shape as `pay(...)`, but builds a subscription request. Subscription-related fields still come from your `CheckoutInput`.
145
193
 
146
- - This is a pure helper and does not perform an HTTP request.
147
- - The library signs the payload with the configured private key.
148
- - `version` is always sent as `7`.
149
- - `resultUrl` and `serverUrl` fall back to module-level defaults if omitted from the payload.
194
+ ```ts
195
+ const subscriptionCheckout = liqpay.payments.subscribe({
196
+ amount: 250,
197
+ currency: 'UAH',
198
+ description: 'Monthly subscription',
199
+ orderId: 'subscription-123',
200
+ subscribe: true,
201
+ subscribeDateStart: new Date('2026-04-01T00:00:00Z'),
202
+ subscribePeriodicity: 'month',
203
+ })
204
+ ```
150
205
 
151
- ### `payments.getCheckoutForm(payload, buttonText?, buttonColor?)`
206
+ ### `payments.getPayButton(payload, buttonText?, buttonColor?)`
152
207
 
153
- Returns an HTML form string with LiqPay's `sdk-button` widget.
208
+ Returns an HTML string containing a form and LiqPay `sdk-button` markup for the `pay` action.
154
209
 
155
210
  ```ts
156
- const html = liqpay.payments.getCheckoutForm(
211
+ const html = liqpay.payments.getPayButton(
157
212
  {
158
- action: 'pay',
159
213
  amount: 100,
160
214
  currency: 'UAH',
161
215
  description: 'Order #123',
@@ -171,24 +225,6 @@ Defaults:
171
225
  - `buttonText`: `Pay`
172
226
  - `buttonColor`: `#77CC5D`
173
227
 
174
- ### `payments.create(payload)`
175
-
176
- Returns the normalized checkout payload together with the generated `checkoutUrl`.
177
-
178
- ```ts
179
- const checkout = liqpay.payments.create({
180
- action: 'pay',
181
- amount: 100,
182
- currency: 'UAH',
183
- description: 'Order #123',
184
- orderId: 'order-123',
185
- })
186
-
187
- console.log(checkout.checkoutUrl)
188
- ```
189
-
190
- Use this when you want both the prepared payload and the final redirect URL without making a network call.
191
-
192
228
  ### `payments.getPaymentStatus(orderId)`
193
229
 
194
230
  Calls LiqPay's status API and returns `Promise<Result<PaymentStatusResponse>>`.
@@ -205,11 +241,11 @@ if (result.error) {
205
241
  }
206
242
  ```
207
243
 
208
- You only pass `orderId`; the library builds the `status` request internally.
244
+ This is the only payments helper that performs an HTTP request.
209
245
 
210
- ### `webhooks.parseCheckoutCallback(envelope)`
246
+ ## Webhooks API
211
247
 
212
- Validates the callback signature, decodes the Base64 payload, and parses it into `Promise<Result<CheckoutCallback>>`.
248
+ `LiqpayService.webhooks.parseCheckoutCallback(envelope)` validates the callback signature, decodes the Base64 payload, and parses it into `Promise<Result<CheckoutCallback>>`.
213
249
 
214
250
  ```ts
215
251
  import { Body, Controller, Post } from '@nestjs/common'
@@ -232,7 +268,7 @@ export class WebhookController {
232
268
  }
233
269
  ```
234
270
 
235
- The expected envelope shape is:
271
+ The envelope shape is:
236
272
 
237
273
  ```ts
238
274
  type LiqPayEnvelope = {
@@ -241,26 +277,24 @@ type LiqPayEnvelope = {
241
277
  }
242
278
  ```
243
279
 
244
- ## Request and Response Normalization
280
+ ## Checkout Types
245
281
 
246
- The library normalizes the most common application-facing models and handles LiqPay's wire format for you.
282
+ The checkout flow exposes three related types.
247
283
 
248
- - Top-level checkout and status request fields use the expected TypeScript property names, for example `orderId`, `resultUrl`, `serverUrl`, and `senderFirstName`.
249
- - Some nested LiqPay-specific helper objects keep the exact field names defined by their exported schemas. When in doubt, validate against the schema you are using.
250
- - Outgoing requests are serialized into the format LiqPay expects.
251
- - Callback and status responses are transformed back to camelCase.
252
- - Dates, booleans, and several enum-backed fields are normalized where possible.
253
- - Checkout signing always uses the module's configured public and private keys.
284
+ | Type | Purpose |
285
+ | -------------------- | -------------------------------------------------------------------------------------------------- |
286
+ | `CheckoutInput` | The consumer-facing payload you pass into `pay`, `hold`, `subscribe`, or `getPayButton`. |
287
+ | `CheckoutRequest` | The enriched request after the library injects `action`, `version`, `publicKey`, and default URLs. |
288
+ | `RawCheckoutRequest` | The final wire-format payload sent to LiqPay after snake_case and value transformations. |
254
289
 
255
- ## Minimal Checkout Payload
290
+ In most applications you should create `CheckoutInput` values and let the library build the rest.
256
291
 
257
- The smallest useful `CheckoutRequest` usually looks like this:
292
+ ### Minimal `CheckoutInput`
258
293
 
259
294
  ```ts
260
- import { CheckoutRequest } from 'liqpay-nestjs'
295
+ import { CheckoutInput } from 'liqpay-nestjs'
261
296
 
262
- const payload: CheckoutRequest = {
263
- action: 'pay',
297
+ const payload: CheckoutInput = {
264
298
  amount: 100,
265
299
  currency: 'UAH',
266
300
  description: 'Order #123',
@@ -268,24 +302,40 @@ const payload: CheckoutRequest = {
268
302
  }
269
303
  ```
270
304
 
271
- `CheckoutRequest` also supports many LiqPay-specific fields for advanced scenarios, including:
305
+ ### Advanced `CheckoutInput` fields
272
306
 
273
- - recurring payments: `subscribe`, `subscribeDateStart`, `subscribePeriodicity`
274
- - one-click and tokenized flows: `cardToken`, `customer`, `customerUserId`, `recurringbytoken`
275
- - fiscalization: `rroInfo`, `dae`
276
- - split payments: `splitRules`
277
- - customer and sender metadata: `ip`, `senderFirstName`, `senderLastName`, `senderAddress`, and related fields
307
+ The public checkout input supports many LiqPay options, including:
308
+
309
+ - `resultUrl`, `serverUrl`
310
+ - `paytypes`, `language`, `expiredDate`
311
+ - `cardToken`, `customer`, `customerUserId`, `recurringByToken`
312
+ - `subscribe`, `subscribeDateStart`, `subscribePeriodicity`
313
+ - `fiscalData`, `detailAddenda`, `splitRules`
314
+ - sender metadata such as `senderFirstName`, `senderLastName`, `senderAddress`, and `senderCountryCode`
315
+ - product metadata such as `productName`, `productDescription`, `productCategory`, and `productUrl`
316
+
317
+ ## Request and Response Normalization
318
+
319
+ The library keeps the application-facing API mostly in camelCase and handles LiqPay's transport format internally.
320
+
321
+ - Top-level request fields use names like `orderId`, `resultUrl`, `serverUrl`, `verifyCode`, `fiscalData`, and `detailAddenda`.
322
+ - Outgoing requests are serialized into LiqPay's expected field format.
323
+ - Checkout callbacks and payment status responses are transformed back into camelCase.
324
+ - Several values such as dates, booleans, and enum-backed fields are normalized during parsing.
325
+ - Some nested helper objects still use provider-specific field names defined by their exported schemas.
278
326
 
279
327
  ## Schemas and Types
280
328
 
281
- All public schemas and types are exported from the package root, so you can import them directly from `liqpay-nestjs`.
329
+ All public schemas and types are exported from the package root.
282
330
 
283
331
  ```ts
284
332
  import {
285
333
  CheckoutCallback,
286
334
  CheckoutCallbackSchema,
287
- CheckoutRequest,
288
- CheckoutRequestSchema,
335
+ CheckoutInput,
336
+ CheckoutInputSchema,
337
+ LiqPayEnvelope,
338
+ LiqPayEnvelopeSchema,
289
339
  PaymentStatusResponse,
290
340
  PaymentStatusResponseSchema,
291
341
  Result,
@@ -294,28 +344,26 @@ import {
294
344
 
295
345
  Main export groups:
296
346
 
297
- - base: `LiqPayEnvelope`, `LiqPayEnvelopeSchema`, `Result<T>`, request and response base unions
298
- - checkout: `CheckoutRequest`, `CheckoutRequestSchema`, `CheckoutCallback`, `CheckoutCallbackSchema`
347
+ - base: `LiqPayEnvelope`, `LiqPayEnvelopeSchema`, `Result<T>`, request and response unions
348
+ - checkout: `CheckoutInput`, `CheckoutInputSchema`, `CheckoutRequest`, `CheckoutCallback`, and raw request helpers
299
349
  - payment status: `PaymentStatusRequest`, `PaymentStatusRequestSchema`, `PaymentStatusResponse`, `PaymentStatusResponseSchema`
300
- - common: `DetailAddenda`, `FiscalData`, `SplitRule` and their schemas
301
- - enums: action, currency, language, paytype, payment status, version, and related schema exports
350
+ - common: fiscal, split, and addenda schemas and their types
351
+ - enums: action, currency, language, paytype, version, payment status, and related schema exports
302
352
  - error: LiqPay error response and error code schemas and types
303
353
  - nest: `LiqPayModule`, `LiqpayService`, `LiqPayOptions`, `LiqPayAsyncOptions`, `LIQPAY_OPTIONS`
304
354
 
305
- ### Validating your own DTOs with the exported schemas
355
+ ### Validate controller input with the exported schemas
306
356
 
307
357
  ```ts
308
- import { CheckoutRequestSchema, LiqpayService } from 'liqpay-nestjs'
358
+ import { CheckoutInputSchema } from 'liqpay-nestjs'
309
359
 
310
- const payload = CheckoutRequestSchema.parse(input)
311
- const checkout = liqpay.payments.create(payload)
360
+ const payload = CheckoutInputSchema.parse(input)
361
+ const checkout = liqpay.payments.pay(payload)
312
362
  ```
313
363
 
314
- This is useful if you want to validate incoming controller data before passing it to the service.
315
-
316
364
  ## Result Contract and Error Handling
317
365
 
318
- Methods that parse LiqPay responses use this result shape:
366
+ Methods that parse LiqPay responses return this shape:
319
367
 
320
368
  ```ts
321
369
  type Result<T> =
@@ -323,10 +371,19 @@ type Result<T> =
323
371
  | { data: null; error: { code: string; description: string } }
324
372
  ```
325
373
 
326
- The library can return:
374
+ This applies to:
375
+
376
+ - `liqpay.payments.getPaymentStatus(...)`
377
+ - `liqpay.webhooks.parseCheckoutCallback(...)`
378
+
379
+ Possible error sources include:
327
380
 
328
381
  - LiqPay provider errors parsed from `err_code` and `err_description`
329
- - internal parsing or transport errors such as `invalid_signature`, `decode_error`, `validation_error`, `invalid_response`, and `http_error`
382
+ - invalid callback signatures
383
+ - Base64 decode failures
384
+ - invalid JSON responses
385
+ - schema validation failures
386
+ - HTTP transport failures
330
387
 
331
388
  Always check `result.error` before using `result.data`.
332
389
 
@@ -338,7 +395,7 @@ The package root also exports:
338
395
  - `createLiqpayOptionsProvider(...)`
339
396
  - `createLiqpayAsyncOptionsProvider(...)`
340
397
 
341
- These helpers are useful if you want to compose your own providers around the package token instead of using `LiqPayModule` directly.
398
+ These are useful if you want to build custom providers around the package token instead of using `LiqPayModule` directly.
342
399
 
343
400
  ## Build
344
401
 
@@ -8,7 +8,8 @@ export declare class PaymentsClient {
8
8
  constructor(utils: UtilsClient);
9
9
  private prepare;
10
10
  private buildUrl;
11
- pay(payload: CheckoutInput): {
11
+ private checkout;
12
+ getCheckoutUrl(payload: CheckoutInput): {
12
13
  url: string;
13
14
  data: string;
14
15
  signature: string;
@@ -25,7 +25,16 @@ class PaymentsClient {
25
25
  buildUrl(data, signature) {
26
26
  return `${url_type_1.CHECKOUT_URL}?data=${data}&signature=${signature}`;
27
27
  }
28
- pay(payload) {
28
+ checkout(payload, action) {
29
+ const { fullfilled, data, signature } = this.prepare(payload, action);
30
+ return {
31
+ ...fullfilled,
32
+ url: this.buildUrl(data, signature),
33
+ data,
34
+ signature,
35
+ };
36
+ }
37
+ getCheckoutUrl(payload) {
29
38
  const { fullfilled, data, signature } = this.prepare(payload, 'pay');
30
39
  return {
31
40
  ...fullfilled,
@@ -122,7 +122,7 @@ export declare const CheckoutCallbackSchema: z.ZodPipe<z.ZodObject<{
122
122
  }, z.core.$strip>, z.ZodTransform<Partial<{
123
123
  version: 7 | undefined;
124
124
  acqId: string | undefined;
125
- action: "pay" | "paytoken" | "hold" | "paysplit" | "subscribe" | "paydonate" | "auth" | "regular" | "status" | undefined;
125
+ action: "data" | "pay" | "hold" | "subscribe" | "paydonate" | "auth" | "refund" | "payment_prepare" | "unsubscribe" | "subscribe_update" | "payqr" | "staticQrCreate" | "paytoken" | "paycash" | "hold_completion" | "paysplit" | "invoice_send" | "invoice_cancel" | "p2pcredit" | "p2pdebit" | "token_create" | "token_create_unique" | "token_update" | "confirm" | "mpi" | "cardverification" | "reports" | "reports_compensation" | "register" | "reports_compensation_file" | "reports_compensation_file_status" | "ticket" | "status" | "agent_shop_create" | "agent_shop_register" | "agent_shop_edit" | "agent_info_merchant" | "agent_info_user" | "regular" | undefined;
126
126
  completionDate: Date | undefined;
127
127
  createDate: Date | undefined;
128
128
  currency: "USD" | "EUR" | "UAH" | undefined;
@@ -1,13 +1,43 @@
1
1
  import z from 'zod';
2
2
  export declare const ActionSchema: z.ZodEnum<{
3
+ data: "data";
3
4
  pay: "pay";
4
- paytoken: "paytoken";
5
5
  hold: "hold";
6
- paysplit: "paysplit";
7
6
  subscribe: "subscribe";
8
7
  paydonate: "paydonate";
9
8
  auth: "auth";
10
- regular: "regular";
9
+ refund: "refund";
10
+ payment_prepare: "payment_prepare";
11
+ unsubscribe: "unsubscribe";
12
+ subscribe_update: "subscribe_update";
13
+ payqr: "payqr";
14
+ staticQrCreate: "staticQrCreate";
15
+ paytoken: "paytoken";
16
+ paycash: "paycash";
17
+ hold_completion: "hold_completion";
18
+ paysplit: "paysplit";
19
+ invoice_send: "invoice_send";
20
+ invoice_cancel: "invoice_cancel";
21
+ p2pcredit: "p2pcredit";
22
+ p2pdebit: "p2pdebit";
23
+ token_create: "token_create";
24
+ token_create_unique: "token_create_unique";
25
+ token_update: "token_update";
26
+ confirm: "confirm";
27
+ mpi: "mpi";
28
+ cardverification: "cardverification";
29
+ reports: "reports";
30
+ reports_compensation: "reports_compensation";
31
+ register: "register";
32
+ reports_compensation_file: "reports_compensation_file";
33
+ reports_compensation_file_status: "reports_compensation_file_status";
34
+ ticket: "ticket";
11
35
  status: "status";
36
+ agent_shop_create: "agent_shop_create";
37
+ agent_shop_register: "agent_shop_register";
38
+ agent_shop_edit: "agent_shop_edit";
39
+ agent_info_merchant: "agent_info_merchant";
40
+ agent_info_user: "agent_info_user";
41
+ regular: "regular";
12
42
  }>;
13
43
  export type Action = z.infer<typeof ActionSchema>;
@@ -6,13 +6,124 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ActionSchema = void 0;
7
7
  const zod_1 = __importDefault(require("zod"));
8
8
  exports.ActionSchema = zod_1.default.enum([
9
+ // checkout
10
+ // payments.pay()
9
11
  'pay',
12
+ // payments.hold()
13
+ 'hold',
14
+ // payments.subscribe()
15
+ 'subscribe',
16
+ // payments.donate()
17
+ 'paydonate',
18
+ // for creating dynamic verification code - did not found where it used
19
+ // payments.auth()
20
+ 'auth',
21
+ // refunds.refund()
22
+ 'refund',
23
+ // payments.payBycard()
24
+ 'pay',
25
+ // payments.payByPrivatPay()
26
+ 'payment_prepare',
27
+ // payments.payByApplePay()
28
+ 'pay',
29
+ // payments.holdByApplePay()
30
+ 'hold',
31
+ // payments.payByGooglePay()
32
+ 'pay',
33
+ // payments.holdByGooglePay()
34
+ 'hold',
35
+ // subscription
36
+ // subscriptions.subscribe()
37
+ 'subscribe',
38
+ // subscriptions.unsubscribe()
39
+ 'unsubscribe',
40
+ // subscriptions.update()
41
+ 'subscribe_update',
42
+ // payments.payByQr()
43
+ 'payqr',
44
+ // payments.createStaticQr()
45
+ 'staticQrCreate',
46
+ // payments.payByToken()
10
47
  'paytoken',
48
+ // payments.payByCash()
49
+ 'paycash',
50
+ // payments.invoke2Factor()
51
+ 'hold',
52
+ // payments.complete2Factor()
53
+ 'hold_completion',
54
+ // available in checkout, payment widget, pay2Factor, payByCard, payByQr, payByToken
55
+ 'paysplit',
56
+ // invoices.send()
57
+ 'invoice_send',
58
+ // invoices.cancel()
59
+ 'invoice_cancel',
60
+ // DCC - payments.payWithCardCurrency()
61
+ 'pay',
62
+ // transferring funds from account to card - transfers.toCard()
63
+ 'p2pcredit',
64
+ // transferring funds from card to account - transfers.toAccount()
65
+ 'p2pdebit',
66
+ // token (without payment)
67
+ // tokens.create()
68
+ 'token_create',
69
+ // tokens.createUnique()
70
+ 'token_create_unique',
71
+ // tokens.update()
72
+ 'token_update',
73
+ // 3D Secure verification
74
+ // verifications.3DSecure()
75
+ 'confirm',
76
+ // OTP verification
77
+ // verifications.OTP()
78
+ 'confirm',
79
+ // check sender card for 3D Secure
80
+ // verifications.checkFor3DSecure()
81
+ 'mpi',
82
+ // CVV verification
83
+ // verifications.CVV()
84
+ 'confirm',
85
+ // card verification (is card valid)
86
+ // verifications.isCardValid()
87
+ 'cardverification',
88
+ // get archive of all accepted payments
89
+ // information.getPaymentsReport()
90
+ 'reports',
91
+ // get register of accepted payments for enterprises (check more)
92
+ // information.getCompensationsReportByDay()
93
+ 'reports_compensation',
94
+ // information.getCompensationsReportByDate()
95
+ 'register',
96
+ // information.getFullCompensationsReport() and information.getCompensationsReportByP2POperation()
97
+ 'reports_compensation_file',
98
+ // information.getFullCompensationsReportStatus() and information.getCompensationsReportByP2POperationStatus()
99
+ 'reports_compensation_file_status',
100
+ // payments.addData()
101
+ 'data',
102
+ // payments.sendTicket()
103
+ 'ticket',
104
+ // payments.getStatus()
105
+ 'status',
106
+ // company creation (check more)
107
+ // companies.create()
108
+ 'agent_shop_create',
109
+ // companies.register()
110
+ 'agent_shop_register',
111
+ // company edit
112
+ // companies.update()
113
+ 'agent_shop_edit',
114
+ // company info
115
+ // companies.getInfo()
116
+ 'agent_info_merchant',
117
+ // partner info
118
+ // companies.getUserInfo()
119
+ 'agent_info_user',
120
+ // + exchange rates and currency exchange rate archive (public API - don't need action)
121
+ // can be in responses/callback
122
+ 'pay',
11
123
  'hold',
12
124
  'paysplit',
13
125
  'subscribe',
14
126
  'paydonate',
15
127
  'auth',
16
128
  'regular',
17
- 'status',
18
129
  ]);
@@ -0,0 +1,7 @@
1
+ import z from 'zod';
2
+ export declare const CardTokenActionSchema: z.ZodEnum<{
3
+ SUSPEND: "SUSPEND";
4
+ UNSUSPEND: "UNSUSPEND";
5
+ DELETE: "DELETE";
6
+ }>;
7
+ export type CardTokenAction = z.infer<typeof CardTokenActionSchema>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CardTokenActionSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ exports.CardTokenActionSchema = zod_1.default.enum(['SUSPEND', 'UNSUSPEND', 'DELETE']);
@@ -0,0 +1,6 @@
1
+ import z from 'zod';
2
+ export declare const InvoiceUnitsActionSchema: z.ZodEnum<{
3
+ invoice_units_get_list: "invoice_units_get_list";
4
+ invoice_units_get_list_by_lang: "invoice_units_get_list_by_lang";
5
+ }>;
6
+ export type InvoiceUnitsAction = z.infer<typeof InvoiceUnitsActionSchema>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.InvoiceUnitsActionSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ exports.InvoiceUnitsActionSchema = zod_1.default.enum([
9
+ 'invoice_units_get_list',
10
+ 'invoice_units_get_list_by_lang',
11
+ ]);
@@ -3,15 +3,45 @@ export declare const PaymentStatusRequestSchema: z.ZodObject<{
3
3
  version: z.ZodOptional<z.ZodLiteral<7>>;
4
4
  publicKey: z.ZodOptional<z.ZodString>;
5
5
  action: z.ZodEnum<{
6
+ data: "data";
6
7
  pay: "pay";
7
- paytoken: "paytoken";
8
8
  hold: "hold";
9
- paysplit: "paysplit";
10
9
  subscribe: "subscribe";
11
10
  paydonate: "paydonate";
12
11
  auth: "auth";
13
- regular: "regular";
12
+ refund: "refund";
13
+ payment_prepare: "payment_prepare";
14
+ unsubscribe: "unsubscribe";
15
+ subscribe_update: "subscribe_update";
16
+ payqr: "payqr";
17
+ staticQrCreate: "staticQrCreate";
18
+ paytoken: "paytoken";
19
+ paycash: "paycash";
20
+ hold_completion: "hold_completion";
21
+ paysplit: "paysplit";
22
+ invoice_send: "invoice_send";
23
+ invoice_cancel: "invoice_cancel";
24
+ p2pcredit: "p2pcredit";
25
+ p2pdebit: "p2pdebit";
26
+ token_create: "token_create";
27
+ token_create_unique: "token_create_unique";
28
+ token_update: "token_update";
29
+ confirm: "confirm";
30
+ mpi: "mpi";
31
+ cardverification: "cardverification";
32
+ reports: "reports";
33
+ reports_compensation: "reports_compensation";
34
+ register: "register";
35
+ reports_compensation_file: "reports_compensation_file";
36
+ reports_compensation_file_status: "reports_compensation_file_status";
37
+ ticket: "ticket";
14
38
  status: "status";
39
+ agent_shop_create: "agent_shop_create";
40
+ agent_shop_register: "agent_shop_register";
41
+ agent_shop_edit: "agent_shop_edit";
42
+ agent_info_merchant: "agent_info_merchant";
43
+ agent_info_user: "agent_info_user";
44
+ regular: "regular";
15
45
  }>;
16
46
  orderId: z.ZodString;
17
47
  }, z.core.$strip>;
@@ -20,24 +50,54 @@ export declare const RawPaymentStatusRequestSchema: z.ZodPipe<z.ZodObject<{
20
50
  version: z.ZodOptional<z.ZodLiteral<7>>;
21
51
  publicKey: z.ZodOptional<z.ZodString>;
22
52
  action: z.ZodEnum<{
53
+ data: "data";
23
54
  pay: "pay";
24
- paytoken: "paytoken";
25
55
  hold: "hold";
26
- paysplit: "paysplit";
27
56
  subscribe: "subscribe";
28
57
  paydonate: "paydonate";
29
58
  auth: "auth";
30
- regular: "regular";
59
+ refund: "refund";
60
+ payment_prepare: "payment_prepare";
61
+ unsubscribe: "unsubscribe";
62
+ subscribe_update: "subscribe_update";
63
+ payqr: "payqr";
64
+ staticQrCreate: "staticQrCreate";
65
+ paytoken: "paytoken";
66
+ paycash: "paycash";
67
+ hold_completion: "hold_completion";
68
+ paysplit: "paysplit";
69
+ invoice_send: "invoice_send";
70
+ invoice_cancel: "invoice_cancel";
71
+ p2pcredit: "p2pcredit";
72
+ p2pdebit: "p2pdebit";
73
+ token_create: "token_create";
74
+ token_create_unique: "token_create_unique";
75
+ token_update: "token_update";
76
+ confirm: "confirm";
77
+ mpi: "mpi";
78
+ cardverification: "cardverification";
79
+ reports: "reports";
80
+ reports_compensation: "reports_compensation";
81
+ register: "register";
82
+ reports_compensation_file: "reports_compensation_file";
83
+ reports_compensation_file_status: "reports_compensation_file_status";
84
+ ticket: "ticket";
31
85
  status: "status";
86
+ agent_shop_create: "agent_shop_create";
87
+ agent_shop_register: "agent_shop_register";
88
+ agent_shop_edit: "agent_shop_edit";
89
+ agent_info_merchant: "agent_info_merchant";
90
+ agent_info_user: "agent_info_user";
91
+ regular: "regular";
32
92
  }>;
33
93
  orderId: z.ZodString;
34
94
  }, z.core.$strip>, z.ZodTransform<{
35
- action: "pay" | "paytoken" | "hold" | "paysplit" | "subscribe" | "paydonate" | "auth" | "regular" | "status";
95
+ action: "data" | "pay" | "hold" | "subscribe" | "paydonate" | "auth" | "refund" | "payment_prepare" | "unsubscribe" | "subscribe_update" | "payqr" | "staticQrCreate" | "paytoken" | "paycash" | "hold_completion" | "paysplit" | "invoice_send" | "invoice_cancel" | "p2pcredit" | "p2pdebit" | "token_create" | "token_create_unique" | "token_update" | "confirm" | "mpi" | "cardverification" | "reports" | "reports_compensation" | "register" | "reports_compensation_file" | "reports_compensation_file_status" | "ticket" | "status" | "agent_shop_create" | "agent_shop_register" | "agent_shop_edit" | "agent_info_merchant" | "agent_info_user" | "regular";
36
96
  order_id: string;
37
97
  version?: 7 | undefined;
38
98
  public_key?: string | undefined;
39
99
  }, {
40
- action: "pay" | "paytoken" | "hold" | "paysplit" | "subscribe" | "paydonate" | "auth" | "regular" | "status";
100
+ action: "data" | "pay" | "hold" | "subscribe" | "paydonate" | "auth" | "refund" | "payment_prepare" | "unsubscribe" | "subscribe_update" | "payqr" | "staticQrCreate" | "paytoken" | "paycash" | "hold_completion" | "paysplit" | "invoice_send" | "invoice_cancel" | "p2pcredit" | "p2pdebit" | "token_create" | "token_create_unique" | "token_update" | "confirm" | "mpi" | "cardverification" | "reports" | "reports_compensation" | "register" | "reports_compensation_file" | "reports_compensation_file_status" | "ticket" | "status" | "agent_shop_create" | "agent_shop_register" | "agent_shop_edit" | "agent_info_merchant" | "agent_info_user" | "regular";
41
101
  orderId: string;
42
102
  version?: 7 | undefined;
43
103
  publicKey?: string | undefined;
@@ -107,7 +107,7 @@ export declare const PaymentStatusResponseSchema: z.ZodPipe<z.ZodObject<{
107
107
  version: z.ZodOptional<z.ZodNumber>;
108
108
  }, z.core.$strip>, z.ZodTransform<Partial<{
109
109
  acqId: string | undefined;
110
- action: "pay" | "paytoken" | "hold" | "paysplit" | "subscribe" | "paydonate" | "auth" | "regular" | "status" | undefined;
110
+ action: "data" | "pay" | "hold" | "subscribe" | "paydonate" | "auth" | "refund" | "payment_prepare" | "unsubscribe" | "subscribe_update" | "payqr" | "staticQrCreate" | "paytoken" | "paycash" | "hold_completion" | "paysplit" | "invoice_send" | "invoice_cancel" | "p2pcredit" | "p2pdebit" | "token_create" | "token_create_unique" | "token_update" | "confirm" | "mpi" | "cardverification" | "reports" | "reports_compensation" | "register" | "reports_compensation_file" | "reports_compensation_file_status" | "ticket" | "status" | "agent_shop_create" | "agent_shop_register" | "agent_shop_edit" | "agent_info_merchant" | "agent_info_user" | "regular" | undefined;
111
111
  bonusType: "bonusplus" | "discount_club" | "personal" | "promo" | undefined;
112
112
  createDate: Date | undefined;
113
113
  currency: "USD" | "EUR" | "UAH" | undefined;
@@ -310,9 +310,9 @@ export declare class PaymentsService {
310
310
  action: import("../..").Action;
311
311
  };
312
312
  getPayButton(payload: CheckoutInput, buttonText?: string, buttonColor?: string): string;
313
- getPaymentStatus(orderId: string): Promise<import("../..").Result<Partial<{
313
+ getStatus(orderId: string): Promise<import("../..").Result<Partial<{
314
314
  acqId: string | undefined;
315
- action: "pay" | "paytoken" | "hold" | "paysplit" | "subscribe" | "paydonate" | "auth" | "regular" | "status" | undefined;
315
+ action: "data" | "pay" | "hold" | "subscribe" | "paydonate" | "auth" | "refund" | "payment_prepare" | "unsubscribe" | "subscribe_update" | "payqr" | "staticQrCreate" | "paytoken" | "paycash" | "hold_completion" | "paysplit" | "invoice_send" | "invoice_cancel" | "p2pcredit" | "p2pdebit" | "token_create" | "token_create_unique" | "token_update" | "confirm" | "mpi" | "cardverification" | "reports" | "reports_compensation" | "register" | "reports_compensation_file" | "reports_compensation_file_status" | "ticket" | "status" | "agent_shop_create" | "agent_shop_register" | "agent_shop_edit" | "agent_info_merchant" | "agent_info_user" | "regular" | undefined;
316
316
  bonusType: "bonusplus" | "discount_club" | "personal" | "promo" | undefined;
317
317
  createDate: Date | undefined;
318
318
  currency: "USD" | "EUR" | "UAH" | undefined;
@@ -7,7 +7,7 @@ class PaymentsService {
7
7
  this.client = client;
8
8
  }
9
9
  pay(payload) {
10
- return this.client.payments.pay(payload);
10
+ return this.client.payments.getCheckoutUrl(payload);
11
11
  }
12
12
  hold(payload) {
13
13
  return this.client.payments.hold(payload);
@@ -18,7 +18,7 @@ class PaymentsService {
18
18
  getPayButton(payload, buttonText, buttonColor) {
19
19
  return this.client.payments.getPayButton(payload, buttonText, buttonColor);
20
20
  }
21
- async getPaymentStatus(orderId) {
21
+ async getStatus(orderId) {
22
22
  return this.client.payments.getStatus(orderId);
23
23
  }
24
24
  }
@@ -6,7 +6,7 @@ export declare class WebhooksService {
6
6
  parseCheckoutCallback(envelope: LiqPayEnvelope): Promise<import("../../core/types/base").Result<Partial<{
7
7
  version: 7 | undefined;
8
8
  acqId: string | undefined;
9
- action: "pay" | "paytoken" | "hold" | "paysplit" | "subscribe" | "paydonate" | "auth" | "regular" | "status" | undefined;
9
+ action: "data" | "pay" | "hold" | "subscribe" | "paydonate" | "auth" | "refund" | "payment_prepare" | "unsubscribe" | "subscribe_update" | "payqr" | "staticQrCreate" | "paytoken" | "paycash" | "hold_completion" | "paysplit" | "invoice_send" | "invoice_cancel" | "p2pcredit" | "p2pdebit" | "token_create" | "token_create_unique" | "token_update" | "confirm" | "mpi" | "cardverification" | "reports" | "reports_compensation" | "register" | "reports_compensation_file" | "reports_compensation_file_status" | "ticket" | "status" | "agent_shop_create" | "agent_shop_register" | "agent_shop_edit" | "agent_info_merchant" | "agent_info_user" | "regular" | undefined;
10
10
  completionDate: Date | undefined;
11
11
  createDate: Date | undefined;
12
12
  currency: "USD" | "EUR" | "UAH" | undefined;
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.1",
4
+ "version": "0.3.3",
5
5
  "type": "commonjs",
6
6
  "module": "dist/index.js",
7
7
  "main": "dist/index.js",