1: <?php
2:
3: /**
4: * A creditcard object
5: */
6: class Syspay_Merchant_Entity_Creditcard extends Syspay_Merchant_Entity
7: {
8: const TYPE = 'creditcard';
9:
10: /**
11: * @var string
12: */
13: protected $number;
14:
15: /**
16: * @var string
17: */
18: protected $cardholder;
19:
20: /**
21: * @var integer
22: */
23: protected $cvc;
24:
25: /**
26: * @var integer
27: */
28: protected $exp_month;
29:
30: /**
31: * @var integer
32: */
33: protected $exp_year;
34:
35: /**
36: * @var string
37: */
38: protected $token;
39:
40: /**
41: * {@inheritDoc}
42: *
43: * If a token is set, use it, otherwise use the full card data
44: */
45: public function toArray()
46: {
47: $data = array();
48: if (true === empty($this->token)) {
49: $data['number'] = $this->number;
50: $data['cardholder'] = $this->cardholder;
51: $data['cvc'] = $this->cvc;
52: $data['exp_month'] = $this->exp_month;
53: $data['exp_year'] = $this->exp_year;
54: } else {
55: $data['token'] = $this->token;
56: }
57:
58: return $data;
59: }
60:
61: /**
62: * Gets the value of token.
63: *
64: * @return string
65: */
66: public function getToken()
67: {
68: return $this->token;
69: }
70:
71: /**
72: * Sets the value of token.
73: *
74: * @param string $token the token
75: *
76: * @return self
77: */
78: public function setToken($token)
79: {
80: $this->token = $token;
81:
82: return $this;
83: }
84:
85: /**
86: * Gets the value of number.
87: *
88: * @return string
89: */
90: public function getNumber()
91: {
92: return $this->number;
93: }
94:
95: /**
96: * Sets the value of number.
97: *
98: * @param string $number the number
99: *
100: * @return self
101: */
102: public function setNumber($number)
103: {
104: $this->number = $number;
105:
106: return $this;
107: }
108:
109: /**
110: * Gets the value of cardholder.
111: *
112: * @return string
113: */
114: public function getHolder()
115: {
116: return $this->cardholder;
117: }
118:
119: /**
120: * Sets the value of cardholder.
121: *
122: * @param string $holder the cardholder
123: *
124: * @return self
125: */
126: public function setHolder($holder)
127: {
128: $this->cardholder = $holder;
129:
130: return $this;
131: }
132:
133: /**
134: * Gets the value of cvc.
135: *
136: * @return integer
137: */
138: public function getCvc()
139: {
140: return $this->cvc;
141: }
142:
143: /**
144: * Sets the value of cvc.
145: *
146: * @param integer $cvc the cvc
147: *
148: * @return self
149: */
150: public function setCvc($cvc)
151: {
152: $this->cvc = $cvc;
153:
154: return $this;
155: }
156:
157: /**
158: * Gets the value of exp_month.
159: *
160: * @return integer
161: */
162: public function getExpMonth()
163: {
164: return $this->exp_month;
165: }
166:
167: /**
168: * Sets the value of exp_month.
169: *
170: * @param integer $expMonth the exp_month
171: *
172: * @return self
173: */
174: public function setExpMonth($expMonth)
175: {
176: $this->exp_month = $expMonth;
177:
178: return $this;
179: }
180:
181: /**
182: * Gets the value of exp_year.
183: *
184: * @return integer
185: */
186: public function getExpYear()
187: {
188: return $this->exp_year;
189: }
190:
191: /**
192: * Sets the value of exp_year.
193: *
194: * @param integer $expYear the exp_year
195: *
196: * @return self
197: */
198: public function setExpYear($expYear)
199: {
200: $this->exp_year = $expYear;
201:
202: return $this;
203: }
204: }
205: