Skip to content

Commit 248a8e9

Browse files
committed
feat: Adicionado campo establishmentCode em PaymentFacilitator
1 parent 5e517b4 commit 248a8e9

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

src/Cielo/API30/Ecommerce/PaymentFacilitator.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@ class PaymentFacilitator implements \JsonSerializable
1111
{
1212
private $subEstablishment;
1313

14+
private $establishmentCode;
15+
1416
public function __construct($subEstablishment = null)
1517
{
1618
$this->subEstablishment = $subEstablishment;
19+
$this->establishmentCode = null;
1720
}
1821

1922
/**
2023
* @param \stdClass $data
2124
*/
2225
public function populate(\stdClass $data)
2326
{
24-
$this->subEstablishment = new SubEstablishment();
27+
$this->subEstablishment = new SubEstablishment();
28+
$this->establishmentCode = $data->EstablishmentCode ?? null;
2529
$this->subEstablishment->populate($data);
2630
}
2731

@@ -38,7 +42,7 @@ public function subEstablishment()
3842
if (is_null($this->subEstablishment)) {
3943
$this->setSubEstablishment(new SubEstablishment());
4044
}
41-
45+
4246
return $this->getSubEstablishment();
4347
}
4448

@@ -61,4 +65,24 @@ public function setSubEstablishment(SubEstablishment $subEstablishment)
6165

6266
return $this;
6367
}
64-
}
68+
69+
/**
70+
* Get the value of establishmentCode
71+
*/
72+
public function getEstablishmentCode()
73+
{
74+
return $this->establishmentCode;
75+
}
76+
77+
/**
78+
* Set the value of establishmentCode
79+
*
80+
* @return self
81+
*/
82+
public function setEstablishmentCode($establishmentCode)
83+
{
84+
$this->establishmentCode = $establishmentCode;
85+
86+
return $this;
87+
}
88+
}

src/Cielo/API30/Ecommerce/SubEstablishment.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function getEstablishmentCode()
7272
*/
7373
public function setEstablishmentCode($establishmentCode)
7474
{
75-
$this->establishmentCode = $establishmentCode;
75+
$this->establishmentCode = mb_substr(trim($establishmentCode), 0, 15);
7676

7777
return $this;
7878
}
@@ -132,7 +132,7 @@ public function getAddress()
132132
*/
133133
public function setAddress($address)
134134
{
135-
$this->address = $address;
135+
$this->address = mb_substr(trim($address), 0, 22);
136136

137137
return $this;
138138
}
@@ -152,7 +152,7 @@ public function getCity()
152152
*/
153153
public function setCity($city)
154154
{
155-
$this->city = $city;
155+
$this->city = mb_substr(trim($city), 0, 13);
156156

157157
return $this;
158158
}
@@ -182,7 +182,7 @@ public function setState($state)
182182
*/
183183
public function getCountryCode()
184184
{
185-
return $this->countryCode;
185+
return $this->countryCode ?? self::DEFAULT_COUTRY_CODE;
186186
}
187187

188188
/**
@@ -212,7 +212,7 @@ public function getPostalCode()
212212
*/
213213
public function setPostalCode($postalCode)
214214
{
215-
$this->postalCode = $postalCode;
215+
$this->postalCode = mb_substr(trim($postalCode), 0, 9);
216216

217217
return $this;
218218
}

0 commit comments

Comments
 (0)