Skip to main content

Disputes

Utility Types

type DisputeSummary = {
id: string;
title: string;
description: string;
status: string;
role: "Complainant" | "Respondant";
};

type Evidence = {
label: string;
url: string;
date_submitted: string;
};

type Expert = {
id: string;
full_name: string;
email: string;
phone: string;
role: string;
};

type UserDetails = {
name: string;
email: string;
address: string;
}

Utility Functions

  • Endpoint: GET /utils/dispute_statuses
  • Headers:
    • None expected
  • Will return a list of all possible states a dispute can be in:
type DisputeStatusesResponse = string[];

Dispute Summaries

  • Endpoint: GET /disputes
  • Headers:
    • Authorization: Bearer <JWT>

Will return a list of dispute summaries the user is involved in:

type DisputeListResponse = DisputeSummary[];

Dispute Details

  • Endpoint: GET /disputes/{id}
  • Headers:
    • Authorization: Bearer <JWT>

Will return detailed information about a dispute the user is involved in:

type DisputeResponse = {
id: string;
title: string;
description: string;
status: string;
date_created: string;

evidence: Evidence[];
experts: Expert[];

role: string;
complainant: UserDetails;
respondent: UserDetails;
};

Dispute Creation

  • Endpoint: POST /disputes/create
  • Headers:
    • Authorization: Bearer <JWT>
type DisputeCreateRequest = {
title: string;
description: string;
"respondent[full_name]": string;
"respondent[email]": string;
"respondent[telephone]": string;
"respondent[workflow]": string;
files: File;
};

The response will return the ID of the newly-created dispute:

type DisputeCreateResponse = {
id: number;
};

Dispute Evidence upload

  • Endpoint: POST /disputes/{id}/evidence
  • Headers:
    • Authorization: Bearer <JWT>

NOTE: This endpoint involves files being exchanged. This requires the use of multipart/form-data instead of JSON. This is left incomplete until this exception is documenteda.

interface EvidenceUploadRequest {
file: File[];
}

Dispute Status Change

  • Endpoint: PUT /disputes/{id}/status
  • Headers:
    • Authorization: Bearer <JWT>
type UpdateRequest = {
status: string;
};

Dispute decision

  • Endpoint: POST /disputes/{id}/decision
  • Headers:
    • Authorization: Bearer <JWT>
  • Note: The endpoint uses multipart/form-data instead of JSON, so the interface below serves only as a guideline
interface DisputeDecisionRequest {
decision: DisputeDecision;
writeup: File;
}

Respond with an HTTP code 204 (no content).