use analysis order id as valis tellimuse id (#92)
* use order analysis id as valis tellimuse id * send analysis order id in xml
This commit is contained in:
@@ -6,11 +6,12 @@ type ProcessedMessage = {
|
||||
hasPartialAnalysisResponse: boolean;
|
||||
hasFullAnalysisResponse: boolean;
|
||||
medusaOrderId: string | undefined;
|
||||
analysisOrderId: number | undefined;
|
||||
};
|
||||
|
||||
type GroupedResults = {
|
||||
processed: Pick<ProcessedMessage, 'messageId' | 'medusaOrderId'>[];
|
||||
waitingForResults: Pick<ProcessedMessage, 'messageId' | 'medusaOrderId'>[];
|
||||
processed: Pick<ProcessedMessage, 'messageId' | 'analysisOrderId'>[];
|
||||
waitingForResults: Pick<ProcessedMessage, 'messageId' | 'analysisOrderId'>[];
|
||||
};
|
||||
|
||||
export default async function syncAnalysisResults() {
|
||||
@@ -37,14 +38,14 @@ export default async function syncAnalysisResults() {
|
||||
}
|
||||
|
||||
const groupedResults = processedMessages.reduce((acc, result) => {
|
||||
if (result.medusaOrderId) {
|
||||
if (result.analysisOrderId) {
|
||||
if (result.hasAnalysisResponse) {
|
||||
if (!acc.processed) {
|
||||
acc.processed = [];
|
||||
}
|
||||
acc.processed.push({
|
||||
messageId: result.messageId,
|
||||
medusaOrderId: result.medusaOrderId,
|
||||
analysisOrderId: result.analysisOrderId,
|
||||
});
|
||||
} else {
|
||||
if (!acc.waitingForResults) {
|
||||
@@ -52,7 +53,7 @@ export default async function syncAnalysisResults() {
|
||||
}
|
||||
acc.waitingForResults.push({
|
||||
messageId: result.messageId,
|
||||
medusaOrderId: result.medusaOrderId,
|
||||
analysisOrderId: result.analysisOrderId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user