Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete customer address at getOrder II #407

Closed
phploader opened this issue Sep 28, 2022 · 9 comments
Closed

Incomplete customer address at getOrder II #407

phploader opened this issue Sep 28, 2022 · 9 comments

Comments

@phploader
Copy link

phploader commented Sep 28, 2022

Unfortunately, the topic I created here was mistakenly closed although the problem persists.
#388
I would ask to look at the problem again.

Hello,

I use SDK in the version: 5.4.0

I am trying to retrieve order information with the following code:

	$config = new Configuration([
		"lwaClientId" => "amzn1.application-oa2-client.xxx",
		"lwaClientSecret" => "7904axxxxx",
		"lwaRefreshToken" => "Atzr|xxxxxx",
		"awsAccessKeyId" => "AKIA4xxxxx",
		"awsSecretAccessKey" => "sLX3zoxxxxxxx",
		"endpoint" => Endpoint::EU
	]);

	$apiInstance = new SellingPartnerApi\Api\OrdersV0Api($config);	
	$order_id = '302-8046517-XXXXXXX';	
	$data_elements = ['buyerInfo', 'shippingAddress'];
	
	try {
		$result = $apiInstance->getOrder($order_id, $data_elements);
		echo "<pre>"; print_r($result); echo "</pre>";
	} catch (Exception $e) {
		echo 'Exception when calling OrdersV0Api->getOrderAddress: ', $e->getMessage(), PHP_EOL;
	}

In response I get the following result. As you can see, customer data is missing like name, first name, street:

SellingPartnerApi\Model\OrdersV0\GetOrderResponse Object
(
	[container:protected] => Array
		(
			[payload] => SellingPartnerApi\Model\OrdersV0\Order Object
				(
					[container:protected] => Array
						(
							[amazon_order_id] => 302-8046517-XXXXXXX
							[seller_order_id] => 302-8046517-XXXXXXX
							[purchase_date] => 2022-08-07T18:46:22Z
							[last_update_date] => 2022-08-08T01:16:16Z
							[order_status] => Shipped
							[fulfillment_channel] => AFN
							[sales_channel] => Amazon.de
							[order_channel] => 
							[ship_service_level] => Expedited
							[order_total] => SellingPartnerApi\Model\OrdersV0\Money Object
								(
									[container:protected] => Array
										(
											[currency_code] => EUR
											[amount] => XX.XX
										)

								)

							[number_of_items_shipped] => 1
							[number_of_items_unshipped] => 0
							[payment_execution_detail] => 
							[payment_method] => Other
							[payment_method_details] => Array
								(
									[0] => Standard
								)

							[marketplace_id] => A1PA6795UKMFR9
							[shipment_service_level_category] => Expedited
							[easy_ship_shipment_status] => 
							[cba_displayable_shipping_label] => 
							[order_type] => StandardOrder
							[earliest_ship_date] => 2022-08-08T21:59:59Z
							[latest_ship_date] => 2022-08-08T21:59:59Z
							[earliest_delivery_date] => 
							[latest_delivery_date] => 
							[is_business_order] => 
							[is_prime] => 
							[is_premium_order] => 
							[is_global_express_enabled] => 
							[replaced_order_id] => 
							[is_replacement_order] => 
							[promise_response_due_date] => 
							[is_estimated_ship_date_set] => 
							[is_sold_by_ab] => 
							[is_iba] => 
							[default_ship_from_location_address] => 
							[buyer_invoice_preference] => 
							[buyer_tax_information] => 
							[fulfillment_instruction] => 
							[is_ispu] => 
							[is_access_point_order] => 
							[marketplace_tax_info] => 
							[seller_display_name] => 
							[shipping_address] => SellingPartnerApi\Model\OrdersV0\Address Object
								(
									[container:protected] => Array
										(
											[name] => 
											[address_line1] => 
											[address_line2] => 
											[address_line3] => 
											[city] => Berlin
											[county] => 
											[district] => 
											[state_or_region] => 
											[municipality] => 
											[postal_code] => 12059
											[country_code] => DE
											[phone] => 
											[address_type] => 
										)

								)

							[buyer_info] => SellingPartnerApi\Model\OrdersV0\BuyerInfo Object
								(
									[container:protected] => Array
										(
											[buyer_email] => [email protected]
											[buyer_name] => 
											[buyer_county] => 
											[buyer_tax_info] => 
											[purchase_order_number] => 
										)

								)

							[automated_shipping_settings] => 
							[has_regulated_items] => 
						)

				)

			[errors] => 
			[headers] => Array
				(
					[Date] => Array
						(
							[0] => Tue, 30 Aug 2022 16:27:35 GMT
						)

					[Content-Type] => Array
						(
							[0] => application/json
						)

					[Content-Length] => Array
						(
							[0] => 977
						)

					[Connection] => Array
						(
							[0] => keep-alive
						)

					[x-amzn-RequestId] => Array
						(
							[0] => 29606bf4-744d-414f-91cd-XXXX
						)

					[x-amzn-RateLimit-Limit] => Array
						(
							[0] => 0.0167
						)

					[x-amz-apigw-id] => Array
						(
							[0] => Xr4SoEfzjXXXXX=
						)

					[X-Amzn-Trace-Id] => Array
						(
							[0] => Root=1-630e3a77-XXXX
						)

				)

		)
)

