/** * Parent transaction getter * May attempt to load it. * * @param bool $shouldLoad * @return bool|\Magento\Sales\Model\Order\Payment\Transaction */ public function getParentTransaction($shouldLoad = true) { if (null === $this->_parentTransaction) { $this->_verifyThisTransactionExists(); $this->_parentTransaction = false; $parentId = $this->getParentId(); if ($parentId) { $this->_parentTransaction = $this->_transactionFactory->create(); if ($shouldLoad) { $this->_parentTransaction->setOrderPaymentObject($this->_paymentObject)->load($parentId); if (!$this->_parentTransaction->getId()) { $this->_parentTransaction = false; } else { $this->_parentTransaction->hasChildTransaction(true); } } } } return $this->_parentTransaction; }