@kreiseck/kasseneck-api 1.11.0 → 1.11.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ Was vor 0.7.0 geschah, steht in der Commit-Historie (`git log`); ab hier wird
4
4
  es hier geführt. Ein Eintrag nennt die Änderung **und ihren Grund** —
5
5
  nur der Grund überlebt den nächsten Umbau.
6
6
 
7
+ ## 1.11.1
8
+
9
+ - `receiptSumCents`, `receiptSubSumCents` and the receipt layout count value vouchers with the opposite sign on a cancellation receipt; new helper `receiptValueVoucherSign`. Reason: the backend mirrors value vouchers onto a full cancellation with the same `action` and a positive value, and reverses the flow there (`receiptDueCents` already did). The cancellation of a sale paid partly with a value voucher (22.40, 17.50 by voucher, 4.90 cash) showed "Total -39.90" instead of the -4.90 actually refunded; the cancelled sale of a value voucher showed +30.00 instead of -30.00.
10
+ - On a cancellation receipt a mirrored promotional voucher no longer reduces `receiptSubSumCents`/`receiptSumCents`; the layout shows it as a reference without an amount. Reason: the backend takes the discount back through compensation items (`kind: 'discount'`, "Gutschein-Ausgleich") and applies a promo entry only to a positive bucket total, which a cancellation never has. The cancellation of a 34.30 sale with a 10.00 promotional voucher showed "Total -34.30" instead of the -24.30 refunded.
11
+ - Receipts other than cancellations print the same bytes as in 1.11.0.
12
+
7
13
  ## 1.11.0
8
14
 
9
15
  Shifts, cash position and drawer log at the register: `./pos` gains the six
@@ -1,5 +1,5 @@
1
1
  export { ReceiptType, type ReceiptTypeKey, VatRate, type VatRateKey, KeckPaymentMethod, type KeckPaymentMethodKey, CreditCardProvider, type CreditCardProviderKey, VoucherType, type VoucherTypeKey, VoucherAction, type VoucherActionKey, StripeLinkMode, type StripeLinkModeKey, } from './enums/index.js';
2
- export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
2
+ export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
3
3
  export { type AuthCredentials, type KasseneckAuth, type ApiKeyAuthOptions, type RegisterUserAuthOptions, apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, type HttpResponseLike, type HttpRequestInit, type FetchLike, type TransportOptions, type TransportBodyFields, type TransportCallOptions, type KasseneckTransport, type KasseneckBinaryTransport, type KasseneckPdfOrDataTransport, type PdfOrData, ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, type PublicCall, type PosCall, createTransport, createBinaryTransport, createPdfOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
4
4
  export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, } from './receipt/due.js';
5
5
  export { parseServerTimeStamp, toViennaWallClock, type ViennaWallClock } from './vienna-time.js';
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isReturnDisposition = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.RETURN_DISPOSITIONS = exports.receiptSumCents = exports.receiptSubSumCents = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = exports.StripeLinkMode = exports.VoucherAction = exports.VoucherType = exports.CreditCardProvider = exports.KeckPaymentMethod = exports.VatRate = exports.ReceiptType = void 0;
4
- exports.sellReceipt = exports.isOutcomeUnknown = exports.isKasseneckValidationError = exports.isKasseneckNetworkError = exports.isKasseneckHttpError = exports.isKasseneckAuthError = exports.isKasseneckApiError = exports.CLIENT_ERROR_CODES = exports.KasseneckValidationError = exports.KasseneckNetworkError = exports.KasseneckHttpError = exports.KasseneckAuthError = exports.KasseneckApiError = exports.createPdfOrDataTransport = exports.createBinaryTransport = exports.createTransport = exports.UNKNOWN_OUTCOME_CALLS = exports.POS_CALLS = exports.PUBLIC_CALLS = exports.ALL_CALLS = exports.DEFAULT_TIMEOUT_MS = exports.POS_BASE_URL = exports.DEFAULT_BASE_URL = exports.registerUserAuth = exports.apiKeyAuth = exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.asksRefundTip = exports.asksTipRefundSource = exports.cancellationCashRefundCents = exports.cancellationItemsForTip = exports.openStaffTipCents = exports.isTipRefundSource = exports.TIP_REFUND_SOURCES = exports.remainingQuantities = void 0;
5
- exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.mergePosSettings = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.toViennaWallClock = exports.parseServerTimeStamp = exports.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = exports.downloadDailyReport = exports.sendReceiptEmail = exports.checkVoucherCombinationError = exports.listMyCashregisters = exports.listMyReceipts = exports.getFirstReceiptDate = exports.generateFullReceiptId = exports.getReceiptWithCompany = exports.getReceipt = exports.zeroReceipt = exports.cancelReceipt = exports.receiptLayoutFromResult = exports.cardRefundReference = exports.paymentsExpectedCents = exports.sellReceiptWithCompany = void 0;
3
+ exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isReturnDisposition = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.RETURN_DISPOSITIONS = exports.receiptValueVoucherSign = exports.receiptSumCents = exports.receiptSubSumCents = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = exports.StripeLinkMode = exports.VoucherAction = exports.VoucherType = exports.CreditCardProvider = exports.KeckPaymentMethod = exports.VatRate = exports.ReceiptType = void 0;
4
+ exports.isOutcomeUnknown = exports.isKasseneckValidationError = exports.isKasseneckNetworkError = exports.isKasseneckHttpError = exports.isKasseneckAuthError = exports.isKasseneckApiError = exports.CLIENT_ERROR_CODES = exports.KasseneckValidationError = exports.KasseneckNetworkError = exports.KasseneckHttpError = exports.KasseneckAuthError = exports.KasseneckApiError = exports.createPdfOrDataTransport = exports.createBinaryTransport = exports.createTransport = exports.UNKNOWN_OUTCOME_CALLS = exports.POS_CALLS = exports.PUBLIC_CALLS = exports.ALL_CALLS = exports.DEFAULT_TIMEOUT_MS = exports.POS_BASE_URL = exports.DEFAULT_BASE_URL = exports.registerUserAuth = exports.apiKeyAuth = exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.asksRefundTip = exports.asksTipRefundSource = exports.cancellationCashRefundCents = exports.cancellationItemsForTip = exports.openStaffTipCents = exports.isTipRefundSource = exports.TIP_REFUND_SOURCES = exports.remainingQuantities = exports.receiptFieldErrors = void 0;
5
+ exports.stockViewOf = exports.receiptsScopeOf = exports.cancelScopeOf = exports.distributeDiscount = exports.setMyRegisterDeviceSettings = exports.setMyPosSettings = exports.getPosSettings = exports.listMyArticles = exports.listMyArticleGroups = exports.fromPosArticlePayload = exports.fromArticleGroupPayload = exports.mergePosSettings = exports.POS_DEVICE_DEFAULTS = exports.POS_BUSINESS_DEFAULTS = exports.toViennaWallClock = exports.parseServerTimeStamp = exports.isReceiptDueError = exports.RECEIPT_DUE_ERROR_REASONS = exports.ReceiptDueError = exports.receiptDueBreakdown = exports.receiptDueCents = exports.createKasseneckApi = exports.getSignatureStatus = exports.getCashboxStatus = exports.getReportV2 = exports.getCashregisterReport = exports.downloadMonthlyReport = exports.downloadDailyReport = exports.sendReceiptEmail = exports.checkVoucherCombinationError = exports.listMyCashregisters = exports.listMyReceipts = exports.getFirstReceiptDate = exports.generateFullReceiptId = exports.getReceiptWithCompany = exports.getReceipt = exports.zeroReceipt = exports.cancelReceipt = exports.receiptLayoutFromResult = exports.cardRefundReference = exports.paymentsExpectedCents = exports.sellReceiptWithCompany = exports.sellReceipt = void 0;
6
6
  var index_js_1 = require("./enums/index.js");
