@ticketboothapp/booking 1.2.89 → 1.2.90

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ticketboothapp/booking",
3
- "version": "1.2.89",
3
+ "version": "1.2.90",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -4930,6 +4930,7 @@ export function AdminChangeBookingFlow({
4930
4930
  let quotedPriceDiff: number | null = null;
4931
4931
  let changeIntentIdForCheckout: string | undefined;
4932
4932
  let changeBookingReferenceForPaidFlow: string | undefined;
4933
+ let confirmedChangeAmountDueForCheckout: number | null = null;
4933
4934
 
4934
4935
  if (isCustomerSelfServeChange) {
4935
4936
  const changeBookingReference = initialValues?.bookingReference?.trim();
@@ -4961,15 +4962,18 @@ export function AdminChangeBookingFlow({
4961
4962
  previousReturnAvailabilityId: initialValues?.returnAvailabilityId ?? null,
4962
4963
  },
4963
4964
  };
4965
+ const adminFeAmountDueMajorUnits = normalizeNearZeroOwed(
4966
+ roundMoney(
4967
+ originalReceipt
4968
+ ? adminFeAuthoritativeReceipt.total - originalReceipt.total
4969
+ : changeFlowClientEstimateDue
4970
+ )
4971
+ );
4964
4972
  const quote = useAdminFeAuthoritativeQuote
4965
4973
  ? await quoteChangeBookingAdminFeReceipt({
4966
4974
  ...quoteRequestBase,
4967
4975
  feReceipt: adminFeAuthoritativeReceipt,
4968
- feAmountDueMajorUnits: roundMoney(
4969
- originalReceipt
4970
- ? adminFeAuthoritativeReceipt.total - originalReceipt.total
4971
- : changeFlowClientEstimateDue
4972
- ),
4976
+ feAmountDueMajorUnits: adminFeAmountDueMajorUnits,
4973
4977
  })
4974
4978
  : await quoteChangeBooking(quoteRequestBase);
4975
4979
  const quoteSlice = sliceChangeQuoteForUi(
@@ -5004,19 +5008,23 @@ export function AdminChangeBookingFlow({
5004
5008
  quote.previousTotalCents != null && quote.newTotalCents != null
5005
5009
  ? (quote.newTotalCents - quote.previousTotalCents) / 100
5006
5010
  : quote.balanceDeltaMajorUnits ?? null;
5007
- const chargeDue =
5008
- signedBalanceMajor != null
5011
+ const chargeDue = useAdminFeAuthoritativeQuote
5012
+ ? Math.max(0, adminFeAmountDueMajorUnits)
5013
+ : signedBalanceMajor != null
5009
5014
  ? Math.max(0, signedBalanceMajor)
5010
5015
  : quote.amountDueCents != null
5011
5016
  ? quote.amountDueCents / 100
5012
5017
  : Math.max(0, quote.priceDiff ?? 0);
5013
5018
  const feChangeDue =
5014
- signedBalanceMajor ??
5015
- changeFlowBalanceVsOriginal({
5016
- newTotal: serverNewTotalForGuard,
5017
- originalReceiptTotal: originalReceipt?.total ?? 0,
5018
- audience: 'admin',
5019
- });
5019
+ useAdminFeAuthoritativeQuote
5020
+ ? adminFeAmountDueMajorUnits
5021
+ : signedBalanceMajor ??
5022
+ changeFlowBalanceVsOriginal({
5023
+ newTotal: serverNewTotalForGuard,
5024
+ originalReceiptTotal: originalReceipt?.total ?? 0,
5025
+ audience: 'admin',
5026
+ });
5027
+ confirmedChangeAmountDueForCheckout = normalizeNearZeroOwed(roundMoney(chargeDue));
5020
5028
  if (feChangeDue > 0.02 && chargeDue <= 0.009) {
5021
5029
  throw new Error(
5022
5030
  'This change requires payment, but the price could not be confirmed. Please refresh and try again.'
@@ -5030,6 +5038,7 @@ export function AdminChangeBookingFlow({
5030
5038
  );
5031
5039
  }
5032
5040
  const upgradeWithoutCharge =
5041
+ !useAdminFeAuthoritativeQuote &&
5033
5042
  quote.newTotalCents != null &&
5034
5043
  quote.previousTotalCents != null &&
5035
5044
  quote.newTotalCents > quote.previousTotalCents + 1;
@@ -5085,10 +5094,11 @@ export function AdminChangeBookingFlow({
5085
5094
  // Backend will charge totalAmount and store this as the receipt so /manage matches.
5086
5095
  const taxForBreakdown = effectivePromoDiscountAmount > 0 ? effectiveTax : tax;
5087
5096
  const amountDueForCheckout = isCustomerSelfServeChange
5088
- ? Math.max(
5097
+ ? confirmedChangeAmountDueForCheckout ??
5098
+ Math.max(
5089
5099
  0,
5090
5100
  changeFlowBalanceVsOriginal({
5091
- newTotal: changeFlowNewBookingTotal,
5101
+ newTotal: displayChangeFlowProposedTotalWithEditableLines,
5092
5102
  originalReceiptTotal: originalReceipt?.total ?? 0,
5093
5103
  audience: 'admin',
5094
5104
  }),