Skip to main content
added 106 characters in body
Source Link
Khoa TruongDinh
  • 32.3k
  • 11
  • 90
  • 156

Edit:

This is a not good answer, you can follow the @adjco answer. Try to use Service Contract.

Try to inject Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory into your constructor:

protected $transactions;

public function __constructor(
  \Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory $transactions,
  ......
)
{
  $this->transactions = $transactions;
}

In your method:

$transactions = $this->transactions->create()->addOrderIdFilter($orderId);
$transactions->getItems();

If Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory doesn't work, try to use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory. I'm not test yet both of them.

Try to inject Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory into your constructor:

protected $transactions;

public function __constructor(
  \Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory $transactions,
  ......
)
{
  $this->transactions = $transactions;
}

In your method:

$transactions = $this->transactions->create()->addOrderIdFilter($orderId);
$transactions->getItems();

If Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory doesn't work, try to use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory. I'm not test yet both of them.

Edit:

This is a not good answer, you can follow the @adjco answer. Try to use Service Contract.

Try to inject Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory into your constructor:

protected $transactions;

public function __constructor(
  \Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory $transactions,
  ......
)
{
  $this->transactions = $transactions;
}

In your method:

$transactions = $this->transactions->create()->addOrderIdFilter($orderId);
$transactions->getItems();

If Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory doesn't work, try to use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory. I'm not test yet both of them.

added 32 characters in body
Source Link
Khoa TruongDinh
  • 32.3k
  • 11
  • 90
  • 156

Try to inject Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory into your constructor:

protected $transactions;

public function __constructor(
  \Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory $transactions,
  ......
)
{
  $this->transactions = $transactions;
}

In your method:

$transactions = $this->transactions->create()->addOrderIdFilter($orderId);
$transactions->getItems();

If Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory doesn't work, try to use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory. I'm not test yet both of them.

Try to inject Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory into your constructor:

protected $transactions;

public function __constructor(
  \Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory $transactions,
  ......
)
{
  $this->transactions = $transactions;
}

In your method:

$transactions = $this->transactions->create()->addOrderIdFilter($orderId);

If Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory doesn't work, try to use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory. I'm not test yet both of them.

Try to inject Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory into your constructor:

protected $transactions;

public function __constructor(
  \Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory $transactions,
  ......
)
{
  $this->transactions = $transactions;
}

In your method:

$transactions = $this->transactions->create()->addOrderIdFilter($orderId);
$transactions->getItems();

If Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory doesn't work, try to use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory. I'm not test yet both of them.

Source Link
Khoa TruongDinh
  • 32.3k
  • 11
  • 90
  • 156

Try to inject Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory into your constructor:

protected $transactions;

public function __constructor(
  \Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory $transactions,
  ......
)
{
  $this->transactions = $transactions;
}

In your method:

$transactions = $this->transactions->create()->addOrderIdFilter($orderId);

If Magento\Sales\Api\Data\TransactionSearchResultInterfaceFactory doesn't work, try to use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory. I'm not test yet both of them.