liqpay-nestjs 0.3.6 → 0.3.8

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.
Files changed (59) hide show
  1. package/README.md +18 -1
  2. package/dist/core/clients/index.d.ts +0 -3
  3. package/dist/core/clients/index.js +0 -3
  4. package/dist/core/clients/liqpay.client.d.ts +2 -0
  5. package/dist/core/clients/liqpay.client.js +3 -0
  6. package/dist/core/clients/payments.client.js +1 -1
  7. package/dist/core/clients/refunds.client.d.ts +7 -0
  8. package/dist/core/clients/refunds.client.js +20 -0
  9. package/dist/core/clients/utils.client.d.ts +1 -1
  10. package/dist/core/clients/utils.client.js +2 -1
  11. package/dist/core/types/base/request.type.d.ts +3 -2
  12. package/dist/core/types/base/response.type.d.ts +3 -2
  13. package/dist/core/types/refund/index.d.ts +2 -0
  14. package/dist/core/types/refund/index.js +18 -0
  15. package/dist/nest/liqpay.service.d.ts +2 -1
  16. package/dist/nest/liqpay.service.js +2 -0
  17. package/dist/nest/services/index.d.ts +1 -0
  18. package/dist/nest/services/index.js +1 -0
  19. package/dist/nest/services/refunds.service.d.ts +7 -0
  20. package/dist/nest/services/refunds.service.js +13 -0
  21. package/package.json +1 -1
  22. package/dist/core/__devtypes/documented/checkout.callback.d.ts +0 -250
  23. package/dist/core/__devtypes/documented/checkout.callback.js +0 -2
  24. package/dist/core/__devtypes/documented/checkout.request.d.ts +0 -236
  25. package/dist/core/__devtypes/documented/checkout.request.js +0 -2
  26. package/dist/core/__devtypes/documented/detail-addenda.d.ts +0 -33
  27. package/dist/core/__devtypes/documented/detail-addenda.js +0 -2
  28. package/dist/core/__devtypes/documented/envelope.d.ts +0 -15
  29. package/dist/core/__devtypes/documented/envelope.js +0 -2
  30. package/dist/core/__devtypes/documented/fiscal-data.d.ts +0 -80
  31. package/dist/core/__devtypes/documented/fiscal-data.js +0 -2
  32. package/dist/core/__devtypes/documented/payment-status.request.d.ts +0 -23
  33. package/dist/core/__devtypes/documented/payment-status.request.js +0 -2
  34. package/dist/core/__devtypes/documented/payment-status.response.d.ts +0 -225
  35. package/dist/core/__devtypes/documented/payment-status.response.js +0 -2
  36. package/dist/core/__devtypes/documented/split-rule.d.ts +0 -29
  37. package/dist/core/__devtypes/documented/split-rule.js +0 -2
  38. package/dist/core/__devtypes/documented/types.d.ts +0 -287
  39. package/dist/core/__devtypes/documented/types.js +0 -199
  40. package/dist/core/__devtypes/payloads.d.ts +0 -158
  41. package/dist/core/__devtypes/payloads.js +0 -2
  42. package/dist/core/__devtypes/undocumented/checkout.callback.d.ts +0 -61
  43. package/dist/core/__devtypes/undocumented/checkout.callback.js +0 -2
  44. package/dist/core/__devtypes/undocumented/checkout.request.d.ts +0 -39
  45. package/dist/core/__devtypes/undocumented/checkout.request.js +0 -2
  46. package/dist/core/__devtypes/undocumented/detail-addenda.d.ts +0 -9
  47. package/dist/core/__devtypes/undocumented/detail-addenda.js +0 -2
  48. package/dist/core/__devtypes/undocumented/envelope.d.ts +0 -4
  49. package/dist/core/__devtypes/undocumented/envelope.js +0 -2
  50. package/dist/core/__devtypes/undocumented/fiscal-data.d.ts +0 -23
  51. package/dist/core/__devtypes/undocumented/fiscal-data.js +0 -2
  52. package/dist/core/__devtypes/undocumented/payment-status.request.d.ts +0 -6
  53. package/dist/core/__devtypes/undocumented/payment-status.request.js +0 -2
  54. package/dist/core/__devtypes/undocumented/payment-status.response.d.ts +0 -54
  55. package/dist/core/__devtypes/undocumented/payment-status.response.js +0 -2
  56. package/dist/core/__devtypes/undocumented/split-rule.d.ts +0 -9
  57. package/dist/core/__devtypes/undocumented/split-rule.js +0 -2
  58. package/dist/core/__devtypes/undocumented/types.d.ts +0 -181
  59. package/dist/core/__devtypes/undocumented/types.js +0 -160
