feat(fleet): integrate costs quotes operations and in-transit handovers
This commit is contained in:
@@ -27,6 +27,7 @@ public class DirectEventClient {
|
||||
EventTypes.OVERSEAS_DELIVERY_COMPLETED -> firstleg.receive(token, event);
|
||||
case EventTypes.WALLET_COMMAND_REQUESTED -> checkedFinance(finance.wallet(token, event));
|
||||
case EventTypes.BUSINESS_FEE_SOURCE_CHANGED -> checkedFinance(finance.fee(token, event));
|
||||
case EventTypes.COMPANY_VEHICLE_COST_SUBMITTED -> checkedVehicleCost(finance.vehicleCost(token, event));
|
||||
default -> throw new EventDeliveryFailure(true, "Unsupported outbound event type: " + event.eventType());
|
||||
};
|
||||
}
|
||||
@@ -34,4 +35,10 @@ public class DirectEventClient {
|
||||
EventDeliveryFailure.requireSuccessful(response, FINANCE_PERMANENT_CODES);
|
||||
return response;
|
||||
}
|
||||
private ApiResponse<DeliveryAck> checkedVehicleCost(ApiResponse<DeliveryAck> response) {
|
||||
var permanentCodes = new java.util.HashSet<>(FINANCE_PERMANENT_CODES);
|
||||
permanentCodes.addAll(Set.of("FIN_400", "FIN_404", "FIN_409"));
|
||||
EventDeliveryFailure.requireSuccessful(response, permanentCodes);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.RequestHeader;
|
||||
@FeignClient(configuration = EventDeliveryFeignConfiguration.class, name = "finance-service", contextId = "FinanceBusinessEventClient",
|
||||
url = "${FINANCE_SERVICE_URL:${baiyue.clients.finance.url:}}")
|
||||
public interface FinanceBusinessEventClient {
|
||||
@PostMapping("/internal/finance/v1/vehicle-costs/events")
|
||||
ApiResponse<DeliveryAck> vehicleCost(@RequestHeader("X-Internal-Service-Token") String token,
|
||||
@RequestBody EventEnvelope envelope);
|
||||
@PostMapping("/internal/finance/v1/wallet-command-events")
|
||||
ApiResponse<DeliveryAck> wallet(@RequestHeader("X-Internal-Service-Token") String token,
|
||||
@RequestBody EventEnvelope envelope);
|
||||
|
||||
Reference in New Issue
Block a user