Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
fix: Prevent notice when tax document or receivers are not returned
Browse files Browse the repository at this point in the history
Prevent notice when tax document or receivers are not returned
  • Loading branch information
caiogaspar committed Oct 9, 2017
1 parent 3dfa2a6 commit 6f6c10b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Resource/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ protected function populate(stdClass $response)
$customer->data->phone->number = $this->getIfSet('number', $phone);
$customer->data->birthDate = $this->getIfSet('birthDate', $response);
$customer->data->taxDocument = new stdClass();
$customer->data->taxDocument->type = $this->getIfSet('type', $response->taxDocument);
$customer->data->taxDocument->number = $this->getIfSet('number', $response->taxDocument);
$customer->data->taxDocument->type = $this->getIfSet('type', $this->getIfSet('taxDocument', $response));
$customer->data->taxDocument->number = $this->getIfSet('number', $this->getIfSet('taxDocument', $response));
$customer->data->addresses = [];
$customer->data->shippingAddress = $this->getIfSet('shippingAddress', $response);
$customer->data->billingAddress = $this->getIfSet('billingAddress', $response);
Expand Down
2 changes: 1 addition & 1 deletion src/Resource/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected function populate(stdClass $response)
$this->orders->data->events = $this->structure($response, Event::PATH, Event::class);

$this->orders->data->items = $response->items;
$this->orders->data->receivers = $response->receivers;
$this->orders->data->receivers = $this->getIfSet('receivers', $response);
$this->orders->data->createdAt = $response->createdAt;
$this->orders->data->status = $response->status;
$this->orders->data->_links = $response->_links;
Expand Down
2 changes: 2 additions & 0 deletions tests/Resource/CustomerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function testCustomerCreate()
$this->assertEquals($customer_original->getFullname(), $customer->getFullname());
$this->assertEquals($customer_original->getPhoneNumber(), $customer->getPhoneNumber());
$this->assertEquals($customer_original->getBirthDate(), $customer->getBirthDate());
$this->assertEquals($customer_original->getTaxDocumentType(), $customer->getTaxDocumentType());
$this->assertEquals($customer_original->getTaxDocumentNumber(), $customer->getTaxDocumentNumber());
}

/**
Expand Down

0 comments on commit 6f6c10b

Please sign in to comment.