@blob-solutions/vcr-am-sdk 0.10.0 → 0.14.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.
- package/CHANGELOG.md +56 -0
- package/README.md +69 -10
- package/lib/index.cjs +183 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +341 -9
- package/lib/index.d.ts +341 -9
- package/lib/index.global.js +22 -22
- package/lib/index.global.js.map +1 -1
- package/lib/index.js +175 -4
- package/lib/index.js.map +1 -1
- package/package.json +8 -8
package/lib/index.d.cts
CHANGED
|
@@ -45,6 +45,19 @@ declare const createDepartmentResponseSchema: z.ZodObject<{
|
|
|
45
45
|
message: z.ZodString;
|
|
46
46
|
department: z.ZodNumber;
|
|
47
47
|
}, z.core.$strip>;
|
|
48
|
+
declare const whoamiResponseSchema: z.ZodObject<{
|
|
49
|
+
vcrId: z.ZodNumber;
|
|
50
|
+
crn: z.ZodNullable<z.ZodString>;
|
|
51
|
+
mode: z.ZodEnum<{
|
|
52
|
+
production: "production";
|
|
53
|
+
sandbox: "sandbox";
|
|
54
|
+
}>;
|
|
55
|
+
tradingPlatformName: z.ZodString;
|
|
56
|
+
businessEntity: z.ZodObject<{
|
|
57
|
+
tin: z.ZodString;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
}, z.core.$strip>;
|
|
48
61
|
declare const cashierListItemSchema: z.ZodObject<{
|
|
49
62
|
deskId: z.ZodString;
|
|
50
63
|
internalId: z.ZodNumber;
|
|
@@ -71,6 +84,46 @@ declare const cashierListResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
71
84
|
content: z.ZodString;
|
|
72
85
|
}, z.core.$strip>>;
|
|
73
86
|
}, z.core.$strip>>;
|
|
87
|
+
declare const departmentListItemSchema: z.ZodObject<{
|
|
88
|
+
internalId: z.ZodNumber;
|
|
89
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
90
|
+
taxRegime: z.ZodEnum<{
|
|
91
|
+
vat: "vat";
|
|
92
|
+
vat_exempt: "vat_exempt";
|
|
93
|
+
turnover_tax: "turnover_tax";
|
|
94
|
+
micro_enterprise: "micro_enterprise";
|
|
95
|
+
}>;
|
|
96
|
+
title: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
97
|
+
id: z.ZodNumber;
|
|
98
|
+
language: z.ZodEnum<{
|
|
99
|
+
hy: "hy";
|
|
100
|
+
ru: "ru";
|
|
101
|
+
en: "en";
|
|
102
|
+
multi: "multi";
|
|
103
|
+
}>;
|
|
104
|
+
content: z.ZodString;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
declare const departmentListResponseSchema: z.ZodArray<z.ZodObject<{
|
|
108
|
+
internalId: z.ZodNumber;
|
|
109
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
110
|
+
taxRegime: z.ZodEnum<{
|
|
111
|
+
vat: "vat";
|
|
112
|
+
vat_exempt: "vat_exempt";
|
|
113
|
+
turnover_tax: "turnover_tax";
|
|
114
|
+
micro_enterprise: "micro_enterprise";
|
|
115
|
+
}>;
|
|
116
|
+
title: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
117
|
+
id: z.ZodNumber;
|
|
118
|
+
language: z.ZodEnum<{
|
|
119
|
+
hy: "hy";
|
|
120
|
+
ru: "ru";
|
|
121
|
+
en: "en";
|
|
122
|
+
multi: "multi";
|
|
123
|
+
}>;
|
|
124
|
+
content: z.ZodString;
|
|
125
|
+
}, z.core.$strip>>;
|
|
126
|
+
}, z.core.$strip>>;
|
|
74
127
|
declare const classifierSearchItemSchema: z.ZodObject<{
|
|
75
128
|
code: z.ZodString;
|
|
76
129
|
title: z.ZodOptional<z.ZodString>;
|
|
@@ -79,6 +132,56 @@ declare const classifierSearchResponseSchema: z.ZodArray<z.ZodObject<{
|
|
|
79
132
|
code: z.ZodString;
|
|
80
133
|
title: z.ZodOptional<z.ZodString>;
|
|
81
134
|
}, z.core.$strip>>;
|
|
135
|
+
declare const offerListItemSchema: z.ZodObject<{
|
|
136
|
+
id: z.ZodNumber;
|
|
137
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
138
|
+
type: z.ZodEnum<{
|
|
139
|
+
product: "product";
|
|
140
|
+
service: "service";
|
|
141
|
+
}>;
|
|
142
|
+
classifierCode: z.ZodString;
|
|
143
|
+
defaultMeasureUnit: z.ZodString;
|
|
144
|
+
defaultDepartment: z.ZodObject<{
|
|
145
|
+
internalId: z.ZodNumber;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
title: z.ZodArray<z.ZodObject<{
|
|
148
|
+
id: z.ZodNumber;
|
|
149
|
+
language: z.ZodEnum<{
|
|
150
|
+
hy: "hy";
|
|
151
|
+
ru: "ru";
|
|
152
|
+
en: "en";
|
|
153
|
+
multi: "multi";
|
|
154
|
+
}>;
|
|
155
|
+
content: z.ZodString;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
archivedAt: z.ZodNullable<z.ZodString>;
|
|
158
|
+
createdAt: z.ZodString;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
declare const offerListResponseSchema: z.ZodArray<z.ZodObject<{
|
|
161
|
+
id: z.ZodNumber;
|
|
162
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
163
|
+
type: z.ZodEnum<{
|
|
164
|
+
product: "product";
|
|
165
|
+
service: "service";
|
|
166
|
+
}>;
|
|
167
|
+
classifierCode: z.ZodString;
|
|
168
|
+
defaultMeasureUnit: z.ZodString;
|
|
169
|
+
defaultDepartment: z.ZodObject<{
|
|
170
|
+
internalId: z.ZodNumber;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
title: z.ZodArray<z.ZodObject<{
|
|
173
|
+
id: z.ZodNumber;
|
|
174
|
+
language: z.ZodEnum<{
|
|
175
|
+
hy: "hy";
|
|
176
|
+
ru: "ru";
|
|
177
|
+
en: "en";
|
|
178
|
+
multi: "multi";
|
|
179
|
+
}>;
|
|
180
|
+
content: z.ZodString;
|
|
181
|
+
}, z.core.$strip>>;
|
|
182
|
+
archivedAt: z.ZodNullable<z.ZodString>;
|
|
183
|
+
createdAt: z.ZodString;
|
|
184
|
+
}, z.core.$strip>>;
|
|
82
185
|
declare const saleDetailResponseSchema: z.ZodObject<{
|
|
83
186
|
id: z.ZodNumber;
|
|
84
187
|
createdAt: z.ZodString;
|
|
@@ -216,6 +319,11 @@ declare const saleDetailResponseSchema: z.ZodObject<{
|
|
|
216
319
|
}, z.core.$strip>;
|
|
217
320
|
}, z.core.$strip>>;
|
|
218
321
|
}, z.core.$strip>;
|
|
322
|
+
declare const prepaymentStateSchema: z.ZodEnum<{
|
|
323
|
+
open: "open";
|
|
324
|
+
consumed: "consumed";
|
|
325
|
+
refunded: "refunded";
|
|
326
|
+
}>;
|
|
219
327
|
declare const prepaymentDetailResponseSchema: z.ZodObject<{
|
|
220
328
|
id: z.ZodNumber;
|
|
221
329
|
createdAt: z.ZodString;
|
|
@@ -262,6 +370,51 @@ declare const prepaymentDetailResponseSchema: z.ZodObject<{
|
|
|
262
370
|
content: z.ZodString;
|
|
263
371
|
}, z.core.$strip>>;
|
|
264
372
|
}, z.core.$strip>;
|
|
373
|
+
remaining: z.ZodNumber;
|
|
374
|
+
state: z.ZodEnum<{
|
|
375
|
+
open: "open";
|
|
376
|
+
consumed: "consumed";
|
|
377
|
+
refunded: "refunded";
|
|
378
|
+
}>;
|
|
379
|
+
}, z.core.$strip>;
|
|
380
|
+
declare const prepaymentListItemSchema: z.ZodObject<{
|
|
381
|
+
id: z.ZodNumber;
|
|
382
|
+
createdAt: z.ZodString;
|
|
383
|
+
buyerTin: z.ZodNullable<z.ZodString>;
|
|
384
|
+
cashAmount: z.ZodNumber;
|
|
385
|
+
nonCashAmount: z.ZodNumber;
|
|
386
|
+
remaining: z.ZodNumber;
|
|
387
|
+
state: z.ZodEnum<{
|
|
388
|
+
open: "open";
|
|
389
|
+
consumed: "consumed";
|
|
390
|
+
refunded: "refunded";
|
|
391
|
+
}>;
|
|
392
|
+
}, z.core.$strip>;
|
|
393
|
+
declare const prepaymentListResponseSchema: z.ZodArray<z.ZodObject<{
|
|
394
|
+
id: z.ZodNumber;
|
|
395
|
+
createdAt: z.ZodString;
|
|
396
|
+
buyerTin: z.ZodNullable<z.ZodString>;
|
|
397
|
+
cashAmount: z.ZodNumber;
|
|
398
|
+
nonCashAmount: z.ZodNumber;
|
|
399
|
+
remaining: z.ZodNumber;
|
|
400
|
+
state: z.ZodEnum<{
|
|
401
|
+
open: "open";
|
|
402
|
+
consumed: "consumed";
|
|
403
|
+
refunded: "refunded";
|
|
404
|
+
}>;
|
|
405
|
+
}, z.core.$strip>>;
|
|
406
|
+
declare const customerPrepaymentBalanceResponseSchema: z.ZodObject<{
|
|
407
|
+
entityId: z.ZodNumber;
|
|
408
|
+
customerRef: z.ZodString;
|
|
409
|
+
balance: z.ZodNumber;
|
|
410
|
+
openPrepayments: z.ZodArray<z.ZodObject<{
|
|
411
|
+
prepaymentId: z.ZodNumber;
|
|
412
|
+
createdAt: z.ZodString;
|
|
413
|
+
cashAmount: z.ZodNumber;
|
|
414
|
+
nonCashAmount: z.ZodNumber;
|
|
415
|
+
buyerTin: z.ZodNullable<z.ZodString>;
|
|
416
|
+
remaining: z.ZodNumber;
|
|
417
|
+
}, z.core.$strip>>;
|
|
265
418
|
}, z.core.$strip>;
|
|
266
419
|
type RegisterSaleResponse = z.infer<typeof registerSaleResponseSchema>;
|
|
267
420
|
type RegisterSaleRefundResponse = z.infer<typeof registerSaleRefundResponseSchema>;
|
|
@@ -272,8 +425,14 @@ type CreateCashierResponse = z.infer<typeof createCashierResponseSchema>;
|
|
|
272
425
|
type CreateDepartmentResponse = z.infer<typeof createDepartmentResponseSchema>;
|
|
273
426
|
type CashierListItem = z.infer<typeof cashierListItemSchema>;
|
|
274
427
|
type ClassifierSearchItem = z.infer<typeof classifierSearchItemSchema>;
|
|
428
|
+
type Whoami = z.infer<typeof whoamiResponseSchema>;
|
|
429
|
+
type OfferListItem = z.infer<typeof offerListItemSchema>;
|
|
275
430
|
type SaleDetail = z.infer<typeof saleDetailResponseSchema>;
|
|
276
431
|
type PrepaymentDetail = z.infer<typeof prepaymentDetailResponseSchema>;
|
|
432
|
+
type PrepaymentListItem = z.infer<typeof prepaymentListItemSchema>;
|
|
433
|
+
type PrepaymentState = z.infer<typeof prepaymentStateSchema>;
|
|
434
|
+
type CustomerPrepaymentBalance = z.infer<typeof customerPrepaymentBalanceResponseSchema>;
|
|
435
|
+
type DepartmentListItem = z.infer<typeof departmentListItemSchema>;
|
|
277
436
|
|
|
278
437
|
declare const unitsKeys: readonly ["pc", "unit", "set", "box", "pack", "case", "hr", "sess", "proj", "sub", "kg", "l", "m", "g", "ml", "cm", "bottle", "can", "jar", "bag", "m2", "dozen", "pair", "mm", "roll", "tube", "km", "ton", "m3", "pallet", "other"];
|
|
279
438
|
declare const AVAILABLE_LANGUAGES: readonly ["hy", "ru", "en"];
|
|
@@ -318,9 +477,14 @@ type Discounts = {
|
|
|
318
477
|
base?: BaseDiscount;
|
|
319
478
|
additional?: AdditionalDiscount;
|
|
320
479
|
};
|
|
321
|
-
|
|
480
|
+
/** Reference an already-created offer by its merchant-provided external id. */
|
|
481
|
+
type ExistingOfferByExternalId = {
|
|
322
482
|
externalId: string;
|
|
323
483
|
};
|
|
484
|
+
/** Reference an already-created offer by its VCR-internal numeric id. */
|
|
485
|
+
type ExistingOfferById = {
|
|
486
|
+
id: number;
|
|
487
|
+
};
|
|
324
488
|
type LocalizedOfferTitle = {
|
|
325
489
|
type: "localized";
|
|
326
490
|
content: Partial<Record<Language, string>> & {
|
|
@@ -332,6 +496,15 @@ type UniversalOfferTitle = {
|
|
|
332
496
|
type: "universal";
|
|
333
497
|
content: string;
|
|
334
498
|
};
|
|
499
|
+
/**
|
|
500
|
+
* Canonical offer-title shape shared by inline new offers (`registerSale`),
|
|
501
|
+
* `createOffer`, and `updateOffer`.
|
|
502
|
+
*
|
|
503
|
+
* - `universal` — one string treated as multi-language (brand names like
|
|
504
|
+
* "Coca-Cola").
|
|
505
|
+
* - `localized` — per-language map (`hy` required; `en`/`ru` optional and
|
|
506
|
+
* filled server-side per `localizationStrategy` when missing).
|
|
507
|
+
*/
|
|
335
508
|
type OfferTitle = LocalizedOfferTitle | UniversalOfferTitle;
|
|
336
509
|
type DepartmentInput = {
|
|
337
510
|
id: number;
|
|
@@ -344,7 +517,12 @@ type NewOffer = {
|
|
|
344
517
|
defaultDepartment: DepartmentInput;
|
|
345
518
|
externalId: string;
|
|
346
519
|
};
|
|
347
|
-
|
|
520
|
+
/**
|
|
521
|
+
* A sale-item offer: a brand-new inline offer, or a reference to an existing
|
|
522
|
+
* one by `externalId` or by internal `id`. Mirrors the three wire shapes the
|
|
523
|
+
* server's `POST /sales` accepts.
|
|
524
|
+
*/
|
|
525
|
+
type Offer = NewOffer | ExistingOfferByExternalId | ExistingOfferById;
|
|
348
526
|
type SaleItem = {
|
|
349
527
|
offer: Offer;
|
|
350
528
|
department: DepartmentInput;
|
|
@@ -353,6 +531,32 @@ type SaleItem = {
|
|
|
353
531
|
unit: Unit;
|
|
354
532
|
discounts?: Discounts;
|
|
355
533
|
totalAmountTolerance?: string;
|
|
534
|
+
/**
|
|
535
|
+
* eMark codes for this line (Govt Decision 1976-N, effective 2026-05-01).
|
|
536
|
+
* Omit or leave empty for unmarked goods. One entry per physical unit sold.
|
|
537
|
+
*/
|
|
538
|
+
emarks?: string[];
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* Foreign-currency input trail (HO-234-N). Present only when the sale was
|
|
542
|
+
* entered in a non-AMD currency; omit it entirely for native-AMD sales.
|
|
543
|
+
*
|
|
544
|
+
* The AMD `price` values in `items[]` remain the authoritative fiscal figures.
|
|
545
|
+
* This block carries the raw foreign inputs plus the CBA rate the client used;
|
|
546
|
+
* the server re-resolves the previous-business-day rate and rejects the sale
|
|
547
|
+
* if the supplied rate is stale.
|
|
548
|
+
*/
|
|
549
|
+
type CurrencyConversionInput = {
|
|
550
|
+
/** 3-letter ISO 4217 code (normalized to uppercase server-side). Not AMD. */
|
|
551
|
+
currency: string;
|
|
552
|
+
/** AMD per one unit of `currency` (CBA rate / amount). */
|
|
553
|
+
ratePerUnit: string;
|
|
554
|
+
/** Rate date in `YYYY-MM-DD` (CBA previous business day). */
|
|
555
|
+
rateDate: string;
|
|
556
|
+
/** Per-line foreign unit prices, index-aligned to `items[]`. At least one. */
|
|
557
|
+
lines: Array<{
|
|
558
|
+
foreignUnitPrice: string;
|
|
559
|
+
}>;
|
|
356
560
|
};
|
|
357
561
|
type SaleAmount = RequireAtLeastOne<{
|
|
358
562
|
prepayment?: string;
|
|
@@ -364,11 +568,27 @@ type SendReceiptToBuyer = {
|
|
|
364
568
|
email: string;
|
|
365
569
|
language: Language;
|
|
366
570
|
};
|
|
367
|
-
|
|
571
|
+
/**
|
|
572
|
+
* Buyer contact captures used by the desk-side prepayment lookup banner.
|
|
573
|
+
* Independent of {@link SendReceiptToBuyer}: a buyer can be reachable for
|
|
574
|
+
* later lookup without receiving an emailed receipt now. When both
|
|
575
|
+
* `email` and `receipt.email` are present, the server stores `email` for
|
|
576
|
+
* lookup and uses `receipt.email` only for delivery (they may
|
|
577
|
+
* legitimately differ — personal vs billing).
|
|
578
|
+
*
|
|
579
|
+
* `phone` must be E.164 ("+37491234567"). Plain Armenian local format
|
|
580
|
+
* is not accepted at the API boundary — clients should parse with
|
|
581
|
+
* libphonenumber before sending.
|
|
582
|
+
*/
|
|
583
|
+
type BuyerContact = {
|
|
584
|
+
email?: string;
|
|
585
|
+
phone?: string;
|
|
586
|
+
};
|
|
587
|
+
type IndividualBuyer = BuyerContact & {
|
|
368
588
|
type: "individual";
|
|
369
589
|
receipt?: SendReceiptToBuyer;
|
|
370
590
|
};
|
|
371
|
-
type LegalEntityBuyer = {
|
|
591
|
+
type LegalEntityBuyer = BuyerContact & {
|
|
372
592
|
type: "business_entity";
|
|
373
593
|
tin: string;
|
|
374
594
|
receipt?: SendReceiptToBuyer;
|
|
@@ -377,6 +597,11 @@ type Buyer = IndividualBuyer | LegalEntityBuyer;
|
|
|
377
597
|
type RegisterSaleInput = {
|
|
378
598
|
cashier: CashierId;
|
|
379
599
|
items: SaleItem[];
|
|
600
|
+
/**
|
|
601
|
+
* Optional foreign-currency input. Absent => native-AMD sale, byte-identical
|
|
602
|
+
* to the pre-existing behaviour. See {@link CurrencyConversionInput}.
|
|
603
|
+
*/
|
|
604
|
+
currencyConversion?: CurrencyConversionInput;
|
|
380
605
|
amount: SaleAmount;
|
|
381
606
|
buyer: Buyer;
|
|
382
607
|
};
|
|
@@ -425,6 +650,22 @@ type RegisterPrepaymentRefundInput = {
|
|
|
425
650
|
type LocalizedName = Partial<Record<Language, string>> & {
|
|
426
651
|
hy: string;
|
|
427
652
|
};
|
|
653
|
+
/**
|
|
654
|
+
* Legacy offer-title shape (`{ value, localizationStrategy }`) once required by
|
|
655
|
+
* `createOffer`.
|
|
656
|
+
*
|
|
657
|
+
* @deprecated since 0.14.0 — the server still accepts it but plans removal.
|
|
658
|
+
* Prefer the canonical {@link OfferTitle} (`{ type: "localized", content,
|
|
659
|
+
* localizationStrategy }` or `{ type: "universal", content }`), which is the
|
|
660
|
+
* same shape used by inline offers and `updateOffer`, and additionally
|
|
661
|
+
* supports `universal` (brand-name) titles.
|
|
662
|
+
*/
|
|
663
|
+
type LegacyOfferTitle = {
|
|
664
|
+
value: LocalizedName;
|
|
665
|
+
localizationStrategy: "translation" | "transliteration";
|
|
666
|
+
};
|
|
667
|
+
/** Title accepted by {@link CreateOfferInput}: canonical or legacy shape. */
|
|
668
|
+
type CreateOfferTitle = OfferTitle | LegacyOfferTitle;
|
|
428
669
|
type CreateCashierInput = {
|
|
429
670
|
name: {
|
|
430
671
|
value: LocalizedName;
|
|
@@ -436,14 +677,21 @@ type CreateCashierInput = {
|
|
|
436
677
|
type CreateDepartmentInput = {
|
|
437
678
|
externalId?: string;
|
|
438
679
|
taxRegime: TaxRegime;
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
680
|
+
/**
|
|
681
|
+
* Department title shown on reports and receipts. `value.hy` is required;
|
|
682
|
+
* `value.ru` and `value.en` are optional and auto-transliterated from
|
|
683
|
+
* `hy` at render time when missing. `localizationStrategy` follows the
|
|
684
|
+
* same shape used by `CreateCashierInput.name` and `CreateOfferInput.title`.
|
|
685
|
+
*/
|
|
443
686
|
title: {
|
|
444
687
|
value: LocalizedName;
|
|
445
688
|
localizationStrategy: "translation" | "transliteration";
|
|
446
689
|
};
|
|
690
|
+
};
|
|
691
|
+
type CreateOfferInputProduct = {
|
|
692
|
+
type: "product";
|
|
693
|
+
classifierCode: string;
|
|
694
|
+
title: CreateOfferTitle;
|
|
447
695
|
defaultMeasureUnit: Unit;
|
|
448
696
|
defaultDepartment: DepartmentInput;
|
|
449
697
|
externalId?: string;
|
|
@@ -452,7 +700,29 @@ type CreateOfferInputService = Omit<CreateOfferInputProduct, "type"> & {
|
|
|
452
700
|
type: "service";
|
|
453
701
|
};
|
|
454
702
|
type CreateOfferInput = CreateOfferInputProduct | CreateOfferInputService;
|
|
703
|
+
/** Body of {@link VCRClient.updateOffer} — a new title for an existing offer. */
|
|
704
|
+
type UpdateOfferInput = {
|
|
705
|
+
title: OfferTitle;
|
|
706
|
+
};
|
|
707
|
+
/** Filter for {@link VCRClient.listOffers}. */
|
|
708
|
+
type ListOffersFilter = {
|
|
709
|
+
/** Exact-match filter by merchant-provided `externalId`. */
|
|
710
|
+
externalId?: string;
|
|
711
|
+
/** Filter by offer type. */
|
|
712
|
+
type?: "product" | "service";
|
|
713
|
+
/** When true, also include archived offers. Defaults to false. */
|
|
714
|
+
includeArchived?: boolean;
|
|
715
|
+
};
|
|
455
716
|
|
|
717
|
+
type ListPrepaymentsFilter = {
|
|
718
|
+
/** Exact-match filter against ledger.customerRef (TIN / phone / email). */
|
|
719
|
+
customerRef?: string;
|
|
720
|
+
/**
|
|
721
|
+
* Filter by derived lifecycle state. `all` (the default) returns every
|
|
722
|
+
* prepayment; the other values filter to a single lifecycle stage.
|
|
723
|
+
*/
|
|
724
|
+
state?: PrepaymentState | "all";
|
|
725
|
+
};
|
|
456
726
|
type VCRClientOptions = {
|
|
457
727
|
/** Base URL for the VCR API. Defaults to https://vcr.am/api/v1. */
|
|
458
728
|
baseUrl?: string;
|
|
@@ -464,16 +734,72 @@ type VCRClientOptions = {
|
|
|
464
734
|
declare class VCRClient {
|
|
465
735
|
#private;
|
|
466
736
|
constructor(apiKey: string, options?: VCRClientOptions);
|
|
737
|
+
/**
|
|
738
|
+
* Resolve which VCR the calling API key belongs to. Returns the register's
|
|
739
|
+
* identity, its `mode` (`production` / `sandbox`), and the owning business
|
|
740
|
+
* entity. Works on freshly-imported VCRs that have not been activated yet
|
|
741
|
+
* (in which case `crn` is `null`) — handy as a cheap SDK health-check and to
|
|
742
|
+
* tell production keys apart from sandbox ones.
|
|
743
|
+
*/
|
|
744
|
+
whoami(options?: RequestOptions): Promise<Whoami>;
|
|
467
745
|
registerSale(data: RegisterSaleInput, options?: RequestOptions): Promise<RegisterSaleResponse>;
|
|
468
746
|
getSale(saleId: number, options?: RequestOptions): Promise<SaleDetail>;
|
|
469
747
|
registerSaleRefund(data: RegisterSaleRefundInput, options?: RequestOptions): Promise<RegisterSaleRefundResponse>;
|
|
470
748
|
registerPrepayment(data: RegisterPrepaymentInput, options?: RequestOptions): Promise<RegisterPrepaymentResponse>;
|
|
471
749
|
getPrepayment(prepaymentId: number, options?: RequestOptions): Promise<PrepaymentDetail>;
|
|
472
750
|
registerPrepaymentRefund(data: RegisterPrepaymentRefundInput, options?: RequestOptions): Promise<RegisterPrepaymentRefundResponse>;
|
|
751
|
+
/**
|
|
752
|
+
* List prepayments registered through the calling VCR. Server caps the
|
|
753
|
+
* response at 500 rows; for larger sets, narrow with `customerRef` or
|
|
754
|
+
* paginate by `id` outside the SDK.
|
|
755
|
+
*
|
|
756
|
+
* `remaining` and `state` are derived from the ledger — call this whenever
|
|
757
|
+
* you want a current snapshot rather than caching the result.
|
|
758
|
+
*/
|
|
759
|
+
listPrepayments(filter?: ListPrepaymentsFilter, options?: RequestOptions): Promise<PrepaymentListItem[]>;
|
|
760
|
+
/**
|
|
761
|
+
* Get a customer's open prepayment balance scoped to the BusinessEntity
|
|
762
|
+
* that owns the calling VCR's API key. Because the ledger is entity-scoped,
|
|
763
|
+
* the result reflects deposits made through any VCR belonging to the same
|
|
764
|
+
* entity — merchants who run more than one VCR see a single wallet.
|
|
765
|
+
*
|
|
766
|
+
* `customerRef` is matched exactly against the ledger — typically a TIN,
|
|
767
|
+
* normalized E.164 phone, or lowercased email. Use whichever identifier the
|
|
768
|
+
* customer gave at deposit time; identities are not auto-merged across
|
|
769
|
+
* different ref types.
|
|
770
|
+
*/
|
|
771
|
+
getCustomerPrepaymentBalance(input: {
|
|
772
|
+
customerRef: string;
|
|
773
|
+
}, options?: RequestOptions): Promise<CustomerPrepaymentBalance>;
|
|
473
774
|
listCashiers(options?: RequestOptions): Promise<CashierListItem[]>;
|
|
474
775
|
createCashier(data: CreateCashierInput, options?: RequestOptions): Promise<CreateCashierResponse>;
|
|
475
776
|
createOffer(data: CreateOfferInput, options?: RequestOptions): Promise<CreateOfferResponse>;
|
|
777
|
+
/**
|
|
778
|
+
* List offers belonging to the calling VCR. Server caps the response at 500
|
|
779
|
+
* rows; narrow with `externalId` / `type` for larger catalogs. Archived
|
|
780
|
+
* offers are excluded unless `includeArchived` is set.
|
|
781
|
+
*
|
|
782
|
+
* A common use is checking whether an offer already exists (by `externalId`)
|
|
783
|
+
* before creating it.
|
|
784
|
+
*/
|
|
785
|
+
listOffers(filter?: ListOffersFilter, options?: RequestOptions): Promise<OfferListItem[]>;
|
|
786
|
+
getOffer(offerId: number, options?: RequestOptions): Promise<OfferListItem>;
|
|
787
|
+
/**
|
|
788
|
+
* Rename an offer's title. Affects only future receipts — already-issued
|
|
789
|
+
* receipts keep the title they were created with, and the SRC fiscal record
|
|
790
|
+
* is unchanged. Missing `en`/`ru` are filled per `localizationStrategy`,
|
|
791
|
+
* exactly as on offer creation. Returns the updated offer.
|
|
792
|
+
*/
|
|
793
|
+
updateOffer(offerId: number, data: UpdateOfferInput, options?: RequestOptions): Promise<OfferListItem>;
|
|
476
794
|
createDepartment(data: CreateDepartmentInput, options?: RequestOptions): Promise<CreateDepartmentResponse>;
|
|
795
|
+
/**
|
|
796
|
+
* List departments configured on the calling VCR — `internalId`,
|
|
797
|
+
* `externalId`, `taxRegime`, and the localized `title`. Mirrors the
|
|
798
|
+
* dashboard catalog: only departments confirmed by the tax service are
|
|
799
|
+
* returned, so the `internalId` field is safe to reference from a sale
|
|
800
|
+
* item's `department.id`.
|
|
801
|
+
*/
|
|
802
|
+
listDepartments(options?: RequestOptions): Promise<DepartmentListItem[]>;
|
|
477
803
|
searchClassifier(input: SearchClassifierInput, options?: RequestOptions): Promise<ClassifierSearchItem[]>;
|
|
478
804
|
/**
|
|
479
805
|
* @deprecated Use {@link searchClassifier} with an options object. Will be
|
|
@@ -491,6 +817,12 @@ type ApiErrorIssue = {
|
|
|
491
817
|
type ApiErrorBody = {
|
|
492
818
|
error: string;
|
|
493
819
|
issues?: Array<ApiErrorIssue>;
|
|
820
|
+
/**
|
|
821
|
+
* Server-generated correlation ID, present on unexpected 5xx responses.
|
|
822
|
+
* Include it when reporting the issue to support so the matching log entry
|
|
823
|
+
* and Sentry event can be located.
|
|
824
|
+
*/
|
|
825
|
+
requestId?: string;
|
|
494
826
|
};
|
|
495
827
|
/**
|
|
496
828
|
* Base class for every error thrown by the SDK.
|
|
@@ -537,4 +869,4 @@ declare class VCRNetworkError extends VCRError {
|
|
|
537
869
|
});
|
|
538
870
|
}
|
|
539
871
|
|
|
540
|
-
export { AVAILABLE_LANGUAGES, type ApiErrorBody, type ApiErrorIssue, type Buyer, type CashierId, type CashierListItem, type ClassifierSearchItem, type ClassifierType, type CreateCashierInput, type CreateCashierResponse, type CreateDepartmentInput, type CreateDepartmentResponse, type CreateOfferInput, type CreateOfferInputProduct, type CreateOfferInputService, type CreateOfferResponse, DEFAULT_API_URL, DEFAULT_TIMEOUT_MS, type DepartmentInput, type Discounts, type Language, type LocalizedName, type NewOffer, type Offer, type OfferTitle, type PrepaymentAmount, type PrepaymentDetail, REFUND_REASONS, type RefundAmount, type RefundItemInput, type RefundReason, type RegisterPrepaymentInput, type RegisterPrepaymentRefundInput, type RegisterPrepaymentRefundResponse, type RegisterPrepaymentResponse, type RegisterSaleInput, type RegisterSaleRefundInput, type RegisterSaleRefundResponse, type RegisterSaleResponse, type RequestOptions, type SaleAmount, type SaleData, type SaleDetail, type SaleItem, type SearchClassifierInput, type SendReceiptToBuyer, TAX_REGIMES, type TaxRegime, type Unit, VCRApiError, VCRClient, type VCRClientOptions, VCRError, VCRNetworkError, VCRValidationError, cashierListItemSchema, cashierListResponseSchema, classifierSearchItemSchema, classifierSearchResponseSchema, createCashierResponseSchema, createDepartmentResponseSchema, createOfferResponseSchema, prepaymentDetailResponseSchema, registerPrepaymentRefundResponseSchema, registerPrepaymentResponseSchema, registerSaleRefundResponseSchema, registerSaleResponseSchema, saleDetailResponseSchema, unitsKeys };
|
|
872
|
+
export { AVAILABLE_LANGUAGES, type ApiErrorBody, type ApiErrorIssue, type Buyer, type CashierId, type CashierListItem, type ClassifierSearchItem, type ClassifierType, type CreateCashierInput, type CreateCashierResponse, type CreateDepartmentInput, type CreateDepartmentResponse, type CreateOfferInput, type CreateOfferInputProduct, type CreateOfferInputService, type CreateOfferResponse, type CreateOfferTitle, type CurrencyConversionInput, type CustomerPrepaymentBalance, DEFAULT_API_URL, DEFAULT_TIMEOUT_MS, type DepartmentInput, type DepartmentListItem, type Discounts, type Language, type LegacyOfferTitle, type ListOffersFilter, type ListPrepaymentsFilter, type LocalizedName, type NewOffer, type Offer, type OfferListItem, type OfferTitle, type PrepaymentAmount, type PrepaymentDetail, type PrepaymentListItem, type PrepaymentState, REFUND_REASONS, type RefundAmount, type RefundItemInput, type RefundReason, type RegisterPrepaymentInput, type RegisterPrepaymentRefundInput, type RegisterPrepaymentRefundResponse, type RegisterPrepaymentResponse, type RegisterSaleInput, type RegisterSaleRefundInput, type RegisterSaleRefundResponse, type RegisterSaleResponse, type RequestOptions, type SaleAmount, type SaleData, type SaleDetail, type SaleItem, type SearchClassifierInput, type SendReceiptToBuyer, TAX_REGIMES, type TaxRegime, type Unit, type UpdateOfferInput, VCRApiError, VCRClient, type VCRClientOptions, VCRError, VCRNetworkError, VCRValidationError, type Whoami, cashierListItemSchema, cashierListResponseSchema, classifierSearchItemSchema, classifierSearchResponseSchema, createCashierResponseSchema, createDepartmentResponseSchema, createOfferResponseSchema, customerPrepaymentBalanceResponseSchema, departmentListItemSchema, departmentListResponseSchema, offerListItemSchema, offerListResponseSchema, prepaymentDetailResponseSchema, prepaymentListItemSchema, prepaymentListResponseSchema, prepaymentStateSchema, registerPrepaymentRefundResponseSchema, registerPrepaymentResponseSchema, registerSaleRefundResponseSchema, registerSaleResponseSchema, saleDetailResponseSchema, unitsKeys, whoamiResponseSchema };
|