liqpay-nestjs 0.3.4 → 0.3.5

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.
@@ -1,6 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * Contract of decoded format of API parameters received in a request from LiqPay after payment
3
+ * Raw (non-normalized) LiqPay checkout callback payload.
4
+ *
5
+ * ⚠️ Notes:
6
+ * - All fields are in snake_case
7
+ * - Types are inconsistent (string | number | boolean)
8
+ * - Some fields may be missing depending on payment flow
9
+ * - Should NOT be used directly in application logic
4
10
  */
5
11
  export declare const RawCheckoutCallbackSchema: z.ZodObject<{
6
12
  version: z.ZodOptional<z.ZodNumber>;
@@ -62,9 +68,20 @@ export declare const RawCheckoutCallbackSchema: z.ZodObject<{
62
68
  refund_amount: z.ZodOptional<z.ZodNumber>;
63
69
  verifycode: z.ZodOptional<z.ZodString>;
64
70
  }, z.core.$strip>;
71
+ /**
72
+ * Type of raw LiqPay callback.
73
+ */
65
74
  export type RawCheckoutCallback = z.infer<typeof RawCheckoutCallbackSchema>;
66
75
  /**
67
- * Contract of decoded format of API parameters received in a request from LiqPay after payment
76
+ * Normalized checkout callback.
77
+ *
78
+ * What this schema does:
79
+ * - Converts keys from snake_case → camelCase
80
+ * - Normalizes types (string → number/date/boolean)
81
+ * - Validates enums
82
+ * - Removes undefined fields
83
+ *
84
+ * Safe to use in business logic.
68
85
  */
69
86
  export declare const CheckoutCallbackSchema: z.ZodPipe<z.ZodObject<{
70
87
  version: z.ZodOptional<z.ZodNumber>;
@@ -316,6 +333,9 @@ export declare const CheckoutCallbackSchema: z.ZodPipe<z.ZodObject<{
316
333
  verifycode?: string | undefined;
317
334
  }>>;
318
335
  /**
319
- * Contract of decoded format of API parameters received in a request from LiqPay after payment
336
+ * Type of normalized checkout callback.
337
+ * - Fully parsed
338
+ * - Type-safe
339
+ * - Ready for backend logic
320
340
  */
321
341
  export type CheckoutCallback = z.infer<typeof CheckoutCallbackSchema>;
@@ -8,7 +8,13 @@ const enums_1 = require("../common/enums");
8
8
  const error_1 = require("../error");
9
9
  // TODO: check for optional fields on real api callbacks
10
10
  /**
11
- * Contract of decoded format of API parameters received in a request from LiqPay after payment
11
+ * Raw (non-normalized) LiqPay checkout callback payload.
12
+ *
13
+ * ⚠️ Notes:
14
+ * - All fields are in snake_case
15
+ * - Types are inconsistent (string | number | boolean)
16
+ * - Some fields may be missing depending on payment flow
17
+ * - Should NOT be used directly in application logic
12
18
  */
13
19
  exports.RawCheckoutCallbackSchema = zod_1.z.object({
14
20
  /**
@@ -257,7 +263,15 @@ exports.RawCheckoutCallbackSchema = zod_1.z.object({
257
263
  verifycode: zod_1.z.string().optional(),
258
264
  });
259
265
  /**
260
- * Contract of decoded format of API parameters received in a request from LiqPay after payment
266
+ * Normalized checkout callback.
267
+ *
268
+ * What this schema does:
269
+ * - Converts keys from snake_case → camelCase
270
+ * - Normalizes types (string → number/date/boolean)
271
+ * - Validates enums
272
+ * - Removes undefined fields
273
+ *
274
+ * Safe to use in business logic.
261
275
  */
262
276
  exports.CheckoutCallbackSchema = exports.RawCheckoutCallbackSchema.transform(raw => {
263
277
  const camelized = (0, ts_case_convert_1.objectToCamel)(raw);
@@ -1,7 +1,7 @@
1
1
  import z from 'zod';
2
2
  import { CheckoutAction, LiqPayVersion } from '../common/enums';
3
3
  /**
4
- * Contract of data that is passed when forming a payment request as `base64` encoded string data when calling the LiqPay API
4
+ * Input data for checkout (payment creation). This is the main payload provided by the user.
5
5
  */
6
6
  export declare const CheckoutInputSchema: z.ZodObject<{
7
7
  amount: z.ZodNumber;
@@ -124,11 +124,13 @@ export declare const CheckoutInputSchema: z.ZodObject<{
124
124
  productUrl: z.ZodOptional<z.ZodString>;
125
125
  }, z.core.$strip>;
126
126
  /**
127
- * Contract of data that is passed when forming a payment request as `base64` encoded string data when calling the LiqPay API
127
+ * Type of checkout input.
128
128
  */
129
129
  export type CheckoutInput = z.infer<typeof CheckoutInputSchema>;
130
130
  /**
131
- * Contract of data that is passed when forming a payment request as `base64` encoded string data when calling the LiqPay API
131
+ * Full checkout request (before serialization).
132
+ *
133
+ * Extends {@link CheckoutInput} with required LiqPay API fields.
132
134
  */
133
135
  export type CheckoutRequest = CheckoutInput & {
134
136
  /**
@@ -150,6 +152,16 @@ export type CheckoutRequest = CheckoutInput & {
150
152
  */
151
153
  action: CheckoutAction;
152
154
  };
155
+ /**
156
+ * Raw checkout request (snake_case).
157
+ *
158
+ * ⚠️ Notes:
159
+ * - Converts camelCase → snake_case
160
+ * - Applies LiqPay-specific formatting
161
+ * - Removes undefined fields
162
+ *
163
+ * Used right before sending request to LiqPay.
164
+ */
153
165
  export declare const RawCheckoutRequestSchema: z.ZodPipe<z.ZodCustom<CheckoutRequest, CheckoutRequest>, z.ZodTransform<Partial<{
154
166
  /**
155
167
  * Data for fiscalization (rro_info)
@@ -250,4 +262,10 @@ export declare const RawCheckoutRequestSchema: z.ZodPipe<z.ZodCustom<CheckoutReq
250
262
  public_key: string;
251
263
  action: CheckoutAction;
252
264
  }>, CheckoutRequest>>;
265
+ /**
266
+ * Type of raw checkout request.
267
+ * - snake_case
268
+ * - formatted for LiqPay
269
+ * - ready to be encoded (base64 + signature)
270
+ */
253
271
  export type RawCheckoutRequest = z.infer<typeof RawCheckoutRequestSchema>;
@@ -10,7 +10,7 @@ const utils_1 = require("../../utils");
10
10
  const common_1 = require("../common");
11
11
  const enums_1 = require("../common/enums");
12
12
  /**
13
- * Contract of data that is passed when forming a payment request as `base64` encoded string data when calling the LiqPay API
13
+ * Input data for checkout (payment creation). This is the main payload provided by the user.
14
14
  */
15
15
  exports.CheckoutInputSchema = zod_1.default.object({
16
16
  /**
@@ -150,10 +150,20 @@ exports.CheckoutInputSchema = zod_1.default.object({
150
150
  */
151
151
  productUrl: zod_1.default.string().max(510).optional(),
152
152
  });
153
+ /**
154
+ * Raw checkout request (snake_case).
155
+ *
156
+ * ⚠️ Notes:
157
+ * - Converts camelCase → snake_case
158
+ * - Applies LiqPay-specific formatting
159
+ * - Removes undefined fields
160
+ *
161
+ * Used right before sending request to LiqPay.
162
+ */
153
163
  exports.RawCheckoutRequestSchema = zod_1.default
154
164
  .custom()
155
- .transform(req => {
156
- const { fiscalData, verifyCode, recurringByToken, detailAddenda, ...rest } = req;
165
+ .transform(request => {
166
+ const { fiscalData, verifyCode, recurringByToken, detailAddenda, ...rest } = request;
157
167
  const snakelized = (0, ts_case_convert_1.objectToSnake)(rest);
158
168
  const transformed = {
159
169
  ...snakelized,
@@ -42,5 +42,7 @@ export declare const ActionSchema: z.ZodEnum<{
42
42
  }>;
43
43
  export type Action = z.infer<typeof ActionSchema>;
44
44
  export type CheckoutAction = Extract<Action, 'pay' | 'hold' | 'subscribe' | 'paydonate'>;
45
+ export type PaymentStatusAction = Extract<Action, 'status'>;
46
+ export type RefundAction = Extract<Action, 'refund'>;
45
47
  export type VerificationAction = Extract<Action, 'confirm' | 'mpi' | 'cardverification'>;
46
48
  export type ReportAction = Extract<Action, 'reports' | 'reports_compensation' | 'register' | 'reports_compensation_file' | 'reports_compensation_file_status'>;
@@ -1,17 +1,19 @@
1
1
  import z from 'zod';
2
- import { Action, LiqPayVersion } from '../common/enums';
2
+ import { LiqPayVersion, PaymentStatusAction } from '../common/enums';
3
3
  /**
4
- * Schema of data that is passed when forming a request to receive payment status as data in `base64` encoded string form when calling the LiqPay API
4
+ * Input data for retrieving payment status. Minimal payload required from the user.
5
5
  */
6
6
  export declare const PaymentStatusInputSchema: z.ZodObject<{
7
7
  orderId: z.ZodString;
8
8
  }, z.core.$strip>;
9
9
  /**
10
- * Contract of data that is passed when forming a request to receive payment status as data in `base64` encoded string form when calling the LiqPay API
10
+ * Type of payment status input.
11
11
  */
12
12
  export type PaymentStatusInput = z.infer<typeof PaymentStatusInputSchema>;
13
13
  /**
14
- * Schema of data that is passed when forming a request to receive payment status as data in `base64` encoded string form when calling the LiqPay API
14
+ * Full payment status request (before serialization).
15
+ *
16
+ * Extends {@link PaymentStatusInput} with required LiqPay API fields.
15
17
  */
16
18
  export type PaymentStatusRequest = PaymentStatusInput & {
17
19
  /**
@@ -27,12 +29,27 @@ export type PaymentStatusRequest = PaymentStatusInput & {
27
29
  /**
28
30
  * Operation type. Possible values: `status`
29
31
  */
30
- action: Extract<Action, 'status'>;
32
+ action: PaymentStatusAction;
31
33
  };
34
+ /**
35
+ * Raw payment status request (snake_case).
36
+ *
37
+ * ⚠️ Notes:
38
+ * - Converts camelCase → snake_case
39
+ * - Does NOT modify values
40
+ * - Does NOT perform validation
41
+ *
42
+ * Used before sending request to LiqPay API.
43
+ */
32
44
  export declare const RawPaymentStatusRequestSchema: z.ZodPipe<z.ZodCustom<PaymentStatusRequest, PaymentStatusRequest>, z.ZodTransform<{
33
45
  order_id: string;
34
46
  version: LiqPayVersion;
35
47
  public_key: string;
36
- action: Extract<Action, "status">;
48
+ action: PaymentStatusAction;
37
49
  }, PaymentStatusRequest>>;
50
+ /**
51
+ * Type of raw payment status request.
52
+ * - snake_case
53
+ * - ready for encoding and sending to LiqPay
54
+ */
38
55
  export type RawPaymentStatusRequest = z.infer<typeof RawPaymentStatusRequestSchema>;
@@ -7,7 +7,7 @@ exports.RawPaymentStatusRequestSchema = exports.PaymentStatusInputSchema = void
7
7
  const ts_case_convert_1 = require("ts-case-convert");
8
8
  const zod_1 = __importDefault(require("zod"));
9
9
  /**
10
- * Schema of data that is passed when forming a request to receive payment status as data in `base64` encoded string form when calling the LiqPay API
10
+ * Input data for retrieving payment status. Minimal payload required from the user.
11
11
  */
12
12
  exports.PaymentStatusInputSchema = zod_1.default.object({
13
13
  /**
@@ -15,9 +15,19 @@ exports.PaymentStatusInputSchema = zod_1.default.object({
15
15
  */
16
16
  orderId: zod_1.default.string().max(255),
17
17
  });
18
+ /**
19
+ * Raw payment status request (snake_case).
20
+ *
21
+ * ⚠️ Notes:
22
+ * - Converts camelCase → snake_case
23
+ * - Does NOT modify values
24
+ * - Does NOT perform validation
25
+ *
26
+ * Used before sending request to LiqPay API.
27
+ */
18
28
  exports.RawPaymentStatusRequestSchema = zod_1.default
19
29
  .custom()
20
- .transform(typed => {
21
- const snakelized = (0, ts_case_convert_1.objectToSnake)(typed);
30
+ .transform(request => {
31
+ const snakelized = (0, ts_case_convert_1.objectToSnake)(request);
22
32
  return { ...snakelized };
23
33
  });
@@ -1,6 +1,13 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
- * Schema of data that comes in response to a request to get payment status
3
+ * Raw response from LiqPay `status` API.
4
+ *
5
+ * ⚠️ Important:
6
+ * - Field names are in `snake_case`
7
+ * - Types are inconsistent (`string | number | boolean`)
8
+ * - Dates are not parsed
9
+ *
10
+ * This schema reflects the API response **as-is**, without normalization.
4
11
  */
5
12
  export declare const RawPaymentStatusResponseSchema: z.ZodObject<{
6
13
  acq_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
@@ -56,11 +63,18 @@ export declare const RawPaymentStatusResponseSchema: z.ZodObject<{
56
63
  version: z.ZodOptional<z.ZodNumber>;
57
64
  }, z.core.$strip>;
58
65
  /**
59
- * Contract of data that comes in response to a request to get payment status
66
+ * Raw (unprocessed) payment status response.
60
67
  */
61
68
  export type RawPaymentStatusResponse = z.infer<typeof RawPaymentStatusResponseSchema>;
62
69
  /**
63
- * Schema of data that comes in response to a request to get payment status
70
+ * Normalized payment status response.
71
+ *
72
+ * This schema:
73
+ * - converts keys to `camelCase`
74
+ * - normalizes primitive types
75
+ * - parses dates
76
+ * - validates enums
77
+ * - removes `undefined` fields
64
78
  */
65
79
  export declare const PaymentStatusResponseSchema: z.ZodPipe<z.ZodObject<{
66
80
  acq_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
@@ -298,6 +312,8 @@ export declare const PaymentStatusResponseSchema: z.ZodPipe<z.ZodObject<{
298
312
  version?: number | undefined;
299
313
  }>>;
300
314
  /**
301
- * Contract of data that comes in response to a request to get payment status
315
+ * Final, fully normalized payment status response.
316
+ *
317
+ * Use this type in application code instead of raw API response.
302
318
  */
303
319
  export type PaymentStatusResponse = z.infer<typeof PaymentStatusResponseSchema>;
@@ -7,7 +7,14 @@ const utils_1 = require("../../utils");
7
7
  const enums_1 = require("../common/enums");
8
8
  // TODO: check for optional fields on real api responses
9
9
  /**
10
- * Schema of data that comes in response to a request to get payment status
10
+ * Raw response from LiqPay `status` API.
11
+ *
12
+ * ⚠️ Important:
13
+ * - Field names are in `snake_case`
14
+ * - Types are inconsistent (`string | number | boolean`)
15
+ * - Dates are not parsed
16
+ *
17
+ * This schema reflects the API response **as-is**, without normalization.
11
18
  */
12
19
  exports.RawPaymentStatusResponseSchema = zod_1.z.object({
13
20
  /**
@@ -231,7 +238,14 @@ exports.RawPaymentStatusResponseSchema = zod_1.z.object({
231
238
  version: zod_1.z.number().optional(),
232
239
  });
233
240
  /**
234
- * Schema of data that comes in response to a request to get payment status
241
+ * Normalized payment status response.
242
+ *
243
+ * This schema:
244
+ * - converts keys to `camelCase`
245
+ * - normalizes primitive types
246
+ * - parses dates
247
+ * - validates enums
248
+ * - removes `undefined` fields
235
249
  */
236
250
  exports.PaymentStatusResponseSchema = exports.RawPaymentStatusResponseSchema.transform(raw => {
237
251
  const camelized = (0, ts_case_convert_1.objectToCamel)(raw);
@@ -0,0 +1,51 @@
1
+ import z from 'zod';
2
+ import { LiqPayVersion, RefundAction } from '../common/enums';
3
+ /**
4
+ * Input data required to initiate a refund. This is the minimal payload provided by the user.
5
+ */
6
+ export declare const RefundInputSchema: z.ZodObject<{
7
+ amount: z.ZodNumber;
8
+ orderId: z.ZodString;
9
+ }, z.core.$strip>;
10
+ /**
11
+ * Type of refund input.
12
+ */
13
+ export type RefundInput = z.infer<typeof RefundInputSchema>;
14
+ /**
15
+ * Full refund request payload (before serialization).
16
+ */
17
+ export type RefundRequest = RefundInput & {
18
+ /**
19
+ * API version. The current version is `7`.
20
+ */
21
+ version: LiqPayVersion;
22
+ /**
23
+ * Public API key: The ID of the created company. Example: `i00000000`.
24
+ * You can retrieve this key in the store settings of your LiqPay cabinet.
25
+ */
26
+ publicKey: string;
27
+ /**
28
+ * The type of operation. For this specific request, the value must be `refund`.
29
+ */
30
+ action: RefundAction;
31
+ };
32
+ /**
33
+ * Raw refund request schema.
34
+ *
35
+ * ⚠️ Notes:
36
+ * - Converts object keys from camelCase → snake_case
37
+ * - Does NOT perform validation (assumes {@link RefundRequest} is already valid)
38
+ *
39
+ * Used right before sending data to LiqPay API.
40
+ */
41
+ export declare const RawRefundRequestSchema: z.ZodPipe<z.ZodCustom<RefundRequest, RefundRequest>, z.ZodTransform<{
42
+ amount: number;
43
+ order_id: string;
44
+ version: LiqPayVersion;
45
+ public_key: string;
46
+ action: RefundAction;
47
+ }, RefundRequest>>;
48
+ /**
49
+ * Type of raw refund request (snake_case). Ready to be encoded and sent to LiqPay.
50
+ */
51
+ export type RawRefundRequest = z.infer<typeof RawRefundRequestSchema>;
@@ -0,0 +1,38 @@
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.RawRefundRequestSchema = exports.RefundInputSchema = void 0;
7
+ const ts_case_convert_1 = require("ts-case-convert");
8
+ const zod_1 = __importDefault(require("zod"));
9
+ /**
10
+ * Input data required to initiate a refund. This is the minimal payload provided by the user.
11
+ */
12
+ exports.RefundInputSchema = zod_1.default.object({
13
+ /**
14
+ * The refund amount. For example: `5`, `7.34`.
15
+ * The amount must be positive and cannot exceed the original transaction amount.
16
+ */
17
+ amount: zod_1.default.number().positive(),
18
+ /**
19
+ * The unique purchase ID from your store associated with the original payment.
20
+ * Maximum length is __255__ characters.
21
+ */
22
+ orderId: zod_1.default.string().max(255),
23
+ });
24
+ /**
25
+ * Raw refund request schema.
26
+ *
27
+ * ⚠️ Notes:
28
+ * - Converts object keys from camelCase → snake_case
29
+ * - Does NOT perform validation (assumes {@link RefundRequest} is already valid)
30
+ *
31
+ * Used right before sending data to LiqPay API.
32
+ */
33
+ exports.RawRefundRequestSchema = zod_1.default
34
+ .custom()
35
+ .transform(request => {
36
+ const snakelized = (0, ts_case_convert_1.objectToSnake)(request);
37
+ return { ...snakelized };
38
+ });
@@ -0,0 +1,88 @@
1
+ import z from 'zod';
2
+ /**
3
+ * Raw (non-normalized) response from LiqPay refund API.
4
+ *
5
+ * ⚠️ Notes:
6
+ * - Field names are in snake_case as returned by LiqPay
7
+ * - Some fields may have inconsistent types (e.g. string | number | boolean)
8
+ * - Requires transformation before safe usage
9
+ */
10
+ export declare const RawRefundResponseSchema: z.ZodObject<{
11
+ result: z.ZodOptional<z.ZodEnum<{
12
+ error: "error";
13
+ ok: "ok";
14
+ }>>;
15
+ wait_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
16
+ action: z.ZodOptional<z.ZodEnum<{
17
+ pay: "pay";
18
+ hold: "hold";
19
+ subscribe: "subscribe";
20
+ paydonate: "paydonate";
21
+ }>>;
22
+ payment_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
23
+ status: z.ZodOptional<z.ZodEnum<{
24
+ error: "error";
25
+ failure: "failure";
26
+ reversed: "reversed";
27
+ success: "success";
28
+ }>>;
29
+ }, z.core.$strip>;
30
+ /**
31
+ * Type of raw refund response from LiqPay.
32
+ */
33
+ export type RawRefundResponse = z.infer<typeof RawRefundResponseSchema>;
34
+ /**
35
+ * Normalized refund response.
36
+ *
37
+ * What this schema does:
38
+ * - Converts keys from snake_case → camelCase
39
+ * - Normalizes inconsistent field types
40
+ * - removes `undefined` fields
41
+ *
42
+ * Transformations:
43
+ * - `wait_amount` → `waitAmount` (boolean | undefined)
44
+ * - `payment_id` → `paymentId` (string | undefined)
45
+ */
46
+ export declare const RefundResponseSchema: z.ZodPipe<z.ZodObject<{
47
+ result: z.ZodOptional<z.ZodEnum<{
48
+ error: "error";
49
+ ok: "ok";
50
+ }>>;
51
+ wait_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
52
+ action: z.ZodOptional<z.ZodEnum<{
53
+ pay: "pay";
54
+ hold: "hold";
55
+ subscribe: "subscribe";
56
+ paydonate: "paydonate";
57
+ }>>;
58
+ payment_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
59
+ status: z.ZodOptional<z.ZodEnum<{
60
+ error: "error";
61
+ failure: "failure";
62
+ reversed: "reversed";
63
+ success: "success";
64
+ }>>;
65
+ }, z.core.$strip>, z.ZodTransform<Partial<{
66
+ /**
67
+ * Refund type indicator. `true` - refund from future payments, `false` - from merchant account
68
+ */
69
+ waitAmount: boolean | undefined;
70
+ /**
71
+ * Payment ID in the LiqPay system
72
+ */
73
+ paymentId: string | undefined;
74
+ result?: "error" | "ok" | undefined;
75
+ action?: "pay" | "hold" | "subscribe" | "paydonate" | undefined;
76
+ status?: "error" | "failure" | "reversed" | "success" | undefined;
77
+ }>, {
78
+ result?: "error" | "ok" | undefined;
79
+ wait_amount?: string | boolean | undefined;
80
+ action?: "pay" | "hold" | "subscribe" | "paydonate" | undefined;
81
+ payment_id?: string | number | undefined;
82
+ status?: "error" | "failure" | "reversed" | "success" | undefined;
83
+ }>>;
84
+ /**
85
+ * Type of normalized refund response.
86
+ * Safe to use in application logic.
87
+ */
88
+ export type RefundResponse = z.infer<typeof RefundResponseSchema>;
@@ -0,0 +1,85 @@
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.RefundResponseSchema = exports.RawRefundResponseSchema = void 0;
7
+ const ts_case_convert_1 = require("ts-case-convert");
8
+ const zod_1 = __importDefault(require("zod"));
9
+ const utils_1 = require("../../utils");
10
+ const enums_1 = require("../common/enums");
11
+ /**
12
+ * Raw (non-normalized) response from LiqPay refund API.
13
+ *
14
+ * ⚠️ Notes:
15
+ * - Field names are in snake_case as returned by LiqPay
16
+ * - Some fields may have inconsistent types (e.g. string | number | boolean)
17
+ * - Requires transformation before safe usage
18
+ */
19
+ exports.RawRefundResponseSchema = zod_1.default.object({
20
+ /**
21
+ * Result of query execution: `ok`, `error`
22
+ */
23
+ result: enums_1.RequestResultSchema.optional(),
24
+ /**
25
+ * Refund type indicator. `true` - refund from future payments, `false` - from merchant account
26
+ */
27
+ wait_amount: zod_1.default.union([zod_1.default.boolean(), zod_1.default.string()]).optional(),
28
+ /**
29
+ * Operation type. Possible values:
30
+ * - `pay` - payment
31
+ * - `hold` - blocking of funds on the sender's account
32
+ * - `subscribe` - regular payment
33
+ * - `paydonate` - donation
34
+ */
35
+ action: enums_1.ActionSchema.extract([
36
+ 'pay',
37
+ 'hold',
38
+ 'subscribe',
39
+ 'paydonate',
40
+ ]).optional(),
41
+ /**
42
+ * Payment ID in the LiqPay system
43
+ */
44
+ payment_id: zod_1.default.union([zod_1.default.number(), zod_1.default.string()]).optional(),
45
+ /**
46
+ * Payment status. Possible values:
47
+ * - `error` - Unsuccessful payment. Incorrectly filled data
48
+ * - `failure` - Unsuccessful payment
49
+ * - `reversed` - Payment reversed
50
+ * - `success` - Successful payment
51
+ */
52
+ status: enums_1.ResolvedPaymentStatusSchema.extract([
53
+ 'error',
54
+ 'failure',
55
+ 'reversed',
56
+ 'success',
57
+ ]).optional(),
58
+ });
59
+ /**
60
+ * Normalized refund response.
61
+ *
62
+ * What this schema does:
63
+ * - Converts keys from snake_case → camelCase
64
+ * - Normalizes inconsistent field types
65
+ * - removes `undefined` fields
66
+ *
67
+ * Transformations:
68
+ * - `wait_amount` → `waitAmount` (boolean | undefined)
69
+ * - `payment_id` → `paymentId` (string | undefined)
70
+ */
71
+ exports.RefundResponseSchema = exports.RawRefundResponseSchema.transform(raw => {
72
+ const camelized = (0, ts_case_convert_1.objectToCamel)(raw);
73
+ const transformed = {
74
+ ...camelized,
75
+ /**
76
+ * Refund type indicator. `true` - refund from future payments, `false` - from merchant account
77
+ */
78
+ waitAmount: (0, utils_1.parseBoolean)(camelized.waitAmount),
79
+ /**
80
+ * Payment ID in the LiqPay system
81
+ */
82
+ paymentId: (0, utils_1.parseString)(camelized.paymentId),
83
+ };
84
+ return (0, utils_1.removeUndefined)(transformed);
85
+ });
@@ -4,7 +4,7 @@ import { PaymentStatusInput } from '../../core/types/payment-status';
4
4
  export declare class PaymentsService {
5
5
  private readonly client;
6
6
  constructor(client: LiqPayClient);
7
- pay(payload: CheckoutInput): {
7
+ getCheckoutUrl(payload: CheckoutInput): {
8
8
  url: string;
9
9
  data: string;
10
10
  signature: string;
@@ -304,7 +304,7 @@ export declare class PaymentsService {
304
304
  publicKey: string;
305
305
  action: import("../..").CheckoutAction;
306
306
  };
307
- getPayButton(payload: CheckoutInput, buttonText?: string, buttonColor?: string): string;
307
+ getCheckoutButton(payload: CheckoutInput, buttonText?: string, buttonColor?: string): string;
308
308
  getStatus(payload: PaymentStatusInput): Promise<import("../..").Result<Partial<{
309
309
  acqId: string | undefined;
310
310
  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;
@@ -6,7 +6,7 @@ class PaymentsService {
6
6
  constructor(client) {
7
7
  this.client = client;
8
8
  }
9
- pay(payload) {
9
+ getCheckoutUrl(payload) {
10
10
  return this.client.payments.getCheckoutUrl(payload);
11
11
  }
12
12
  hold(payload) {
@@ -15,7 +15,7 @@ class PaymentsService {
15
15
  subscribe(payload) {
16
16
  return this.client.payments.subscribe(payload);
17
17
  }
18
- getPayButton(payload, buttonText, buttonColor) {
18
+ getCheckoutButton(payload, buttonText, buttonColor) {
19
19
  return this.client.payments.getCheckoutButton(payload, buttonText, buttonColor);
20
20
  }
21
21
  async getStatus(payload) {
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",
4
+ "version": "0.3.5",
5
5
  "type": "commonjs",
6
6
  "module": "dist/index.js",
7
7
  "main": "dist/index.js",