/** * Tests the getters and setters of the model * @test */ public function setGetTest() { $type = "Test"; $client = "Test"; $cardType = "Test"; $country = "Test"; $expireMonth = 1; $expireYear = 2; $cardHolder = "Test"; $lastFour = "Test"; $code = "Test"; $account = "Test"; $holder = "Test"; $iban = "Test"; $bic = "Test"; $this->_payment->setType($type)->setClient($client)->setCardType($cardType)->setCountry($country)->setExpireMonth($expireMonth)->setExpireYear($expireYear)->setCardHolder($cardHolder)->setLastFour($lastFour)->setCode($code)->setAccount($account)->setHolder($holder)->setIban($iban)->setBic($bic); $this->assertEquals($this->_payment->getType(), $type); $this->assertEquals($this->_payment->getClient(), $client); $this->assertEquals($this->_payment->getCardType(), $cardType); $this->assertEquals($this->_payment->getCountry(), $country); $this->assertEquals($this->_payment->getExpireMonth(), $expireMonth); $this->assertEquals($this->_payment->getExpireYear(), $expireYear); $this->assertEquals($this->_payment->getCardHolder(), $cardHolder); $this->assertEquals($this->_payment->getLastFour(), $lastFour); $this->assertEquals($this->_payment->getCode(), $code); $this->assertEquals($this->_payment->getAccount(), $account); $this->assertEquals($this->_payment->getHolder(), $holder); $this->assertEquals($this->_payment->getBic(), $bic); $this->assertEquals($this->_payment->getIban(), $iban); }
/** * Creates and fills a paymentmodel * * @param array $response * @return \Paymill\Models\Response\Payment */ private function _createPayment($response) { $model = new Models\Payment(); $model->setId($response['id']); $model->setType($response['type']); $model->setClient($this->_convertResponseToModel($response['client'], "client")); if ($response['type'] === "creditcard") { $model->setCardType($response['card_type']); $model->setCountry($response['country']); $model->setExpireMonth($response['expire_month']); $model->setExpireYear($response['expire_year']); $model->setCardHolder($response['card_holder']); $model->setLastFour($response['last4']); } else { if ($response['type'] === "debit") { $model->setHolder($response['holder']); $model->setCode($response['code']); $model->setAccount($response['account']); $model->setBic($response['bic']); $model->setIban($response['iban']); } } $model->setCreatedAt($response['created_at']); $model->setUpdatedAt($response['updated_at']); $model->setAppId($response['app_id']); return $model; }