lineofflight / peddler

Amazon Selling Partner API (SP-API) in Ruby
https://lineofflight.github.io/peddler/
MIT License
307 stars 130 forks source link

finances list potentially not matching amazon #83

Closed chrishough closed 6 years ago

chrishough commented 7 years ago

As you can see from what is shown below it appears an entire node is either missing or not mapping correctly via the parser. Thoughts?

Amazon Example

{"NextToken"=>"2YgYW55IGNhcm5hbCBwbGVhcEXAMPLE",
 "FinancialEvents"=>
  {"ShipmentEventList"=>
    {"ShipmentEvent"=>
      {"AmazonOrderId"=>"333-1234567-1234567",
       "SellerOrderId"=>"333-1234567-7654321",
       "MarketplaceName"=>"amazon.com",
       "OrderChargeList"=>
        {"OrderCharge"=>[{"ChargeType"=>"Principal", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"10.0"}}, {"ChargeType"=>"Tax", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"1.0"}}]},
       "ShipmentFeeList"=>{"ShipmentFee"=>{"FeeType"=>"FBAStorageFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-1.0"}}},
       "OrderFeeList"=>{"OrderFee"=>{"FeeType"=>"LabellingFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-1.0"}}},
       "FulfillmentList"=>
        {"PostedDate"=>"2012-07-18T00:00:00Z",
         "DirectPaymentList"=>{"DirectPayment"=>{"DirectPaymentType"=>"StoredValuedCardRevenue", "DirectPaymentAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"1.0"}}},
         "ShipmentItemList"=>
          {"ShipmentItem"=>
            {"SellerSKU"=>"CBA_OTF_1",
             "OrderItemId"=>"6882857EXAMPLE",
             "QuantityShipped"=>"2",
             "ItemChargeList"=>{"ItemCharge"=>{"ChargeType"=>"Discount", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"1.99"}}},
             "ItemFeeList"=>{"ItemFee"=>{"FeeType"=>"FBAStorageFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-1.99"}}},
             "PromotionList"=>{"Promotion"=>{"PromotionType"=>"Shipping", "PromotionId"=>"SummerEXAMPLE", "PromotionAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-15.99"}}},
             "CostOfPointsGranted"=>{"CurrencyCode"=>"USD", "Amount"=>"-5.99"}}}}}},
   "RefundEventList"=>
    {"ShipmentEvent"=>
      {"SellerOrderId"=>"333-7654321-7654321",
       "MarketplaceName"=>"amazon.com",
       "OrderChargeAdjustmentList"=>
        {"OrderChargeAdjustment"=>
          [{"ChargeType"=>"ShippingCharge", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-1.99"}}, {"ChargeType"=>"Giftwrap", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-0.99"}}]},
       "ShipmentFeeAdjustmentList"=>
        {"ShipmentFeeAdjustment"=>
          [{"FeeType"=>"FBADeliveryServicesFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"1.99"}}, {"FeeType"=>"FBAPlacementServiceFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"0.99"}}]},
       "OrderFeeAdjustmentList"=>{"OrderFeeAdjustment"=>{"FeeType"=>"FBAInventoryReturnFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"1.99"}}},
       "FulfillmentList"=>
        {"PostedDate"=>"2012-07-18T00:00:00Z",
         "ShipmentItemAdjustmentList"=>
          {"ShipmentItemAdjustment"=>
            {"SellerSKU"=>"CBA_OTF_1",
             "OrderAdjustmentItemId"=>"6882857EXAMPLE",
             "QuantityShipped"=>"4",
             "ItemChargeAdjustmentList"=>{"ItemCharge"=>{"ChargeType"=>"ReturnShipping", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-1.99"}}},
             "ItemFeeAdjustmentList"=>{"ItemFee"=>{"FeeType"=>"ShippingChargeback", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"2.99"}}},
             "PromotionAdjustmentList"=>{"Promotion"=>{"PromotionType"=>"Shipping", "PromotionId"=>"Summer099018", "PromotionAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"22.99"}}},
             "CostOfPointsReturned"=>{"CurrencyCode"=>"USD", "Amount"=>"5.99"}}}}}},
   "PayWithAmazonEventList"=>
    {"PayWithAmazonEvent"=>
      {"SellerOrderId"=>"333-7654321-7654321",
       "TransactionPostedDate"=>"\n            2013-09-071T02:00:00.000-06:00\n          ",
       "BusinessObjectType"=>"PaymentContract",
       "SalesChannel"=>"www.merchantsite.com",
       "Charge"=>{"ChargeType"=>"Principal", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"2.99"}},
       "FeeList"=>{"Fee"=>{"FeeType"=>"VariableClosingFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-0.99"}}},
       "PaymentAmountType"=>"Sales",
       "AmountDescription"=>"Pay with amazon transaction",
       "FulfillmentNetwork"=>"MFN",
       "StoreName"=>"TestStoreName"}},
   "SolutionProviderCreditEventList"=>
    {"SolutionProviderCreditEvent"=>
      {"ProviderTransactionType"=>"\n            SolutionProviderCredit\n          ",
       "SellerOrderId"=>"333-7654321-7654321",
       "MarketplaceId"=>"12",
       "MarketplaceCountryCode"=>"US",
       "TransactionAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"22.99"},
       "SellerId"=>"987918809",
       "SellerStoreName"=>"TestSellerStoreName",
       "ProviderId"=>"6798769889",
       "ProviderStoreName"=>"TestProviderStoreName"}},
   "RetrochargeEventList"=>
    {"RetrochargeEvent"=>
      {"RetrochargeEventType"=>"Retrocharge",
       "AmazonOrderId"=>"333-1234567-1234567",
       "PostedDate"=>"2013-09-071T02:00:00.000-06:00",
       "BaseTax"=>{"CurrencyCode"=>"USD", "Amount"=>"1.99"},
       "ShippingTax"=>{"CurrencyCode"=>"USD", "Amount"=>"2.99"},
       "MarketplaceName"=>"amazon.com"}},
   "RentalTransactionEventList"=>
    {"RentalTransaction"=>
      {"AmazonOrderId"=>"333-1234567-1234567",
       "RentalTransactionType"=>"\n            RentalCustomerPayment-Buyout\n          ",
       "PostedDate"=>"2013-09-071T02:00:00.000-06:00",
       "ExtensionLength"=>"12",
       "RentalChargeList"=>{"ChargeType"=>"Tax", "ChargeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"0.99"}},
       "RentalFeeList"=>{"FeeType"=>"SalesTaxServiceFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-1.99"}},
       "MarketplaceName"=>"amazon.com",
       "RentalInitialValue"=>{"CurrencyCode"=>"USD", "Amount"=>"3.99"},
       "RentalReimbursement"=>{"CurrencyCode"=>"USD", "Amount"=>"1.99"}}},
   "PerformanaceBondRefundEventList"=>
    {"PerformanceBondRefundEvent"=>
      {"MarketplaceCountryCode"=>"US",
       "Amount"=>{"CurrencyCode"=>"USD", "Amount"=>"1.99"},
       "ProductGroupList"=>{"GLProductGroup"=>{"GLName"=>"gl_books", "TranslatorStringId"=>"\n                string_translator_id_6982708\n              "}}}},
   "ServiceFeeEventList"=>
    {"ServiceFeeEvent"=>
      {"AmazonOrderId"=>"333-1234567-1234567",
       "FeeReason"=>"fba inbound defect fee",
       "FeeList"=>{"Fee"=>{"FeeType"=>"FBAOrderHandlingFee", "FeeAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-0.99"}}},
       "SellerSKU"=>"CBA_OF_1",
       "FNSKU"=>"AKSJD12",
       "FeeDescription"=>"Test Fee description",
       "ASIN"=>"BT0093TELA"}},
   "DebtRecoveryEventList"=>
    {"DebtRecoveryEvent"=>
      {"DebtRecoveryType"=>"DebtAdjustment",
       "RecoveryAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"10.99"},
       "OverPaymentCredit"=>{"CurrencyCode"=>"USD", "Amount"=>"8.99"},
       "DebtRecoveryItemList"=>
        {"DebtRecoveryItem"=>
          {"RecoveryAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"5.99"},
           "OriginalAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"4.99"},
           "GroupBeginDate"=>"2013-09-09T01:30:00.000-06:00",
           "GroupEndDate"=>"2013-09-23T01:30:00.000-06:00"}},
       "ChargeInstrumentList"=>{"ChargeInstrument"=>{"Description"=>"Credit card", "Tail"=>"9887", "Amount"=>{"CurrencyCode"=>"USD", "Amount"=>"9.99"}}}}},
   "LoanServicingEventList"=>{"LoanServicingEvent"=>{"LoanAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"13.99"}, "SourceBusinessEventType"=>"LoanAdvance"}},
   "AdjustmentEventList"=>
    {"AdjustmentEvent"=>
      {"AdjustmentType"=>"PostageBilling",
       "AdjustmentAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-5.99"},
       "AdjustmentItemList"=>
        {"AdjustmentItem"=>
          {"Quantity"=>"2",
           "PerUnitAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-1.99"},
           "TotalAmount"=>{"CurrencyCode"=>"USD", "Amount"=>"-5.99"},
           "SellerSKU"=>"ASK_AS_1",
           "FNSKU"=>"ASLKLDS12",
           "ProductDescription"=>"Test Product",
           "ASIN"=>"BT0093TELA"}}}}}}

