IPCGetTxnLog Class
The IPCGetTxnLog class allows you to retrieve full transaction logs for a given order using the IPC method IPCGetTxnLog. This can include all relevant details like transaction status, timestamps, and references.
Ideal for post-transaction analysis, debugging, customer support, or reporting dashboards.
Class Info
- Namespace:
Mypos\IPC - Located at:
IPCGetTxnLog.php - Extends:
Mypos\IPC\Base - Purpose: Retrieve detailed transaction logs for a specific order ID
Method Summary
| Method | Return Type | Description |
|---|---|---|
__construct(Mypos\IPC\Config $cnf) | - | Initializes the request with your IPC config object. |
process() | Mypos\IPC\Response | Sends the request and returns a detailed transaction log. |
validate() | bool | Validates whether all required parameters (like order ID) are set. |
getOrderID() | string | Returns the order ID used for lookup. |
setOrderID(string $orderID) | IPCGetTxnLog | Sets the order ID to retrieve the transaction log for. |
Inherited from Base
Includes access to all core API methods:
_addPostParam()_processPost()_processHtmlPost()getCnf(), setCnf()getOutputFormat(), setOutputFormat()isValidSignature()
Example Usage
<?php
namespace Mypos\IPC;
/**
* Process IPC method: IPCGetTxnLog.
* Collect, validate and send API params
*/
class IPCGetTxnLog extends Base
{
private $orderID;
/**
* Return IPCGetTxnLog object
*
* @param Config $cnf
*/
public function __construct(Config $cnf)
{
$this->setCnf($cnf);
}
/**
* Initiate API request
*
* @return Response
*/
public function process()
{
$this->validate();
$this->_addPostParam('IPCmethod', 'IPCGetTxnLog');
$this->_addPostParam('IPCVersion', $this->getCnf()->getVersion());
$this->_addPostParam('IPCLanguage', $this->getCnf()->getLang());
$this->_addPostParam('SID', $this->getCnf()->getSid());
$this->_addPostParam('WalletNumber', $this->getCnf()->getWallet());
$this->_addPostParam('KeyIndex', $this->getCnf()->getKeyIndex());
$this->_addPostParam('Source', $this->getCnf()->getSource());
$this->_addPostParam('OrderID', $this->getOrderID());
$this->_addPostParam('OutputFormat', $this->getOutputFormat());
return $this->_processPost();
}
/**
* Validate all set details
*
* @return boolean
* @throws IPC_Exception
*/
public function validate()
{
try {
$this->getCnf()->validate();
} catch (\Exception $ex) {
throw new IPC_Exception('Invalid Config details: '.$ex->getMessage());
}
if ($this->getOrderID() == null || !Helper::isValidOrderId($this->getOrderID())) {
throw new IPC_Exception('Invalid OrderId');
}
if ($this->getOutputFormat() == null || !Helper::isValidOutputFormat($this->getOutputFormat())) {
throw new IPC_Exception('Invalid Output format');
}
return true;
}
/**
* Original request order id
*
* @return string
*/
public function getOrderID()
{
return $this->orderID;
}
/**
* Original request order id
*
* @param string $orderID
*
* @return IPCGetTxnLog
*/
public function setOrderID($orderID)
{
$this->orderID = $orderID;
return $this;
}
}
Use Cases
Use the IPCGetTxnLog class when:
- You need to audit a transaction
- A customer requests details about a charge
- You’re building a merchant dashboard or admin panel
- You need to verify payment data in real-time or for logs