@@ -323,6 +323,37 @@ func TestCheckoutStatus(t *testing.T) {
323323 assert .Equal (t , CheckoutStatus ("abandoned" ), CheckoutStatusAbandoned )
324324 assert .Equal (t , CheckoutStatus ("expired" ), CheckoutStatusExpired )
325325 })
326+
327+ t .Run ("MarkAsAbandoned" , func (t * testing.T ) {
328+ checkout , err := NewCheckout ("session123" , "USD" )
329+ require .NoError (t , err )
330+
331+ originalTime := checkout .LastActivityAt
332+ time .Sleep (1 * time .Millisecond ) // Ensure time difference
333+
334+ checkout .MarkAsAbandoned ()
335+
336+ assert .Equal (t , CheckoutStatusAbandoned , checkout .Status )
337+ assert .True (t , checkout .LastActivityAt .After (originalTime ))
338+ })
339+
340+ t .Run ("Reactivate" , func (t * testing.T ) {
341+ checkout , err := NewCheckout ("session123" , "USD" )
342+ require .NoError (t , err )
343+
344+ // First mark as abandoned
345+ checkout .MarkAsAbandoned ()
346+ assert .Equal (t , CheckoutStatusAbandoned , checkout .Status )
347+
348+ originalTime := checkout .LastActivityAt
349+ time .Sleep (1 * time .Millisecond ) // Ensure time difference
350+
351+ // Then reactivate
352+ checkout .Reactivate ()
353+
354+ assert .Equal (t , CheckoutStatusActive , checkout .Status )
355+ assert .True (t , checkout .LastActivityAt .After (originalTime ))
356+ })
326357}
327358
328359func TestCheckoutDTOConversions (t * testing.T ) {
0 commit comments