예제 #1
0
        public IActionResult GetWalletAvg(string walletId)
        {
            WalletAvgResponse response = new WalletAvgResponse();

            try
            {
                response = WalletAccess.GetDebitAvg(Guid.Parse(walletId));

                if (response.ErrorCode == MyJijoWalletData.ErrorCode.NoError)
                {
                    return(Ok(response.DebitsAvg));
                }
                if (response.ErrorCode == MyJijoWalletData.ErrorCode.Validation)
                {
                    return(BadRequest(response));
                }
                else
                {
                    throw new Exception(response.ErrorMessage);
                }
            }
            catch (Exception ex)
            {
                response.ErrorCode    = MyJijoWalletData.ErrorCode.Other;
                response.ErrorMessage = ex.Message;
                return(StatusCode(StatusCodes.Status500InternalServerError, response));
            }
        }
예제 #2
0
        public void GetDebitAvgShouldSucceed()
        {
            var wallet = "8920d0ff-4d19-4a3f-8d11-63c0ceb39922";

            WalletAvgResponse response = WalletAccess.GetDebitAvg(Guid.Parse(wallet));

            Assert.IsTrue(response.ErrorCode == 0);
        }