lineofflight / peddler

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

How do I pass array of prep details instructions when creating inbound shipment plans? #112

Closed noorani786 closed 6 years ago

noorani786 commented 6 years ago

Passing it as follows but not working:

{:seller_sku=>"0009-27395", :quantity=>50, :fulfillment_network_sku=>"B01AZC3J3M", :prep_details_list=>[{:prep_instruction=>"Labeling", :prep_owner=>"AMAZON"}]}

But it doesn't seem to be working. Here is what peddler is generating:

...InboundShipmentPlanRequestItems.member.37.PrepDetailsList=%5B%7B%3Aprep_instruction%3D%3E%22Labeling%22%2C%20%3Aprep_owner%3D%3E%22AMAZON%22%7D%5D...

Can you please help? Thanks!

hakanensari commented 6 years ago

@noorani786 Thanks for reporting, I fixed this.

noorani786 commented 6 years ago

Excellent! Thank you.

noorani786 commented 6 years ago

Hey... did you release this yet on 2.0?

noorani786 commented 6 years ago

Still breaks if you have more than one item with PrepDetailsList. See below:

InboundShipmentPlanRequestItems.member.141.PrepDetailsList.member.1.PrepInstruction=Labeling&InboundShipmentPlanRequestItems.member.141.PrepDetailsList.member.1.PrepOwner=AMAZON&InboundShipmentPlanRequestItems.member.141.Quantity=5&InboundShipmentPlanRequestItems.member.141.SellerSKU=SC2-33-JIMA5BRP&InboundShipmentPlanRequestItems.member.142.FulfillmentNetworkSKU=B00MWM8506&InboundShipmentPlanRequestItems.member.142.PrepDetailsList=%5B%7B%22PrepInstruction%22%3D%3E%22Labeling%22%2C%20%22PrepOwner%22%3D%3E%22AMAZON%22%7D%2C%20%7B%22PrepInstruction%22%3D%3E%22BubbleWrapping%22%2C%20%22PrepOwner%22%3D%3E%22AMAZON%22%7D%5D&InboundShipmentPlanRequestItems.member.142.Quantity=1&InboundShipmentPlanRequestItems.member.142.SellerSKU=SC2-33-JIMA6ID8&InboundShipmentPlanRequestItems.member.143.FulfillmentNetworkSKU=B01AZC3J3M&InboundShipmentPlanRequestItems.member.143.PrepDetailsList=%5B%7B%22PrepInstruction%22%3D%3E%22Labeling%22%2C%20%22PrepOwner%22%3D%3E%22AMAZON%22%7D%5D&InboundShipmentPlanRequestItems.member.143.Quantity=1&InboundShipmentPlanRequestItems.member.143.SellerSKU=0009-27395

hakanensari commented 6 years ago

@noorani786 I'm not sure, perhaps your request is set up incorrectly? The test ☝️ still passes with multiple items.

noorani786 commented 6 years ago

The following request_items array will break the test, ie. passing multiple items with prep-instructions.

request_items = [
        {
          'SellerSKU' => 'SKU00001',
          'Quantity' => '1',
          'PrepDetailsList' => [
            { 'PrepInstruction' => 'Taping', 'PrepOwner' => 'AMAZON' },
            { 'PrepInstruction' => 'BubbleWrapping', 'PrepOwner' => 'AMAZON' }
          ]
        }, {
          'SellerSKU' => 'SKU000002',
          'Quantity' => '2',
          'PrepDetailsList' => [
             { 'PrepInstruction' => 'Taping', 'PrepOwner' => 'AMAZON' },
            { 'PrepInstruction' => 'BubbleWrapping', 'PrepOwner' => 'AMAZON' }
           ]
        }
      ]
hakanensari commented 6 years ago

@noorani786 Thanks again for reporting, I just pushed a fix

noorani786 commented 6 years ago

This works now. All that is remaining now is to add

.structure!('PrepDetailsList', 'member')

to create_inbound_shipment and update_inbound_shipment :)

Thanks!

hakanensari commented 6 years ago

Thanks for the PR @noorani786. I also ended up fixing another issue ☝️

angeldev20 commented 5 years ago

Hi, So what's the correct syntax to call the create_inbound_shipment?