liqpay-nestjs 0.2.1

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 (136) hide show
  1. package/README.md +15 -0
  2. package/dist/core/constants.d.ts +3 -0
  3. package/dist/core/constants.js +7 -0
  4. package/dist/core/index.d.ts +1 -0
  5. package/dist/core/index.js +17 -0
  6. package/dist/core/liqpay.client.d.ts +65 -0
  7. package/dist/core/liqpay.client.js +156 -0
  8. package/dist/core/schemas/base/envelope.schema.d.ts +6 -0
  9. package/dist/core/schemas/base/envelope.schema.js +11 -0
  10. package/dist/core/schemas/base/index.d.ts +3 -0
  11. package/dist/core/schemas/base/index.js +19 -0
  12. package/dist/core/schemas/base/request.type.d.ts +4 -0
  13. package/dist/core/schemas/base/request.type.js +2 -0
  14. package/dist/core/schemas/base/response.type.d.ts +15 -0
  15. package/dist/core/schemas/base/response.type.js +2 -0
  16. package/dist/core/schemas/checkout/checkout-callback.schema.d.ts +241 -0
  17. package/dist/core/schemas/checkout/checkout-callback.schema.js +91 -0
  18. package/dist/core/schemas/checkout/checkout-request.schema.d.ts +421 -0
  19. package/dist/core/schemas/checkout/checkout-request.schema.js +70 -0
  20. package/dist/core/schemas/checkout/index.d.ts +2 -0
  21. package/dist/core/schemas/checkout/index.js +18 -0
  22. package/dist/core/schemas/common/detail-addenda.schema.d.ts +11 -0
  23. package/dist/core/schemas/common/detail-addenda.schema.js +13 -0
  24. package/dist/core/schemas/common/enums/action.schema.d.ts +12 -0
  25. package/dist/core/schemas/common/enums/action.schema.js +17 -0
  26. package/dist/core/schemas/common/enums/bonus-type.schema.d.ts +8 -0
  27. package/dist/core/schemas/common/enums/bonus-type.schema.js +10 -0
  28. package/dist/core/schemas/common/enums/commission-payer.schema.d.ts +6 -0
  29. package/dist/core/schemas/common/enums/commission-payer.schema.js +5 -0
  30. package/dist/core/schemas/common/enums/currency.schema.d.ts +7 -0
  31. package/dist/core/schemas/common/enums/currency.schema.js +8 -0
  32. package/dist/core/schemas/common/enums/error-code.schema.d.ts +117 -0
  33. package/dist/core/schemas/common/enums/error-code.schema.js +122 -0
  34. package/dist/core/schemas/common/enums/index.d.ts +13 -0
  35. package/dist/core/schemas/common/enums/index.js +29 -0
  36. package/dist/core/schemas/common/enums/language.schema.d.ts +6 -0
  37. package/dist/core/schemas/common/enums/language.schema.js +5 -0
  38. package/dist/core/schemas/common/enums/mpi-eci.schema.d.ts +3 -0
  39. package/dist/core/schemas/common/enums/mpi-eci.schema.js +9 -0
  40. package/dist/core/schemas/common/enums/payment-status.schema.d.ts +81 -0
  41. package/dist/core/schemas/common/enums/payment-status.schema.js +48 -0
  42. package/dist/core/schemas/common/enums/paytype.schema.d.ts +14 -0
  43. package/dist/core/schemas/common/enums/paytype.schema.js +16 -0
  44. package/dist/core/schemas/common/enums/request-result.schema.d.ts +6 -0
  45. package/dist/core/schemas/common/enums/request-result.schema.js +5 -0
  46. package/dist/core/schemas/common/enums/subscribe-period.schema.d.ts +8 -0
  47. package/dist/core/schemas/common/enums/subscribe-period.schema.js +10 -0
  48. package/dist/core/schemas/common/enums/unit.schema.d.ts +55 -0
  49. package/dist/core/schemas/common/enums/unit.schema.js +58 -0
  50. package/dist/core/schemas/common/enums/version.schema.d.ts +2 -0
  51. package/dist/core/schemas/common/enums/version.schema.js +8 -0
  52. package/dist/core/schemas/common/fiscal-data.schema.d.ts +86 -0
  53. package/dist/core/schemas/common/fiscal-data.schema.js +41 -0
  54. package/dist/core/schemas/common/index.d.ts +3 -0
  55. package/dist/core/schemas/common/index.js +19 -0
  56. package/dist/core/schemas/common/split-rule.schema.d.ts +36 -0
  57. package/dist/core/schemas/common/split-rule.schema.js +13 -0
  58. package/dist/core/schemas/error/error-response.schema.d.ts +121 -0
  59. package/dist/core/schemas/error/error-response.schema.js +10 -0
  60. package/dist/core/schemas/error/error.type.d.ts +6 -0
  61. package/dist/core/schemas/error/error.type.js +2 -0
  62. package/dist/core/schemas/error/index.d.ts +3 -0
  63. package/dist/core/schemas/error/index.js +19 -0
  64. package/dist/core/schemas/payment-status/index.d.ts +2 -0
  65. package/dist/core/schemas/payment-status/index.js +18 -0
  66. package/dist/core/schemas/payment-status/payment-status-request.schema.d.ts +43 -0
  67. package/dist/core/schemas/payment-status/payment-status-request.schema.js +23 -0
  68. package/dist/core/schemas/payment-status/payment-status-response.schema.d.ts +213 -0
  69. package/dist/core/schemas/payment-status/payment-status-response.schema.js +85 -0
  70. package/dist/core/types/documented/checkout.callback.d.ts +250 -0
  71. package/dist/core/types/documented/checkout.callback.js +2 -0
  72. package/dist/core/types/documented/checkout.request.d.ts +236 -0
  73. package/dist/core/types/documented/checkout.request.js +2 -0
  74. package/dist/core/types/documented/detail-addenda.d.ts +33 -0
  75. package/dist/core/types/documented/detail-addenda.js +2 -0
  76. package/dist/core/types/documented/envelope.d.ts +15 -0
  77. package/dist/core/types/documented/envelope.js +2 -0
  78. package/dist/core/types/documented/fiscal-data.d.ts +80 -0
  79. package/dist/core/types/documented/fiscal-data.js +2 -0
  80. package/dist/core/types/documented/payment-status.request.d.ts +23 -0
  81. package/dist/core/types/documented/payment-status.request.js +2 -0
  82. package/dist/core/types/documented/payment-status.response.d.ts +225 -0
  83. package/dist/core/types/documented/payment-status.response.js +2 -0
  84. package/dist/core/types/documented/split-rule.d.ts +29 -0
  85. package/dist/core/types/documented/split-rule.js +2 -0
  86. package/dist/core/types/documented/types.d.ts +287 -0
  87. package/dist/core/types/documented/types.js +199 -0
  88. package/dist/core/types/payloads.d.ts +158 -0
  89. package/dist/core/types/payloads.js +2 -0
  90. package/dist/core/types/undocumented/checkout.callback.d.ts +61 -0
  91. package/dist/core/types/undocumented/checkout.callback.js +2 -0
  92. package/dist/core/types/undocumented/checkout.request.d.ts +39 -0
  93. package/dist/core/types/undocumented/checkout.request.js +2 -0
  94. package/dist/core/types/undocumented/detail-addenda.d.ts +9 -0
  95. package/dist/core/types/undocumented/detail-addenda.js +2 -0
  96. package/dist/core/types/undocumented/envelope.d.ts +4 -0
  97. package/dist/core/types/undocumented/envelope.js +2 -0
  98. package/dist/core/types/undocumented/fiscal-data.d.ts +23 -0
  99. package/dist/core/types/undocumented/fiscal-data.js +2 -0
  100. package/dist/core/types/undocumented/payment-status.request.d.ts +6 -0
  101. package/dist/core/types/undocumented/payment-status.request.js +2 -0
  102. package/dist/core/types/undocumented/payment-status.response.d.ts +54 -0
  103. package/dist/core/types/undocumented/payment-status.response.js +2 -0
  104. package/dist/core/types/undocumented/split-rule.d.ts +9 -0
  105. package/dist/core/types/undocumented/split-rule.js +2 -0
  106. package/dist/core/types/undocumented/types.d.ts +181 -0
  107. package/dist/core/types/undocumented/types.js +160 -0
  108. package/dist/core/utils/index.d.ts +2 -0
  109. package/dist/core/utils/index.js +18 -0
  110. package/dist/core/utils/is-success.util.d.ts +5 -0
  111. package/dist/core/utils/is-success.util.js +6 -0
  112. package/dist/core/utils/parse-boolean.d.ts +2 -0
  113. package/dist/core/utils/parse-boolean.js +7 -0
  114. package/dist/core/utils/parse-date.d.ts +1 -0
  115. package/dist/core/utils/parse-date.js +10 -0
  116. package/dist/index.d.ts +5 -0
  117. package/dist/index.js +21 -0
  118. package/dist/nest/constants/index.d.ts +1 -0
  119. package/dist/nest/constants/index.js +17 -0
  120. package/dist/nest/constants/liqpay.constants.d.ts +1 -0
  121. package/dist/nest/constants/liqpay.constants.js +4 -0
  122. package/dist/nest/index.d.ts +3 -0
  123. package/dist/nest/index.js +19 -0
  124. package/dist/nest/interfaces/index.d.ts +2 -0
  125. package/dist/nest/interfaces/index.js +18 -0
  126. package/dist/nest/interfaces/liqpay-async-options.interface.d.ts +7 -0
  127. package/dist/nest/interfaces/liqpay-async-options.interface.js +2 -0
  128. package/dist/nest/interfaces/liqpay-options.interface.d.ts +25 -0
  129. package/dist/nest/interfaces/liqpay-options.interface.js +2 -0
  130. package/dist/nest/liqpay.module.d.ts +6 -0
  131. package/dist/nest/liqpay.module.js +37 -0
  132. package/dist/nest/liqpay.providers.d.ts +4 -0
  133. package/dist/nest/liqpay.providers.js +32 -0
  134. package/dist/nest/liqpay.service.d.ts +66 -0
  135. package/dist/nest/liqpay.service.js +57 -0
  136. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # liqpay-nestjs
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.3.10. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
@@ -0,0 +1,3 @@
1
+ export declare const LIQPAY_REQUEST_URL = "https://www.liqpay.ua/api/request";
2
+ export declare const LIQPAY_CHECKOUT_URL = "https://www.liqpay.ua/api/3/checkout";
3
+ export type LiqPayApiPath = typeof LIQPAY_REQUEST_URL | typeof LIQPAY_CHECKOUT_URL;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LIQPAY_CHECKOUT_URL = exports.LIQPAY_REQUEST_URL = void 0;
4
+ const LIQPAY_HOST_URL = 'https://www.liqpay.ua';
5
+ const LIQPAY_BASE_URL = `${LIQPAY_HOST_URL}/api`;
6
+ exports.LIQPAY_REQUEST_URL = `${LIQPAY_BASE_URL}/request`;
7
+ exports.LIQPAY_CHECKOUT_URL = `${LIQPAY_BASE_URL}/3/checkout`;
@@ -0,0 +1 @@
1
+ export * from './liqpay.client';
@@ -0,0 +1,17 @@
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("./liqpay.client"), exports);
@@ -0,0 +1,65 @@
1
+ import { LiqPayCallResult, LiqPayEnvelope } from './schemas/base';
2
+ import { LiqPayCheckoutCallback, type LiqPayCheckoutRequest } from './schemas/checkout';
3
+ import { LiqPayPaymentStatusResponse } from './schemas/payment-status';
4
+ /**
5
+ * workflow:
6
+ * 1) user register liqpay client where it needs to
7
+ * 2) user builds data for request and call client method
8
+ * 3) in client method data filled with key and got encoded
9
+ * 4) client gets response with encoded data and signature
10
+ * 5) client method decode data and returns it
11
+ * 6) user gets only decoded data from response
12
+ *
13
+ * So this API only provides requests methods and returns encoded data from responses
14
+ *
15
+ * On request user:
16
+ * 1) build typed data for request
17
+ * 2) calls method from client
18
+ *
19
+ * On response/callback user:
20
+ * 1) gets typed data from response/callback
21
+ *
22
+ * - on request user works only with typed data that stringifies and inserts into data field of envelope
23
+ * - on response user works only with typed data that parses from decoded string layed in data field on envelope
24
+ *
25
+ * On request client:
26
+ * 1) gets typed data object from user
27
+ * 2) calls call api method
28
+ * 3) validates typed data via zod
29
+ * 4) maps typed data to form that LiqPay API expects it
30
+ * 5) encodes typed data to string
31
+ * 6) sends request with envelope that contains data: encoded string with data and signature
32
+ *
33
+ * On response/callback client:
34
+ * 1) gets response/callback with envelope that contains data: encoded string with data and signature
35
+ * 2) decodes and parse encoded string from data field in envelope
36
+ * 3) maps encoded data to typed data
37
+ * 4) validates typed data
38
+ * 5) returns typed data to user
39
+ *
40
+ * For request build envelope with:
41
+ * 1) data - stringified json encoded with base64
42
+ * 2) signature - encoded base64(sha3-256(privateKey+data+privateKey))
43
+ */
44
+ /**
45
+ * Client for easy interaction with LiqPay API
46
+ */
47
+ export declare class LiqPayClient {
48
+ private readonly publicKey;
49
+ private readonly privateKey;
50
+ constructor(publicKey: string, privateKey: string);
51
+ private encodeData;
52
+ private decodeData;
53
+ private createSignature;
54
+ private getCredentials;
55
+ private isValidSignature;
56
+ private createError;
57
+ private parseData;
58
+ private parseError;
59
+ private parseEnvelope;
60
+ private call;
61
+ getPaymentStatus(orderId: string): Promise<LiqPayCallResult<LiqPayPaymentStatusResponse>>;
62
+ getCheckoutUrl(payload: LiqPayCheckoutRequest): string;
63
+ getCheckoutFormButton(payload: LiqPayCheckoutRequest, buttonText?: string, buttonColor?: string): string;
64
+ parseCheckoutCallback(envelope: LiqPayEnvelope): LiqPayCallResult<LiqPayCheckoutCallback>;
65
+ }
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LiqPayClient = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const constants_1 = require("./constants");
6
+ const checkout_1 = require("./schemas/checkout");
7
+ const error_1 = require("./schemas/error");
8
+ const payment_status_1 = require("./schemas/payment-status");
9
+ /**
10
+ * workflow:
11
+ * 1) user register liqpay client where it needs to
12
+ * 2) user builds data for request and call client method
13
+ * 3) in client method data filled with key and got encoded
14
+ * 4) client gets response with encoded data and signature
15
+ * 5) client method decode data and returns it
16
+ * 6) user gets only decoded data from response
17
+ *
18
+ * So this API only provides requests methods and returns encoded data from responses
19
+ *
20
+ * On request user:
21
+ * 1) build typed data for request
22
+ * 2) calls method from client
23
+ *
24
+ * On response/callback user:
25
+ * 1) gets typed data from response/callback
26
+ *
27
+ * - on request user works only with typed data that stringifies and inserts into data field of envelope
28
+ * - on response user works only with typed data that parses from decoded string layed in data field on envelope
29
+ *
30
+ * On request client:
31
+ * 1) gets typed data object from user
32
+ * 2) calls call api method
33
+ * 3) validates typed data via zod
34
+ * 4) maps typed data to form that LiqPay API expects it
35
+ * 5) encodes typed data to string
36
+ * 6) sends request with envelope that contains data: encoded string with data and signature
37
+ *
38
+ * On response/callback client:
39
+ * 1) gets response/callback with envelope that contains data: encoded string with data and signature
40
+ * 2) decodes and parse encoded string from data field in envelope
41
+ * 3) maps encoded data to typed data
42
+ * 4) validates typed data
43
+ * 5) returns typed data to user
44
+ *
45
+ * For request build envelope with:
46
+ * 1) data - stringified json encoded with base64
47
+ * 2) signature - encoded base64(sha3-256(privateKey+data+privateKey))
48
+ */
49
+ /**
50
+ * Client for easy interaction with LiqPay API
51
+ */
52
+ class LiqPayClient {
53
+ publicKey;
54
+ privateKey;
55
+ constructor(publicKey, privateKey) {
56
+ this.publicKey = publicKey;
57
+ this.privateKey = privateKey;
58
+ }
59
+ encodeData(data) {
60
+ return Buffer.from(JSON.stringify(data)).toString('base64');
61
+ }
62
+ decodeData(encodedData) {
63
+ return JSON.parse(Buffer.from(encodedData, 'base64').toString('utf-8'));
64
+ }
65
+ createSignature(encodedData) {
66
+ const signatureString = `${this.privateKey}${encodedData}${this.privateKey}`;
67
+ return (0, node_crypto_1.createHash)('sha3-256').update(signatureString).digest('base64');
68
+ }
69
+ getCredentials(data) {
70
+ const payload = { ...data, public_key: this.publicKey };
71
+ const encoded = this.encodeData(payload);
72
+ const signature = this.createSignature(encoded);
73
+ return { data: encoded, signature };
74
+ }
75
+ isValidSignature(envelope) {
76
+ const expected = this.createSignature(envelope.data);
77
+ const a = Buffer.from(expected);
78
+ const b = Buffer.from(envelope.signature);
79
+ if (a.length !== b.length)
80
+ return false;
81
+ return (0, node_crypto_1.timingSafeEqual)(a, b);
82
+ }
83
+ createError(code, description) {
84
+ return { data: null, error: { code, description } };
85
+ }
86
+ parseData(schema, data) {
87
+ const error = this.parseError(data);
88
+ if (error)
89
+ return error;
90
+ const parsed = schema.safeParse(data);
91
+ if (!parsed.success)
92
+ return this.createError('validation_error', 'Invalid response schema');
93
+ return { data: parsed.data, error: null };
94
+ }
95
+ parseError(data) {
96
+ const parsed = error_1.LiqPayErrorResponseSchema.safeParse(data);
97
+ if (!parsed.success)
98
+ return null;
99
+ return this.createError(parsed.data.err_code, parsed.data.err_description);
100
+ }
101
+ parseEnvelope(envelope, schema) {
102
+ if (!this.isValidSignature(envelope))
103
+ return this.createError('invalid_signature', 'Invalid signature');
104
+ let rawData;
105
+ try {
106
+ rawData = this.decodeData(envelope.data);
107
+ }
108
+ catch {
109
+ return this.createError('decode_error', 'Failed to decode base64 data');
110
+ }
111
+ return this.parseData(schema, rawData);
112
+ }
113
+ async call(payload, rawSchema, responseSchema, url) {
114
+ const raw = rawSchema.parse(payload);
115
+ const envelope = this.getCredentials(raw);
116
+ const response = await fetch(url, {
117
+ method: 'POST',
118
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
119
+ body: new URLSearchParams(envelope),
120
+ });
121
+ if (!response.ok)
122
+ return this.createError('http_error', `HTTP ${response.status}`);
123
+ let rawData;
124
+ try {
125
+ rawData = await response.json();
126
+ }
127
+ catch {
128
+ return this.createError('invalid_response', 'Failed to parse JSON response');
129
+ }
130
+ return this.parseData(responseSchema, rawData);
131
+ }
132
+ async getPaymentStatus(orderId) {
133
+ return await this.call({ version: 7, action: 'status', orderId }, payment_status_1.LiqPayRawPaymentStatusRequestSchema, payment_status_1.LiqPayPaymentStatusResponseSchema, constants_1.LIQPAY_REQUEST_URL);
134
+ }
135
+ getCheckoutUrl(payload) {
136
+ const raw = checkout_1.LiqPayRawCheckoutRequestSchema.parse(payload);
137
+ const { data, signature } = this.getCredentials(raw);
138
+ return `${constants_1.LIQPAY_CHECKOUT_URL}?data=${data}&signature=${signature}`;
139
+ }
140
+ getCheckoutFormButton(payload, buttonText = 'Pay', buttonColor = '#77CC5D') {
141
+ const raw = checkout_1.LiqPayRawCheckoutRequestSchema.parse(payload);
142
+ const { data, signature } = this.getCredentials(raw);
143
+ return `
144
+ <form method="POST" action="${constants_1.LIQPAY_CHECKOUT_URL}" accept-charset="utf-8">
145
+ <input type="hidden" name="data" value="${data}" />
146
+ <input type="hidden" name="signature" value="${signature}" />
147
+ <script type="text/javascript" src="https://static.liqpay.ua/libjs/sdk_button.js"></script>
148
+ <sdk-button label="${buttonText}" background="${buttonColor}" onClick="submit()"></sdk-button>
149
+ </form>
150
+ `;
151
+ }
152
+ parseCheckoutCallback(envelope) {
153
+ return this.parseEnvelope(envelope, checkout_1.LiqPayCheckoutCallbackSchema);
154
+ }
155
+ }
156
+ exports.LiqPayClient = LiqPayClient;
@@ -0,0 +1,6 @@
1
+ import z from 'zod';
2
+ export declare const LiqPayEnvelopeSchema: z.ZodObject<{
3
+ data: z.ZodString;
4
+ signature: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export type LiqPayEnvelope = z.infer<typeof LiqPayEnvelopeSchema>;
@@ -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.LiqPayEnvelopeSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ exports.LiqPayEnvelopeSchema = zod_1.default.object({
9
+ data: zod_1.default.string().nonempty(),
10
+ signature: zod_1.default.string().nonempty(),
11
+ });
@@ -0,0 +1,3 @@
1
+ export * from './envelope.schema';
2
+ export * from './request.type';
3
+ export * from './response.type';
@@ -0,0 +1,19 @@
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("./envelope.schema"), exports);
18
+ __exportStar(require("./request.type"), exports);
19
+ __exportStar(require("./response.type"), exports);
@@ -0,0 +1,4 @@
1
+ import { LiqPayCheckoutRequest, LiqPayRawCheckoutRequest } from '../checkout';
2
+ import { LiqPayPaymentStatusRequest, LiqPayRawPaymentStatusRequest } from '../payment-status';
3
+ export type LiqPayRequest = LiqPayCheckoutRequest | LiqPayPaymentStatusRequest;
4
+ export type LiqPayRawRequest = LiqPayRawCheckoutRequest | LiqPayRawPaymentStatusRequest;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import { LiqPayCheckoutCallback, LiqPayRawCheckoutCallback } from '../checkout';
2
+ import { LiqPayErrorResponse } from '../error';
3
+ import { LiqPayPaymentStatusResponse, LiqPayRawPaymentStatusResponse } from '../payment-status';
4
+ export type LiqPayResponse = LiqPayCheckoutCallback | LiqPayPaymentStatusResponse;
5
+ export type LiqPayRawResponse = LiqPayRawCheckoutCallback | LiqPayRawPaymentStatusResponse | LiqPayErrorResponse;
6
+ export type LiqPayCallResult<T> = {
7
+ data: T;
8
+ error?: null;
9
+ } | {
10
+ data: null;
11
+ error: {
12
+ code: string;
13
+ description: string;
14
+ };
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,241 @@
1
+ import { z } from 'zod';
2
+ export declare const LiqPayRawCheckoutCallbackSchema: z.ZodObject<{
3
+ version: z.ZodOptional<z.ZodNumber>;
4
+ public_key: z.ZodOptional<z.ZodString>;
5
+ acq_id: z.ZodOptional<z.ZodNumber>;
6
+ action: z.ZodOptional<z.ZodString>;
7
+ agent_commission: z.ZodOptional<z.ZodNumber>;
8
+ amount: z.ZodOptional<z.ZodNumber>;
9
+ amount_bonus: z.ZodOptional<z.ZodNumber>;
10
+ amount_credit: z.ZodOptional<z.ZodNumber>;
11
+ amount_debit: z.ZodOptional<z.ZodNumber>;
12
+ authcode_credit: z.ZodOptional<z.ZodString>;
13
+ authcode_debit: z.ZodOptional<z.ZodString>;
14
+ card_token: z.ZodOptional<z.ZodString>;
15
+ commission_credit: z.ZodOptional<z.ZodNumber>;
16
+ commission_debit: z.ZodOptional<z.ZodNumber>;
17
+ completion_date: z.ZodOptional<z.ZodString>;
18
+ create_date: z.ZodOptional<z.ZodString>;
19
+ currency: z.ZodOptional<z.ZodString>;
20
+ currency_credit: z.ZodOptional<z.ZodString>;
21
+ currency_debit: z.ZodOptional<z.ZodString>;
22
+ customer: z.ZodOptional<z.ZodString>;
23
+ description: z.ZodOptional<z.ZodString>;
24
+ end_date: z.ZodOptional<z.ZodString>;
25
+ err_code: z.ZodOptional<z.ZodString>;
26
+ err_description: z.ZodOptional<z.ZodString>;
27
+ info: z.ZodOptional<z.ZodString>;
28
+ ip: z.ZodOptional<z.ZodString>;
29
+ is_3ds: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
30
+ liqpay_order_id: z.ZodOptional<z.ZodString>;
31
+ mpi_eci: z.ZodOptional<z.ZodNumber>;
32
+ order_id: z.ZodOptional<z.ZodString>;
33
+ payment_id: z.ZodOptional<z.ZodNumber>;
34
+ paytype: z.ZodOptional<z.ZodString>;
35
+ receiver_commission: z.ZodOptional<z.ZodNumber>;
36
+ redirect_to: z.ZodOptional<z.ZodString>;
37
+ refund_date_last: z.ZodOptional<z.ZodString>;
38
+ rrn_credit: z.ZodOptional<z.ZodString>;
39
+ rrn_debit: z.ZodOptional<z.ZodString>;
40
+ sender_bonus: z.ZodOptional<z.ZodNumber>;
41
+ sender_card_bank: z.ZodOptional<z.ZodString>;
42
+ sender_card_country: z.ZodOptional<z.ZodString>;
43
+ sender_card_mask2: z.ZodOptional<z.ZodString>;
44
+ sender_iban: z.ZodOptional<z.ZodString>;
45
+ sender_card_type: z.ZodOptional<z.ZodString>;
46
+ sender_commission: z.ZodOptional<z.ZodNumber>;
47
+ sender_first_name: z.ZodOptional<z.ZodString>;
48
+ sender_last_name: z.ZodOptional<z.ZodString>;
49
+ sender_phone: z.ZodOptional<z.ZodString>;
50
+ status: z.ZodOptional<z.ZodString>;
51
+ wait_reserve_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
52
+ token: z.ZodOptional<z.ZodString>;
53
+ type: z.ZodOptional<z.ZodString>;
54
+ err_erc: z.ZodOptional<z.ZodString>;
55
+ product_category: z.ZodOptional<z.ZodString>;
56
+ product_description: z.ZodOptional<z.ZodString>;
57
+ product_name: z.ZodOptional<z.ZodString>;
58
+ product_url: z.ZodOptional<z.ZodString>;
59
+ refund_amount: z.ZodOptional<z.ZodNumber>;
60
+ verifycode: z.ZodOptional<z.ZodString>;
61
+ }, z.core.$strip>;
62
+ export type LiqPayRawCheckoutCallback = z.infer<typeof LiqPayRawCheckoutCallbackSchema>;
63
+ export declare const LiqPayCheckoutCallbackSchema: z.ZodPipe<z.ZodObject<{
64
+ version: z.ZodOptional<z.ZodNumber>;
65
+ public_key: z.ZodOptional<z.ZodString>;
66
+ acq_id: z.ZodOptional<z.ZodNumber>;
67
+ action: z.ZodOptional<z.ZodString>;
68
+ agent_commission: z.ZodOptional<z.ZodNumber>;
69
+ amount: z.ZodOptional<z.ZodNumber>;
70
+ amount_bonus: z.ZodOptional<z.ZodNumber>;
71
+ amount_credit: z.ZodOptional<z.ZodNumber>;
72
+ amount_debit: z.ZodOptional<z.ZodNumber>;
73
+ authcode_credit: z.ZodOptional<z.ZodString>;
74
+ authcode_debit: z.ZodOptional<z.ZodString>;
75
+ card_token: z.ZodOptional<z.ZodString>;
76
+ commission_credit: z.ZodOptional<z.ZodNumber>;
77
+ commission_debit: z.ZodOptional<z.ZodNumber>;
78
+ completion_date: z.ZodOptional<z.ZodString>;
79
+ create_date: z.ZodOptional<z.ZodString>;
80
+ currency: z.ZodOptional<z.ZodString>;
81
+ currency_credit: z.ZodOptional<z.ZodString>;
82
+ currency_debit: z.ZodOptional<z.ZodString>;
83
+ customer: z.ZodOptional<z.ZodString>;
84
+ description: z.ZodOptional<z.ZodString>;
85
+ end_date: z.ZodOptional<z.ZodString>;
86
+ err_code: z.ZodOptional<z.ZodString>;
87
+ err_description: z.ZodOptional<z.ZodString>;
88
+ info: z.ZodOptional<z.ZodString>;
89
+ ip: z.ZodOptional<z.ZodString>;
90
+ is_3ds: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
91
+ liqpay_order_id: z.ZodOptional<z.ZodString>;
92
+ mpi_eci: z.ZodOptional<z.ZodNumber>;
93
+ order_id: z.ZodOptional<z.ZodString>;
94
+ payment_id: z.ZodOptional<z.ZodNumber>;
95
+ paytype: z.ZodOptional<z.ZodString>;
96
+ receiver_commission: z.ZodOptional<z.ZodNumber>;
97
+ redirect_to: z.ZodOptional<z.ZodString>;
98
+ refund_date_last: z.ZodOptional<z.ZodString>;
99
+ rrn_credit: z.ZodOptional<z.ZodString>;
100
+ rrn_debit: z.ZodOptional<z.ZodString>;
101
+ sender_bonus: z.ZodOptional<z.ZodNumber>;
102
+ sender_card_bank: z.ZodOptional<z.ZodString>;
103
+ sender_card_country: z.ZodOptional<z.ZodString>;
104
+ sender_card_mask2: z.ZodOptional<z.ZodString>;
105
+ sender_iban: z.ZodOptional<z.ZodString>;
106
+ sender_card_type: z.ZodOptional<z.ZodString>;
107
+ sender_commission: z.ZodOptional<z.ZodNumber>;
108
+ sender_first_name: z.ZodOptional<z.ZodString>;
109
+ sender_last_name: z.ZodOptional<z.ZodString>;
110
+ sender_phone: z.ZodOptional<z.ZodString>;
111
+ status: z.ZodOptional<z.ZodString>;
112
+ wait_reserve_status: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>;
113
+ token: z.ZodOptional<z.ZodString>;
114
+ type: z.ZodOptional<z.ZodString>;
115
+ err_erc: z.ZodOptional<z.ZodString>;
116
+ product_category: z.ZodOptional<z.ZodString>;
117
+ product_description: z.ZodOptional<z.ZodString>;
118
+ product_name: z.ZodOptional<z.ZodString>;
119
+ product_url: z.ZodOptional<z.ZodString>;
120
+ refund_amount: z.ZodOptional<z.ZodNumber>;
121
+ verifycode: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strip>, z.ZodTransform<{
123
+ version: 0 | 7 | undefined;
124
+ action: "" | "pay" | "hold" | "paysplit" | "subscribe" | "paydonate" | "auth" | "regular" | "status" | undefined;
125
+ completionDate: Date | undefined;
126
+ createDate: Date | undefined;
127
+ currency: "" | "USD" | "EUR" | "UAH" | undefined;
128
+ currencyCredit: "" | "USD" | "EUR" | "UAH" | undefined;
129
+ currencyDebit: "" | "USD" | "EUR" | "UAH" | undefined;
130
+ endDate: Date | undefined;
131
+ errCode: "" | "5" | "limit" | "frod" | "decline" | "err_auth" | "err_cache" | "user_not_found" | "err_sms_send" | "err_sms_otp" | "shop_blocked" | "shop_not_active" | "invalid_signature" | "order_id_empty" | "err_shop_not_agent" | "err_card_def_notfound" | "err_no_card_token" | "err_card_liqpay_def" | "err_card_type" | "err_card_country" | "err_limit_amount" | "err_payment_amount_limit" | "amount_limit" | "payment_err_sender_card" | "payment_processing" | "err_payment_discount" | "err_wallet" | "err_get_verify_code" | "err_verify_code" | "wait_info" | "err_path" | "err_payment_cash_acq" | "err_split_amount" | "err_card_receiver_def" | "payment_err_status" | "public_key_not_found" | "payment_not_found" | "payment_not_subscribed" | "wrong_amount_currency" | "err_amount_hold" | "err_access" | "order_id_duplicate" | "err_blocked" | "err_empty" | "err_empty_phone" | "err_missing" | "err_wrong" | "err_wrong_currency" | "err_phone" | "err_card" | "err_card_bin" | "err_terminal_notfound" | "err_commission_notfound" | "err_payment_create" | "err_mpi" | "err_currency_is_not_allowed" | "err_look" | "err_mods_empty" | "payment_err_type" | "err_payment_currency" | "err_payment_exchangerates" | "err_signature" | "err_api_action" | "err_api_callback" | "err_api_ip" | "expired_phone" | "expired_3ds" | "expired_otp" | "expired_cvv" | "expired_p24" | "expired_sender" | "expired_pin" | "expired_ivr" | "expired_captcha" | "expired_password" | "expired_senderapp" | "expired_prepared" | "expired_mp" | "expired_qr" | "90" | "101" | "102" | "103" | "104" | "105" | "106" | "107" | "108" | "109" | "110" | "111" | "112" | "113" | "114" | "115" | "2903" | "2915" | "3914" | "9851" | "9852" | "9854" | "9855" | "9857" | "9859" | "9860" | "9861" | "9863" | "9867" | "9868" | "9872" | "9882" | "9886" | "9961" | "9989" | undefined;
132
+ is3ds: boolean | undefined;
133
+ mpiEci: 0 | 5 | 6 | 7 | undefined;
134
+ paytype: "" | "apay" | "gpay" | "card" | "privat24" | "masterpass" | "moment_part" | "paypart" | "cash" | "invoice" | "qr" | undefined;
135
+ refundDateLast: Date | undefined;
136
+ status: "" | "success" | "error" | "failure" | "reversed" | "subscribed" | "unsubscribed" | "3ds_verify" | "captcha_verify" | "cvv_verify" | "ivr_verify" | "otp_verify" | "password_verify" | "phone_verify" | "pin_verify" | "receiver_verify" | "sender_verify" | "senderapp_verify" | "wait_qr" | "wait_sender" | "p24_verify" | "mp_verify" | "cash_wait" | "hold_wait" | "invoice_wait" | "prepared" | "processing" | "wait_accept" | "wait_card" | "wait_compensation" | "wait_lc" | "wait_reserve" | "wait_secure" | "try_again" | undefined;
137
+ waitReserveStatus: boolean | undefined;
138
+ publicKey?: string | undefined;
139
+ acqId?: number | undefined;
140
+ agentCommission?: number | undefined;
141
+ amount?: number | undefined;
142
+ amountBonus?: number | undefined;
143
+ amountCredit?: number | undefined;
144
+ amountDebit?: number | undefined;
145
+ authcodeCredit?: string | undefined;
146
+ authcodeDebit?: string | undefined;
147
+ cardToken?: string | undefined;
148
+ commissionCredit?: number | undefined;
149
+ commissionDebit?: number | undefined;
150
+ customer?: string | undefined;
151
+ description?: string | undefined;
152
+ errDescription?: string | undefined;
153
+ info?: string | undefined;
154
+ ip?: string | undefined;
155
+ liqpayOrderId?: string | undefined;
156
+ orderId?: string | undefined;
157
+ paymentId?: number | undefined;
158
+ receiverCommission?: number | undefined;
159
+ redirectTo?: string | undefined;
160
+ rrnCredit?: string | undefined;
161
+ rrnDebit?: string | undefined;
162
+ senderBonus?: number | undefined;
163
+ senderCardBank?: string | undefined;
164
+ senderCardCountry?: string | undefined;
165
+ senderCardMask2?: string | undefined;
166
+ senderIban?: string | undefined;
167
+ senderCardType?: string | undefined;
168
+ senderCommission?: number | undefined;
169
+ senderFirstName?: string | undefined;
170
+ senderLastName?: string | undefined;
171
+ senderPhone?: string | undefined;
172
+ token?: string | undefined;
173
+ type?: string | undefined;
174
+ errErc?: string | undefined;
175
+ productCategory?: string | undefined;
176
+ productDescription?: string | undefined;
177
+ productName?: string | undefined;
178
+ productUrl?: string | undefined;
179
+ refundAmount?: number | undefined;
180
+ verifycode?: string | undefined;
181
+ }, {
182
+ version?: number | undefined;
183
+ public_key?: string | undefined;
184
+ acq_id?: number | undefined;
185
+ action?: string | undefined;
186
+ agent_commission?: number | undefined;
187
+ amount?: number | undefined;
188
+ amount_bonus?: number | undefined;
189
+ amount_credit?: number | undefined;
190
+ amount_debit?: number | undefined;
191
+ authcode_credit?: string | undefined;
192
+ authcode_debit?: string | undefined;
193
+ card_token?: string | undefined;
194
+ commission_credit?: number | undefined;
195
+ commission_debit?: number | undefined;
196
+ completion_date?: string | undefined;
197
+ create_date?: string | undefined;
198
+ currency?: string | undefined;
199
+ currency_credit?: string | undefined;
200
+ currency_debit?: string | undefined;
201
+ customer?: string | undefined;
202
+ description?: string | undefined;
203
+ end_date?: string | undefined;
204
+ err_code?: string | undefined;
205
+ err_description?: string | undefined;
206
+ info?: string | undefined;
207
+ ip?: string | undefined;
208
+ is_3ds?: string | boolean | undefined;
209
+ liqpay_order_id?: string | undefined;
210
+ mpi_eci?: number | undefined;
211
+ order_id?: string | undefined;
212
+ payment_id?: number | undefined;
213
+ paytype?: string | undefined;
214
+ receiver_commission?: number | undefined;
215
+ redirect_to?: string | undefined;
216
+ refund_date_last?: string | undefined;
217
+ rrn_credit?: string | undefined;
218
+ rrn_debit?: string | undefined;
219
+ sender_bonus?: number | undefined;
220
+ sender_card_bank?: string | undefined;
221
+ sender_card_country?: string | undefined;
222
+ sender_card_mask2?: string | undefined;
223
+ sender_iban?: string | undefined;
224
+ sender_card_type?: string | undefined;
225
+ sender_commission?: number | undefined;
226
+ sender_first_name?: string | undefined;
227
+ sender_last_name?: string | undefined;
228
+ sender_phone?: string | undefined;
229
+ status?: string | undefined;
230
+ wait_reserve_status?: string | boolean | undefined;
231
+ token?: string | undefined;
232
+ type?: string | undefined;
233
+ err_erc?: string | undefined;
234
+ product_category?: string | undefined;
235
+ product_description?: string | undefined;
236
+ product_name?: string | undefined;
237
+ product_url?: string | undefined;
238
+ refund_amount?: number | undefined;
239
+ verifycode?: string | undefined;
240
+ }>>;
241
+ export type LiqPayCheckoutCallback = z.infer<typeof LiqPayCheckoutCallbackSchema>;