amazon-php / sp-api-sdk

Amazon Selling Partner SPI - PHP SDKs
128 stars 52 forks source link

Return value of AmazonPHP\SellingPartner\Model\Orders\Address::getName() must be of the type string, null returned #328

Closed axsweet closed 2 months ago

axsweet commented 1 year ago

V: amazon-php/sp-api-sdk 4.0.12 Amazon Selling Partner API - PHP SDK PHP V ~7.4

Some address is null so on jsonSerialize() I get this error... seems the data has a null and wants a string.

TypeError

Return value of AmazonPHP\SellingPartner\Model\Orders\Address::getName() must be of the type string, null returned

at vendor/amazon-php/sp-api-sdk/src/AmazonPHP/SellingPartner/Model/Orders/Address.php:282 278▕ Gets name. 279▕ / 280▕ public function getName() : string 281▕ { ➜ 282▕ return $this->container['name']; 283▕ } 284▕ 285▕ /* 286▕ Sets name.

  +6 vendor frames

7 app/Console/Commands/AmazonCommands.php:660 AmazonPHP\SellingPartner\Model\Orders\GetOrdersResponse::jsonSerialize()

fawsan commented 1 year ago

any answers on this ?

axsweet commented 1 year ago

I removed the strict types requirement on the ask file.

But ultimately i beliehe i didn't have the approval (still waiting) to get the customer info. Found it funnny I can get 85% but need advanced approval for the name but. Anyway.

stdmedoth commented 1 year ago

I had the same problem.

I solved it by adding ? in string return type on getName method from Address class

like this: before: public function getName(): string after: public function getName(): ?string

axsweet commented 1 year ago

Yeah i worked around it similarly by either A removing strict type declaration or just the return type. except for the fact that the information in the fields i wanted is infact coming as null because i need extra permissions they wont grant it to be in dev vetting so we are working on that. its frsutratig since we get that info now from MWS already.

A

On Thu, Feb 23, 2023 at 3:04 PM Calisto @.***> wrote:

I had the same problem.

I solved it by adding ? in string return type on getName method from Address class

like this: before: public function getName(): string after: public function getName(): ?string

— Reply to this email directly, view it on GitHub https://github.com/amazon-php/sp-api-sdk/issues/328#issuecomment-1442363222, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALF5SJHBEUPXVK2P6I6AHODWY67GDANCNFSM6AAAAAAUOKK37Y . You are receiving this because you authored the thread.Message ID: @.***>

xiaoguo0426 commented 1 year ago

got the same error.

bolner commented 1 year ago

It's weird that there were tons of commits since the 2nd of February, but this issue is still not fixed: https://github.com/amazon-php/sp-api-sdk/blob/cda85c7ad9f9fdcd537d4e25d532b022f33feaad/src/AmazonPHP/SellingPartner/Model/Orders/Address.php#L291

The API clearly returns NULL values for the address.name, so this library is not compatible with the Amazon SP-API.

sergisolanellas commented 1 year ago

Amazon will not fix this. The privacy of Amazon avoid to return the name, address, phone, etc...

johncarlson21 commented 1 year ago

I think the privacy part is where you need to be approved for PII. I had no problem with our MWS app but now making this new one I think it needs to be approved.

axsweet commented 1 year ago

Yeah shoudlnt throw an error though should have error handling for permissions. Would save devs time.

Anyway i only wanted to make the app for myself (my company) they wont approve my dev access again. Dk why keep saying same reply have zero idea.

On Thu, May 25, 2023 at 12:48 AM John Carlson @.***> wrote:

I think the privacy part is where you need to be approved for PII. I had no problem with our MWS app but now making this new one I think it needs to be approved.

— Reply to this email directly, view it on GitHub https://github.com/amazon-php/sp-api-sdk/issues/328#issuecomment-1562260830, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALF5SJEJUTXNK73KCCLOLFLXH3QDDANCNFSM6AAAAAAUOKK37Y . You are receiving this because you authored the thread.Message ID: @.***>

sergisolanellas commented 1 year ago

I think the privacy part is where you need to be approved for PII. I had no problem with our MWS app but now making this new one I think it needs to be approved.

Hi! Can you explain how it's possible to contact to Amazon to give the permission of receive all data of the orders?

Thanks

axsweet commented 1 year ago

Apply for developer access

On Thu, May 25, 2023 at 9:46 AM Sergi Solanellas @.***> wrote:

I think the privacy part is where you need to be approved for PII. I had no problem with our MWS app but now making this new one I think it needs to be approved.

Hi! Can you explain how it's possible to contact to Amazon to give the permission of receive all data of the orders?

Thanks

— Reply to this email directly, view it on GitHub https://github.com/amazon-php/sp-api-sdk/issues/328#issuecomment-1562939786, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALF5SJEBLUI3YCWCNVQB5VTXH5PCHANCNFSM6AAAAAAUOKK37Y . You are receiving this because you authored the thread.Message ID: @.***>

jasonhebert commented 2 months ago

This method returns string or null and shouldn't throw the error anymore.