using BBWY.Common.Http; using BBWY.Common.Models; using BBWY.Server.Model; using BBWY.Server.Model.Dto; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Options; using Newtonsoft.Json; namespace BBWY.Server.Business { public class VenderBusiness : BasePlatformRelayBusiness, IDenpendency { public VenderBusiness(RestApiService restApiService, IOptions options) : base(restApiService, options) { } public VenderResponse GetVenderInfo(PlatformRequest platformRequest) { var relayAPIHost = GetPlatformRelayAPIHost(platformRequest.Platform); var sendResult = restApiService.SendRequest(relayAPIHost, "api/PlatformSDK/GetVenderInfo", platformRequest, null, System.Net.Http.HttpMethod.Post); if (sendResult.StatusCode != System.Net.HttpStatusCode.OK) throw new BusinessException(sendResult.Content) { Code = (int)sendResult.StatusCode }; var response = JsonConvert.DeserializeObject>(sendResult.Content); if (!response.Success) throw new BusinessException(sendResult.Content) { Code = response.Code }; return response.Data; } } }