liqpay-nestjs 0.2.17 → 0.3.0

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.
@@ -3,5 +3,10 @@ import { WebhooksClient } from './webhooks.client';
3
3
  export declare class LiqPayClient {
4
4
  payments: PaymentsClient;
5
5
  webhooks: WebhooksClient;
6
- constructor(publicKey: string, privateKey: string, resultUrl: string, serverUrl: string);
6
+ constructor(options: {
7
+ publicKey: string;
8
+ privateKey: string;
9
+ resultUrl?: string;
10
+ serverUrl?: string;
11
+ });
7
12
  }
@@ -7,8 +7,9 @@ const webhooks_client_1 = require("./webhooks.client");
7
7
  class LiqPayClient {
8
8
  payments;
9
9
  webhooks;
10
- constructor(publicKey, privateKey, resultUrl, serverUrl) {
11
- const utils = new utils_client_1.UtilsClient(publicKey, privateKey, resultUrl, serverUrl);
10
+ constructor(options) {
11
+ const { publicKey, privateKey, resultUrl, serverUrl } = options;
12
+ const utils = new utils_client_1.UtilsClient(publicKey, privateKey, resultUrl ?? '', serverUrl ?? '');
12
13
  this.payments = new payments_client_1.PaymentsClient(utils);
13
14
  this.webhooks = new webhooks_client_1.WebhooksClient(utils);
14
15
  }
@@ -1,16 +1,21 @@
1
1
  import { Result } from '../types/base';
2
- import { type CheckoutRequest } from '../types/checkout';
2
+ import { CheckoutInput, type CheckoutRequest } from '../types/checkout';
3
3
  import { PaymentStatusResponse } from '../types/payment-status';
4
4
  import { UtilsClient } from './utils.client';
5
5
  export declare class PaymentsClient {
6
6
  private readonly utils;
7
7
  constructor(utils: UtilsClient);
8
- private fulfillPayload;
9
- private prepareCheckout;
10
- getCheckoutUrl(payload: CheckoutRequest): string;
11
- create(payload: CheckoutRequest): CheckoutRequest & {
12
- checkoutUrl: string;
8
+ private prepare;
9
+ private buildUrl;
10
+ pay(payload: CheckoutInput): CheckoutRequest & {
11
+ url: string;
13
12
  };
14
- getCheckoutFormButton(payload: CheckoutRequest, buttonText?: string, buttonColor?: string): string;
13
+ hold(payload: CheckoutInput): CheckoutRequest & {
14
+ url: string;
15
+ };
16
+ subscribe(payload: CheckoutInput): CheckoutRequest & {
17
+ url: string;
18
+ };
19
+ getPayButton(payload: CheckoutInput, buttonText?: string, buttonColor?: string): string;
15
20
  getStatus(orderId: string): Promise<Result<PaymentStatusResponse>>;
16
21
  }
@@ -9,30 +9,36 @@ class PaymentsClient {
9
9
  constructor(utils) {
10
10
  this.utils = utils;
11
11
  }
12
- fulfillPayload(payload) {
13
- return {
12
+ prepare(payload, action) {
13
+ const fullfilled = {
14
14
  ...payload,
15
+ action,
15
16
  version: 7,
17
+ publicKey: this.utils.publicKey,
16
18
  resultUrl: payload.resultUrl ?? this.utils.resultUrl,
17
19
  serverUrl: payload.serverUrl ?? this.utils.serverUrl,
18
20
  };
19
- }
20
- prepareCheckout(payload) {
21
- const fullfilled = this.fulfillPayload(payload);
22
21
  const raw = checkout_1.RawCheckoutRequestSchema.parse(fullfilled);
23
- const { data, signature } = this.utils.getCredentials(raw);
22
+ const { data, signature } = this.utils.toEnvelope(raw);
24
23
  return { fullfilled, data, signature };
25
24
  }
26
- getCheckoutUrl(payload) {
27
- const { data, signature } = this.prepareCheckout(payload);
25
+ buildUrl(data, signature) {
28
26
  return `${url_type_1.CHECKOUT_URL}?data=${data}&signature=${signature}`;
29
27
  }
30
- create(payload) {
31
- const fullfilled = this.fulfillPayload(payload);
32
- return { ...fullfilled, checkoutUrl: this.getCheckoutUrl(fullfilled) };
28
+ pay(payload) {
29
+ const { fullfilled, data, signature } = this.prepare(payload, 'pay');
30
+ return { ...fullfilled, url: this.buildUrl(data, signature) };
31
+ }
32
+ hold(payload) {
33
+ const { fullfilled, data, signature } = this.prepare(payload, 'hold');
34
+ return { ...fullfilled, url: this.buildUrl(data, signature) };
35
+ }
36
+ subscribe(payload) {
37
+ const { fullfilled, data, signature } = this.prepare(payload, 'subscribe');
38
+ return { ...fullfilled, url: this.buildUrl(data, signature) };
33
39
  }
34
- getCheckoutFormButton(payload, buttonText = 'Pay', buttonColor = '#77CC5D') {
35
- const { data, signature } = this.prepareCheckout(payload);
40
+ getPayButton(payload, buttonText = 'Pay', buttonColor = '#77CC5D') {
41
+ const { data, signature } = this.prepare(payload, 'pay');
36
42
  return `
37
43
  <form method="POST" action="${url_type_1.CHECKOUT_URL}" accept-charset="utf-8">
38
44
  <input type="hidden" name="data" value="${data}" />
@@ -10,7 +10,7 @@ export declare class UtilsClient {
10
10
  encodeData(data: LiqPayRawRequest): string;
11
11
  decodeData(encodedData: string): unknown;
12
12
  createSignature(encodedData: string): string;
13
- getCredentials(data: LiqPayRawRequest): LiqPayEnvelope;
13
+ toEnvelope(data: LiqPayRawRequest): LiqPayEnvelope;
14
14
  isValidSignature(envelope: LiqPayEnvelope): boolean;
15
15
  createError(code: LiqPayError['code'], description: string): Result<never>;
16
16
  parseData<T>(schema: z.ZodType<T>, data: unknown): Result<T>;
@@ -24,13 +24,8 @@ class UtilsClient {
24
24
  const signatureString = `${this.privateKey}${encodedData}${this.privateKey}`;
25
25
  return (0, node_crypto_1.createHash)('sha3-256').update(signatureString).digest('base64');
26
26
  }
27
- getCredentials(data) {
28
- const payload = {
29
- ...data,
30
- version: 7,
31
- public_key: this.publicKey,
32
- };
33
- const encoded = this.encodeData(payload);
27
+ toEnvelope(data) {
28
+ const encoded = this.encodeData(data);
34
29
  const signature = this.createSignature(encoded);
35
30
  return { data: encoded, signature };
36
31
  }
@@ -77,7 +72,7 @@ class UtilsClient {
77
72
  }
78
73
  async call(payload, rawSchema, responseSchema, url) {
79
74
  const raw = rawSchema.parse(payload);
80
- const envelope = this.getCredentials(raw);
75
+ const envelope = this.toEnvelope(raw);
81
76
  const response = await fetch(url, {
82
77
  method: 'POST',
83
78
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
@@ -0,0 +1,225 @@
1
+ import z from 'zod';
2
+ import { Action, LiqPayVersion } from '../common/enums';
3
+ /**
4
+ * Public layer - what library user provides
5
+ * These are the fields user can actually fill
6
+ */
7
+ export declare const CheckoutInputSchema: z.ZodObject<{
8
+ amount: z.ZodNumber;
9
+ cardToken: z.ZodOptional<z.ZodString>;
10
+ currency: z.ZodEnum<{
11
+ USD: "USD";
12
+ EUR: "EUR";
13
+ UAH: "UAH";
14
+ }>;
15
+ description: z.ZodString;
16
+ ip: z.ZodOptional<z.ZodString>;
17
+ orderId: z.ZodString;
18
+ fiscalData: z.ZodOptional<z.ZodObject<{
19
+ items: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
20
+ amount: z.ZodNumber;
21
+ cost: z.ZodNumber;
22
+ id: z.ZodNumber;
23
+ price: z.ZodNumber;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ amount: z.ZodNumber;
26
+ cost: z.ZodNumber;
27
+ price: z.ZodNumber;
28
+ categoryname: z.ZodString;
29
+ name: z.ZodString;
30
+ unitcode: z.ZodEnum<typeof import("../common/enums").UnitEnum>;
31
+ barcode: z.ZodOptional<z.ZodString>;
32
+ codifier: z.ZodOptional<z.ZodString>;
33
+ vndcode: z.ZodOptional<z.ZodString>;
34
+ taxs: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ letter: z.ZodString;
36
+ name: z.ZodString;
37
+ type: z.ZodNumber;
38
+ prc: z.ZodNumber;
39
+ }, z.core.$strip>>>;
40
+ }, z.core.$strip>]>>>;
41
+ delivery_emails: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ }, z.core.$strip>>;
43
+ expiredDate: z.ZodOptional<z.ZodDate>;
44
+ language: z.ZodOptional<z.ZodEnum<{
45
+ uk: "uk";
46
+ en: "en";
47
+ }>>;
48
+ paytypes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
49
+ apay: "apay";
50
+ gpay: "gpay";
51
+ card: "card";
52
+ privat24: "privat24";
53
+ masterpass: "masterpass";
54
+ moment_part: "moment_part";
55
+ paypart: "paypart";
56
+ cash: "cash";
57
+ invoice: "invoice";
58
+ qr: "qr";
59
+ }>>>;
60
+ resultUrl: z.ZodOptional<z.ZodString>;
61
+ serverUrl: z.ZodOptional<z.ZodString>;
62
+ verifyCode: z.ZodOptional<z.ZodBoolean>;
63
+ splitRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
64
+ public_key: z.ZodString;
65
+ amount: z.ZodNumber;
66
+ commission_payer: z.ZodEnum<{
67
+ sender: "sender";
68
+ receiver: "receiver";
69
+ }>;
70
+ server_url: z.ZodString;
71
+ rro_info: z.ZodOptional<z.ZodObject<{
72
+ items: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
73
+ amount: z.ZodNumber;
74
+ cost: z.ZodNumber;
75
+ id: z.ZodNumber;
76
+ price: z.ZodNumber;
77
+ }, z.core.$strip>, z.ZodObject<{
78
+ amount: z.ZodNumber;
79
+ cost: z.ZodNumber;
80
+ price: z.ZodNumber;
81
+ categoryname: z.ZodString;
82
+ name: z.ZodString;
83
+ unitcode: z.ZodEnum<typeof import("../common/enums").UnitEnum>;
84
+ barcode: z.ZodOptional<z.ZodString>;
85
+ codifier: z.ZodOptional<z.ZodString>;
86
+ vndcode: z.ZodOptional<z.ZodString>;
87
+ taxs: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
+ letter: z.ZodString;
89
+ name: z.ZodString;
90
+ type: z.ZodNumber;
91
+ prc: z.ZodNumber;
92
+ }, z.core.$strip>>>;
93
+ }, z.core.$strip>]>>>;
94
+ delivery_emails: z.ZodOptional<z.ZodArray<z.ZodString>>;
95
+ }, z.core.$strip>>;
96
+ }, z.core.$strip>>>;
97
+ senderAddress: z.ZodOptional<z.ZodString>;
98
+ senderCity: z.ZodOptional<z.ZodString>;
99
+ senderCountryCode: z.ZodOptional<z.ZodString>;
100
+ senderFirstName: z.ZodOptional<z.ZodString>;
101
+ senderLastName: z.ZodOptional<z.ZodString>;
102
+ senderPostalCode: z.ZodOptional<z.ZodString>;
103
+ subscribe: z.ZodOptional<z.ZodBoolean>;
104
+ subscribeDateStart: z.ZodOptional<z.ZodDate>;
105
+ subscribePeriodicity: z.ZodOptional<z.ZodEnum<{
106
+ day: "day";
107
+ week: "week";
108
+ month: "month";
109
+ year: "year";
110
+ }>>;
111
+ customer: z.ZodOptional<z.ZodString>;
112
+ recurringByToken: z.ZodOptional<z.ZodBoolean>;
113
+ customerUserId: z.ZodOptional<z.ZodString>;
114
+ detailAddenda: z.ZodOptional<z.ZodObject<{
115
+ airLine: z.ZodString;
116
+ ticketNumber: z.ZodString;
117
+ passengerName: z.ZodString;
118
+ flightNumber: z.ZodString;
119
+ originCity: z.ZodString;
120
+ destinationCity: z.ZodString;
121
+ departureDate: z.ZodString;
122
+ }, z.core.$strip>>;
123
+ info: z.ZodOptional<z.ZodString>;
124
+ productCategory: z.ZodOptional<z.ZodString>;
125
+ productDescription: z.ZodOptional<z.ZodString>;
126
+ productName: z.ZodOptional<z.ZodString>;
127
+ productUrl: z.ZodOptional<z.ZodString>;
128
+ }, z.core.$strip>;
129
+ /**
130
+ * Contract of data that is passed when forming a payment request as `base64` encoded string data when calling the LiqPay API
131
+ */
132
+ export type CheckoutInput = z.infer<typeof CheckoutInputSchema>;
133
+ /**
134
+ * Internal layer - full object inside the library
135
+ * Includes version, publicKey, action — set internally
136
+ *
137
+ *
138
+ * Contract of data that is passed when forming a payment request as `base64` encoded string data when calling the LiqPay API
139
+ */
140
+ export type CheckoutRequest = CheckoutInput & {
141
+ /**
142
+ * API version. Current version: `7`
143
+ */
144
+ version: LiqPayVersion;
145
+ /**
146
+ * Public API key: ID of created company. Example: `i00000000`
147
+ *
148
+ * You can get the key in the store settings.
149
+ */
150
+ publicKey: string;
151
+ /**
152
+ * Operation type. Possible values:
153
+ * - `pay` - payment
154
+ * - `hold` - blocking of funds on sender's account
155
+ * - `subscribe` - regular payment
156
+ * - `paydonate` - donation
157
+ */
158
+ action: Action;
159
+ };
160
+ /**
161
+ * Raw layer - what is actually sent to LiqPay API
162
+ * snake_case, bool/date/string transformations
163
+ */
164
+ export declare const RawCheckoutRequestSchema: z.ZodPipe<z.ZodCustom<CheckoutRequest, CheckoutRequest>, z.ZodTransform<Partial<{
165
+ rro_info: {
166
+ items?: ({
167
+ amount: number;
168
+ cost: number;
169
+ id: number;
170
+ price: number;
171
+ } | {
172
+ amount: number;
173
+ cost: number;
174
+ price: number;
175
+ categoryname: string;
176
+ name: string;
177
+ unitcode: import("../common/enums").UnitEnum;
178
+ barcode?: string | undefined;
179
+ codifier?: string | undefined;
180
+ vndcode?: string | undefined;
181
+ taxs?: {
182
+ letter: string;
183
+ name: string;
184
+ type: number;
185
+ prc: number;
186
+ }[] | undefined;
187
+ })[] | undefined;
188
+ delivery_emails?: string[] | undefined;
189
+ } | undefined;
190
+ expired_date: string | undefined;
191
+ paytypes: string | undefined;
192
+ verifycode: "Y" | undefined;
193
+ split_rules: string | undefined;
194
+ subscribe: "1" | undefined;
195
+ subscribe_date_start: string | undefined;
196
+ recurringbytoken: "1" | undefined;
197
+ dae: string | undefined;
198
+ amount: number;
199
+ currency: "USD" | "EUR" | "UAH";
200
+ description: string;
201
+ order_id: string;
202
+ card_token?: string | undefined;
203
+ ip?: string | undefined;
204
+ language?: "uk" | "en" | undefined;
205
+ result_url?: string | undefined;
206
+ server_url?: string | undefined;
207
+ sender_address?: string | undefined;
208
+ sender_city?: string | undefined;
209
+ sender_country_code?: string | undefined;
210
+ sender_first_name?: string | undefined;
211
+ sender_last_name?: string | undefined;
212
+ sender_postal_code?: string | undefined;
213
+ subscribe_periodicity?: "day" | "week" | "month" | "year" | undefined;
214
+ customer?: string | undefined;
215
+ customer_user_id?: string | undefined;
216
+ info?: string | undefined;
217
+ product_category?: string | undefined;
218
+ product_description?: string | undefined;
219
+ product_name?: string | undefined;
220
+ product_url?: string | undefined;
221
+ version: LiqPayVersion;
222
+ public_key: string;
223
+ action: Action;
224
+ }>, CheckoutRequest>>;
225
+ export type RawCheckoutRequest = z.infer<typeof RawCheckoutRequestSchema>;
@@ -0,0 +1,181 @@
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.RawCheckoutRequestSchema = exports.CheckoutInputSchema = 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 common_1 = require("../common");
11
+ const enums_1 = require("../common/enums");
12
+ /**
13
+ * Public layer - what library user provides
14
+ * These are the fields user can actually fill
15
+ */
16
+ exports.CheckoutInputSchema = zod_1.default.object({
17
+ /**
18
+ * Payment amount. For example: `5`, `7.34`
19
+ */
20
+ amount: zod_1.default.number().positive(),
21
+ cardToken: zod_1.default.string().optional(),
22
+ /**
23
+ * Payment currency. Possible values: `USD`, `EUR`, `UAH`
24
+ */
25
+ currency: enums_1.CurrencySchema,
26
+ /**
27
+ * Payment purpose
28
+ */
29
+ description: zod_1.default.string(),
30
+ ip: zod_1.default.string().optional(),
31
+ /**
32
+ * Unique purchase ID in your store. Maximum length __255__ characters
33
+ */
34
+ orderId: zod_1.default.string().max(255),
35
+ /**
36
+ * Data for fiscalization (rro_info)
37
+ */
38
+ fiscalData: common_1.FiscalDataSchema.optional(),
39
+ /**
40
+ * The time by which the customer can pay the invoice in `UTC`. Transmitted in the format `2016-04-24 00:00:00`
41
+ */
42
+ expiredDate: zod_1.default.date().optional(),
43
+ /**
44
+ * Client language: `uk`, `en`
45
+ */
46
+ language: enums_1.LanguageSchema.optional(),
47
+ /**
48
+ * Parameter that transmits payment methods to be displayed at checkout.
49
+ * If the parameter is not provided, the store settings are applied. Possible values:
50
+ * - `apay` - Apple Pay
51
+ * - `gpay` - Google Pay
52
+ * - `card` - card payment
53
+ * - `privat24` - via Privat24 account
54
+ * - `moment_part` - installments
55
+ * - `paypart` - payment in parts
56
+ * - `cash` - cash
57
+ * - `invoice` - invoice to e-mail
58
+ * - `qr` - scanning a QR code
59
+ */
60
+ paytypes: zod_1.default.array(enums_1.PaytypeSchema).optional(),
61
+ /**
62
+ * The URL in your store to which the buyer will be redirected after completing the purchase. Maximum length __510__ characters
63
+ */
64
+ resultUrl: zod_1.default.string().max(510).optional(),
65
+ /**
66
+ * API URL in your store for notifications about payment status changes (`server -> server`). Maximum length __510__ characters.
67
+ */
68
+ serverUrl: zod_1.default.string().max(510).optional(),
69
+ /**
70
+ * Possible value `Y`. Dynamic verification code, generated and returned in `Callback`. Similarly, the generated code will be passed in the verification transaction to be displayed in the client's card statement. Works for `action = auth` (verifycode)
71
+ */
72
+ verifyCode: zod_1.default.boolean().optional(),
73
+ /**
74
+ * Payment with splitting the amount into several recipients. This parameter specifies a `JSON` array with payment splitting rules.
75
+ * One debit is made from the client and several credits are made to the recipients. If you need to transfer your purpose for each amount, use the `description` parameter.
76
+ * If you need to fiscalize payments for each recipient, add the `rro_info` object. The acquiring fee is charged for each recipient.
77
+ */
78
+ splitRules: zod_1.default.array(common_1.SplitRuleSchema).optional(),
79
+ /**
80
+ * Sender address
81
+ */
82
+ senderAddress: zod_1.default.string().optional(),
83
+ /**
84
+ * Sender city
85
+ */
86
+ senderCity: zod_1.default.string().optional(),
87
+ /**
88
+ * Sender country code. Numeric __ISO 3166-1__ code
89
+ */
90
+ senderCountryCode: zod_1.default.string().optional(),
91
+ /**
92
+ * Sender first name
93
+ */
94
+ senderFirstName: zod_1.default.string().optional(),
95
+ /**
96
+ * Sender's last name
97
+ */
98
+ senderLastName: zod_1.default.string().optional(),
99
+ /**
100
+ * Sender's postal code
101
+ */
102
+ senderPostalCode: zod_1.default.string().optional(),
103
+ /**
104
+ * Regular payment. Possible values: `1`
105
+ */
106
+ subscribe: zod_1.default.boolean().optional(),
107
+ /**
108
+ * Date of first payment. The time must be specified in the format `2015-03-31 00:00:00` in `UTC`. If the date is past, the subscription will be activated from the current date of receipt of the request
109
+ */
110
+ subscribeDateStart: zod_1.default.date().optional(),
111
+ /**
112
+ * The frequency of funds write-off. Possible values:
113
+ * - `day` - daily
114
+ * - `week` - weekly
115
+ * - `month` - once a month
116
+ * - `year` - once a year, раз
117
+ */
118
+ subscribePeriodicity: enums_1.SubscribePeriodicitySchema.optional(),
119
+ /**
120
+ * Unique client identifier on the merchant's website. When transmitting the parameter, LiqPay remembers the client's payment details and his identifier - further payment can be made in 1 click. Maximum length __100__ characters. (When using the parameter for __Masterpass 1 click__, a valid payer's phone number is transmitted in this field)
121
+ */
122
+ customer: zod_1.default.string().max(100).optional(),
123
+ /**
124
+ * Allows you to generate a `card_token` of the payer, which you will receive in a callback request to `server_url`. `card_token` allows you to make payments without entering the payer's card details, using the token payment API - that is, in 1 click. To receive `card_token`, you must pass the value: `1` in the request (recurringbytoken)
125
+ */
126
+ recurringByToken: zod_1.default.boolean().optional(),
127
+ /**
128
+ * User ID in the merchant system, transmitted with each user payment (must not match `customer`, used for payment using the __Masterpass 1 click__ wallet)
129
+ */
130
+ customerUserId: zod_1.default.string().optional(),
131
+ /**
132
+ * Long Detail Addenda entry. __Required for merchants with MCC 4511__.
133
+ *
134
+ * The `dae` parameter is a `JSON` string to which `base64` has been applied.
135
+ * It can contain the parameters given in the example below. (dae)
136
+ */
137
+ detailAddenda: common_1.DetailAddendaSchema.optional(),
138
+ /**
139
+ * Information to add data to the payment. For example: `"External information for payments"`
140
+ */
141
+ info: zod_1.default.string().optional(),
142
+ /**
143
+ * Product category. Maximum length `25` characters
144
+ */
145
+ productCategory: zod_1.default.string().max(25).optional(),
146
+ /**
147
+ * Product description. Maximum length `500` characters.
148
+ */
149
+ productDescription: zod_1.default.string().max(500).optional(),
150
+ /**
151
+ * Product name. Maximum length `100` characters.
152
+ */
153
+ productName: zod_1.default.string().max(100).optional(),
154
+ /**
155
+ * Product page address. Maximum length `510` characters
156
+ */
157
+ productUrl: zod_1.default.string().max(510).optional(),
158
+ });
159
+ /**
160
+ * Raw layer - what is actually sent to LiqPay API
161
+ * snake_case, bool/date/string transformations
162
+ */
163
+ exports.RawCheckoutRequestSchema = zod_1.default
164
+ .custom()
165
+ .transform(req => {
166
+ const { fiscalData, verifyCode, recurringByToken, detailAddenda, ...rest } = req;
167
+ const snakelized = (0, ts_case_convert_1.objectToSnake)(rest);
168
+ const transformed = {
169
+ ...snakelized,
170
+ rro_info: fiscalData,
171
+ expired_date: (0, utils_1.dateToIso)(snakelized.expired_date),
172
+ paytypes: (0, utils_1.join)(snakelized.paytypes),
173
+ verifycode: (0, utils_1.boolTo)(verifyCode, 'Y'),
174
+ split_rules: (0, utils_1.stringify)(snakelized.split_rules),
175
+ subscribe: (0, utils_1.boolTo)(snakelized.subscribe, '1'),
176
+ subscribe_date_start: (0, utils_1.dateToIso)(snakelized.subscribe_date_start),
177
+ recurringbytoken: (0, utils_1.boolTo)(recurringByToken, '1'),
178
+ dae: (0, utils_1.stringify)(detailAddenda),
179
+ };
180
+ return (0, utils_1.removeUndefined)(transformed);
181
+ });
@@ -1,2 +1,2 @@
1
1
  export * from './checkout-callback.schema';
2
- export * from './checkout-request.schema';
2
+ export * from './checkout-request';
@@ -15,4 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./checkout-callback.schema"), exports);
18
- __exportStar(require("./checkout-request.schema"), exports);
18
+ __exportStar(require("./checkout-request"), exports);
@@ -23,8 +23,7 @@ let LiqpayService = class LiqpayService {
23
23
  webhooks;
24
24
  constructor(options) {
25
25
  this.options = options;
26
- const { privateKey, publicKey, resultUrl, serverUrl } = options;
27
- const client = new clients_1.LiqPayClient(publicKey, privateKey, resultUrl ?? '', serverUrl ?? '');
26
+ const client = new clients_1.LiqPayClient(options);
28
27
  this.payments = new services_1.PaymentsService(client);
29
28
  this.webhooks = new services_1.WebhooksService(client);
30
29
  }