Class: Airwallex::Dispute
- Inherits:
-
APIResource
- Object
- APIResource
- Airwallex::Dispute
- 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 live create — real disputes originate from card
networks/issuing banks. In the sandbox, .simulate_create (and
#simulate_escalate/#simulate_resolve) stand in for the card
network/issuing bank to drive the full dispute lifecycle for testing.
See https://www.airwallex.com/docs/api/simulation/payment-disputes
Constant Summary collapse
- SIMULATION_PATH =
Sandbox-only — see https://www.airwallex.com/docs/api/simulation/payment-disputes
"/api/v1/simulation/pa/payment_disputes"
Instance Attribute Summary
Attributes inherited from APIResource
Class Method Summary collapse
- .resource_path ⇒ Object
-
.simulate_create(params = {}) ⇒ Dispute
Simulate a card network/issuing bank raising a dispute against a PaymentIntent.
-
.simulate_escalate(dispute_id, params = {}) ⇒ Dispute
Simulate the issuing bank rejecting the merchant's challenge evidence and advancing the dispute to the next stage (e.g. Chargeback -> Pre-arbitration).
-
.simulate_resolve(dispute_id, params = {}) ⇒ Dispute
Simulate the issuing bank's final decision on a dispute.
Instance Method Summary collapse
-
#accept ⇒ Airwallex::Dispute
Accept a dispute without challenging it.
-
#challenge(params = {}) ⇒ Airwallex::Dispute
Challenge a dispute with evidence.
-
#related_payment_intents(params = {}) ⇒ ListObject<PaymentIntent>
List payment intents related to this dispute.
-
#simulate_escalate(params = {}) ⇒ Airwallex::Dispute
Simulate the issuing bank rejecting this dispute's challenge evidence and advancing it to the next stage.
-
#simulate_resolve(params = {}) ⇒ Airwallex::Dispute
Simulate the issuing bank's final decision on this dispute.
Methods included from APIOperations::Retrieve
Methods included from APIOperations::List
Methods included from APIOperations::Update
Methods inherited from APIResource
#changed_attributes, #dirty?, #initialize, #inspect, #method_missing, #refresh, #refresh_from, resource_name, #respond_to_missing?, symbolized_get, symbolized_post, #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_path ⇒ Object
43 44 45 |
# File 'lib/airwallex/resources/dispute.rb', line 43 def self.resource_path "/api/v1/pa/payment_disputes" end |
.simulate_create(params = {}) ⇒ Dispute
Simulate a card network/issuing bank raising a dispute against a PaymentIntent
56 57 58 59 |
# File 'lib/airwallex/resources/dispute.rb', line 56 def self.simulate_create(params = {}) response = Airwallex.client.post("#{SIMULATION_PATH}/create", params) new(response) end |
.simulate_escalate(dispute_id, params = {}) ⇒ Dispute
Simulate the issuing bank rejecting the merchant's challenge evidence and advancing the dispute to the next stage (e.g. Chargeback -> Pre-arbitration). Not valid while status is REQUIRES_RESPONSE — the merchant must #accept or #challenge first.
70 71 72 73 |
# File 'lib/airwallex/resources/dispute.rb', line 70 def self.simulate_escalate(dispute_id, params = {}) response = Airwallex.client.post("#{SIMULATION_PATH}/#{dispute_id}/escalate", params) new(response) end |
.simulate_resolve(dispute_id, params = {}) ⇒ Dispute
Simulate the issuing bank's final decision on a dispute. in_favor_of: "MERCHANT" resolves it WON/REVERSED; "CUSTOMER" resolves it LOST. Not valid while status is REQUIRES_RESPONSE — the merchant must #accept or #challenge first.
84 85 86 87 |
# File 'lib/airwallex/resources/dispute.rb', line 84 def self.simulate_resolve(dispute_id, params = {}) response = Airwallex.client.post("#{SIMULATION_PATH}/#{dispute_id}/resolve", params) new(response) end |
Instance Method Details
#accept ⇒ Airwallex::Dispute
Accept a dispute without challenging it
92 93 94 95 96 |
# File 'lib/airwallex/resources/dispute.rb', line 92 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
103 104 105 106 107 |
# File 'lib/airwallex/resources/dispute.rb', line 103 def challenge(params = {}) response = Airwallex.client.post("#{self.class.resource_path}/#{id}/challenge", params) refresh_from(response) self end |
#related_payment_intents(params = {}) ⇒ ListObject<PaymentIntent>
List payment intents related to this dispute
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/airwallex/resources/dispute.rb', line 136 def (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 |
#simulate_escalate(params = {}) ⇒ Airwallex::Dispute
Simulate the issuing bank rejecting this dispute's challenge evidence and advancing it to the next stage
115 116 117 118 119 |
# File 'lib/airwallex/resources/dispute.rb', line 115 def simulate_escalate(params = {}) response = Airwallex.client.post("#{self.class::SIMULATION_PATH}/#{id}/escalate", params) refresh_from(response) self end |
#simulate_resolve(params = {}) ⇒ Airwallex::Dispute
Simulate the issuing bank's final decision on this dispute
126 127 128 129 130 |
# File 'lib/airwallex/resources/dispute.rb', line 126 def simulate_resolve(params = {}) response = Airwallex.client.post("#{self.class::SIMULATION_PATH}/#{id}/resolve", params) refresh_from(response) self end |