Exemple #1
0
        public async Task GetAllPaymentRequests()
        {
            PaymentRequest payment = new PaymentRequest();

            PayRequestOM[] result = await payment.GetAllPaymentRequests();

            Assert.IsNotNull(result);
        }
        public static async Task <ApiResponse> GetAllPaymentRequests()
        {
            ApiResponse response = new ApiResponse();

            try
            {
                PaymentRequest    request = new PaymentRequest();
                List <PayRequest> list    = new List <PayRequest>();
                PayRequestOM[]    result  = await request.GetAllPaymentRequests();

                if (result != null)
                {
                    for (int i = 0; i < result.Length; i++)
                    {
                        list.Add(new PayRequest()
                        {
                            AccountId = result[i].AccountId,
                            Amount    = result[i].Amount,
                            Comment   = result[i].Comment,
                            Id        = result[i].Id,
                            Tag       = result[i].Tag,
                            Timestamp = result[i].Timestamp
                        });
                    }

                    response.Result = Newtonsoft.Json.Linq.JToken.FromObject(list);
                }
                else
                {
                    response.Result = null;
                }
            }
            catch (ApiCustomException ex)
            {
                Logger.Singleton.Error(ex.Message);
                response.Error = new ApiError(ex.ErrorCode, ex.Message);
            }
            catch (Exception ex)
            {
                Logger.Singleton.Error(ex.Message);
                response.Error = new ApiError(ex.HResult, ex.Message);
            }
            return(response);
        }