Exemplo n.º 1
0
        public static CheckPaymantStatusResponseModel CheckStatus(CheckPaymantStatusRequestModel model)
        {
            CheckPaymantStatusResponseModel responseModel = new CheckPaymantStatusResponseModel();

            if (model.PaymentId >= 0 && model.PaymentId <= payments.Count)
            {
                if (payments[model.PaymentId].State == 4 && payments[model.PaymentId].AppproveData != null)
                {
                    responseModel.IsSuccess = true;
                    responseModel.Message   = "The transcation is success!";
                    return(responseModel);
                }
            }
            responseModel.IsSuccess = false;
            responseModel.Message   = "The transcation is censeled!";
            return(responseModel);
        }
Exemplo n.º 2
0
        public HttpResponseMessage CheckStatus(CheckPaymantStatusRequestModel model)
        {
            CheckPaymantStatusResponseModel responseModel   = new CheckPaymantStatusResponseModel();
            HttpResponseMessage             responseMessage = new HttpResponseMessage();

            if (!ModelState.IsValid)
            {
                responseModel.IsSuccess    = false;
                responseModel.Message      = "False request for payment";
                responseMessage.StatusCode = HttpStatusCode.BadRequest;
                responseMessage.Content    = new StringContent(JsonConvert.SerializeObject(responseModel));
                return(responseMessage);
            }
            responseModel              = PaymentDB.CheckStatus(model);
            responseMessage.Content    = new StringContent(JsonConvert.SerializeObject(responseModel));
            responseMessage.StatusCode = HttpStatusCode.Accepted;
            return(responseMessage);
        }