예제 #1
0
        /// <summary>
        /// Get Next Inbound Shipment Items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnListInboundShipmentItemsByNextToken_Click(object sender, RoutedEventArgs e)
        {
            string SellerId           = CommonValue.strMerchantId;
            string MarketplaceId      = CommonValue.strMarketplaceId;
            string AccessKeyId        = CommonValue.strAccessKeyId;
            string SecretKeyId        = CommonValue.strSecretKeyId;
            string ApplicationVersion = CommonValue.strApplicationVersion;
            string ApplicationName    = CommonValue.strApplicationName;
            string MWSAuthToken       = CommonValue.strMWSAuthToken;
            string strbuff            = string.Empty;

            FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();

            config.ServiceURL = CommonValue.strServiceURL;

            FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient(
                AccessKeyId,
                SecretKeyId,
                ApplicationName,
                ApplicationVersion,
                config);
            ListInboundShipmentItemsRequest request = new ListInboundShipmentItemsRequest();

            request.SellerId     = SellerId;
            request.Marketplace  = MarketplaceId;
            request.MWSAuthToken = MWSAuthToken;
            request.ShipmentId   = "Set ShipmentId";
            ListInboundShipmentItemsResponse response = client.ListInboundShipmentItems(request);

            if (response.IsSetListInboundShipmentItemsResult())
            {
                if (response.ListInboundShipmentItemsResult.NextToken != null)
                {
                    ListInboundShipmentItemsByNextTokenRequest request1 = new ListInboundShipmentItemsByNextTokenRequest();
                    request1.SellerId    = SellerId;
                    request1.Marketplace = MarketplaceId;
                    request1.NextToken   = response.ListInboundShipmentItemsResult.NextToken;
                    // データ取得処理
                    ListInboundShipmentItemsByNextTokenResponse response1 = client.ListInboundShipmentItemsByNextToken(request1);
                    if (response1.IsSetListInboundShipmentItemsByNextTokenResult())
                    {
                        ListInboundShipmentItemsByNextTokenResult listInboundShipmentItemsByNextTokenResult = response1.ListInboundShipmentItemsByNextTokenResult;
                        if (listInboundShipmentItemsByNextTokenResult.IsSetItemData())
                        {
                            InboundShipmentItemList itemData = listInboundShipmentItemsByNextTokenResult.ItemData;
                            foreach (InboundShipmentItem item in itemData.member)
                            {
                                strbuff += "SKU番号:" + item.SellerSKU + System.Environment.NewLine;
                            }
                        }
                    }
                }
                else
                {
                    strbuff = "次のアイテムがありません。";
                }
            }
            txtListInboundShipmentItemsByNextToken.Text = strbuff;
        }
        public MwsInboundShipmentApi(string sellerId, string marketPlaceId, string accessKeyId, string secretAccessKeyId, string serviceUrl)
        {
            m_sellerId      = sellerId;
            m_marketPlaceId = marketPlaceId;

            FBAInboundServiceMWSConfig fbaInboundServiceConfig = new FBAInboundServiceMWSConfig()
                                                                 .WithServiceURL(serviceUrl);

            fbaInboundServiceConfig.SetUserAgentHeader(string.Empty, string.Empty, "C#");

            m_fbaInboundServiceMwsClient = new FBAInboundServiceMWSClient(accessKeyId, secretAccessKeyId, fbaInboundServiceConfig);
        }
예제 #3
0
        /// <summary>
        /// Update InboundShipment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdateInboundShipment_Click(object sender, RoutedEventArgs e)
        {
            string SellerId           = CommonValue.strMerchantId;
            string MarketplaceId      = CommonValue.strMarketplaceId;
            string AccessKeyId        = CommonValue.strAccessKeyId;
            string SecretKeyId        = CommonValue.strSecretKeyId;
            string ApplicationVersion = CommonValue.strApplicationVersion;
            string ApplicationName    = CommonValue.strApplicationName;
            string MWSAuthToken       = CommonValue.strMWSAuthToken;
            string strbuff            = string.Empty;

            FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();

            config.ServiceURL = CommonValue.strServiceURL;

            FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient(
                AccessKeyId,
                SecretKeyId,
                ApplicationName,
                ApplicationVersion,
                config);
            UpdateInboundShipmentRequest request = new UpdateInboundShipmentRequest();

            request.SellerId     = SellerId;
            request.Marketplace  = MarketplaceId;
            request.MWSAuthToken = MWSAuthToken;
            request.ShipmentId   = txtShipId2.Text;

            InboundShipmentItemList itemList = new InboundShipmentItemList();
            InboundShipmentItem     item     = new InboundShipmentItem();

            item.SellerSKU       = txtSKU2.Text;
            item.QuantityShipped = decimal.Parse(txtQuantity2.Text);

            itemList.member.Add(item);
            request.WithInboundShipmentItems(itemList);
            UpdateInboundShipmentResponse response = client.UpdateInboundShipment(request);

            if (response.IsSetUpdateInboundShipmentResult())
            {
                strbuff = "正常に処理が完了しました。";
            }
            else
            {
                strbuff = "処理途中でエラーが発生しました。";
            }
            txtUpdateInboundShipment.Text = strbuff;
        }
예제 #4
0
        /// <summary>
        /// Get Inbound Shipments List
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnListInboundShipments_Click(object sender, RoutedEventArgs e)
        {
            string SellerId           = CommonValue.strMerchantId;
            string MarketplaceId      = CommonValue.strMarketplaceId;
            string AccessKeyId        = CommonValue.strAccessKeyId;
            string SecretKeyId        = CommonValue.strSecretKeyId;
            string ApplicationVersion = CommonValue.strApplicationVersion;
            string ApplicationName    = CommonValue.strApplicationName;
            string MWSAuthToken       = CommonValue.strMWSAuthToken;
            string strbuff            = string.Empty;

            FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();

            config.ServiceURL = CommonValue.strServiceURL;

            FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient(
                AccessKeyId,
                SecretKeyId,
                ApplicationName,
                ApplicationVersion,
                config);
            ListInboundShipmentsRequest request = new ListInboundShipmentsRequest();

            request.SellerId     = SellerId;
            request.MWSAuthToken = MWSAuthToken;
            request.Marketplace  = MarketplaceId;
            ShipmentStatusList list = new ShipmentStatusList();

            list.member.Add("WORKING");
            request.ShipmentStatusList = list;
            ListInboundShipmentsResponse response = client.ListInboundShipments(request);

            if (response.IsSetListInboundShipmentsResult())
            {
                ListInboundShipmentsResult listInboundShipmentsResult = response.ListInboundShipmentsResult;
                if (listInboundShipmentsResult.IsSetShipmentData())
                {
                    InboundShipmentList        shipmentData = listInboundShipmentsResult.ShipmentData;
                    List <InboundShipmentInfo> memberList   = shipmentData.member;
                    foreach (InboundShipmentInfo member in memberList)
                    {
                        strbuff = "シップメント名:" + member.ShipmentName;
                    }
                }
            }
            txtListInboundShipments.Text = strbuff;
        }
예제 #5
0
        /// <summary>
        /// FbaInbountShipment Service Check
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnGetServiceStatus_Click(object sender, RoutedEventArgs e)
        {
            string SellerId           = CommonValue.strMerchantId;
            string MarketplaceId      = CommonValue.strMarketplaceId;
            string AccessKeyId        = CommonValue.strAccessKeyId;
            string SecretKeyId        = CommonValue.strSecretKeyId;
            string ApplicationVersion = CommonValue.strApplicationVersion;
            string ApplicationName    = CommonValue.strApplicationName;
            string MWSAuthToken       = CommonValue.strMWSAuthToken;
            string strbuff            = string.Empty;

            FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();

            config.ServiceURL = CommonValue.strServiceURL;

            FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient(
                AccessKeyId,
                SecretKeyId,
                ApplicationName,
                ApplicationVersion,
                config);
            GetServiceStatusRequest request = new GetServiceStatusRequest();

            request.SellerId     = SellerId;
            request.MWSAuthToken = MWSAuthToken;
            request.Marketplace  = MarketplaceId;
            GetServiceStatusResponse response = client.GetServiceStatus(request);

            if (response.IsSetGetServiceStatusResult())
            {
                strbuff = "正常終了:" + response.GetServiceStatusResult.Status;
            }
            else
            {
                strbuff = "異常終了:" + response.GetServiceStatusResult.Status;
            }
            txtGetServiceStatus.Text = strbuff;
        }
예제 #6
0
        /// <summary>
        /// Create Inbound Shipment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreateInboundShipment_Click(object sender, RoutedEventArgs e)
        {
            string SellerId           = CommonValue.strMerchantId;
            string MarketplaceId      = CommonValue.strMarketplaceId;
            string AccessKeyId        = CommonValue.strAccessKeyId;
            string SecretKeyId        = CommonValue.strSecretKeyId;
            string ApplicationVersion = CommonValue.strApplicationVersion;
            string ApplicationName    = CommonValue.strApplicationName;
            string MWSAuthToken       = CommonValue.strMWSAuthToken;
            string strbuff            = string.Empty;

            FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();

            config.ServiceURL = CommonValue.strServiceURL;

            FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient(
                AccessKeyId,
                SecretKeyId,
                ApplicationName,
                ApplicationVersion,
                config);
            CreateInboundShipmentPlanRequest request = new CreateInboundShipmentPlanRequest();

            request.SellerId     = SellerId;
            request.Marketplace  = MarketplaceId;
            request.MWSAuthToken = MWSAuthToken;
            Address shipFromAddress = new Address();

            shipFromAddress.AddressLine1        = txtAddress11.Text;
            shipFromAddress.AddressLine2        = txtAddress21.Text;
            shipFromAddress.City                = txtCity1.Text;
            shipFromAddress.StateOrProvinceCode = txtPrefecture1.Text;
            shipFromAddress.Name                = txtName1.Text;
            shipFromAddress.PostalCode          = txtPostalCode1.Text;
            shipFromAddress.CountryCode         = "JP";
            request.ShipFromAddress             = shipFromAddress;
            request.LabelPrepPreference         = "SELLER_LABEL";
            request.ShipToCountryCode           = "JP";
            InboundShipmentPlanRequestItemList itemList = new InboundShipmentPlanRequestItemList();
            InboundShipmentPlanRequestItem     item     = new InboundShipmentPlanRequestItem();

            item.SellerSKU = txtSKU1.Text;
            item.Quantity  = 1;
            itemList.member.Add(item);
            request.WithInboundShipmentPlanRequestItems(itemList);
            CreateInboundShipmentPlanResponse response = client.CreateInboundShipmentPlan(request);

            if (response.IsSetCreateInboundShipmentPlanResult())
            {
                CreateInboundShipmentPlanResult createInboundShipmentPlanResult = response.CreateInboundShipmentPlanResult;
                if (createInboundShipmentPlanResult.IsSetInboundShipmentPlans())
                {
                    InboundShipmentPlanList    inboundShipmentPlans = createInboundShipmentPlanResult.InboundShipmentPlans;
                    List <InboundShipmentPlan> memberList           = inboundShipmentPlans.member;
                    foreach (InboundShipmentPlan member in memberList)
                    {
                        if (member.IsSetShipmentId())
                        {
                            CreateInboundShipmentRequest request1 = new CreateInboundShipmentRequest();

                            request1.SellerId     = SellerId;
                            request1.Marketplace  = MarketplaceId;
                            request1.MWSAuthToken = MWSAuthToken;
                            request1.ShipmentId   = member.ShipmentId;

                            InboundShipmentHeader inboundShipmentHeader = new InboundShipmentHeader();
                            inboundShipmentHeader.ShipFromAddress     = shipFromAddress;
                            inboundShipmentHeader.LabelPrepPreference = "SELLER_LABEL";
                            inboundShipmentHeader.ShipmentName        = txtSKU1.Text;
                            request1.InboundShipmentHeader            = inboundShipmentHeader;
                            InboundShipmentItemList itemList1 = new InboundShipmentItemList();
                            InboundShipmentItem     item1     = new InboundShipmentItem();
                            item1.SellerSKU       = txtSKU1.Text;
                            item1.QuantityShipped = 1;
                            itemList1.member.Add(item1);
                            request1.WithInboundShipmentItems(itemList1);
                            request1.InboundShipmentHeader.DestinationFulfillmentCenterId = member.DestinationFulfillmentCenterId;
                            CreateInboundShipmentResponse response1 = client.CreateInboundShipment(request1);
                            if (response1.IsSetCreateInboundShipmentResult())
                            {
                                strbuff = "処理が正常に完了しました。";
                            }
                            else
                            {
                                strbuff = "処理時にエラーが発生しました。";
                            }
                        }
                    }
                }
            }
            txtCreateInboundShipment.Text = strbuff;
        }
        public static void Main(string[] args)
        {
            // TODO: Set the below configuration variables before attempting to run

            // Developer AWS access key
            string accessKey = "";

            // Developer AWS secret key
            string secretKey = "";

            // The client application name
            string appName = "CSharpSampleCode";

            // The client application version
            string appVersion = "1.0";

            // The endpoint for region service and version (see developer guide)
            // ex: https://mws.amazonservices.com
            string serviceURL = "https://mws.amazonservices.com";

            // Create a configuration object
            FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();

            config.ServiceURL = serviceURL;
            // Set other client connection configurations here if needed
            // Create the client itself
            FBAInboundServiceMWS client =
                new FBAInboundServiceMWSClient(accessKey, secretKey, appName, appVersion, config);

            FBAInboundServiceMWSSample sample = new FBAInboundServiceMWSSample(client);

            // Uncomment the operation you'd like to test here
            // TODO: Modify the request created in the Invoke method to be valid

            try
            {
                IMWSResponse response = null;
                // response = sample.InvokeConfirmPreorder();
                // response = sample.InvokeConfirmTransportRequest();
                // response = sample.InvokeCreateInboundShipment();
                // response = sample.InvokeCreateInboundShipmentPlan();
                // response = sample.InvokeEstimateTransportRequest();
                // response = sample.InvokeGetBillOfLading();
                // response = sample.InvokeGetInboundGuidanceForASIN();
                // response = sample.InvokeGetInboundGuidanceForSKU();
                // response = sample.InvokeGetPackageLabels();
                // response = sample.InvokeGetPalletLabels();
                // response = sample.InvokeGetPreorderInfo();
                // response = sample.InvokeGetPrepInstructionsForASIN();
                // response = sample.InvokeGetPrepInstructionsForSKU();
                response = sample.InvokeGetServiceStatus();
                // response = sample.InvokeGetTransportContent();
                // response = sample.InvokeGetUniquePackageLabels();
                // response = sample.InvokeListInboundShipmentItems();
                // response = sample.InvokeListInboundShipmentItemsByNextToken();
                // response = sample.InvokeListInboundShipments();
                // response = sample.InvokeListInboundShipmentsByNextToken();
                // response = sample.InvokePutTransportContent();
                // response = sample.InvokeUpdateInboundShipment();
                // response = sample.InvokeVoidTransportRequest();
                Console.WriteLine("Response:");
                ResponseHeaderMetadata rhmd = response.ResponseHeaderMetadata;
                // We recommend logging the request id and timestamp of every call.
                Console.WriteLine("RequestId: " + rhmd.RequestId);
                Console.WriteLine("Timestamp: " + rhmd.Timestamp);
                string responseXml = response.ToXML();
                Console.WriteLine(responseXml);
            }
            catch (FBAInboundServiceMWSException ex)
            {
                // Exception properties are important for diagnostics.
                ResponseHeaderMetadata rhmd = ex.ResponseHeaderMetadata;
                Console.WriteLine("Service Exception:");
                if (rhmd != null)
                {
                    Console.WriteLine("RequestId: " + rhmd.RequestId);
                    Console.WriteLine("Timestamp: " + rhmd.Timestamp);
                }
                Console.WriteLine("Message: " + ex.Message);
                Console.WriteLine("StatusCode: " + ex.StatusCode);
                Console.WriteLine("ErrorCode: " + ex.ErrorCode);
                Console.WriteLine("ErrorType: " + ex.ErrorType);
                throw ex;
            }
        }
예제 #8
0
        private List <AsinPrepData> GetDataFromMws(List <string> requestedAsins)
        {
            List <AsinPrepData> asinData = new List <AsinPrepData>();

            string accessKey     = System.Configuration.ConfigurationManager.AppSettings["MwsAccK"];
            string secretKey     = System.Configuration.ConfigurationManager.AppSettings["MwsSecK"];
            string sellerId      = System.Configuration.ConfigurationManager.AppSettings["MwsSeller"];
            string marketplaceId = System.Configuration.ConfigurationManager.AppSettings["MwsMktpl"];

            FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();

            config.ServiceURL = "https://mws.amazonservices.com ";
            config.SetUserAgentHeader("CMA", "1.0", "C#", new string[] { });
            FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient(accessKey, secretKey, config);

            FBAInboundServiceMWS.Model.GetPrepInstructionsForASINRequest request = new FBAInboundServiceMWS.Model.GetPrepInstructionsForASINRequest();
            request.AsinList          = new FBAInboundServiceMWS.Model.AsinList();
            request.AsinList.Id       = requestedAsins;
            request.SellerId          = System.Configuration.ConfigurationManager.AppSettings["MwsSeller"];
            request.ShipToCountryCode = "US";

            FBAInboundServiceMWS.Model.GetPrepInstructionsForASINResponse response = new FBAInboundServiceMWS.Model.GetPrepInstructionsForASINResponse();


            try { response = client.GetPrepInstructionsForASIN(request); } catch (Exception e) {}
            while (response.ResponseHeaderMetadata == null || response.ResponseHeaderMetadata.QuotaRemaining < 1000)
            {
                if (response.ResponseHeaderMetadata == null)
                {
                    this.StatusDescription = string.Format("No response given to MWS Request");
                }
                else
                {
                    this.StatusDescription = string.Format("API Quota reached. Remaining: {0} of {1}, Resets: {2},", response.ResponseHeaderMetadata.QuotaRemaining, response.ResponseHeaderMetadata.QuotaMax, response.ResponseHeaderMetadata.QuotaResetsAt.Value.ToShortTimeString());
                }

                Thread.Sleep(20000);
                try { response = client.GetPrepInstructionsForASIN(request); } catch (Exception e) { }
            }

            foreach (var result in response.GetPrepInstructionsForASINResult.ASINPrepInstructionsList.ASINPrepInstructions)
            {
                if (result.IsSetASIN())
                {
                    AsinPrepData asinPrep = new AsinPrepData();
                    asinPrep.Asin = result.ASIN;

                    if (result.IsSetBarcodeInstruction())
                    {
                        if (result.BarcodeInstruction.Equals("RequiresFNSKULabel"))
                        {
                            asinPrep.Labelling = "Required";
                        }
                        else if (result.BarcodeInstruction.Equals("MustProvideSellerSKU"))
                        {
                            asinPrep.Labelling = "Undetermined";
                        }
                    }

                    if (result.IsSetPrepGuidance())
                    {
                        if (result.PrepGuidance.Equals("SeePrepInstructionsList"))
                        {
                            // prep exists
                            if (result.IsSetPrepInstructionList())
                            {
                                foreach (var prep in result.PrepInstructionList.PrepInstruction)
                                {
                                    asinPrep.Prep += prep;
                                }
                            }
                        }
                        else if (result.PrepGuidance.Equals("NoAdditionalPrepRequired"))
                        {
                            asinPrep.Prep = "None";
                        }
                        else if (result.PrepGuidance.Equals("ConsultHelpDocuments"))
                        {
                            asinPrep.Prep = "Undetermined";
                        }
                    }

                    asinData.Add(asinPrep);
                }
            }

            return(asinData);
        }
예제 #9
0
    private List<AsinPrepData> GetDataFromMws(List<string> requestedAsins)
    {
      List<AsinPrepData> asinData = new List<AsinPrepData>();

      string accessKey = System.Configuration.ConfigurationManager.AppSettings["MwsAccK"];
      string secretKey = System.Configuration.ConfigurationManager.AppSettings["MwsSecK"];
      string sellerId = System.Configuration.ConfigurationManager.AppSettings["MwsSeller"];
      string marketplaceId = System.Configuration.ConfigurationManager.AppSettings["MwsMktpl"];

      FBAInboundServiceMWSConfig config = new FBAInboundServiceMWSConfig();
      config.ServiceURL = "https://mws.amazonservices.com ";
      config.SetUserAgentHeader("CMA", "1.0", "C#", new string[] { });
      FBAInboundServiceMWSClient client = new FBAInboundServiceMWSClient(accessKey, secretKey, config);

      FBAInboundServiceMWS.Model.GetPrepInstructionsForASINRequest request = new FBAInboundServiceMWS.Model.GetPrepInstructionsForASINRequest();
      request.AsinList = new FBAInboundServiceMWS.Model.AsinList();
      request.AsinList.Id = requestedAsins;
      request.SellerId = System.Configuration.ConfigurationManager.AppSettings["MwsSeller"];
      request.ShipToCountryCode = "US";

      FBAInboundServiceMWS.Model.GetPrepInstructionsForASINResponse response = new FBAInboundServiceMWS.Model.GetPrepInstructionsForASINResponse();


      try { response = client.GetPrepInstructionsForASIN(request); } catch (Exception e) {}
      while (response.ResponseHeaderMetadata == null || response.ResponseHeaderMetadata.QuotaRemaining < 1000)
      {
        if (response.ResponseHeaderMetadata == null)
        {
          this.StatusDescription = string.Format("No response given to MWS Request");
        }
        else
          this.StatusDescription = string.Format("API Quota reached. Remaining: {0} of {1}, Resets: {2},", response.ResponseHeaderMetadata.QuotaRemaining, response.ResponseHeaderMetadata.QuotaMax, response.ResponseHeaderMetadata.QuotaResetsAt.Value.ToShortTimeString());

        Thread.Sleep(20000);
        try { response = client.GetPrepInstructionsForASIN(request); } catch (Exception e) { }
      }

      foreach (var result in response.GetPrepInstructionsForASINResult.ASINPrepInstructionsList.ASINPrepInstructions)
      {
        if (result.IsSetASIN())
        {
          AsinPrepData asinPrep = new AsinPrepData();
          asinPrep.Asin = result.ASIN;

          if (result.IsSetBarcodeInstruction())
          {
            if (result.BarcodeInstruction.Equals("RequiresFNSKULabel"))
              asinPrep.Labelling = "Required";
            else if (result.BarcodeInstruction.Equals("MustProvideSellerSKU"))
              asinPrep.Labelling = "Undetermined";
          }

          if (result.IsSetPrepGuidance())
          {
            if (result.PrepGuidance.Equals("SeePrepInstructionsList"))
            {
              // prep exists
              if (result.IsSetPrepInstructionList())
              {
                foreach (var prep in result.PrepInstructionList.PrepInstruction)
                {
                  asinPrep.Prep += prep;
                }
              }
            }
            else if (result.PrepGuidance.Equals("NoAdditionalPrepRequired"))
            {
              asinPrep.Prep = "None";
            }
            else if (result.PrepGuidance.Equals("ConsultHelpDocuments"))
            {
              asinPrep.Prep = "Undetermined";
            }

          }

          asinData.Add(asinPrep);
        }
        
        
      }

      return asinData;
    }