Merged in feat/LOY-431-profile-v2 (pull request #3202)
Feat/LOY-431: Switch to V2 of Profile endpoint * feat(LOY-431): switch to v2 of profile endpoint * feat(LOY-431): use CreditCard * feat(LOY-431): remove hotelinformation from friendTransaction schema * chore(LOY-431): add hotel data request to transactions * fix(LOY-431): use v1 of friendTransactions Approved-by: Linus Flood Approved-by: Erik Tiekstra Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -30,7 +30,7 @@ export const userMutationRouter = router({
|
||||
JSON.stringify({ query: { language: input.language } })
|
||||
)
|
||||
const apiResponse = await api.post(
|
||||
api.endpoints.v1.Profile.CreditCards.initiateSaveCard,
|
||||
api.endpoints.v2.Profile.CreditCard.initiateSaveCard,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
@@ -85,7 +85,7 @@ export const userMutationRouter = router({
|
||||
JSON.stringify({})
|
||||
)
|
||||
const apiResponse = await api.post(
|
||||
api.endpoints.v1.Profile.CreditCards.transaction(input.transactionId),
|
||||
api.endpoints.v2.Profile.CreditCard.transaction(input.transactionId),
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
@@ -121,7 +121,7 @@ export const userMutationRouter = router({
|
||||
JSON.stringify({ query: {} })
|
||||
)
|
||||
const apiResponse = await api.remove(
|
||||
api.endpoints.v1.Profile.CreditCards.deleteCreditCard(
|
||||
api.endpoints.v2.Profile.CreditCard.deleteCreditCard(
|
||||
input.creditCardId
|
||||
),
|
||||
{
|
||||
@@ -165,7 +165,7 @@ export const userMutationRouter = router({
|
||||
|
||||
metricsGeneratePreferencesLink.start()
|
||||
|
||||
const apiResponse = await api.get(api.endpoints.v1.Profile.subscriberId, {
|
||||
const apiResponse = await api.get(api.endpoints.v2.Profile.subscriberId, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
},
|
||||
|
||||
@@ -309,14 +309,14 @@ export const userQueryRouter = router({
|
||||
awardPoints: attributes.awardPoints,
|
||||
checkinDate: attributes.checkinDate,
|
||||
checkoutDate: attributes.checkoutDate,
|
||||
city: attributes.hotelInformation?.city,
|
||||
confirmationNumber: attributes.confirmationNumber,
|
||||
hotelName: attributes.hotelInformation?.name,
|
||||
nights: attributes.nights,
|
||||
pointsCalculated: attributes.pointsCalculated,
|
||||
hotelId: attributes.hotelOperaId,
|
||||
transactionDate: attributes.transactionDate,
|
||||
bookingUrl: attributes.bookingUrl,
|
||||
hotelName: attributes.hotelInformation?.name,
|
||||
city: attributes.hotelInformation?.city,
|
||||
}
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -22,11 +22,14 @@ export const getCreditCards = cache(
|
||||
|
||||
metricsGetCreditCards.start()
|
||||
|
||||
const apiResponse = await api.get(api.endpoints.v1.Profile.creditCards, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${session.token.access_token}`,
|
||||
},
|
||||
})
|
||||
const apiResponse = await api.get(
|
||||
api.endpoints.v2.Profile.CreditCard.creditCard,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${session.token.access_token}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if (!apiResponse.ok) {
|
||||
await metricsGetCreditCards.httpError(apiResponse)
|
||||
|
||||
@@ -135,11 +135,14 @@ export const getCreditCards = cache(
|
||||
|
||||
metricsGetCreditCards.start()
|
||||
|
||||
const apiResponse = await api.get(api.endpoints.v1.Profile.creditCards, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${session.token.access_token}`,
|
||||
},
|
||||
})
|
||||
const apiResponse = await api.get(
|
||||
api.endpoints.v2.Profile.CreditCard.creditCard,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${session.token.access_token}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
if (!apiResponse.ok) {
|
||||
await metricsGetCreditCards.httpError(apiResponse)
|
||||
|
||||
Reference in New Issue
Block a user