File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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) => {
You can’t perform that action at this time.
0 commit comments