FIX: existing agreement exists, but is out of sync #41

Merged
olaven merged 2 commits from fix-vipps-crash into add-another-promotional-text 2025-05-26 12:31:56 +00:00
2 changed files with 7 additions and 3 deletions
Showing only changes of commit 2d68e927eb - Show all commits

View File

@ -93,9 +93,12 @@ export const createAgreement = async function (email: string) {
} }
}; };
export const getAgreement = async function (agreementId: string): Promise<{ export const getAgreement = async function (agreementId: string): Promise<
| {
status: "PENDING" | "ACTIVE" | "STOPPED" | "EXPIRED"; status: "PENDING" | "ACTIVE" | "STOPPED" | "EXPIRED";
}> { }
| Error
> {
const token = await getAccessToken(); const token = await getAccessToken();
const response = await fetch( const response = await fetch(
`${config.baseUrl}/recurring/v3/agreements/${agreementId}`, `${config.baseUrl}/recurring/v3/agreements/${agreementId}`,

View File

@ -27,6 +27,7 @@ export const handler = async function (req: Request): Promise<Response> {
if ( if (
agreementInVipps && agreementInVipps &&
!(agreementInVipps instanceof Error) &&
agreementInVipps.status !== "ACTIVE" && agreementInVipps.status !== "ACTIVE" &&
hasActiveAgreement hasActiveAgreement
) { ) {