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<{
status: "PENDING" | "ACTIVE" | "STOPPED" | "EXPIRED";
}> {
export const getAgreement = async function (agreementId: string): Promise<
| {
status: "PENDING" | "ACTIVE" | "STOPPED" | "EXPIRED";
}
| Error
> {
const token = await getAccessToken();
const response = await fetch(
`${config.baseUrl}/recurring/v3/agreements/${agreementId}`,

View File

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