Skip to content

Commit 9aea3aa

Browse files
authored
Merge pull request #2 from ipagdevs/IPAG-3185-AddPaymentFacilitatorAndSubEstablishment
Add: Classes PaymentFacilitator e SubEstablishment
2 parents a83e70e + 51c8f2a commit 9aea3aa

File tree

3 files changed

+338
-0
lines changed

3 files changed

+338
-0
lines changed

src/Cielo/API30/Ecommerce/Payment.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ class Payment implements \JsonSerializable
110110

111111
private $instructions;
112112

113+
private $paymentFacilitator;
114+
113115
/**
114116
* Payment constructor.
115117
*
@@ -168,6 +170,10 @@ public function populate(\stdClass $data)
168170
$this->externalAuthentication->populate($data->ExternalAuthentication);
169171
}
170172

173+
if (isset($data->PaymentFacilitator)) {
174+
$this->paymentFacilitator()->populate($data->paymentFacilitator);
175+
}
176+
171177
$this->expirationDate = isset($data->ExpirationDate) ? $data->ExpirationDate : null;
172178
$this->url = isset($data->Url) ? $data->Url : null;
173179
$this->boletoNumber = isset($data->BoletoNumber) ? $data->BoletoNumber : null;
@@ -1154,4 +1160,33 @@ public function setInstructions($instructions)
11541160

11551161
return $this;
11561162
}
1163+
1164+
public function paymentFacilitator()
1165+
{
1166+
if (is_null($this->paymentFacilitator)) {
1167+
$this->setPaymentFacilitator(new PaymentFacilitator());
1168+
}
1169+
1170+
return $this->getPaymentFacilitator();
1171+
}
1172+
1173+
/**
1174+
* Get the value of paymentFacilitator
1175+
*/
1176+
public function getPaymentFacilitator()
1177+
{
1178+
return $this->paymentFacilitator;
1179+
}
1180+
1181+
/**
1182+
* Set the value of paymentFacilitator
1183+
*
1184+
* @return self
1185+
*/
1186+
public function setPaymentFacilitator($paymentFacilitator)
1187+
{
1188+
$this->paymentFacilitator = $paymentFacilitator;
1189+
1190+
return $this;
1191+
}
11571192
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
namespace Cielo\API30\Ecommerce;
4+
5+
/**
6+
* Class PaymentFacilitator
7+
*
8+
* @package Cielo\API30\Ecommerce
9+
*/
10+
class PaymentFacilitator implements \JsonSerializable
11+
{
12+
private $subEstablishment;
13+
14+
public function __construct($subEstablishment = null)
15+
{
16+
$this->subEstablishment = $subEstablishment;
17+
}
18+
19+
/**
20+
* @param \stdClass $data
21+
*/
22+
public function populate(\stdClass $data)
23+
{
24+
$this->subEstablishment = new SubEstablishment();
25+
$this->subEstablishment->populate($data);
26+
}
27+
28+
/**
29+
* @return array
30+
*/
31+
public function jsonSerialize()
32+
{
33+
return get_object_vars($this);
34+
}
35+
36+
public function subEstablishment()
37+
{
38+
if (is_null($this->subEstablishment)) {
39+
$this->setSubEstablishment(new SubEstablishment());
40+
}
41+
42+
return $this->getSubEstablishment();
43+
}
44+
45+
/**
46+
* Get the value of subEstablishment
47+
*/
48+
public function getSubEstablishment()
49+
{
50+
return $this->subEstablishment;
51+
}
52+
53+
/**
54+
* Set the value of subEstablishment
55+
*
56+
* @return self
57+
*/
58+
public function setSubEstablishment(SubEstablishment $subEstablishment)
59+
{
60+
$this->subEstablishment = $subEstablishment;
61+
62+
return $this;
63+
}
64+
}
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
<?php
2+
3+
namespace Cielo\API30\Ecommerce;
4+
5+
/**
6+
* Class SubEstablishment
7+
*
8+
* @package Cielo\API30\Ecommerce
9+
*/
10+
class SubEstablishment implements \JsonSerializable
11+
{
12+
const DEFAULT_COUTRY_CODE = "076";
13+
14+
private $establishmentCode;
15+
private $identity;
16+
private $mcc;
17+
private $address;
18+
private $city;
19+
private $state;
20+
private $postalCode;
21+
private $countryCode;
22+
private $phoneNumber;
23+
24+
public function __construct()
25+
{
26+
$this->countryCode = self::DEFAULT_COUTRY_CODE;
27+
$this->establishmentCode = null;
28+
$this->identity = null;
29+
$this->mcc = null;
30+
$this->address = null;
31+
$this->city = null;
32+
$this->state = null;
33+
$this->countryCode = null;
34+
$this->postalCode = null;
35+
$this->phoneNumber = null;
36+
}
37+
38+
/**
39+
* @param \stdClass $data
40+
*/
41+
public function populate(\stdClass $data)
42+
{
43+
$this->establishmentCode = $data->EstablishmentCode ?? null;
44+
$this->identity = $data->Identity ?? null;
45+
$this->mcc = $data->Mcc ?? null;
46+
$this->address = $data->Address ?? null;
47+
$this->city = $data->City ?? null;
48+
$this->state = $data->State ?? null;
49+
$this->countryCode = $data->CountryCode ?? null;
50+
$this->postalCode = $data->PostalCode ?? null;
51+
$this->phoneNumber = $data->PhoneNumber ?? null;
52+
}
53+
54+
public function jsonSerialize()
55+
{
56+
return get_object_vars($this);
57+
}
58+
59+
60+
/**
61+
* Get the value of establishmentCode
62+
*/
63+
public function getEstablishmentCode()
64+
{
65+
return $this->establishmentCode;
66+
}
67+
68+
/**
69+
* Set the value of establishmentCode
70+
*
71+
* @return self
72+
*/
73+
public function setEstablishmentCode($establishmentCode)
74+
{
75+
$this->establishmentCode = $establishmentCode;
76+
77+
return $this;
78+
}
79+
80+
/**
81+
* Get the value of identity
82+
*/
83+
public function getIdentity()
84+
{
85+
return $this->identity;
86+
}
87+
88+
/**
89+
* Set the value of identity
90+
*
91+
* @return self
92+
*/
93+
public function setIdentity($identity)
94+
{
95+
$this->identity = $identity;
96+
97+
return $this;
98+
}
99+
100+
/**
101+
* Get the value of mcc
102+
*/
103+
public function getMcc()
104+
{
105+
return $this->mcc;
106+
}
107+
108+
/**
109+
* Set the value of mcc
110+
*
111+
* @return self
112+
*/
113+
public function setMcc($mcc)
114+
{
115+
$this->mcc = $mcc;
116+
117+
return $this;
118+
}
119+
120+
/**
121+
* Get the value of address
122+
*/
123+
public function getAddress()
124+
{
125+
return $this->address;
126+
}
127+
128+
/**
129+
* Set the value of address
130+
*
131+
* @return self
132+
*/
133+
public function setAddress($address)
134+
{
135+
$this->address = $address;
136+
137+
return $this;
138+
}
139+
140+
/**
141+
* Get the value of city
142+
*/
143+
public function getCity()
144+
{
145+
return $this->city;
146+
}
147+
148+
/**
149+
* Set the value of city
150+
*
151+
* @return self
152+
*/
153+
public function setCity($city)
154+
{
155+
$this->city = $city;
156+
157+
return $this;
158+
}
159+
160+
/**
161+
* Get the value of state
162+
*/
163+
public function getState()
164+
{
165+
return $this->state;
166+
}
167+
168+
/**
169+
* Set the value of state
170+
*
171+
* @return self
172+
*/
173+
public function setState($state)
174+
{
175+
$this->state = $state;
176+
177+
return $this;
178+
}
179+
180+
/**
181+
* Get the value of countryCode
182+
*/
183+
public function getCountryCode()
184+
{
185+
return $this->countryCode;
186+
}
187+
188+
/**
189+
* Set the value of countryCode
190+
*
191+
* @return self
192+
*/
193+
public function setCountryCode($countryCode)
194+
{
195+
$this->countryCode = $countryCode;
196+
197+
return $this;
198+
}
199+
200+
/**
201+
* Get the value of postalCode
202+
*/
203+
public function getPostalCode()
204+
{
205+
return $this->postalCode;
206+
}
207+
208+
/**
209+
* Set the value of postalCode
210+
*
211+
* @return self
212+
*/
213+
public function setPostalCode($postalCode)
214+
{
215+
$this->postalCode = $postalCode;
216+
217+
return $this;
218+
}
219+
220+
/**
221+
* Get the value of phoneNumber
222+
*/
223+
public function getPhoneNumber()
224+
{
225+
return $this->phoneNumber;
226+
}
227+
228+
/**
229+
* Set the value of phoneNumber
230+
*
231+
* @return self
232+
*/
233+
public function setPhoneNumber($phoneNumber)
234+
{
235+
$this->phoneNumber = $phoneNumber;
236+
237+
return $this;
238+
}
239+
}

0 commit comments

Comments
 (0)