CodeExplorer orderVersionExists example
$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);
$operationCreditNote =
new DocumentGenerateOperation($orderId);
static::
assertEquals($operationCreditNote->
getOrderVersionId(), Defaults::LIVE_VERSION
);
static::
assertTrue($this->
orderVersionExists($orderId,
$operationCreditNote->
getOrderVersionId()));
$this->creditNoteRenderer->
render( [$orderId =>
$operationCreditNote],
$this->context,
new DocumentRendererConfig() );
static::
assertEquals($operationCreditNote->
getOrderVersionId(), Defaults::LIVE_VERSION
);
static::
assertTrue($this->
orderVersionExists($orderId,
$operationCreditNote->
getOrderVersionId()));
} $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);
$operationStorno =
new DocumentGenerateOperation($orderId);
static::
assertEquals($operationStorno->
getOrderVersionId(), Defaults::LIVE_VERSION
);
static::
assertTrue($this->
orderVersionExists($orderId,
$operationStorno->
getOrderVersionId()));
$this->stornoRenderer->
render( [$orderId =>
$operationStorno],
$this->context,
new DocumentRendererConfig() );
static::
assertEquals($operationInvoice->
getOrderVersionId(),
$operationStorno->
getOrderVersionId());
static::
assertTrue($this->
orderVersionExists($orderId,
$operationStorno->
getOrderVersionId()));
}