My Example

  "ShipmentEventList"=>
   {"ShipmentEvent"=>
     {"ShipmentItemList"=>
       {"ShipmentItem"=>
         {"ItemChargeList"=>
           {"ChargeComponent"=>
             [{"ChargeType"=>"Principal", "ChargeAmount"=>{"CurrencyAmount"=>"5.75", "CurrencyCode"=>"USD"}},
              {"ChargeType"=>"Tax", "ChargeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}},
              {"ChargeType"=>"GiftWrap", "ChargeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}},
              {"ChargeType"=>"GiftWrapTax", "ChargeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}},
              {"ChargeType"=>"ShippingCharge", "ChargeAmount"=>{"CurrencyAmount"=>"1.33", "CurrencyCode"=>"USD"}},
              {"ChargeType"=>"ShippingTax", "ChargeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}}]},
          "ItemFeeList"=>
           {"FeeComponent"=>
             [{"FeeType"=>"FBAPerOrderFulfillmentFee", "FeeAmount"=>{"CurrencyAmount"=>"-1.0", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"FBAPerUnitFulfillmentFee", "FeeAmount"=>{"CurrencyAmount"=>"-1.06", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"FBAWeightBasedFee", "FeeAmount"=>{"CurrencyAmount"=>"-0.96", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"Commission", "FeeAmount"=>{"CurrencyAmount"=>"-1.0", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"FixedClosingFee", "FeeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"GiftwrapChargeback", "FeeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"SalesTaxCollectionFee", "FeeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"ShippingChargeback", "FeeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}},
              {"FeeType"=>"VariableClosingFee", "FeeAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}}]},
          "OrderItemId"=>"17345807364258",
          "QuantityShipped"=>"1",
          "SellerSKU"=>"JE-VQ0J-STX8",
          "PromotionList"=>
           {"Promotion"=>
             [{"PromotionType"=>"PromotionMetaDataDefinitionValue", "PromotionAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}, "PromotionId"=>"US Core Free Shipping"},
              {"PromotionType"=>"PromotionMetaDataDefinitionValue", "PromotionAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}, "PromotionId"=>"US Core Free Shipping"},
              {"PromotionType"=>"PromotionMetaDataDefinitionValue", "PromotionAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}, "PromotionId"=>"US Core Free Shipping"},
              {"PromotionType"=>"PromotionMetaDataDefinitionValue", "PromotionAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}, "PromotionId"=>"US Core Free Shipping"},
              {"PromotionType"=>"PromotionMetaDataDefinitionValue", "PromotionAmount"=>{"CurrencyAmount"=>"-1.33", "CurrencyCode"=>"USD"}, "PromotionId"=>"US Core Free Shipping"},
              {"PromotionType"=>"PromotionMetaDataDefinitionValue", "PromotionAmount"=>{"CurrencyAmount"=>"0.0", "CurrencyCode"=>"USD"}, "PromotionId"=>"US Core Free Shipping"}]}}},
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.