Skip to content

Commit be47860

Browse files
Merge pull request #72 from pagarme/bugfix/PAOPN-279/error_when_editing_customer_in_adm_portal
Bug fix editing customer through admin
2 parents ed5eaf2 + f847451 commit be47860

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Payment/Aggregates/Customer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ public function setDocument($document)
124124
{
125125
$this->document = $this->formatDocument($document);
126126

127-
if (empty($this->document)) {
128-
127+
if (empty($this->document) && empty($this->getPagarmeId())) {
129128
$inputName = $this->i18n->getDashboard('document');
130129
$message = $this->i18n->getDashboard(
131130
"The %s should not be empty!",
@@ -228,8 +227,11 @@ public function convertToSDKRequest()
228227
$customerRequest->code = $this->getCode();
229228
$customerRequest->name = $this->getName();
230229
$customerRequest->email = $this->getEmail();
231-
$customerRequest->document = $this->getDocument();
232-
$customerRequest->type = $this->getTypeValue();
230+
if ($this->getDocument()) {
231+
$customerRequest->document = $this->getDocument();
232+
$customerRequest->type = $this->getTypeValue();
233+
}
234+
233235
$customerRequest->address = $this->getAddressToSDK();
234236
$customerRequest->phones = $this->getPhonesToSDK();
235237

0 commit comments

Comments
 (0)