- {
- foreach ($this->getOrder()->getInvoiceCollection() as $invoice) {
- if ($invoice->getTransactionId() == $transactionId) {
- $invoice->load($invoice->getId());
- // to make sure all data will properly load (maybe not required)
- return $invoice;
- }
- }
- foreach ($this->getOrder()->getInvoiceCollection() as $invoice) {
- if ($invoice->getState() == \Magento\Sales\Model\Order\Invoice::STATE_OPEN && $invoice->load(
- $invoice->getId()
- )
- ) {
- $invoice->setTransactionId($transactionId);
- return $invoice;
- }
- }
- return false;
- }