Example #1
0
        public async Task <IActionResult> PayService([FromBody] RequestBalance data)
        {
            var result          = new ResponsePayment();
            var validateRequest = SchemaEngine.Validate <RequestBalance>(data, reqBalanceSchema);

            if (validateRequest)
            {
                var serv = new DealBusiness();
                result = await serv.PayService(data);

                if (result.Code == 200)
                {
                    var validate = SchemaEngine.Validate <ResponsePayment>(result, respPaymentSchema);

                    if (!validate)
                    {
                        result.Code    = 500;
                        result.Message = "Invalid result data schema";
                        result.Data    = null;

                        return(StatusCode(500, result));
                    }
                }
                else
                {
                    return(StatusCode(result.Code, result));
                }

                return(Ok(result));
            }
            else
            {
                result.Code    = 500;
                result.Message = "Invalid params schema";
                result.Data    = null;

                return(StatusCode(500, result));
            }
        }