package/README.md CHANGED
@@ -313,7 +313,7 @@ Useful optional fields include:
313
313
  - sender metadata such as `senderFirstName`, `senderLastName`, `senderAddress`, and `senderCountryCode`
314
314
  - product metadata such as `productName`, `productDescription`, `productCategory`, and `productUrl`
315
315
 
316
- The source repository keeps the full request and response models under `src/core/types` if you need exact field-level reference.
316
+ The source repository keeps the full request and response models under `src/core/types` if you need exact field-level reference, including the internal refund models.
317
317
 
318
318
  ## Type Exports
319
319
 
@@ -323,11 +323,15 @@ The package root exports TypeScript types for request and response modeling, for
323
323
  import type {
324
324
  CheckoutCallback,
325
325
  CheckoutInput,
326
+ Currency,
326
327
  LiqPayEnvelope,
327
328
  LiqPayError,
329
+ LiqPayRequest,
330
+ LiqPayResponse,
328
331
  PaymentStatusInput,
329
332
  PaymentStatusResponse,
330
333
  Result,
334
+ SplitRule,
331
335
  } from 'liqpay-nestjs'
332
336
  ```
333
337
 
@@ -340,6 +344,17 @@ It also exports these runtime values:
340
344
 
341
345
  Note: the package root currently exports types, not Zod schema values. The schema implementations live in the source under `src/core/types`.
342
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.
357
+
343
358
  ## Result Contract and Error Handling
344
359
 
345
360
  Methods that parse LiqPay responses return this shape:
@@ -376,6 +391,8 @@ The package root exports:
376
391
  - `LiqPayOptions`
377
392
  - `LiqPayAsyncOptions`
378
393
 
394
+ It does not currently export `RefundsService` or refund-specific request and response types from the package root.
395
+
379
396
  ## Build
380
397
 
381
398
  ```bash
@@ -1,4 +1 @@
1
1
  export * from './liqpay.client';
2
- export * from './payments.client';
3
- export * from './utils.client';
4
- export * from './webhooks.client';
@@ -15,6 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./liqpay.client"), exports);
18
- __exportStar(require("./payments.client"), exports);
19
- __exportStar(require("./utils.client"), exports);
20
- __exportStar(require("./webhooks.client"), exports);
@@ -1,8 +1,10 @@
1
1
  import { PaymentsClient } from './payments.client';
2
+ import { RefundsClient } from './refunds.client';
2
3
  import { WebhooksClient } from './webhooks.client';