(Please note that I made sensitive data with XX away).

Amazon support says that I already have PII roll and the data I had already received with the old interface MWS as well.

Can you please tell me if it is a bug in my code that I am not getting this data?

@asakpke
Copy link

asakpke commented Oct 4, 2022

Maybe some customers have not stored all of their info.

@phploader
Copy link
Author

No.
I still use the old MWS interface in parallel and was able to import all data of this order via MWS.
For this reason I exclude missing data or missing PII rights.

I have now also updated the Selling-Partner-API to the current 5.4.0.

Problem still exists.

@gokigoks
Copy link

gokigoks commented Oct 7, 2022

Can you try dumping the raw response from the SPAPI response and see if it returns the missing values? This could very well be a SPAPI problem.

@jlevers
Copy link
Owner

jlevers commented Oct 9, 2022

I don't see anything wrong with your code. Could you please provide a screenshot of your SP API app config in Seller Central?

@phploader
Copy link
Author

phploader commented Oct 12, 2022

Hello @gokigoks
Which answer do you mean?
I did the output with "print_r($result);" and output in the First Message like this.
How else should I mac the output?

Hallo @jlevers,
This is my cofiguration, look at the picture.
I had also already set all the hooks to test, but same problem.

(App names I have replaced with XXX!).
image

@jlevers
Copy link
Owner

jlevers commented Oct 13, 2022

You won't be able to retrieve shipping addresses with the roles you have access to -- Tax Invoicing gives you access to the buyer_info data, but not shipping-related info. What happens if you only pass buyerInfo to $data_elements?

@phploader
Copy link
Author

@jlevers I tried so just now and passed only byer_info. Unfortunately the same problem. :-(
Are my APP settings so in order or should I change something?

Amazon gave me the following answer:

Please make a call to getOrders and use the Atz.sprdt|XXXXX token under the x-amz-access-token.

Amazon support assumes that it is transferred wrong token when querying. Since I use this API for this, I have made no change in the direction, because I assume that this API already correctly transmits the data to Apazon.
Or could there be an internal problem with the API?

Can someone check my code and confirm if it works as it is?

@phploader
Copy link
Author

Ok, thanks for all who have investigated the problem with.
I was now able to solve the problem.

The token needs to be regenerated, just as was said here:
amzn/selling-partner-api-models#1854

@jlevers
I'm afraid I have another problem from your other project:
jlevers/spapi-oauth-template#4

I guess your project doesn't work with new composer packages anymore. But I also just need a simple script that works. I have already created something and I also have difficulties to use your API. I think for you the error would be easy to find than for me.

@jlevers
Copy link
Owner

jlevers commented Oct 30, 2022

Glad you got it resolved.
i'll be addressing the issue in the OAuth repo in a couple weeks by releasing a new version of the OAuth flow that's built on Laravel.

@jlevers jlevers closed this as completed Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants