fix(transfer): reserve receipt resources with durable recovery intents
This commit is contained in:
+11
-2
@@ -75,7 +75,15 @@ public class HttpWarehouseResourceGateway implements WarehouseResourceGateway {
|
||||
response.message() == null || response.message().isBlank()
|
||||
? "Warehouse resource reservation was rejected" : response.message());
|
||||
}
|
||||
return response.data().lockId();
|
||||
ReserveData lock = response.data();
|
||||
if (!"200".equals(response.code()) || lock.lockId() <= 0 || !"ACTIVE".equals(lock.status())
|
||||
|| !Long.valueOf(Long.parseLong(customerId)).equals(lock.customerId())
|
||||
|| !Long.valueOf(warehouseId).equals(lock.warehouseId()) || !Long.valueOf(palletId).equals(lock.palletId())
|
||||
|| !Long.valueOf(locationId).equals(lock.locationId()) || !java.util.Objects.equals(businessType, lock.businessType())
|
||||
|| !java.util.Objects.equals(businessId, lock.businessId()) || !java.util.Objects.equals(reservationKey, lock.reservationKey())) {
|
||||
throw new ResponseStatusException(HttpStatus.CONFLICT, "Warehouse reservation is not the requested ACTIVE lock");
|
||||
}
|
||||
return lock.lockId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -340,7 +348,8 @@ public class HttpWarehouseResourceGateway implements WarehouseResourceGateway {
|
||||
String locationType, String locationStatus, boolean reservable,
|
||||
String reservationBlockReason) {}
|
||||
private record ReserveEnvelope(String code, String message, ReserveData data) {}
|
||||
private record ReserveData(long lockId) {}
|
||||
private record ReserveData(long lockId, Long customerId, Long warehouseId, Long palletId, Long locationId,
|
||||
String businessType, String businessId, String reservationKey, String status) {}
|
||||
private record WarehouseReferenceResponse(String code, String message, WarehouseReference data) {}
|
||||
private record WarehouseLocationResponse(String code, String message, WarehouseLocationReference data) {}
|
||||
private record PalletBatchEnvelope(String code, String message, PalletBatchResponse data) {}
|
||||
|
||||
Reference in New Issue
Block a user