7
7
  Object.defineProperty(exports, "ReceiptType", { enumerable: true, get: function () { return index_js_1.ReceiptType; } });
8
8
  Object.defineProperty(exports, "VatRate", { enumerable: true, get: function () { return index_js_1.VatRate; } });
@@ -25,6 +25,7 @@ Object.defineProperty(exports, "toReceiptPayload", { enumerable: true, get: func
25
25
  Object.defineProperty(exports, "fromReceiptPayload", { enumerable: true, get: function () { return index_js_2.fromReceiptPayload; } });
26
26
  Object.defineProperty(exports, "receiptSubSumCents", { enumerable: true, get: function () { return index_js_2.receiptSubSumCents; } });
27
27
  Object.defineProperty(exports, "receiptSumCents", { enumerable: true, get: function () { return index_js_2.receiptSumCents; } });
28
+ Object.defineProperty(exports, "receiptValueVoucherSign", { enumerable: true, get: function () { return index_js_2.receiptValueVoucherSign; } });
28
29
  Object.defineProperty(exports, "RETURN_DISPOSITIONS", { enumerable: true, get: function () { return index_js_2.RETURN_DISPOSITIONS; } });
29
30
  Object.defineProperty(exports, "CANCELLATION_REASONS", { enumerable: true, get: function () { return index_js_2.CANCELLATION_REASONS; } });
30
31
  Object.defineProperty(exports, "CANCELLATION_STATUSES", { enumerable: true, get: function () { return index_js_2.CANCELLATION_STATUSES; } });
@@ -1,6 +1,6 @@
1
1
  export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isDiscountItem, } from './receipt-item.js';
2
2
  export { type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid } from './voucher.js';
3
- export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, } from './receipt.js';
3
+ export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, } from './receipt.js';
4
4
  export { type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, } from './cancellation.js';
5
5
  export { type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, } from './receipt-payment.js';
6
6
  export { type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError } from './payment-errors.js';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isReceiptErrorCode = exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.asksRefundTip = exports.asksTipRefundSource = exports.cancellationCashRefundCents = exports.cancellationItemsForTip = exports.openStaffTipCents = exports.isTipRefundSource = exports.TIP_REFUND_SOURCES = exports.remainingQuantities = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isReturnDisposition = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.RETURN_DISPOSITIONS = exports.receiptSumCents = exports.receiptSubSumCents = exports.readRegistrationInfo = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isDiscountItem = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = void 0;
