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:
@@ -188,7 +188,7 @@ export const rewardQueryRouter = router({
|
||||
metricsGetCurrentReward.start()
|
||||
|
||||
const apiResponse = await api.get(
|
||||
api.endpoints.v1.Profile.Reward.reward,
|
||||
api.endpoints.v2.Profile.Reward.reward,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
@@ -246,7 +246,7 @@ export const rewardQueryRouter = router({
|
||||
|
||||
metricsGetSurprises.start()
|
||||
|
||||
const endpoint = api.endpoints.v1.Profile.Reward.reward
|
||||
const endpoint = api.endpoints.v2.Profile.Reward.reward
|
||||
|
||||
const apiResponse = await api.get(endpoint, {
|
||||
cache: undefined,
|
||||
@@ -316,7 +316,7 @@ export const rewardQueryRouter = router({
|
||||
metricsGetUnwrapSurprise.start()
|
||||
|
||||
const apiResponse = await api.post(
|
||||
api.endpoints.v1.Profile.Reward.unwrap,
|
||||
api.endpoints.v2.Profile.Reward.unwrap,
|
||||
{
|
||||
body: {
|
||||
rewardId,
|
||||
@@ -367,7 +367,7 @@ export const rewardQueryRouter = router({
|
||||
metricGetRedeem.start()
|
||||
|
||||
const apiResponse = await api.post(
|
||||
api.endpoints.v1.Profile.Reward.redeem,
|
||||
api.endpoints.v2.Profile.Reward.redeem,
|
||||
{
|
||||
body: {
|
||||
rewardId,
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function getCachedAllTierRewards(token: string) {
|
||||
metricsGetApiRewardAllTiers.start()
|
||||
|
||||
const apiResponse = await api.get(
|
||||
api.endpoints.v1.Profile.Reward.allTiers,
|
||||
api.endpoints.v2.Profile.Reward.allTiers,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
|
||||
@@ -29,7 +29,7 @@ export const linkAccount = protectedProcedure
|
||||
|
||||
sasLogger.debug("[SAS] link account")
|
||||
|
||||
const apiResponse = await api.post(api.endpoints.v1.Profile.link, {
|
||||
const apiResponse = await api.post(api.endpoints.v2.Profile.link, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
},
|
||||
|
||||
@@ -42,7 +42,7 @@ export const performLevelUpgrade = protectedProcedure
|
||||
|
||||
sasLogger.debug("tier match started")
|
||||
|
||||
const apiResponse = await api.post(api.endpoints.v1.Profile.matchTier, {
|
||||
const apiResponse = await api.post(api.endpoints.v2.Profile.matchTier, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
},
|
||||
|
||||
@@ -25,7 +25,7 @@ export const transferPoints = protectedProcedure
|
||||
const { referenceId } = await getOTPState()
|
||||
|
||||
const apiResponse = await api.post(
|
||||
api.endpoints.v1.Profile.pointTransfer,
|
||||
api.endpoints.v2.Profile.pointTransfer,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
|
||||
@@ -17,7 +17,7 @@ export const unlinkAccount = protectedProcedure
|
||||
const sasAuthToken = await getSasToken()
|
||||
const { referenceId } = await getOTPState()
|
||||
|
||||
const apiResponse = await api.post(api.endpoints.v1.Profile.unlink, {
|
||||
const apiResponse = await api.post(api.endpoints.v2.Profile.unlink, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${ctx.session.token.access_token}`,
|
||||
},
|
||||
|
||||
@@ -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