omise v0.6.0 Omise.Dispute

Provides Dispute API interfaces.

https://www.omise.co/disputes-api

Link to this section Summary

Link to this section Types

Link to this type t()
t() :: %Omise.Dispute{amount: integer(), charge: String.t(), closed_at: String.t(), created: String.t(), currency: String.t(), documents: Omise.List.t(), id: String.t(), livemode: boolean(), location: String.t(), message: String.t(), object: String.t(), reason_code: String.t(), reason_message: String.t(), status: String.t(), transaction: String.t()}

Link to this section Functions

Link to this function destroy_document(id, document_id, opts \\ [])
destroy_document(String.t(), String.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

Destroy a document.

Returns {:ok, document} if the request is successful, {:error, error} otherwise.

Examples

Omise.Dispute.destroy_document("dspt_test_4zgf15h89w8t775kcm8", "docu_test_55alwcu1phxmsxx3y9p")
Link to this function list(params \\ [], opts \\ [])
list(Keyword.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

List all disputes.

Returns {:ok, disputes} if the request is successful, {:error, error} otherwise.

Query Parameters:

  • offset - (optional, default: 0) The offset of the first record returned.
  • limit - (optional, default: 20, maximum: 100) The maximum amount of records returned.
  • from - (optional, default: 1970-01-01T00:00:00Z, format: ISO 8601) The UTC date and time limiting the beginning of returned records.
  • to - (optional, default: current UTC Datetime, format: ISO 8601) The UTC date and time limiting the end of returned records.

Examples

# List all disputes
Omise.Dispute.list

# List all open disputes
Omise.Dispute.list(status: "open")

# List all pending disputes
Omise.Dispute.list(status: "pending")

# List all closed disputes
Omise.Dispute.list(status: "closed")
Link to this function list_documents(id, params \\ [], opts \\ [])
list_documents(String.t(), Keyword.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

List all dispute documents.

Returns {:ok, documents} if the request is successful, {:error, error} otherwise.

Examples

Omise.Dispute.list_documents("dspt_5089off452g5m5te7xs")
Link to this function retrieve(id, opts \\ [])
retrieve(String.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

Retrieve a dispute.

Returns {:ok, dispute} if the request is successful, {:error, error} otherwise.

Examples

Omise.Dispute.retrieve("dspt_test_51yfnnpsxajeybpytm4")
Link to this function retrieve_document(id, document_id, opts \\ [])
retrieve_document(String.t(), String.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

Retrieve a dispute document.

Returns {:ok, document} if the request is successful, {:error, error} otherwise.

Examples

Omise.Dispute.retrieve_document("dspt_test_55aj9q9iipt3tcdwb5r", "docu_test_55alwcu1phxmsxx3y9p")
Link to this function search(params \\ [], opts \\ [])
search(Keyword.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

Search all the disputes.

Returns {:ok, disputes} if the request is successful, {:error, error} otherwise.

Query Parameters:

<https://www.omise.co/search-query-and-filters>

Examples

Omise.Dispute.search(filters: [status: "pending"])

Omise.Dispute.search(query: "dspt_5089off452g5m5te7xs")
Link to this function update(id, params, opts \\ [])
update(String.t(), Keyword.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

Update a dispute.

Returns {:ok, dispute} if the request is successful, {:error, error} otherwise.

Request Parameter:

  • message - The new dispute message.

Examples

Omise.Dispute.update("dspt_test_4zgf15h89w8t775kcm8", message: "Shut up and dance with me!")
Link to this function upload_document(id, params \\ [], opts \\ [])
upload_document(String.t(), Keyword.t(), Keyword.t()) ::
  {:ok, struct()} |
  {:error, Omise.Error.t()}

Upload a document.

Returns {:ok, document} if the request is successful, {:error, error} otherwise.

Request Parameter:

  • file - (required) The file to upload. Valid files include PNG and JPG images and PDF files. The uploaded file should also includes metadata such as filename and content type.

Examples

Omise.Dispute.upload_document("dspt_test_4zgf15h89w8t775kcm8", file: "rick-and-morty.jpg")