4
- exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = void 0;
3
+ exports.RECEIPT_ERROR_CODES = exports.receiptEmailFieldErrors = exports.isReceiptEmailError = exports.receiptEmailErrorCode = exports.isReceiptEmailErrorCode = exports.RECEIPT_EMAIL_VIAS = exports.RECEIPT_EMAIL_SEND_ERROR_CODES = exports.RECEIPT_EMAIL_ERROR_CODES = exports.paymentFieldErrors = exports.isPaymentError = exports.paymentErrorCode = exports.isPaymentErrorCode = exports.PAYMENT_ERROR_CODES = exports.toReceiptPaymentPayload = exports.fromReceiptPaymentPayload = exports.asksRefundTip = exports.asksTipRefundSource = exports.cancellationCashRefundCents = exports.cancellationItemsForTip = exports.openStaffTipCents = exports.isTipRefundSource = exports.TIP_REFUND_SOURCES = exports.remainingQuantities = exports.cancellationFieldErrors = exports.isCancellationError = exports.cancellationErrorCode = exports.isCancellationErrorCode = exports.isReturnDisposition = exports.isCancellationReason = exports.CANCELLATION_RESERVATION_MS = exports.CANCELLATION_ERROR_CODES = exports.CANCELLATION_STATUSES = exports.CANCELLATION_REASONS = exports.RETURN_DISPOSITIONS = exports.receiptValueVoucherSign = exports.receiptSumCents = exports.receiptSubSumCents = exports.readRegistrationInfo = exports.fromReceiptPayload = exports.toReceiptPayload = exports.voucherIsValid = exports.fromVoucherPayload = exports.toVoucherPayload = exports.isDiscountItem = exports.isTipItem = exports.negateReceiptItem = exports.receiptItemIsValid = exports.receiptItemTotalCents = exports.fromReceiptItemPayload = exports.toReceiptItemPayload = void 0;
4
+ exports.hobexReceiptNeedsSignature = exports.hobexReceiptToCardPaymentData = exports.fromHobexReceiptPayload = exports.toHobexReceiptPayload = exports.fromStripeUrlSessionPayload = exports.toStripeUrlSessionPayload = exports.reportMonthReadable = exports.reportMonthKey = exports.nextReportMonth = exports.previousReportMonth = exports.reportMonthFromDate = exports.isZeroKind = exports.ZERO_KINDS = exports.fromReceiptSummaryPayload = exports.fromCashregisterPayload = exports.receiptCompanyTaxInfo = exports.fromReceiptCompanyPayload = exports.receiptFieldErrors = exports.isReceiptError = exports.receiptErrorCode = exports.isReceiptErrorCode = void 0;
5
5
  var receipt_item_js_1 = require("./receipt-item.js");
6
6
  Object.defineProperty(exports, "toReceiptItemPayload", { enumerable: true, get: function () { return receipt_item_js_1.toReceiptItemPayload; } });
7
7
  Object.defineProperty(exports, "fromReceiptItemPayload", { enumerable: true, get: function () { return receipt_item_js_1.fromReceiptItemPayload; } });
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "fromReceiptPayload", { enumerable: true, get: fu
20
20
  Object.defineProperty(exports, "readRegistrationInfo", { enumerable: true, get: function () { return receipt_js_1.readRegistrationInfo; } });
21
21
  Object.defineProperty(exports, "receiptSubSumCents", { enumerable: true, get: function () { return receipt_js_1.receiptSubSumCents; } });
22
22
  Object.defineProperty(exports, "receiptSumCents", { enumerable: true, get: function () { return receipt_js_1.receiptSumCents; } });
23
+ Object.defineProperty(exports, "receiptValueVoucherSign", { enumerable: true, get: function () { return receipt_js_1.receiptValueVoucherSign; } });
23
24
  var cancellation_js_1 = require("./cancellation.js");
24
25
  Object.defineProperty(exports, "RETURN_DISPOSITIONS", { enumerable: true, get: function () { return cancellation_js_1.RETURN_DISPOSITIONS; } });
25
26
  Object.defineProperty(exports, "CANCELLATION_REASONS", { enumerable: true, get: function () { return cancellation_js_1.CANCELLATION_REASONS; } });
@@ -143,11 +143,29 @@ export declare function readRegistrationInfo(roh: {
143
143
  cardRegisteredAt?: unknown;
144
144
  cashregisterRegisteredAt?: unknown;
145
145
  }): RegistrationInfo;
146
+ /**
147
+ * Vorzeichen der Wertgutscheine am Beleg: am Storno-Beleg -1, sonst 1.
148
+ *
149
+ * Das Backend spiegelt Wertgutscheine beim Vollstorno mit UNVERAENDERTER
150
+ * `action` und positivem Wert (storno-core.stornoVouchers); der Fluss dreht
151
+ * sich am Storno um (zahlungen-core.wertgutscheinFlussCents, hier
152
+ * `receiptDueCents`): ein verkaufter Gutschein wird zurueckgezahlt, ein
153
+ * eingeloester mindert die Rueckzahlung.
154
+ */
155
+ export declare function receiptValueVoucherSign(receipt: Receipt): 1 | -1;
146
156
  /**
147
157
  * Zwischensumme in **Cent** — Positionen plus verkaufte Wertgutscheine minus
148
158
  * eingeloeste Promotionsgutscheine. Wertgutschein-Einloesungen wirken erst auf
149
159
  * [receiptSumCents], nicht hier (siehe Dart-Vorbild `subSumCents`/`sumCents`).
160
+ * Am Storno-Beleg zaehlen Wertgutscheine mit umgekehrtem Vorzeichen
161
+ * ([receiptValueVoucherSign]), und ein gespiegelter Promotionsgutschein
162
+ * mindert nichts: den Rabatt nimmt der Server dort ueber Ausgleichspositionen
163
+ * (`kind: 'discount'`) zurueck, und belegToepfe verteilt einen Promo-Eintrag
164
+ * nur auf eine positive Topfsumme, die ein Storno nie hat.
150
165
  */
151
166
  export declare function receiptSubSumCents(receipt: Receipt): number;
152
- /** Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine. */
167
+ /**
168
+ * Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine
169
+ * (am Storno-Beleg plus, siehe [receiptValueVoucherSign]).
170
+ */
153
171
  export declare function receiptSumCents(receipt: Receipt): number;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toReceiptPayload = toReceiptPayload;
4
4
  exports.fromReceiptPayload = fromReceiptPayload;
5
5
  exports.readRegistrationInfo = readRegistrationInfo;
6
+ exports.receiptValueVoucherSign = receiptValueVoucherSign;
6
7
  exports.receiptSubSumCents = receiptSubSumCents;
7
8
  exports.receiptSumCents = receiptSumCents;
8
9
  const index_js_1 = require("../enums/index.js");
@@ -134,29 +135,52 @@ function gueltigeRueckzahlungen(rueckzahlungen) {
134
135
  }
135
136
  return raus;
136
137
  }
