API Support Forum
OEC API > API Support > Why order states changes from one state to the same one?
Author Topic: Why order states changes from one state to the same one?
(5 messages, Page 1 of 1)
Moderators: VPfau
CZendejas116
Posts: 51
Joined: Apr 13, 2011


Posted: Apr 26, 2011 @ 11:08 AM             Msg. 1 of 5
Hi,

I see the following behaviour in OnOrderStateChanged event when I sent an order:

*Order status changed: Order.ID=60749069 FROM Sent TO Sent
*Order status changed: Order.ID=60749069 FROM Sent TO Completed
*Order status changed: Order.ID=60749069 FROM Sent TO Completed

Why occur the event if OldOrderState = Order.CurrentState ?
also, why do I have twice OnOrderStateChanged events from Sent status to Completed status?

Thanks in advance :)

Claudia Zendejas
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Apr 27, 2011 @ 11:49 AM             Msg. 2 of 5
Hello,

I don't see any signs that we sent two Completed states for this order.

Victor Vins
Software Developer
CZendejas116
Posts: 51
Joined: Apr 13, 2011


Posted: Apr 27, 2011 @ 12:04 PM             Msg. 3 of 5
Hi,

I think I understand what's happening. I made several tests and I can see things in my log like this:

State changed: Order.ID=-1 FROM Unknown TO Sent
State changed: Order.ID=60800516 FROM Sent TO Sent
State changed: Order.ID=60800516 FROM Sent TO Sent
State changed: Order.ID=60800516 FROM Sent TO Completed

After some tests I became to thing that Order object received in OnOrderStateChanged it's the same along all events of this type, and for some reason my log delays too much between each line printed, so, state in order change before I can print the order's current state.

It's safe to assume all OnOrderStateChanged executions are because the state change and there is no way the Completed state gets duplicated?


Thank you so much!

Claudia Zendejas
CZendejas116
Posts: 51
Joined: Apr 13, 2011


Posted: Apr 29, 2011 @ 08:49 AM             Msg. 4 of 5
Object Order is the same all the time? I have the theory that API OEC mantains same reference with updated information, is that right?

Claudia Zendejas
VictorV
Posts: 746
Joined: May 08, 2007


Posted: May 06, 2011 @ 01:09 PM             Msg. 5 of 5
Hello,

right - all references are the same during one session

Victor Vins
Software Developer