Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/api/contracts/escrow/refund/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ error: "Could not find a profile linked to the given wallet ID" }, { status: 500 });
}

const isAgreementParty =
depositorWallet.id === contractTransaction.depositor_wallet_id ||
depositorWallet.id === contractTransaction.beneficiary_wallet_id;

if (!isAgreementParty) {
return NextResponse.json(
{ error: "You are not authorized to refund this escrow agreement" },
{ status: 403 }
);
}

// Retrieves contract data from Circle's SDK
const contractData = await circleContractSdk.getContract({
id: contractTransaction.circle_contract_id
Expand Down