Skip to content

Commit c91ebfb

Browse files
authored
Merge pull request #142 from AndreaDiazCorreia/fix/issue-141
Fix timeout error when initiating disputes
2 parents e56665c + 9130545 commit c91ebfb

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/util.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,29 @@ where
164164
// Continue waiting for a valid event
165165
continue;
166166
}
167+
// this is the case where the user initiates a dispute
168+
Action::DisputeInitiatedByYou => {
169+
if let Some(Payload::Dispute(dispute_id, _)) = &message.payload {
170+
println!("Dispute initiated successfully with ID: {}", dispute_id);
171+
// Update order status to disputed if we have the order
172+
if let Some(mut order) = order.take() {
173+
match order
174+
.set_status(Status::Dispute.to_string())
175+
.save(pool)
176+
.await
177+
{
178+
Ok(_) => println!("Order status updated to Dispute"),
179+
Err(e) => println!("Failed to update order status: {}", e),
180+
}
181+
}
182+
return Ok(());
183+
} else {
184+
println!("Warning: Dispute initiated but received unexpected payload structure");
185+
return Ok(());
186+
}
187+
}
188+
_ => {}
189+
}
167190
}
168191
}
169192
Err(e) => {

0 commit comments

Comments
 (0)