Class: Airwallex::Dispute

Inherits:
APIResource show all
Extended by:
APIOperations::List, APIOperations::Retrieve
Includes:
APIOperations::Update
Defined in:
lib/airwallex/resources/dispute.rb

Overview

Dispute resource for handling chargebacks and payment disputes

Disputes represent chargebacks or payment disputes initiated by cardholders. Merchants can view disputes, challenge them with evidence, or accept them. There is no create — disputes originate from card networks/issuing banks.

Examples:

List open disputes

disputes = Airwallex::Dispute.list(status: 'OPEN')

Retrieve a dispute

dispute = Airwallex::Dispute.retrieve('dis_123')

Accept a dispute

dispute.accept

Challenge a dispute

dispute.challenge(...)

Instance Attribute Summary

Attributes inherited from APIResource

#attributes, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Retrieve

retrieve

Methods included from APIOperations::List

list

Methods included from APIOperations::Update

included, #save, #update

Methods inherited from APIResource

#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, #to_hash, #to_json, #to_s

Constructor Details

This class inherits a constructor from Airwallex::APIResource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Airwallex::APIResource

Class Method Details

.resource_pathObject



26
27
28
# File 'lib/airwallex/resources/dispute.rb', line 26

def self.resource_path
  "/api/v1/pa/payment_disputes"
end

Instance Method Details

#acceptAirwallex::Dispute

Accept a dispute without challenging it

Returns:



33
34
35
36
37
# File 'lib/airwallex/resources/dispute.rb', line 33

def accept
  response = Airwallex.client.post("#{self.class.resource_path}/#{id}/accept", {})
  refresh_from(response)
  self
end

#challenge(params = {}) ⇒ Airwallex::Dispute

Challenge a dispute with evidence

Parameters:

  • params (Hash) (defaults to: {})

    challenge params — exact shape unconfirmed, pass through whatever Airwallex's challenge schema requires

Returns:



44
45
46
47
48
# File 'lib/airwallex/resources/dispute.rb', line 44

def challenge(params = {})
  response = Airwallex.client.post("#{self.class.resource_path}/#{id}/challenge", params)
  refresh_from(response)
  self
end

List payment intents related to this dispute

Parameters:

  • params (Hash) (defaults to: {})

    additional query params (e.g. pagination)

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/airwallex/resources/dispute.rb', line 54

def related_payment_intents(params = {})
  response = Airwallex.client.get(
    "#{self.class.resource_path}/#{id}/related_payment_intents", params
  )

  ListObject.new(
    data: extract_items(response),
    has_more: extract_has_more(response),
    next_cursor: extract_next_cursor(response),
    resource_class: PaymentIntent,
    params: params
  )
end