138
+ /**
139
+ * Vorzeichen der Wertgutscheine am Beleg: am Storno-Beleg -1, sonst 1.
140
+ *
141
+ * Das Backend spiegelt Wertgutscheine beim Vollstorno mit UNVERAENDERTER
142
+ * `action` und positivem Wert (storno-core.stornoVouchers); der Fluss dreht
143
+ * sich am Storno um (zahlungen-core.wertgutscheinFlussCents, hier
144
+ * `receiptDueCents`): ein verkaufter Gutschein wird zurueckgezahlt, ein
145
+ * eingeloester mindert die Rueckzahlung.
146
+ */
147
+ function receiptValueVoucherSign(receipt) {
148
+ const typ = typeof receipt.receiptType === 'object' ? receipt.receiptType.value : receipt.receiptType;
149
+ return typ === index_js_1.ReceiptType.cancellation.value ? -1 : 1;
150
+ }
137
151
  /**
138
152
  * Zwischensumme in **Cent** — Positionen plus verkaufte Wertgutscheine minus
139
153
  * eingeloeste Promotionsgutscheine. Wertgutschein-Einloesungen wirken erst auf
140
154
  * [receiptSumCents], nicht hier (siehe Dart-Vorbild `subSumCents`/`sumCents`).
155
+ * Am Storno-Beleg zaehlen Wertgutscheine mit umgekehrtem Vorzeichen
156
+ * ([receiptValueVoucherSign]), und ein gespiegelter Promotionsgutschein
157
+ * mindert nichts: den Rabatt nimmt der Server dort ueber Ausgleichspositionen
158
+ * (`kind: 'discount'`) zurueck, und belegToepfe verteilt einen Promo-Eintrag
159
+ * nur auf eine positive Topfsumme, die ein Storno nie hat.
141
160
  */
