return $result;
} $referenceInvoiceNumbers =
[];
$orders =
new OrderCollection();
/** @var DocumentGenerateOperation $operation */
foreach ($operations as $operation) { try { $orderId =
$operation->
getOrderId();
$invoice =
$this->referenceInvoiceLoader->
load($orderId,
$operation->
getReferencedDocumentId(),
$rendererConfig->deepLinkCode
);
if (empty($invoice)) { throw new DocumentGenerationException('Can not generate credit note document because no invoice document exists. OrderId: ' .
$operation->
getOrderId());
} $documentRefer =
json_decode((string) $invoice['config'
], true, 512, \JSON_THROW_ON_ERROR
);
$referenceInvoiceNumbers[$orderId] =
$documentRefer['documentNumber'
];
$order =
$this->
getOrder($orderId,
$invoice['orderVersionId'
],
$context,
$rendererConfig->deepLinkCode
);