Beispiel #1
0
        public async Task <IActionResult> Status(string address)
        {
            var isValid = await ValidateRequest();

            if ((isValid as OkResult)?.StatusCode != Ok().StatusCode)
            {
                return(isValid);
            }

            if (string.IsNullOrEmpty(address))
            {
                return(NotFound());
            }

            var storeResponse = await _storeRequestClient.ApiStoreOrderByMerchantIdGetWithHttpMessagesAsync(MerchantId);

            var content = await storeResponse.Response.Content.ReadAsStringAsync();

            if (string.IsNullOrEmpty(content))
            {
                return(NotFound());
            }

            var result = (from o in JsonConvert
                          .DeserializeObject <List <Lykke.Pay.Service.StoreRequest.Client.Models.OrderRequest> >(content)
                          where
                          address.Equals(o.SourceAddress)
                          group o by o.MerchantPayRequestStatus
                          into go
                          select go.Key.ParsePayEnum <MerchantPayRequestStatus>()).ToList();

            if (result.Exists(st => st == MerchantPayRequestStatus.Failed))
            {
                return(Content(MerchantPayRequestStatus.Failed.ToString()));
            }

            if (result.Exists(st => st == MerchantPayRequestStatus.Completed))
            {
                return(Content(MerchantPayRequestStatus.Completed.ToString()));
            }

            if (result.Exists(st => st == MerchantPayRequestStatus.New))
            {
                return(Content(MerchantPayRequestStatus.New.ToString()));
            }

            return(NotFound());
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='merchantId'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task ApiStoreOrderByMerchantIdGetAsync(this ILykkePayServiceStoreRequestMicroService operations, string merchantId, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.ApiStoreOrderByMerchantIdGetWithHttpMessagesAsync(merchantId, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }