@ticketboothapp/booking 1.2.160 → 1.2.161

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.160",
3
+ "version": "1.2.161",
4
4
  "private": false,
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -115,11 +115,13 @@ function resolveFeChangeDue({
115
115
  function assertNoUnconfirmedNoChargeUpgrade({
116
116
  quote,
117
117
  quoteSlice,
118
+ originalReceiptTotal,
118
119
  audience,
119
120
  useAdminFeAuthoritativeQuote,
120
121
  }: {
121
122
  quote: ChangeBookingQuoteResponse;
122
123
  quoteSlice: ChangeQuoteUiSlice;
124
+ originalReceiptTotal: number;
123
125
  audience: ChangeBookingCheckoutQuoteAudience;
124
126
  useAdminFeAuthoritativeQuote?: boolean;
125
127
  }): void {
@@ -141,9 +143,7 @@ function assertNoUnconfirmedNoChargeUpgrade({
141
143
  pricingQuote?.totalAmount ??
142
144
  quote.proposed?.total ??
143
145
  quote.newReceipt?.total;
144
- const originalTotal =
145
- pricingQuote?.amountPreviouslyPaid ?? quote.original?.total ?? quote.originalReceipt?.total;
146
- if (proposedTotal != null && originalTotal != null && proposedTotal - originalTotal > 0.01) {
146
+ if (proposedTotal != null && proposedTotal - originalReceiptTotal > 0.01) {
147
147
  throw new Error(CHANGE_PAYMENT_CONFIRMATION_ERROR);
148
148
  }
149
149
  }
@@ -198,6 +198,7 @@ export function evaluateChangeBookingQuoteForCheckout(
198
198
  assertNoUnconfirmedNoChargeUpgrade({
199
199
  quote,
200
200
  quoteSlice,
201
+ originalReceiptTotal,
201
202
  audience,
202
203
  useAdminFeAuthoritativeQuote,
203
204
  });
@@ -443,6 +443,37 @@ test('routes customer no-pay quote to free confirmation with the quote intent',
443
443
  });
444
444
  });
445
445
 
446
+ test('allows pay-later customer no-charge change when receipt total is unchanged', () => {
447
+ const decision = evaluateChangeBookingQuoteForCheckout({
448
+ quote: quote({
449
+ changeIntentId: 'ci_pay_later_free',
450
+ amountToCharge: 0,
451
+ balanceDelta: 0,
452
+ pricingQuote: {
453
+ payableTotal: 202.87,
454
+ amountPreviouslyPaid: 0,
455
+ balanceDelta: 0,
456
+ amountToCharge: 0,
457
+ },
458
+ proposed: { total: 202.87 },
459
+ original: { total: 202.87 },
460
+ }),
461
+ quoteSlice: quoteSlice({
462
+ changeIntentId: 'ci_pay_later_free',
463
+ quotedTotal: 202.87,
464
+ }),
465
+ fallbackNewBookingTotal: 202.87,
466
+ originalReceiptTotal: 202.87,
467
+ audience: 'customer',
468
+ });
469
+
470
+ assert.deepEqual(decision, {
471
+ kind: 'free',
472
+ changeIntentId: 'ci_pay_later_free',
473
+ amountDueForCheckout: 0,
474
+ });
475
+ });
476
+
446
477
  test('blocks customer upgrade when server confirms no charge but totals increased', () => {
447
478
  assert.throws(
448
479
  () =>