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

Commit 6f6c10b

Browse files
committed
fix: Prevent notice when tax document or receivers are not returned
Prevent notice when tax document or receivers are not returned
1 parent 3dfa2a6 commit 6f6c10b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/Resource/Customer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ protected function populate(stdClass $response)
258258
$customer->data->phone->number = $this->getIfSet('number', $phone);
259259
$customer->data->birthDate = $this->getIfSet('birthDate', $response);
260260
$customer->data->taxDocument = new stdClass();
261-
$customer->data->taxDocument->type = $this->getIfSet('type', $response->taxDocument);
262-
$customer->data->taxDocument->number = $this->getIfSet('number', $response->taxDocument);
261+
$customer->data->taxDocument->type = $this->getIfSet('type', $this->getIfSet('taxDocument', $response));
262+
$customer->data->taxDocument->number = $this->getIfSet('number', $this->getIfSet('taxDocument', $response));
263263
$customer->data->addresses = [];
264264
$customer->data->shippingAddress = $this->getIfSet('shippingAddress', $response);
265265
$customer->data->billingAddress = $this->getIfSet('billingAddress', $response);

src/Resource/Orders.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected function populate(stdClass $response)
161161
$this->orders->data->events = $this->structure($response, Event::PATH, Event::class);
162162

163163
$this->orders->data->items = $response->items;
164-
$this->orders->data->receivers = $response->receivers;
164+
$this->orders->data->receivers = $this->getIfSet('receivers', $response);
165165
$this->orders->data->createdAt = $response->createdAt;
166166
$this->orders->data->status = $response->status;
167167
$this->orders->data->_links = $response->_links;

tests/Resource/CustomerTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public function testCustomerCreate()
4747
$this->assertEquals($customer_original->getFullname(), $customer->getFullname());
4848
$this->assertEquals($customer_original->getPhoneNumber(), $customer->getPhoneNumber());
4949
$this->assertEquals($customer_original->getBirthDate(), $customer->getBirthDate());
50+
$this->assertEquals($customer_original->getTaxDocumentType(), $customer->getTaxDocumentType());
51+
$this->assertEquals($customer_original->getTaxDocumentNumber(), $customer->getTaxDocumentNumber());
5052
}
5153

5254
/**

0 commit comments

Comments
 (0)