lock-capabilities
CreateOrderLock
POST REST /v1/orders/{orderId}/lock
This capability allows Dojo to acquire a lock on orders before making modifications to it like recording payments or adding items. These locks allow the EPOS to know when an Order being modified and give Dojo the guarantee that the Order will not be modified externally while these operations are taking place. Dojo will only try to acquire when making modifications, for other purposes fetching an eventually consistent snapshot of an Order from the EPOS through GetOrder should always be possible.
Registered capabilities | Behaviour |
---|---|
RecordOrderPayment | Dojo will send the RecordOrderPayment request, if a Conflict error is returned Dojo will attempt to reverse the payment |
RecordOrderPayment, CreateOrderLock, DeleteOrderLock | Dojo will first try to create the order lock with a long expiry. If successful it will try to record one or multiple payments then delete the lock. |
RecordOrderPayment, CreateOrderLock, DeleteOrderLock, ExtendOrderLock | Dojo will first try to create the order lock with a short expiry. If successful it will try to record one or multiple payments. If the payment session takes longer, it will extend the lock. After the payment session has finished we will delete the lock. |
DeleteOrderLock
DELETE REST /v1/orders/{orderId}/locks/{lockId}
This capability allows Dojo to release a lock on orders. If both this and CreateOrderLockRequest are registered then Dojo will only attempt to RecordOrderPayment against an order after having successfully acquired a lock and will release the lock once the payment is recorded.
ExtendOrderLock
PUT REST /v1/orders/{orderId}/locks/{lockId}
This capability allows Dojo to extend an existing lock. It is not required for the locking flow to function, registering this will allow Dojo to create locks with a shorter initial expiry and extend as needed.