|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/erp.theinteractive.co.in/vendor/midtrans/midtrans-php/Midtrans/ |
Upload File : |
<?php
namespace Midtrans;
/**
* Read raw post input and parse as JSON. Provide getters for fields in notification object
*
* Example:
*
* ```php
*
* namespace Midtrans;
*
* $notif = new Notification();
* echo $notif->order_id;
* echo $notif->transaction_status;
* ```
*/
class Notification
{
private $response;
public function __construct($input_source = "php://input")
{
$raw_notification = json_decode(file_get_contents($input_source), true);
$status_response = Transaction::status($raw_notification['transaction_id']);
$this->response = $status_response;
}
public function __get($name)
{
if (isset($this->response->$name)) {
return $this->response->$name;
}
}
public function getResponse()
{
return $this->response;
}
}