142
161
  function receiptSubSumCents(receipt) {
162
+ const vz = receiptValueVoucherSign(receipt);
143
163
  let cents = receipt.items.reduce((acc, item) => acc + (0, receipt_item_js_1.receiptItemTotalCents)(item), 0);
144
164
  for (const voucher of receipt.vouchers) {
145
- if (voucher.action === index_js_1.VoucherAction.redeem && voucher.type === index_js_1.VoucherType.promo) {
165
+ if (vz === 1 && voucher.action === index_js_1.VoucherAction.redeem && voucher.type === index_js_1.VoucherType.promo) {
146
166
  cents -= voucher.valueCents ?? 0;
147
167
  }
148
168
  if (voucher.action === index_js_1.VoucherAction.sell && voucher.type === index_js_1.VoucherType.value) {
149
- cents += voucher.valueCents ?? 0;
169
+ cents += vz * (voucher.valueCents ?? 0);
150
170
  }
151
171
  }
152
172
  return cents;
153
173
  }
154
- /** Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine. */
174
+ /**
175
+ * Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine
176
+ * (am Storno-Beleg plus, siehe [receiptValueVoucherSign]).
177
+ */
155
178
  function receiptSumCents(receipt) {
179
+ const vz = receiptValueVoucherSign(receipt);
156
180
  let cents = receiptSubSumCents(receipt);
157
181
  for (const voucher of receipt.vouchers) {
158
182
  if (voucher.action === index_js_1.VoucherAction.redeem && voucher.type === index_js_1.VoucherType.value) {
159
- cents -= voucher.valueCents ?? 0;
183
+ cents -= vz * (voucher.valueCents ?? 0);
160
184
  }
161
185
  }
162
186
  return cents;
@@ -958,28 +958,35 @@ function buildReceiptLayout(receipt, company, options = {}) {
958
958
  }
959
959
  // --- Gutscheine: verkaufte Wertgutscheine sind Umsatz zu 0 %, eingeloeste
960
960
  // Promotionsgutscheine mindern die Steuergruppen anteilig.
961
+ // Am Storno-Beleg zaehlen Wertgutscheine mit umgekehrtem Vorzeichen
962
+ // (receiptValueVoucherSign): der verkaufte wird zurueckgezahlt.
963
+ const wgVz = (0, index_js_2.receiptValueVoucherSign)(receipt);
961
964
  let promoCents = 0;
962
965
  for (const voucher of receipt.vouchers) {
963
966
  const wert = voucher.valueCents ?? 0;
967
+ const vz = voucher.type === index_js_1.VoucherType.value ? wgVz : 1;
964
968
  if ((0, index_js_2.voucherIsValid)(voucher) && voucher.action === index_js_1.VoucherAction.sell) {
965
- gruppeVon(steuersatz(index_js_1.VatRate.vat0)).bruttoCents += wert;
969
+ gruppeVon(steuersatz(index_js_1.VatRate.vat0)).bruttoCents += vz * wert;
966
970
  }
967
971
  if (voucher.action === index_js_1.VoucherAction.sell && voucher.type === index_js_1.VoucherType.value) {
968
972
  lines.push({
969
973
  kind: 'columns',
970
974
  columns: [
971
975
  { text: `1 x ${gutscheinText(voucher)}`, width: 7, align: 'left' },
972
- { text: `${formatCents(wert)} ${index_js_1.VatRate.vat0.category}`, width: 5, align: 'right' },
976
+ { text: `${formatCents(vz * wert)} ${index_js_1.VatRate.vat0.category}`, width: 5, align: 'right' },
973
977
  ],
974
978
  });
975
979
  }
976
980
  if (voucher.action === index_js_1.VoucherAction.redeem && voucher.type === index_js_1.VoucherType.promo) {
977
- promoCents += wert;
981
+ // Am Storno-Beleg steht der Promotionsgutschein nur als Bezug: den Rabatt
982
+ // nimmt dort die Position „Gutschein-Ausgleich“ zurueck (receiptSubSumCents).
983
+ if (wgVz === 1)
984
+ promoCents += wert;
978
985
  lines.push({
979
986
  kind: 'columns',
980
987
  columns: [
981
988
  { text: gutscheinText(voucher), width: 7, align: 'left' },
982
- { text: `-${formatCents(wert)} €`, width: 5, align: 'right' },
989
+ { text: wgVz === 1 ? `-${formatCents(wert)} €` : '', width: 5, align: 'right' },
983
990
  ],
984
991
  });
985
992
  }
@@ -1030,7 +1037,9 @@ function buildReceiptLayout(receipt, company, options = {}) {
1030
1037
  if (voucher.action === index_js_1.VoucherAction.redeem && voucher.type === index_js_1.VoucherType.value) {
1031
1038
  // Breite 8:4 — "Wertgutschein GS-1" (Label + Code) passt so auf 58 mm
1032
1039
  // in die Zeile, statt den Code in eine Folgezeile fliessen zu lassen.
1033
- lines.push(paarZeile(gutscheinText(voucher), `-${formatCents(voucher.valueCents ?? 0)} €`, 8, 4));
1040
+ // Am Storno-Beleg geht der Wert auf den Gutschein zurueck: ohne Minus.
1041
+ const wert = voucher.valueCents ?? 0;
1042
+ lines.push(paarZeile(gutscheinText(voucher), wgVz === 1 ? `-${formatCents(wert)} €` : `${formatCents(wert)} €`, 8, 4));
1034
1043
  }
1035
1044
  }
1036
1045
  lines.push({ kind: 'rule', char: '-' });
@@ -4,4 +4,4 @@
4
4
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
5
5
  * beim Anheben der Version beide Stellen aendern.
6
6
  */
7
- export declare const PACKAGE_VERSION = "1.11.0";
7
+ export declare const PACKAGE_VERSION = "1.11.1";
@@ -7,4 +7,4 @@ exports.PACKAGE_VERSION = void 0;
7
7
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
8
8
  * beim Anheben der Version beide Stellen aendern.
9
9
  */
10
- exports.PACKAGE_VERSION = '1.11.0';
10
+ exports.PACKAGE_VERSION = '1.11.1';
@@ -1,5 +1,5 @@
1
1
  export { ReceiptType, type ReceiptTypeKey, VatRate, type VatRateKey, KeckPaymentMethod, type KeckPaymentMethodKey, CreditCardProvider, type CreditCardProviderKey, VoucherType, type VoucherTypeKey, VoucherAction, type VoucherActionKey, StripeLinkMode, type StripeLinkModeKey, } from './enums/index.js';
2
- export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
2
+ export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid, type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError, type ReceiptEmailErrorCode, type ReceiptEmailVia, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, type ReceiptEmailSendErrorCode, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, type ReceiptEmailFieldError, type ReceiptErrorCode, type ReceiptFieldError, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, type ReceiptCompany, type ReceiptCompanyPayload, fromReceiptCompanyPayload, receiptCompanyTaxInfo, type Cashregister, type CashregisterOnboarding, type CashregisterPayload, type CashregisterOnboardingPayload, type CashregisterAutoLogout, type CashregisterAutoLogoutPayload, fromCashregisterPayload, type ReceiptSummary, type ReceiptSummaryPayload, fromReceiptSummaryPayload, type ZeroKind, ZERO_KINDS, isZeroKind, type ReportMonth, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, type StripeUrlSession, type StripeUrlSessionPayload, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, type HobexReceipt, type HobexReceiptPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
3
3
  export { type AuthCredentials, type KasseneckAuth, type ApiKeyAuthOptions, type RegisterUserAuthOptions, apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, type HttpResponseLike, type HttpRequestInit, type FetchLike, type TransportOptions, type TransportBodyFields, type TransportCallOptions, type KasseneckTransport, type KasseneckBinaryTransport, type KasseneckPdfOrDataTransport, type PdfOrData, ALL_CALLS, type ApiCall, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, type PublicCall, type PosCall, createTransport, createBinaryTransport, createPdfOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, type ValidationScope, type KasseneckError, type HttpFailureReason, type CauseDigest, type ErrorOutcome, CLIENT_ERROR_CODES, type ClientErrorCode, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, type ReceiptCommonOptions, type SellReceiptOptions, type TipOptions, type TipRecipientShare, type CancelReceiptOptions, type CancelReceiptResult, type ReceiptWithCompany, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, type ListMyReceiptsOptions, type ReceiptList, type ReceiptListStats, listMyCashregisters, checkVoucherCombinationError, type SendReceiptEmailOptions, type SendReceiptEmailResult, sendReceiptEmail, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, type CashregisterReportPeriod, getReportV2, type ReportV2, type ReportV2Metadata, type ReportV2Options, type CashboxStatus, type SignatureStatus, getCashboxStatus, getSignatureStatus, type KasseneckApi, createKasseneckApi, } from './client/index.js';
4
4
  export { type ReceiptDueTip, type ReceiptDueTipRecipient, type ReceiptDueOptions, type ReceiptDueBuckets, type ReceiptDueBreakdown, type ReceiptDueErrorReason, receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, } from './receipt/due.js';
5
5
  export { parseServerTimeStamp, toViennaWallClock, type ViennaWallClock } from './vienna-time.js';
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { ReceiptType, VatRate, KeckPaymentMethod, CreditCardProvider, VoucherType, VoucherAction, StripeLinkMode, } from './enums/index.js';
2
- export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, toVoucherPayload, fromVoucherPayload, voucherIsValid, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, fromReceiptPaymentPayload, toReceiptPaymentPayload, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, fromReceiptCompanyPayload, receiptCompanyTaxInfo, fromCashregisterPayload, fromReceiptSummaryPayload, ZERO_KINDS, isZeroKind, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
2
+ export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, toVoucherPayload, fromVoucherPayload, voucherIsValid, toReceiptPayload, fromReceiptPayload, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, fromReceiptPaymentPayload, toReceiptPaymentPayload, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, RECEIPT_EMAIL_ERROR_CODES, RECEIPT_EMAIL_SEND_ERROR_CODES, RECEIPT_EMAIL_VIAS, isReceiptEmailErrorCode, receiptEmailErrorCode, isReceiptEmailError, receiptEmailFieldErrors, RECEIPT_ERROR_CODES, isReceiptErrorCode, receiptErrorCode, isReceiptError, receiptFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, fromReceiptCompanyPayload, receiptCompanyTaxInfo, fromCashregisterPayload, fromReceiptSummaryPayload, ZERO_KINDS, isZeroKind, reportMonthFromDate, previousReportMonth, nextReportMonth, reportMonthKey, reportMonthReadable, toStripeUrlSessionPayload, fromStripeUrlSessionPayload, toHobexReceiptPayload, fromHobexReceiptPayload, hobexReceiptToCardPaymentData, hobexReceiptNeedsSignature, } from './models/index.js';
3
3
  export { apiKeyAuth, registerUserAuth, DEFAULT_BASE_URL, POS_BASE_URL, DEFAULT_TIMEOUT_MS, ALL_CALLS, PUBLIC_CALLS, POS_CALLS, UNKNOWN_OUTCOME_CALLS, createTransport, createBinaryTransport, createPdfOrDataTransport, KasseneckApiError, KasseneckAuthError, KasseneckHttpError, KasseneckNetworkError, KasseneckValidationError, CLIENT_ERROR_CODES, isKasseneckApiError, isKasseneckAuthError, isKasseneckHttpError, isKasseneckNetworkError, isKasseneckValidationError, isOutcomeUnknown, sellReceipt, sellReceiptWithCompany, paymentsExpectedCents, cardRefundReference, receiptLayoutFromResult, cancelReceipt, zeroReceipt, getReceipt, getReceiptWithCompany, generateFullReceiptId, getFirstReceiptDate, listMyReceipts, listMyCashregisters, checkVoucherCombinationError, sendReceiptEmail, downloadDailyReport, downloadMonthlyReport, getCashregisterReport, getReportV2, getCashboxStatus, getSignatureStatus, createKasseneckApi, } from './client/index.js';
4
4
  export { receiptDueCents, receiptDueBreakdown, ReceiptDueError, RECEIPT_DUE_ERROR_REASONS, isReceiptDueError, } from './receipt/due.js';
5
5
  export { parseServerTimeStamp, toViennaWallClock } from './vienna-time.js';
@@ -1,6 +1,6 @@
1
1
  export { type ReceiptItem, type ReceiptItemPayload, type ReceiptItemPayloadRead, toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, type TipRecipient, isTipItem, isDiscountItem, } from './receipt-item.js';
2
2
  export { type Voucher, type VoucherPayload, toVoucherPayload, fromVoucherPayload, voucherIsValid } from './voucher.js';
3
- export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, } from './receipt.js';
3
+ export { type Receipt, type RegistrationInfo, type ReceiptPayload, type ReceiptPayloadRead, toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, } from './receipt.js';
4
4
  export { type CancellationOf, type CancellationItem, type Cancellation, type CancellationReason, type CancellationErrorCode, type CancellationStatus, type ReturnDisposition, RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, type CancellationFieldError, remainingQuantities, TIP_REFUND_SOURCES, type TipRefundSource, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, } from './cancellation.js';
5
5
  export { type ReceiptPayment, type ReceiptPaymentPayload, type ReceiptPaymentInput, fromReceiptPaymentPayload, toReceiptPaymentPayload, } from './receipt-payment.js';
6
6
  export { type PaymentErrorCode, PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors, type PaymentFieldError } from './payment-errors.js';
@@ -1,6 +1,6 @@
1
1
  export { toReceiptItemPayload, fromReceiptItemPayload, receiptItemTotalCents, receiptItemIsValid, negateReceiptItem, isTipItem, isDiscountItem, } from './receipt-item.js';
2
2
  export { toVoucherPayload, fromVoucherPayload, voucherIsValid } from './voucher.js';
3
- export { toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, } from './receipt.js';
3
+ export { toReceiptPayload, fromReceiptPayload, readRegistrationInfo, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, } from './receipt.js';
4
4
  export { RETURN_DISPOSITIONS, CANCELLATION_REASONS, CANCELLATION_STATUSES, CANCELLATION_ERROR_CODES, CANCELLATION_RESERVATION_MS, isCancellationReason, isReturnDisposition, isCancellationErrorCode, cancellationErrorCode, isCancellationError, cancellationFieldErrors, remainingQuantities, TIP_REFUND_SOURCES, isTipRefundSource, openStaffTipCents, cancellationItemsForTip, cancellationCashRefundCents, asksTipRefundSource, asksRefundTip, } from './cancellation.js';
5
5
  export { fromReceiptPaymentPayload, toReceiptPaymentPayload, } from './receipt-payment.js';
6
6
  export { PAYMENT_ERROR_CODES, isPaymentErrorCode, paymentErrorCode, isPaymentError, paymentFieldErrors } from './payment-errors.js';
@@ -143,11 +143,29 @@ export declare function readRegistrationInfo(roh: {
143
143
  cardRegisteredAt?: unknown;
144
144
  cashregisterRegisteredAt?: unknown;
145
145
  }): RegistrationInfo;
146
+ /**
147
+ * Vorzeichen der Wertgutscheine am Beleg: am Storno-Beleg -1, sonst 1.
148
+ *
149
+ * Das Backend spiegelt Wertgutscheine beim Vollstorno mit UNVERAENDERTER
150
+ * `action` und positivem Wert (storno-core.stornoVouchers); der Fluss dreht
151
+ * sich am Storno um (zahlungen-core.wertgutscheinFlussCents, hier
152
+ * `receiptDueCents`): ein verkaufter Gutschein wird zurueckgezahlt, ein
153
+ * eingeloester mindert die Rueckzahlung.
154
+ */
155
+ export declare function receiptValueVoucherSign(receipt: Receipt): 1 | -1;
146
156
  /**
147
157
  * Zwischensumme in **Cent** — Positionen plus verkaufte Wertgutscheine minus
148
158
  * eingeloeste Promotionsgutscheine. Wertgutschein-Einloesungen wirken erst auf
149
159
  * [receiptSumCents], nicht hier (siehe Dart-Vorbild `subSumCents`/`sumCents`).
160
+ * Am Storno-Beleg zaehlen Wertgutscheine mit umgekehrtem Vorzeichen
161
+ * ([receiptValueVoucherSign]), und ein gespiegelter Promotionsgutschein
162
+ * mindert nichts: den Rabatt nimmt der Server dort ueber Ausgleichspositionen
163
+ * (`kind: 'discount'`) zurueck, und belegToepfe verteilt einen Promo-Eintrag
164
+ * nur auf eine positive Topfsumme, die ein Storno nie hat.
150
165
  */
151
166
  export declare function receiptSubSumCents(receipt: Receipt): number;
152
- /** Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine. */
167
+ /**
168
+ * Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine
169
+ * (am Storno-Beleg plus, siehe [receiptValueVoucherSign]).
170
+ */
153
171
  export declare function receiptSumCents(receipt: Receipt): number;
@@ -127,29 +127,52 @@ function gueltigeRueckzahlungen(rueckzahlungen) {
127
127
  }
128
128
  return raus;
129
129
  }
