In order to show whether or not the OTC is "sold out", the state of the exchanger must be propagated to the web service.
The exchanger's state changes depending on the status of its attempts to send a deposit.
For the case of a "sold out", when the exchanger receives an "insufficient balance" error during transaction creation, its state would be changed to "insufficient balance" and the web service would display a "sold out" message.
Record the state on the Exchanger object. Add a method to the exchanger to return the state. Pass the exchanger (as an interface) to the web service. Use a lock around the state for thread safety.
In order to show whether or not the OTC is "sold out", the state of the exchanger must be propagated to the web service.
The exchanger's state changes depending on the status of its attempts to send a deposit.
For the case of a "sold out", when the exchanger receives an "insufficient balance" error during transaction creation, its state would be changed to "insufficient balance" and the web service would display a "sold out" message.
Record the state on the Exchanger object. Add a method to the exchanger to return the state. Pass the exchanger (as an interface) to the web service. Use a lock around the state for thread safety.