public async Task Run(CheckPaymentRequestData data) { try { bool isSuccessStatusCode = false; await RepeatedCall.ActionAsync(async() => { using (HttpResponseMessage response = await this.GetResponse(data.RequestData, HttpMethod.Get, null)) { string str = await response.Content.ReadAsStringAsync(); ResponseData <PaymentDoc> result = data.CreateResponseInstance(); result.RequestJson = ""; result.ResponseJson = str; isSuccessStatusCode = response.IsSuccessStatusCode; } }, 5, 500); data.DeserializeResults(isSuccessStatusCode); } catch (Exception ex) { _logger.LogError(ex, "Ошибка при отправке запроса CheckRequest и десериализации ответа"); data.ExceptionData = ex; } }
public async Task Run(CreatePaymentRequestData data) { try { string content = JsonConvert.SerializeObject(data.RequestData, Startup.JsonSettings); this._idempotenceKey = "CreateRequest_" + data.RequestData.Metadata.RequestId.ToString(); bool isSuccessStatusCode = false; await RepeatedCall.ActionAsync(async() => { using (HttpResponseMessage response = await this.GetResponse("", HttpMethod.Post, content)) { string str = await response.Content.ReadAsStringAsync(); ResponseData <PaymentDoc> result = data.CreateResponseInstance(); result.RequestJson = content; result.ResponseJson = str; isSuccessStatusCode = response.IsSuccessStatusCode; } }, 5, 500); data.DeserializeResults(isSuccessStatusCode); } catch (Exception ex) { _logger.LogError(ex, "Ошибка при отправке запроса CreateRequest и десериализации ответа"); data.ExceptionData = ex; } }
public static async Task<List<Operation>> Run(HttpClient client, string bankAccountId, Parameters parameters) { return await RepeatedCall.ActionAsync(async () => { OperationHistoryRequest request = new OperationHistoryRequest(client); return await request.Run(bankAccountId, parameters); }, 5, 1000); }