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

Full address and Name is not showing in the response of getOrderReferenceDetails #55

Open
rohitpatil-tudip opened this issue Jul 7, 2017 · 10 comments

Comments

@rohitpatil-tudip
Copy link

rohitpatil-tudip commented Jul 7, 2017

I want full selected address when the user selects any address from the address book.
Following is the response what I got when "getOrderReferenceDetails" is executed.

{
    "GetOrderReferenceDetailsResult": {
        "OrderReferenceDetails": {
            "OrderReferenceStatus": {
                "State": "Draft"
            },
            "Destination": {
                "DestinationType": "Physical",
                "PhysicalDestination": {
                    "StateOrRegion": "Maharashtra",
                    "City": "Pune",
                    "CountryCode": "IN",
                    "PostalCode": "411057"
                }
            },
            "ExpirationTimestamp": "2018-01-03T11:27:29.805Z",
            "IdList": {

            },
            "SellerOrderAttributes": {
                "StoreName": "ZACK ACADEMY"
            },
            "OrderTotal": {
                "CurrencyCode": "USD",
                "Amount": "253.98"
            },
            "ReleaseEnvironment": "Sandbox",
            "SellerNote": "12-31-2020 - LEED Green Associate Exam Prep Online Anytime - Online, Live",
            "AmazonOrderReferenceId": "S01-4810502-0586824",
            "CreationTimestamp": "2017-07-07T11:27:29.805Z",
            "RequestPaymentAuthorization": "false"
        }
    },
    "ResponseMetadata": {
        "RequestId": "86c8e015-a182-4eca-b86f-b6c799ad6115"
    },
    "ResponseStatus": "200"
}
@pdbreen
Copy link
Contributor

pdbreen commented Jul 7, 2017

Two thoughts

  1. make sure you're including payments:shipping_address in your scope
...
authorization: function () {
   loginOptions = {scope: 'profile payments:widget payments:shipping_address', popup: true};
   authRequest = amazon.Login.authorize(loginOptions, '{{route('amazon_login')}}');
},
...
  1. it's possible that's all the information that Amazon has in the wallet for that address.

@rohitpatil-tudip
Copy link
Author

@pdbreen, Thanks for the quick reply,

Yes, It is already there in my code but still, it is not giving the address1, address2, name etc details.

@rohitpatil-tudip
Copy link
Author

Here is the expected response that I want,


<GetOrderReferenceDetailsResponse 
   xmlns="http://mws.amazonservices.com/schema/OffAmazonPayments/2013-01-01">
  <GetOrderReferenceDetailsResult>
    <OrderReferenceDetails>
    <AmazonOrderReferenceId>S01-8474066-EXAMPLE</AmazonOrderReferenceId>
    <ExpirationTimestamp>2015-08-31T17:27:35.053Z</ExpirationTimestamp>
    <SellerNote>Thank you for your order.</SellerNote>
    <OrderTotal>
      <Amount>15.00</Amount>
      <CurrencyCode>USD</CurrencyCode>
    </OrderTotal>
    <IdList>
      <member>S01-8474066-2115738-EXAMPLE</member>
    </IdList>
    <OrderReferenceStatus>
      <LastUpdateTimestamp>
        2015-03-04T17:27:43.851Z
      </LastUpdateTimestamp>
      <State>Open</State>
    </OrderReferenceStatus>
    <Destination>
      <DestinationType>Physical</DestinationType>
      <PhysicalDestination>
        <Phone>800-000-0000</Phone>
        <PostalCode>60602</PostalCode>
        <Name>Susie Smith</Name>
        <CountryCode>US</CountryCode>
        <StateOrRegion>IL</StateOrRegion>
        <AddressLine2>Suite 2500</AddressLine2>
        <AddressLine1>10 Ditka Ave</AddressLine1>
        <City>Chicago</City>
      </PhysicalDestination>
    </Destination>
    <ReleaseEnvironment>Sandbox</ReleaseEnvironment>
    <Buyer>
      <Email>[email protected]</Email>
      <Name>Sandbox_tester</Name>
    </Buyer>
    <SellerOrderAttributes>
      <StoreName>Sandbox_test_app</StoreName>
    </SellerOrderAttributes>
    <CreationTimestamp>2015-03-04T17:27:35.053Z</CreationTimestamp>
    </OrderReferenceDetails>
  </GetOrderReferenceDetailsResult>
  <ResponseMetadata>
    <RequestId>181efc0d-a90b-429f-837e-1209bfe4da0e</RequestId>
  </ResponseMetadata>
</GetOrderReferenceDetailsResponse>

@pdbreen
Copy link
Contributor

pdbreen commented Jul 7, 2017

Are you including the token passed to your logon handler as the address_consent_token in the call to getOrderReferenceDetails?

        $this->result = $this->client->getOrderReferenceDetails([
            'amazon_order_reference_id' => $orderReferenceId,
            'address_consent_token' => $token,
        ]);

@rohitpatil-tudip
Copy link
Author

Yes! On the GUI widget it is showing address properly but in the API response, it is not showing all the details.

I want to access these address related details. Is there any other way to do this?

@rohitpatil-tudip
Copy link
Author

Please check details.
details

@pdbreen
Copy link
Contributor

pdbreen commented Jul 7, 2017

I'd double check to make sure that address_consent_token being passed in is correct and the scope is being set properly. When its not supplied, you get partial shipping detail like you have.

https://pay.amazon.com/us/developer/documentation/apireference/201751970

@rohitpatil-tudip
Copy link
Author

Here is my code,
code

@pdbreen
Copy link
Contributor

pdbreen commented Jul 7, 2017

Debug your $_POST values and I think you'll find the addressConsentToken is not set/missing. So, you'll need to go back to the amazon integration doc and figure out what step was missed. Anyway, it doesn't sound like there's any issue with this library.

@islandskater43
Copy link
Contributor

It looks like you are trying to pass the address consent token into a SetOrderReferenceDetails API call. Instead, make the GetOrderReferenceDetails API call with the same inputs.

Otherwise, everything that @pdbreen mentioned above is correct and should work.

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

3 participants