1: <?php
2:
3: /**
4: * A customer object
5: */
6: class Syspay_Merchant_Entity_Customer extends Syspay_Merchant_Entity implements
7: Syspay_Merchant_Entity_ReturnedEntityInterface
8: {
9: const TYPE = 'customer';
10:
11: /**
12: * @var string
13: */
14: protected $email;
15:
16: /**
17: * @var string
18: */
19: protected $language;
20:
21: /**
22: * @var string
23: */
24: protected $ip;
25:
26: /**
27: * @var string
28: */
29: protected $mobile;
30:
31: /**
32: * @var reference
33: */
34: protected $reference;
35:
36: /**
37: * Gets the value of email.
38: *
39: * @return string
40: */
41: public function getEmail()
42: {
43: return $this->email;
44: }
45:
46: /**
47: * Sets the value of email.
48: *
49: * @param string $email the email
50: *
51: * @return self
52: */
53: public function setEmail($email)
54: {
55: $this->email = $email;
56:
57: return $this;
58: }
59:
60: /**
61: * Gets the value of language.
62: *
63: * @return string
64: */
65: public function getLanguage()
66: {
67: return $this->language;
68: }
69:
70: /**
71: * Sets the value of language.
72: *
73: * @param string $language the language
74: *
75: * @return self
76: */
77: public function setLanguage($language)
78: {
79: $this->language = $language;
80:
81: return $this;
82: }
83:
84: /**
85: * Gets the value of ip.
86: *
87: * @return string
88: */
89: public function getIp()
90: {
91: return $this->ip;
92: }
93:
94: /**
95: * Sets the value of ip.
96: *
97: * @param string $ip the ip
98: *
99: * @return self
100: */
101: public function setIp($ip)
102: {
103: $this->ip = $ip;
104:
105: return $this;
106: }
107:
108: /**
109: * Gets the value of mobile.
110: *
111: * @return string
112: */
113: public function getMobile()
114: {
115: return $this->mobile;
116: }
117:
118: /**
119: * Sets the value of mobile.
120: *
121: * @param string $mobile the mobile
122: *
123: * @return self
124: */
125: public function setMobile($mobile)
126: {
127: $this->mobile = $mobile;
128:
129: return $this;
130: }
131:
132: /**
133: * Gets the value of reference.
134: *
135: * @return string
136: */
137: public function getReference()
138: {
139: return $this->reference;
140: }
141:
142: /**
143: * Sets the value of reference.
144: *
145: * @param string $reference the reference
146: *
147: * @return self
148: */
149: public function setReference($reference)
150: {
151: $this->reference = $reference;
152:
153: return $this;
154: }
155:
156:
157: /**
158: * Build a customer entity based on a json-decoded customer stdClass
159: *
160: * @param stdClass $response The customer data
161: *
162: * @return Syspay_Merchant_Entity_Customer The customer object
163: */
164: public static function buildFromResponse(stdClass $response)
165: {
166: $customer = new self();
167: $customer->setEmail(isset($response->email)?$response->email:null);
168: $customer->setLanguage(isset($response->language)?$response->language:null);
169: $customer->setIp(isset($response->ip)?$response->ip:null);
170: $customer->setMobile(isset($response->mobile)?$response->mobile:null);
171: $customer->setReference(isset($response->reference)?$response->refernce:null);
172:
173: $customer->raw = $response;
174:
175: return $customer;
176: }
177: }
178: