CodeExplorer generateCreditItems example
public function testRender( array
$possibleTaxes,
array
$creditPrices,
?\Closure
$successCallback = null,
?\Closure
$errorCallback = null,
array
$additionalConfig =
[] ): void
{ $cart =
$this->
generateDemoCart($possibleTaxes);
$cart =
$this->
generateCreditItems($cart,
$creditPrices);
$orderId =
$this->cartService->
order($cart,
$this->salesChannelContext,
new RequestDataBag());
$invoiceConfig =
new DocumentConfiguration();
$invoiceConfig->
setDocumentNumber('1001'
);
$operationInvoice =
new DocumentGenerateOperation($orderId, FileTypes::PDF,
$invoiceConfig->
jsonSerialize());
$result =
$this->documentGenerator->
generate(InvoiceRenderer::TYPE,
[$orderId =>
$operationInvoice],
$this->context
)->
getSuccess()->
first();
static::
assertNotNull($result);
$invoiceId =
$result->
getId();