fix production issue

This commit is contained in:
root
2026-05-10 19:55:57 -04:00
parent a224d7704a
commit 2d28947b92
17 changed files with 107 additions and 81 deletions
+8 -8
View File
@@ -50,15 +50,15 @@ export async function createCheckout(params: AmanPayCreateParams): Promise<AmanP
})
if (!res.ok) {
const err = await res.json().catch(() => ({}))
throw new Error(`AmanPay checkout failed: ${err?.message ?? res.statusText}`)
const err = await res.json().catch(() => ({})) as Record<string, unknown>
throw new Error(`AmanPay checkout failed: ${(err?.message as string) ?? res.statusText}`)
}
const json = await res.json()
const json = await res.json() as Record<string, unknown>
return {
transactionId: json.transaction_id ?? json.id,
checkoutUrl: json.checkout_url ?? json.payment_url,
status: json.status ?? 'PENDING',
transactionId: (json.transaction_id ?? json.id) as string,
checkoutUrl: (json.checkout_url ?? json.payment_url) as string,
status: (json.status ?? 'PENDING') as string,
}
}
@@ -77,8 +77,8 @@ export async function refundTransaction(transactionId: string, amount: number, r
body: JSON.stringify({ amount, reason }),
})
if (!res.ok) {
const err = await res.json().catch(() => ({}))
throw new Error(`AmanPay refund failed: ${err?.message ?? res.statusText}`)
const err = await res.json().catch(() => ({})) as Record<string, unknown>
throw new Error(`AmanPay refund failed: ${(err?.message as string) ?? res.statusText}`)
}
return res.json()
}