1 <?php
2 /**
3 * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
4 */
5 namespace Team3\PayU\Communication\Request\Model;
6
7 use JMS\Serializer\Annotation as JMS;
8
9 /**
10 * This class is representing status of the given request to PayU.
11 *
12 * Class RequestStatus
13 * @package Team3\PayU\Communication\Request\Model
14 */
15 class RequestStatus
16 {
17 const STATUS_SUCCESS = 'SUCCESS';
18
19 /**
20 * @var string
21 * @JMS\SerializedName("statusCode")
22 * @JMS\Type("string")
23 */
24 private $code;
25
26 /**
27 * @var string
28 * @JMS\SerializedName("statusDesc")
29 * @JMS\Type("string")
30 */
31 private $description;
32
33 /**
34 * @return string
35 */
36 public function getCode()
37 {
38 return $this->code;
39 }
40
41 /**
42 * @param string $code
43 *
44 * @return RequestStatus
45 */
46 public function setCode($code)
47 {
48 $this->code = $code;
49
50 return $this;
51 }
52
53 /**
54 * @return string
55 */
56 public function getDescription()
57 {
58 return $this->description;
59 }
60
61 /**
62 * @param string $description
63 *
64 * @return RequestStatus
65 */
66 public function setDescription($description)
67 {
68 $this->description = $description;
69
70 return $this;
71 }
72
73 /**
74 * @return bool
75 */
76 public function isSuccess()
77 {
78 return self::STATUS_SUCCESS === $this->code;
79 }
80
81 /**
82 * @return bool
83 */
84 public function isError()
85 {
86 return self::STATUS_SUCCESS !== $this->code;
87 }
88 }
89