/** * Set Transaction * Transaction to which the refund is applied * @param object $value * @return $this */ public function setTransaction($value) { if (is_object($value)) { $this->transaction = $value; } else { $obj = new Transaction($this->client); $obj->fillWithData($value); $this->transaction = $obj; } return $this; }
/** * Void the invoice * @param array $options * @return Transaction */ public function void($options = array()) { $request = new Request($this->client); $path = "/invoices/" . urlencode($this->getId()) . "/void"; $data = array(); $response = $request->post($path, $data, $options); $returnValues = array(); // Handling for field transaction $body = $response->getBody(); $body = $body['transaction']; $transaction = new Transaction($this->client); $returnValues['transaction'] = $transaction->fillWithData($body); return array_values($returnValues)[0]; }
/** * Get the subscriptions past transactions. * @param array $options * @return array */ public function fetchTransactions($options = array()) { $request = new Request($this->client); $path = "/subscriptions/" . urlencode($this->getId()) . "/transactions"; $data = array(); $response = $request->get($path, $data, $options); $returnValues = array(); // Handling for field transactions $a = array(); $body = $response->getBody(); foreach ($body['transactions'] as $v) { $tmp = new Transaction($this->client); $tmp->fillWithData($v); $a[] = $tmp; } $returnValues['Transactions'] = $a; return array_values($returnValues)[0]; }