| Total Complexity | 5 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class Transaction |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var EnvInterface |
||
| 19 | */ |
||
| 20 | private $env; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Notification constructor. |
||
| 24 | * @param $env |
||
| 25 | */ |
||
| 26 | public function __construct(EnvInterface $env) |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getTransaction($transactionCode, $isSimple = false) |
||
| 32 | { |
||
| 33 | $client = new Client([ |
||
| 34 | 'base_uri' => $this->env->getUri(), |
||
| 35 | //'http_errors' => false |
||
| 36 | ]); |
||
| 37 | |||
| 38 | $xml = $client->get("/v3/transactions/{$transactionCode}", ['query' => [ |
||
| 39 | 'email' => $this->env->getCredential(), |
||
| 40 | 'token' => $this->env->getToken() |
||
| 41 | ]])->getBody()->getContents(); |
||
| 42 | $doc = new \DOMDocument(); |
||
| 43 | $doc->loadXML($xml); |
||
| 44 | return !$isSimple ? $doc : $xml; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return EnvInterface |
||
| 49 | */ |
||
| 50 | public function getEnv() |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param EnvInterface $env |
||
| 57 | * @return Transaction |
||
| 58 | */ |
||
| 59 | public function setEnv(EnvInterface $env) |
||
| 63 | } |
||
| 64 | |||
| 66 | } |