Merged in feat/SW-1007-saved-cards-filtering (pull request #980)

Feat/SW-1007 saved payment cards now shown based on supported cards by hotel

* fix(SW-1007): refactored savedCards to only show supported payment cards

* fix(SW-1007): show error message even if metadata is null

* fix: merge changes that were missed

* fix: remove use server


Approved-by: Christel Westerberg
This commit is contained in:
Tobias Johansson
2024-11-28 08:08:39 +00:00
parent 8f3d203b70
commit 9b90e99adf
10 changed files with 494 additions and 433 deletions

View File

@@ -42,12 +42,12 @@ export default async function PaymentCallbackPage({
const bookingStatus = await serverClient().booking.status({
confirmationNumber,
})
if (bookingStatus.metadata) {
searchObject.set(
"errorCode",
bookingStatus.metadata.errorCode?.toString() ?? ""
)
}
searchObject.set(
"errorCode",
bookingStatus?.metadata?.errorCode
? bookingStatus.metadata.errorCode.toString()
: PaymentErrorCodeEnum.Failed.toString()
)
} catch (error) {
console.error(
`[payment-callback] failed to get booking status for ${confirmationNumber}, status: ${status}`

View File

@@ -3,7 +3,6 @@ import { Suspense } from "react"
import {
getBreakfastPackages,
getCreditCardsSafely,
getHotelData,
getPackages,
getProfileSafely,
@@ -75,7 +74,6 @@ export default async function StepPage({
}
void getProfileSafely()
void getCreditCardsSafely()
void getBreakfastPackages(breakfastInput)
void getSelectedRoomAvailability(selectedRoomAvailabilityInput)
if (packageCodes?.length) {
@@ -110,7 +108,6 @@ export default async function StepPage({
})
const breakfastPackages = await getBreakfastPackages(breakfastInput)
const user = await getProfileSafely()
const savedCreditCards = await getCreditCardsSafely()
if (!hotelData || !roomAvailability) {
return notFound()
@@ -213,7 +210,9 @@ export default async function StepPage({
hotelData.data.attributes.merchantInformationData
.alternatePaymentOptions
}
savedCreditCards={savedCreditCards}
supportedCards={
hotelData.data.attributes.merchantInformationData.cards
}
mustBeGuaranteed={mustBeGuaranteed}
/>
</Suspense>