130
+ /**
131
+ * Vorzeichen der Wertgutscheine am Beleg: am Storno-Beleg -1, sonst 1.
132
+ *
133
+ * Das Backend spiegelt Wertgutscheine beim Vollstorno mit UNVERAENDERTER
134
+ * `action` und positivem Wert (storno-core.stornoVouchers); der Fluss dreht
135
+ * sich am Storno um (zahlungen-core.wertgutscheinFlussCents, hier
136
+ * `receiptDueCents`): ein verkaufter Gutschein wird zurueckgezahlt, ein
137
+ * eingeloester mindert die Rueckzahlung.
138
+ */
139
+ export function receiptValueVoucherSign(receipt) {
140
+ const typ = typeof receipt.receiptType === 'object' ? receipt.receiptType.value : receipt.receiptType;
141
+ return typ === ReceiptType.cancellation.value ? -1 : 1;
142
+ }
130
143
  /**
131
144
  * Zwischensumme in **Cent** — Positionen plus verkaufte Wertgutscheine minus
132
145
  * eingeloeste Promotionsgutscheine. Wertgutschein-Einloesungen wirken erst auf
133
146
  * [receiptSumCents], nicht hier (siehe Dart-Vorbild `subSumCents`/`sumCents`).
147
+ * Am Storno-Beleg zaehlen Wertgutscheine mit umgekehrtem Vorzeichen
148
+ * ([receiptValueVoucherSign]), und ein gespiegelter Promotionsgutschein
149
+ * mindert nichts: den Rabatt nimmt der Server dort ueber Ausgleichspositionen
150
+ * (`kind: 'discount'`) zurueck, und belegToepfe verteilt einen Promo-Eintrag
151
+ * nur auf eine positive Topfsumme, die ein Storno nie hat.
134
152
  */
