FIX: existing agreement exists, but is out of sync #41
|
|
@ -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";
|
||||
}> {
|
||||
}
|
||||
| Error
|
||||
> {
|
||||
const token = await getAccessToken();
|
||||
const response = await fetch(
|
||||
`${config.baseUrl}/recurring/v3/agreements/${agreementId}`,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export const handler = async function (req: Request): Promise<Response> {
|
|||
|
||||
if (
|
||||
agreementInVipps &&
|
||||
!(agreementInVipps instanceof Error) &&
|
||||
agreementInVipps.status !== "ACTIVE" &&
|
||||
hasActiveAgreement
|
||||
) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue