@ticketboothapp/booking 1.2.156 → 1.2.158
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 +1 -1
- package/src/components/booking/AdminChangeReceiptComparison.tsx +4 -2
- package/src/components/booking/CheckoutModal.tsx +1 -1
- package/src/components/booking/PrivateShuttleCheckoutSection.tsx +1 -1
- package/src/components/booking/admin-refund-disposition.ts +8 -0
- package/src/lib/booking/i18n/messages/en.json +1 -1
- package/test/change-booking-helpers.test.ts +8 -0
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import { PriceSummary, type PriceSummaryLine } from './PriceSummary';
|
|
|
12
12
|
import {
|
|
13
13
|
adminRemovalOperationLabel,
|
|
14
14
|
noRefundRemovedValue,
|
|
15
|
+
normalizeReturnPriceTreatment,
|
|
15
16
|
refundDecisionsComplete,
|
|
16
17
|
releaseRefundDispositionOptions,
|
|
17
18
|
returnPriceTreatmentOptions,
|
|
@@ -173,8 +174,9 @@ export function AdminChangeReceiptComparison({
|
|
|
173
174
|
const options = returnPriceTreatmentOptions(
|
|
174
175
|
allowedRefundDispositionsByOperationId[operation.operationId],
|
|
175
176
|
);
|
|
176
|
-
const selectedValue: AdminReturnPriceTreatment =
|
|
177
|
-
refundDispositionsByOperationId[operation.operationId]
|
|
177
|
+
const selectedValue: AdminReturnPriceTreatment = normalizeReturnPriceTreatment(
|
|
178
|
+
refundDispositionsByOperationId[operation.operationId],
|
|
179
|
+
);
|
|
178
180
|
const selected = options.find((option) => option.value === selectedValue);
|
|
179
181
|
return (
|
|
180
182
|
<div key={operation.operationId} className="rounded-md border border-sky-200 bg-white p-3">
|
|
@@ -411,7 +411,7 @@ export function CheckoutModal({
|
|
|
411
411
|
{balanceChargeDaysBefore > 0
|
|
412
412
|
? (t('booking.balanceChargeNotice', { days: balanceChargeDaysBefore }) !== 'booking.balanceChargeNotice'
|
|
413
413
|
? t('booking.balanceChargeNotice', { days: balanceChargeDaysBefore })
|
|
414
|
-
: `The remaining balance
|
|
414
|
+
: `The remaining balance is due ${balanceChargeDaysBefore} days before your booking. You can pay it from your Manage Booking page.`)
|
|
415
415
|
: (t('booking.balancePayEarlier') !== 'booking.balancePayEarlier'
|
|
416
416
|
? t('booking.balancePayEarlier')
|
|
417
417
|
: 'You can pay the remaining balance anytime from your Manage Booking page.')}
|
|
@@ -179,7 +179,7 @@ export function PrivateShuttleCheckoutSection({
|
|
|
179
179
|
{balanceChargeDaysBefore && balanceChargeDaysBefore > 0
|
|
180
180
|
? (t('booking.balanceChargeNotice', { days: balanceChargeDaysBefore }) !== 'booking.balanceChargeNotice'
|
|
181
181
|
? t('booking.balanceChargeNotice', { days: balanceChargeDaysBefore })
|
|
182
|
-
: `The remaining balance
|
|
182
|
+
: `The remaining balance is due ${balanceChargeDaysBefore} days before your booking. You can pay it from your Manage Booking page.`)
|
|
183
183
|
: (t('booking.balancePayEarlier') !== 'booking.balancePayEarlier'
|
|
184
184
|
? t('booking.balancePayEarlier')
|
|
185
185
|
: 'You can pay the remaining balance anytime from your Manage Booking page.')}
|
|
@@ -66,6 +66,14 @@ export function returnPriceTreatmentOptions(
|
|
|
66
66
|
];
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
export function normalizeReturnPriceTreatment(
|
|
70
|
+
disposition: AdminAmendmentRefundDisposition | undefined,
|
|
71
|
+
): AdminReturnPriceTreatment {
|
|
72
|
+
return disposition === 'PENDING_REFUND' || disposition === 'NO_REFUND'
|
|
73
|
+
? disposition
|
|
74
|
+
: 'KEEP_FLOOR';
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
export function adminRemovalOperationLabel(operation: AdminAmendmentOperationSnapshot): string {
|
|
70
78
|
const component = operation.componentKey.split(':').slice(1).join(':') || operation.componentKey;
|
|
71
79
|
const quantity = operation.quantityDelta ? ` (${Math.abs(operation.quantityDelta)})` : '';
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"included": "Included",
|
|
154
154
|
"flexibleCancellation": "Flexible cancellation",
|
|
155
155
|
"depositPaymentNotice": "You're paying the deposit today.",
|
|
156
|
-
"balanceChargeNotice": "The remaining balance
|
|
156
|
+
"balanceChargeNotice": "The remaining balance is due {days} days before your booking. You can pay it from your Manage Booking page.",
|
|
157
157
|
"balancePayEarlier": "You can pay the remaining balance anytime from your Manage Booking page.",
|
|
158
158
|
"remainingBalance": "Remaining Balance"
|
|
159
159
|
},
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import { buildAdminChangeQuoteRequestKey } from '../src/components/booking/admin-change-quote-request-key';
|
|
17
17
|
import {
|
|
18
18
|
noRefundRemovedValue,
|
|
19
|
+
normalizeReturnPriceTreatment,
|
|
19
20
|
refundDecisionsComplete,
|
|
20
21
|
releaseRefundDispositionOptions,
|
|
21
22
|
returnPriceTreatmentOptions,
|
|
@@ -217,6 +218,13 @@ test('admin return price treatment defaults to keep floor and maps optional repr
|
|
|
217
218
|
);
|
|
218
219
|
});
|
|
219
220
|
|
|
221
|
+
test('unsupported immediate refund cannot become a return price treatment', () => {
|
|
222
|
+
assert.equal(normalizeReturnPriceTreatment(undefined), 'KEEP_FLOOR');
|
|
223
|
+
assert.equal(normalizeReturnPriceTreatment('REFUND_TO_ORIGINAL_PAYMENT'), 'KEEP_FLOOR');
|
|
224
|
+
assert.equal(normalizeReturnPriceTreatment('PENDING_REFUND'), 'PENDING_REFUND');
|
|
225
|
+
assert.equal(normalizeReturnPriceTreatment('NO_REFUND'), 'NO_REFUND');
|
|
226
|
+
});
|
|
227
|
+
|
|
220
228
|
test('changing admin refund treatment creates a distinct authoritative quote request', () => {
|
|
221
229
|
const base = {
|
|
222
230
|
bookingReference: 'DE8H04DX',
|