lineofflight / peddler

Amazon Selling Partner API (SP-API) in Ruby
MIT License
307 stars 130 forks source link

The field PerUnitDeclaredValue has a value of USD, was expecting CAD #102

Closed Trimakas closed 6 years ago

Trimakas commented 6 years ago

I'm getting this error when requesting a shipment be sent from Canada to the US.

So I thought I would monkey patch the create_fulfillment_order items struct.

and just put in the values needed by Amazon.. an amount and currency type.

Problem I'm having is I can't find where items is defined anywhere.

Where should I look?

hakanensari commented 6 years ago

It sounds like you are dealing with the US marketplace, so you should perhaps include that as a parameter? Otherwise, Peddler or Amazon (not sure which one in this case) will default to your home marketplace.

Trimakas commented 6 years ago

This occurs when the user has a Canadian FBA account and we're requesting a shipment to the US. So its going across borders.. Seems to only request this when going from Canada to the US.. I just tried sending the marketplace as well and got the same error:

<Message>The request must contain the parameter PerUnitDeclaredValue.</Message>\n </Error>\n <RequestId>92e57483-c9f8-40a1-82cb-6670a85fffee</RequestId>\n</ErrorResponse>

Trimakas commented 6 years ago

I've tried also including this in the items struct: Value = Struct.new(:currency_code, :value)

And then items would look like this then: Struct.new(:seller_sku, :seller_fulfillment_order_item_id, :quantity, :per_unit_declared_value)

But when I try that I get this error: <Message>the SellerSKU for Item Id: s2 is invalid.</Message>

But s2 isn't the SellerSKU, its the seller_fulfillment_order_item_id

Trimakas commented 6 years ago

That's why I was thinking I could change the items argument that's fed to create_fulfillment_order but I can't find how/where.

hakanensari commented 6 years ago

Looking at Amazon's docs, it does look like they have a new argument for marketplace. I'm pretty certain this is going to work if you include marketplace_id: 'THE US MARKETPLACE ID HERE' with the other arguments. I'll update the docs when I get a chance.

(Yes, Amazon changes their API without announcement.)

Trimakas commented 6 years ago

OK, let me see.. I was doing this and it didn't work?? client.create_fulfillment_order("z536", "z536", Time.now.getutc, "Thank You", "Standard", address, sku, opts = {marketplace_id: "A2EUQ1WTGCTBG2"})

but that is the Canadian marketplace.. the one that matches the client

let me try the destination marketplace..

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.