/** * Tests the getters and setters of the model * @test */ public function setGetTest() { $amount = "010"; $status = "closed"; $description = "Test Description"; $livemode = false; $responseCode = 20000; $transaction = new Response\Transaction(); $this->_refund->setAmount($amount)->setStatus($status)->setDescription($description)->setLivemode($livemode)->setResponseCode($responseCode)->setTransaction($transaction); $this->assertEquals($this->_refund->getAmount(), $amount); $this->assertEquals($this->_refund->getStatus(), $status); $this->assertEquals($this->_refund->getDescription(), $description); $this->assertEquals($this->_refund->getLivemode(), $livemode); $this->assertEquals($this->_refund->getResponseCode(), $responseCode); $this->assertEquals($this->_refund->getTransaction(), $transaction); }
/** * Creates and fills a refundmodel * * @param array $response * @return \Paymill\Models\Response\Refund */ private function _createRefund($response) { $model = new Models\Refund(); $model->setId($response['id']); $model->setAmount($response['amount']); $model->setStatus($response['status']); $model->setDescription($response['description']); $model->setLivemode($response['livemode']); $model->setCreatedAt($response['created_at']); $model->setUpdatedAt($response['updated_at']); $model->setResponseCode($response['response_code']); //Refund doesn't have the array index 'transaction' when using getOne $model->setTransaction(isset($response['transaction']) ? $this->_convertResponseToModel($response['transaction'], 'transaction') : null); $model->setAppId($response['app_id']); return $model; }