private ICollection <MemberDemographicModel> GetDemographicDetail(IEnumerable <long> memberIdList, int currentRetryFailAttemtp) { ICollection <MemberDemographicModel> ret; // Get from Soa using (var client = new HttpClientDataTalk()) { var request = HttpClientComponentSettingProvider.GetRequestSetting($"msademographicdetail{AppConfig.CurrentEnvironment}"); var headers = HttpClientComponentSettingProvider.GetHeaderSetting("msa"); //var body = HttpClientComponentSettingProvider.GetBodySetting("msademographicdetail"); RequestApply(client, request); HeadersApply(client, headers); HeaderCustomApply(client, $"Authorization: Bearer {AccessToken()}"); //BodyApply(client, body.Content); client.Body += Serialize <long[]>((memberIdList ?? new long[] { 0 }).ToArray()); try { client.Execute(); ret = ResponseData <ICollection <MemberDemographicModel> >(client.Result); } catch (Exception ex) { if (SleepAndRetry(ref currentRetryFailAttemtp)) { return(GetDemographicDetail(memberIdList, currentRetryFailAttemtp)); } throw new Exception($"{request}", ex); } } return(ret); }
private ICollection <ProviderContractMap> GetProviderContractMap(long[] contractMapKey, int currentRetryFailAttemtp) { ICollection <ProviderContractMap> ret; // Get from Soa using (var client = new HttpClientDataTalk()) { var bodySettingName = "msaprovidercontractmapdetail"; var request = HttpClientComponentSettingProvider.GetRequestSetting($"msaprovidercontractmap{AppConfig.CurrentEnvironment}"); var headers = HttpClientComponentSettingProvider.GetHeaderSetting("msa"); var body = HttpClientComponentSettingProvider.GetBodySetting(bodySettingName); RequestApply(client, request); HeadersApply(client, headers); HeaderCustomApply(client, $"Authorization: Bearer {AccessToken()}"); BodyApply(client, body.Content); client.Body += Serialize <long[]>((contractMapKey ?? new long[] { 0 }).ToArray()); try { client.Execute(); ret = ResponseData <ICollection <ProviderContractMap> >(client.Result); } catch (Exception ex) { if (SleepAndRetry(ref currentRetryFailAttemtp)) { return(GetProviderContractMap(contractMapKey, currentRetryFailAttemtp)); } throw new Exception($"{request}", ex); } } return(ret); }
private ICollection <SoaEligibility> GetEligibilities(int currentRetryFailAttemtp) { ICollection <SoaEligibility> ret; // Get from Soa using (var client = new HttpClientDataTalk()) { const string bodySettingName = "msadeltaeligibility"; var request = HttpClientComponentSettingProvider.GetRequestSetting($"msaeligibility{AppConfig.CurrentEnvironment}"); var headers = HttpClientComponentSettingProvider.GetHeaderSetting("msa"); var body = HttpClientComponentSettingProvider.GetBodySetting(bodySettingName); RequestApply(client, request); HeadersApply(client, headers); HeaderCustomApply(client, $"Authorization: Bearer {AccessToken()}"); BodyApply(client, Serialize <long[]>(body.Content, "MemberNumbers", MemberIdList)); try { client.Execute(); ret = ResponseData <ICollection <SoaEligibility> >(client.Result); } catch (Exception ex) { if (SleepAndRetry(ref currentRetryFailAttemtp)) { return(GetEligibilities(currentRetryFailAttemtp)); } throw new Exception($"{request}", ex); } } return(ret); }
private ICollection <ProviderDetailModel> GetProviders(long[] providerKeyList, int currentRetryFailAttemtp) { ICollection <ProviderDetailModel> ret; // Get from Soa using (var client = new HttpClientDataTalk()) { var bodySettingName = "msaproviderdetail"; var request = HttpClientComponentSettingProvider.GetRequestSetting($"msaproviderdetail{AppConfig.CurrentEnvironment}"); var headers = HttpClientComponentSettingProvider.GetHeaderSetting("msa"); var body = HttpClientComponentSettingProvider.GetBodySetting(bodySettingName); RequestApply(client, request); HeadersApply(client, headers); HeaderCustomApply(client, $"Authorization: Bearer {AccessToken()}"); BodyApply(client, Serialize <long[]>(body.Content, "ProviderKeys", providerKeyList)); try { client.Execute(); ret = ResponseData <ICollection <ProviderDetailModel> >(client.Result); } catch (Exception ex) { if (SleepAndRetry(ref currentRetryFailAttemtp)) { return(GetProviders(providerKeyList, currentRetryFailAttemtp)); } throw new Exception($"{request}", ex); } } return(ret); }
public string GetToken(string tokenEnv, out double expiredInSeconds) { string token = string.Empty; using (var client = new HttpClientDataTalk()) { var request = HttpClientComponentSettingProvider.GetRequestSetting(tokenEnv); var headers = HttpClientComponentSettingProvider.GetHeaderSetting("token"); var body = HttpClientComponentSettingProvider.GetBodySetting("token"); RequestApply(client, request); HeadersApply(client, headers); BodyApply(client, body.Content); try { client.Execute(); token = GetToken(client, out expiredInSeconds); } catch (Exception) { throw; } } return(token); }