135
153
  export function receiptSubSumCents(receipt) {
154
+ const vz = receiptValueVoucherSign(receipt);
136
155
  let cents = receipt.items.reduce((acc, item) => acc + receiptItemTotalCents(item), 0);
137
156
  for (const voucher of receipt.vouchers) {
138
- if (voucher.action === VoucherAction.redeem && voucher.type === VoucherType.promo) {
157
+ if (vz === 1 && voucher.action === VoucherAction.redeem && voucher.type === VoucherType.promo) {
139
158
  cents -= voucher.valueCents ?? 0;
140
159
  }
141
160
  if (voucher.action === VoucherAction.sell && voucher.type === VoucherType.value) {
142
- cents += voucher.valueCents ?? 0;
161
+ cents += vz * (voucher.valueCents ?? 0);
143
162
  }
144
163
  }
145
164
  return cents;
146
165
  }
147
- /** Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine. */
166
+ /**
167
+ * Gesamtsumme in **Cent** — Zwischensumme minus eingeloeste Wertgutscheine
168
+ * (am Storno-Beleg plus, siehe [receiptValueVoucherSign]).
169
+ */
148
170
  export function receiptSumCents(receipt) {
171
+ const vz = receiptValueVoucherSign(receipt);
149
172
  let cents = receiptSubSumCents(receipt);
150
173
  for (const voucher of receipt.vouchers) {
151
174
  if (voucher.action === VoucherAction.redeem && voucher.type === VoucherType.value) {
152
- cents -= voucher.valueCents ?? 0;
175
+ cents -= vz * (voucher.valueCents ?? 0);
153
176
  }
154
177
  }
155
178
  return cents;
@@ -1,5 +1,5 @@
1
1
  import { VatRate, VoucherAction, VoucherType } from '../enums/index.js';
2
- import { CANCELLATION_REASONS, isCancellationReason, receiptCompanyTaxInfo, receiptItemTotalCents, isDiscountItem, isTipItem, receiptSubSumCents, receiptSumCents, voucherIsValid, } from '../models/index.js';
2
+ import { CANCELLATION_REASONS, isCancellationReason, receiptCompanyTaxInfo, receiptItemTotalCents, isDiscountItem, isTipItem, receiptSubSumCents, receiptSumCents, receiptValueVoucherSign, voucherIsValid, } from '../models/index.js';
3
3
  import { parseServerTimeStamp, toViennaWallClock } from '../vienna-time.js';
4
4
  import { KasseneckValidationError } from '../client/errors.js';
5
5
  export const CURRENT_LAYOUT_RULESET = 2;
@@ -946,28 +946,35 @@ export function buildReceiptLayout(receipt, company, options = {}) {
946
946
  }
947
947
  // --- Gutscheine: verkaufte Wertgutscheine sind Umsatz zu 0 %, eingeloeste
948
948
  // Promotionsgutscheine mindern die Steuergruppen anteilig.
949
+ // Am Storno-Beleg zaehlen Wertgutscheine mit umgekehrtem Vorzeichen
950
+ // (receiptValueVoucherSign): der verkaufte wird zurueckgezahlt.
951
+ const wgVz = receiptValueVoucherSign(receipt);
949
952
  let promoCents = 0;
950
953
  for (const voucher of receipt.vouchers) {
951
954
  const wert = voucher.valueCents ?? 0;
955
+ const vz = voucher.type === VoucherType.value ? wgVz : 1;
952
956
  if (voucherIsValid(voucher) && voucher.action === VoucherAction.sell) {
953
- gruppeVon(steuersatz(VatRate.vat0)).bruttoCents += wert;
957
+ gruppeVon(steuersatz(VatRate.vat0)).bruttoCents += vz * wert;
954
958
  }
955
959
  if (voucher.action === VoucherAction.sell && voucher.type === VoucherType.value) {
956
960
  lines.push({
957
961
  kind: 'columns',
958
962
  columns: [
959
963
  { text: `1 x ${gutscheinText(voucher)}`, width: 7, align: 'left' },
960
- { text: `${formatCents(wert)} ${VatRate.vat0.category}`, width: 5, align: 'right' },
964
+ { text: `${formatCents(vz * wert)} ${VatRate.vat0.category}`, width: 5, align: 'right' },
961
965
  ],
962
966
  });
963
967
  }
964
968
  if (voucher.action === VoucherAction.redeem && voucher.type === VoucherType.promo) {
965
- promoCents += wert;
969
+ // Am Storno-Beleg steht der Promotionsgutschein nur als Bezug: den Rabatt
970
+ // nimmt dort die Position „Gutschein-Ausgleich“ zurueck (receiptSubSumCents).
971
+ if (wgVz === 1)
972
+ promoCents += wert;
966
973
  lines.push({
967
974
  kind: 'columns',
968
975
  columns: [
969
976
  { text: gutscheinText(voucher), width: 7, align: 'left' },
970
- { text: `-${formatCents(wert)} €`, width: 5, align: 'right' },
977
+ { text: wgVz === 1 ? `-${formatCents(wert)} €` : '', width: 5, align: 'right' },
971
978
  ],
972
979
  });
973
980
  }
@@ -1018,7 +1025,9 @@ export function buildReceiptLayout(receipt, company, options = {}) {
1018
1025
  if (voucher.action === VoucherAction.redeem && voucher.type === VoucherType.value) {
1019
1026
  // Breite 8:4 — "Wertgutschein GS-1" (Label + Code) passt so auf 58 mm
1020
1027
  // in die Zeile, statt den Code in eine Folgezeile fliessen zu lassen.
1021
- lines.push(paarZeile(gutscheinText(voucher), `-${formatCents(voucher.valueCents ?? 0)} €`, 8, 4));
1028
+ // Am Storno-Beleg geht der Wert auf den Gutschein zurueck: ohne Minus.
1029
+ const wert = voucher.valueCents ?? 0;
1030
+ lines.push(paarZeile(gutscheinText(voucher), wgVz === 1 ? `-${formatCents(wert)} €` : `${formatCents(wert)} €`, 8, 4));
1022
1031
  }
1023
1032
  }
1024
1033
  lines.push({ kind: 'rule', char: '-' });
@@ -4,4 +4,4 @@
4
4
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
5
5
  * beim Anheben der Version beide Stellen aendern.
6
6
  */
7
- export declare const PACKAGE_VERSION = "1.11.0";
7
+ export declare const PACKAGE_VERSION = "1.11.1";
@@ -4,4 +4,4 @@
4
4
  * Client-Version, Nachtrag §6). Ein Test haelt sie gleich mit `package.json`;
5
5
  * beim Anheben der Version beide Stellen aendern.
6
6
  */
7
- export const PACKAGE_VERSION = '1.11.0';
7
+ export const PACKAGE_VERSION = '1.11.1';
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.0",
2
+ "version": "1.11.1",
3
3
  "measuredOn": {
4
4
  "tid": "3600335",
5
5
  "hpsVersion": "1.10.0",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "Kasseneck Rechnungs-API",
4
4
  "version": 2,
5
- "package": "1.11.0",
5
+ "package": "1.11.1",
6
6
  "endpoints": {
7
7
  "createCustomer": {
8
8
  "request": {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.0",
2
+ "version": "1.11.1",
3
3
  "languages": [
4
4
  "de",
5
5
  "en"
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.0",
2
+ "version": "1.11.1",
3
3
  "messages": {
4
4
  "network.no_connection": {
5
5
  "text": "Keine Verbindung zum Server. Bitte die Internetverbindung prüfen und erneut versuchen."
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.11.0",
2
+ "version": "1.11.1",
3
3
  "baseUrls": {
4
4
  "public": "https://api.kasseneck.at/v3",
5
5
  "pos": "https://kasse.kasseneck.at/api/v3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kreiseck/kasseneck-api",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Austrian fiscal cash register (RKSV) client for JavaScript and TypeScript: signed receipts, cancellations, card payments, receipt printing (ESC/POS), invoices, inventory. RKSV-Registrierkasse für JavaScript und TypeScript.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Kreiseck",