3
4
  export declare class LiqPayClient {
4
5
  payments: PaymentsClient;
5
6
  webhooks: WebhooksClient;
7
+ refunds: RefundsClient;
6
8
  constructor(options: {
7
9
  publicKey: string;
8
10
  privateKey: string;
@@ -2,16 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LiqPayClient = void 0;
4
4
  const payments_client_1 = require("./payments.client");
5
+ const refunds_client_1 = require("./refunds.client");
5
6
  const utils_client_1 = require("./utils.client");
6
7
  const webhooks_client_1 = require("./webhooks.client");
7
8
  class LiqPayClient {
8
9
  payments;
9
10
  webhooks;
11
+ refunds;
10
12
  constructor(options) {
11
13
  const { publicKey, privateKey, resultUrl, serverUrl } = options;
12
14
  const utils = new utils_client_1.UtilsClient(publicKey, privateKey, resultUrl ?? '', serverUrl ?? '');
13
15
  this.payments = new payments_client_1.PaymentsClient(utils);
14
16
  this.webhooks = new webhooks_client_1.WebhooksClient(utils);
17
+ this.refunds = new refunds_client_1.RefundsClient(utils);
15
18
  }
16
19
  }
17
20
  exports.LiqPayClient = LiqPayClient;
@@ -82,7 +82,7 @@ class PaymentsClient {
82
82
  version: 7,
83
83
  publicKey: this.utils.publicKey,
84
84
  };
85
- return await this.utils.call(request, payment_status_1.RawPaymentStatusRequestSchema, payment_status_1.PaymentStatusResponseSchema, common_1.REQUEST_URL);
85
+ return await this.utils.call(request, payment_status_1.RawPaymentStatusRequestSchema, payment_status_1.PaymentStatusResponseSchema);
86
86
  }
87
87
  }
88
88
  exports.PaymentsClient = PaymentsClient;
@@ -0,0 +1,7 @@
1
+ import { RefundInput } from '../types/refund';
2
+ import { UtilsClient } from './utils.client';
3
+ export declare class RefundsClient {
4
+ private readonly utils;
5
+ constructor(utils: UtilsClient);
6
+ refund(payload: RefundInput): void;
7
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RefundsClient = void 0;
4
+ const refund_1 = require("../types/refund");
5
+ class RefundsClient {
6
+ utils;
7
+ constructor(utils) {
8
+ this.utils = utils;
9
+ }
10
+ refund(payload) {
11
+ const request = {
12
+ ...payload,
13
+ version: 7,
14
+ publicKey: this.utils.publicKey,
15
+ action: 'refund',
16
+ };
17
+ this.utils.call(request, refund_1.RawRefundRequestSchema, refund_1.RefundResponseSchema);
18
+ }
19
+ }
20
+ exports.RefundsClient = RefundsClient;
@@ -16,5 +16,5 @@ export declare class UtilsClient {
16
16
  parseData<T>(schema: z.ZodType<T>, data: unknown): Result<T>;
17
17
  parseError(data: unknown): Result<never> | null;
18
18
  parseEnvelope<TResponse extends LiqPayResponse>(envelope: LiqPayEnvelope, schema: z.ZodType<TResponse>): Result<TResponse>;
19
- call<TRequest extends LiqPayRequest, TRawRequest extends LiqPayRawRequest, TResponse extends LiqPayResponse>(payload: TRequest, rawSchema: z.ZodType<TRawRequest>, responseSchema: z.ZodType<TResponse>, url: string): Promise<Result<TResponse>>;
19
+ call<TRequest extends LiqPayRequest, TRawRequest extends LiqPayRawRequest, TResponse extends LiqPayResponse>(payload: TRequest, rawSchema: z.ZodType<TRawRequest>, responseSchema: z.ZodType<TResponse>, url?: string): Promise<Result<TResponse>>;
20
20
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UtilsClient = void 0;
4
4
  const node_crypto_1 = require("node:crypto");
5
+ const common_1 = require("../types/common");
5
6
  const error_1 = require("../types/error");
6
7
  class UtilsClient {
7
8
  publicKey;
@@ -70,7 +71,7 @@ class UtilsClient {
70
71
  }
71
72
  return this.parseData(schema, rawData);
72
73
  }
73
- async call(payload, rawSchema, responseSchema, url) {
74
+ async call(payload, rawSchema, responseSchema, url = common_1.REQUEST_URL) {
74
75
  const raw = rawSchema.parse(payload);
75
76
  const envelope = this.toEnvelope(raw);
76
77
  const response = await fetch(url, {
@@ -1,4 +1,5 @@
1
1
  import { CheckoutRequest, RawCheckoutRequest } from '../checkout';
2
2
  import { PaymentStatusRequest, RawPaymentStatusRequest } from '../payment-status';
3
- export type LiqPayRequest = CheckoutRequest | PaymentStatusRequest;
4
- export type LiqPayRawRequest = RawCheckoutRequest | RawPaymentStatusRequest;
3
+ import { RawRefundRequest, RefundRequest } from '../refund';
4
+ export type LiqPayRequest = CheckoutRequest | PaymentStatusRequest | RefundRequest;
5
+ export type LiqPayRawRequest = RawCheckoutRequest | RawPaymentStatusRequest | RawRefundRequest;
@@ -1,8 +1,9 @@
1
1
  import { CheckoutCallback, RawCheckoutCallback } from '../checkout';
2
2
  import { LiqPayErrorResponse } from '../error';
3
3
  import { PaymentStatusResponse, RawPaymentStatusResponse } from '../payment-status';
4
- export type LiqPayResponse = CheckoutCallback | PaymentStatusResponse;
5
- export type LiqPayRawResponse = RawCheckoutCallback | RawPaymentStatusResponse | LiqPayErrorResponse;
4
+ import { RawRefundResponse, RefundResponse } from '../refund';
5
+ export type LiqPayResponse = CheckoutCallback | PaymentStatusResponse | RefundResponse;
6
+ export type LiqPayRawResponse = RawCheckoutCallback | RawPaymentStatusResponse | RawRefundResponse | LiqPayErrorResponse;
6
7
  export type Result<T> = {
7
8
  data: T;
8
9
  error?: null;
@@ -0,0 +1,2 @@
1
+ export * from './refund.request';
2
+ export * from './refund.response';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./refund.request"), exports);
18
+ __exportStar(require("./refund.response"), exports);
@@ -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);
@@ -0,0 +1,7 @@
1
+ import { LiqPayClient } from '../../core/clients';
2
+ import { RefundInput } from '../../core/types/refund';
3
+ export declare class RefundsService {
4
+ private readonly client;
5
+ constructor(client: LiqPayClient);
6
+ refund(payload: RefundInput): Promise<void>;
7
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RefundsService = void 0;
4
+ class RefundsService {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ async refund(payload) {
10
+ return this.client.refunds.refund(payload);
11
+ }
12
+ }
13
+ exports.RefundsService = RefundsService;
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.6",
4
+ "version": "0.3.8",
5
5
  "type": "commonjs",
6
6
  "module": "dist/index.js",
7
7
  "main": "dist/index.js",
@@ -1,250 +0,0 @@
1
- import { Action, Currency, MpiEci, PaymentStatus, Paytype } from './types';
2
- /**
3
- * Contract of decoded format of API parameters received in a request from LiqPay after payment
4
- */
5
- export interface CheckoutCallback {
6
- /**
7
- * Acquirer ID
8
- */
9
- acq_id: number;
10
- /**
11
- * Operation type. Possible values:
12
- * - `pay` - payment
13
- * - `hold` - blocking of funds on the sender's account
14
- * - `subscribe` - creation of a regular payment
15
- * - `regular` - regular payment
16
- */
17
- action: Action;
18
- /**
19
- * Agent commission in payment currency
20
- */
21
- agent_commission: number;
22
- /**
23
- * Payment amount
24
- */
25
- amount: number;
26
- /**
27
- * Sender bonus in debit payment currency
28
- */
29
- amount_bonus: number;
30
- /**
31
- * Transaction amount credit in currency `currency_credit`
32
- */
33
- amount_credit: number;
34
- /**
35
- * Transaction amount debit in currency `currency_debit`
36
- */
37
- amount_debit: number;
38
- /**
39
- * Authorization code for credit transaction
40
- */
41
- authcode_credit: string;
42
- /**
43
- * Authorization code for debit transaction
44
- */
45
- authcode_debit: string;
46
- /**
47
- * Sender card token
48
- */
49
- card_token: string;
50
- /**
51
- * Recipient fee in `currency_credit` currency
52
- */
53
- commission_credit: number;
54
- /**
55
- * Sender fee in `currency_debit`
56
- */
57
- commission_debit: number;
58
- /**
59
- * Date of debiting funds
60
- */
61
- completion_date: Date;
62
- /**
63
- * Payment creation date
64
- */
65
- create_date: Date;
66
- /**
67
- * Payment currency
68
- */
69
- currency: Currency;
70
- /**
71
- * Transaction currency credit
72
- */
73
- currency_credit: Currency;
74
- /**
75
- * Transaction currency debit
76
- */
77
- currency_debit: Currency;
78
- /**
79
- * A unique user identifier on the merchant's website. Maximum length __100__ characters.
80
- */
81
- customer: string;
82
- /**
83
- * Payment comment
84
- */
85
- description: string;
86
- /**
87
- * Payment completion/change date
88
- */
89
- end_date: Date;
90
- /**
91
- * Error code
92
- */
93
- err_code: string;
94
- /**
95
- * Error description
96
- */
97
- err_description: string;
98
- /**
99
- * Additional payment information
100
- */
101
- info: string;
102
- /**
103
- * Sender IP address
104
- */
105
- ip: string;
106
- /**
107
- * Represents whether 3D-Secure verification was performed during payment. Possible values: `true` - the transaction went through with 3DS verification, `false` - the transaction went through without 3DS verification
108
- */
109
- is_3ds: boolean;
110
- /**
111
- * `Order_id` of payment in the LiqPay system
112
- */
113
- liqpay_order_id: string;
114
- /**
115
- * Code that represents whether 3D-Secure verification was performed during payment. Possible values:
116
- * - `5` - the transaction was completed with 3DS (the issuer and acquirer support 3D-Secure technology)
117
- * - `6` - the payer's card issuer does not support 3D-Secure technology
118
- * - `7` - the transaction was completed without 3D-Secure
119
- */
120
- mpi_eci: MpiEci;
121
- /**
122
- * Payment `Order_id`
123
- */
124
- order_id: string;
125
- /**
126
- * Payment ID in the LiqPay system
127
- */
128
- payment_id: number;
129
- /**
130
- * Payment method. Possible values:
131
- * - card - payment by card
132
- * - privat24 - through the Privat24 account
133
- * - moment_part - installment
134
- * - invoice - invoice to e-mail
135
- * - qr - scan qr code
136
- */
137
- paytype: Paytype;
138
- /**
139
- * Store public key
140
- */
141
- public_key: string;
142
- /**
143
- * Recipient fee in payment currency
144
- */
145
- receiver_commission: number;
146
- /**
147
- * Link to which the client must be redirected to complete 3DS verification
148
- */
149
- redirect_to: string;
150
- /**
151
- * Date of last payment refund
152
- */
153
- refund_date_last: Date;
154
- /**
155
- * Unique transaction number in the authorization and settlement system of the servicing bank `Retrieval Reference number`
156
- */
157
- rrn_credit: string;
158
- /**
159
- * Unique transaction number in the authorization and settlement system of the servicing bank `Retrieval Reference number`
160
- */
161
- rrn_debit: string;
162
- /**
163
- * Sender bonus in payment currency
164
- */
165
- sender_bonus: number;
166
- /**
167
- * Sender's bank
168
- */
169
- sender_card_bank: string;
170
- /**
171
- * Country of the sender's card. Numeric __ISO 3166-1__ code
172
- */
173
- sender_card_country: string;
174
- /**
175
- * Sender's card mask
176
- */
177
- sender_card_mask2: string;
178
- /**
179
- * Sender's IBAN
180
- */
181
- sender_iban: string;
182
- /**
183
- * Sender's card type MC/Visa
184
- */
185
- sender_card_type: string;
186
- /**
187
- * Sender's fee in payment currency
188
- */
189
- sender_commission: number;
190
- /**
191
- * Sender's first name
192
- */
193
- sender_first_name: string;
194
- /**
195
- * Sender's last name
196
- */
197
- sender_last_name: string;
198
- /**
199
- * Sender's phone number
200
- */
201
- sender_phone: string;
202
- /**
203
- * Payment status
204
- */
205
- status: PaymentStatus;
206
- /**
207
- * An additional payment status indicating that the current payment is reserved for a refund on your store. Possible values: `true` - the payment is reserved for a refund
208
- */
209
- wait_reserve_status?: boolean;
210
- /**
211
- * Payment Token
212
- */
213
- token: string;
214
- /**
215
- * Payment type
216
- */
217
- type: string;
218
- /**
219
- * API version. Current value is `7`
220
- */
221
- version: 7;
222
- /**
223
- * Error code
224
- */
225
- err_erc: string;
226
- /**
227
- * Product category
228
- */
229
- product_category: string;
230
- /**
231
- * Product description
232
- */
233
- product_description: string;
234
- /**
235
- * Product name
236
- */
237
- product_name: string;
238
- /**
239
- * Product page address
240
- */
241
- product_url: string;
242
- /**
243
- * Refund amount
244
- */
245
- refund_amount: number;
246
- /**
247
- * Verification code
248
- */
249
- verifycode?: string;
250
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });