public Demo() { //Construct an APIConfig with SellerID, APIKey(Authorization) and SecretKey. //APIConfig config = new APIConfig("****", "********************************", "********-****-****-****-************"); // or load the config file to get it. APIConfig USA_Config_XML = APIConfig.FromJsonFile("configUSA_JSON.json"); APIConfig CAN_Config_XML = APIConfig.FromJsonFile("configCAN_JSON.json"); //Create a APIClient with the config APIClient fakeUSAClientXML = new APIClient(USA_Config_XML) { SimulationEnabled = true }; APIClient fakeCANClientXML = new APIClient(CAN_Config_XML) { SimulationEnabled = true }; //Create the Api Call object with he client. ordercall = new OrderCall(fakeUSAClientXML); itemCall = new ItemCall(fakeUSAClientXML); CANordercall = new OrderCall(fakeCANClientXML); CANitemCall = new ItemCall(fakeCANClientXML); sellerCall = new SellerCall(fakeUSAClientXML); datafeedCall = new DatafeedCall(fakeUSAClientXML); rmaCall = new RMACall(fakeUSAClientXML); shippingCall = new ShippingCall(fakeUSAClientXML); reportCall = new ReportCall(fakeUSAClientXML); otherCall = new OtherCall(fakeUSAClientXML); }
private static ApiCallInterface _testOrderUpdate() { string path = Path.Combine(Environment.CurrentDirectory, @"example", "order_update.xml"); Payload payload = new Payload(File.ReadAllText(path)); OrderCall orderCall = new OrderCall(Endpoint.Update, payload); return(orderCall); }
public OrderFakeTest() { fakeapi = new OrderCall(fakeUSAClientXML); fakeapi_json = new OrderCall(fakeUSAClientJSON); fakeapi_b2b = new OrderCall(fakeB2BClientXML); fakeapi_json_b2b = new OrderCall(fakeB2BClientJSON); fakeapi_can = new OrderCall(fakeCANClientXML); fakeapi_json_can = new OrderCall(fakeCANClientJSON); }
public OrderTest() { api = new OrderCall(USAClientXML); fakeapi = new OrderCall(fakeUSAClientXML); api_json = new OrderCall(USAClientJSON); fakeapi_json = new OrderCall(fakeUSAClientJSON); api_B2B = new OrderCall(B2BClientXML); api_CAN = new OrderCall(CANClientXML); fakeapi_B2B = new OrderCall(fakeB2BClientJSON); }
public IActionResult SaveCall([FromBody] OrderCallBindingModel call) { if (!ModelState.IsValid) { return(BadRequest()); } OrderCall callItem = new OrderCall(call.Name, call.Phone); callsRepository.SaveCall(callItem); return(Ok()); }
public async Task <GetOrderInformationResponse> CallApi() { string mockPath = HttpContext.Current.Server.MapPath(@"~/mocks/"); // fix the formatting mockPath = mockPath.Replace(@"\", @"\\"); string jsonString = @"{ ""SellerID"": ""****"", ""Credentials"": { ""Authorization"": ""********************************"", ""SecretKey"": ""*******-****-****-****-************"" }, ""MockPath"": """ + mockPath + @""", ""Connection"": { ""RequestTimeoutMs"": 5000, ""AttemptsTimes"": 5, ""RetryIntervalMs"": 1000 }, ""APIFormat"": ""XML"", ""LogLevel"": ""Debug"" }"; System.Diagnostics.Debug.WriteLine(jsonString); //APIConfig config = APIConfig.FromJsonFile(HttpContext.Current.Server.MapPath(@"~/Newegg.json")); APIConfig config = APIConfig.FromJson(jsonString); APIClient test = new APIClient(config) { SimulationEnabled = true }; orderCall = new OrderCall(test); var orderReq = new GetOrderInformationRequest(new GetOrderInformationRequestCriteria() { Status = Newegg.Marketplace.SDK.Order.Model.OrderStatus.Unshipped, Type = OrderInfoType.All, OrderDateFrom = "2016-01-01 09:30:47", OrderDateTo = "2017-12-17 09:30:47", OrderDownloaded = 0 }); return(await orderCall.GetOrderInformation(null, orderReq)); }
public Demo() { //Construct an APIConfig with SellerID, APIKey(Authorization) and SecretKey. APIConfig config = new APIConfig("****", "********************************", "********-****-****-****-************"); // or load the config file to get it. //APIConfig config = APIConfig.FromJsonFile("setting.json"); //Create a APIClient with the config APIClient client = new APIClient(config); //Create the Api Call object with he client. ordercall = new OrderCall(client); itemCall = new ItemCall(client); sellerCall = new SellerCall(client); datafeedCall = new DatafeedCall(client); rmaCall = new RMACall(client); shippingCall = new ShippingCall(client); reportCall = new ReportCall(client); otherCall = new OtherCall(client); }
public IActionResult Index() { APIConfig config = APIConfig.FromJsonFile("newegg"); APIClient client = new APIClient(config); OrderCall ordercall = new OrderCall(client); var requestModel = new GetOrderInformationRequest() { OperationType = "GetOrderInfoRequest", RequestBody = new GetOrderInformationRequestBody() { PageIndex = 0, PageSize = 20, RequestCriteria = new GetOrderInformationRequestCriteria() { } } }; var response = ordercall.GetOrderInformation(304, requestModel); return(View(response)); }
/// <summary> /// Сохраняет заказ обратного звонка. /// </summary> /// <param name="call">Данные звонка.</param> public void SaveCall(OrderCall call) { context.OrderCalls.Add(call); Save(); }