func (d *UserBalanceController) transferAmount() {
	var input InputRequest
	var from = new(models.UserBalance)
	var to = new(models.UserBalance)
	debug, _ := conf.AppConfig.Bool("debug")
	defer LogErr()
	body, error := ioutil.ReadAll(d.Request.Body)
	error = json.Unmarshal(body, &input)
	if debug {
		Log.WithField("request", string(body)).Printf("transfer - %+v", input)
	}
	if error != nil {
		Log.WithField("error", error).Printf("read body or json error")
	}
	if input.FromUid == 0 || input.Amount == 0 || input.ToUid == 0 {
		d.makeIncorrectRequestParamsReponse("From, To and Amount params is required")
		return
	}

	from = from.GetById(input.FromUid)
	to = to.GetById(input.ToUid)
	if from.Id == 0 || to.Id == 0 {
		d.makeNotFound("balance.not_found", "User not found")
		return
	}
	from.WithdrawAmount(input.Amount)
	to.AddAmount(input.Amount)

	d.ResponseWriter(d.Request, d.Response, "")

	return
}
// transfer amount from between users balance
transfer amount from between users balance
// transfer amount from between users balance
func (d *UserBalanceController) transferAmount() {
	var input InputRequest
	var from = new(models.UserBalance)
	var to = new(models.UserBalance)
	debug, _ := conf.AppConfig.Bool("debug")
	defer LogErr()
	body, error := ioutil.ReadAll(d.Request.Body)
	error = json.Unmarshal(body, &input)
	if debug {
		Log.WithField("request", string(body)).Printf("transfer - %+v", input)
	}
	if error != nil {
		Log.WithField("error", error).Printf("read body or json error")
	}
	if input.FromUid == 0 || input.Amount == 0 || input.ToUid == 0 {
		d.makeIncorrectRequestParamsReponse("From, To and Amount params is required")
		return
	}
	from = from.GetById(input.FromUid)
	to = to.GetById(input.ToUid)
	if from.Id == 0 || to.Id == 0 {
		d.makeNotFound("balance.not_found", "User not found")
		return
	}
	from.WithdrawAmount(input.Amount)
	to.AddAmount(input.Amount)
	d.ResponseWriter(d.Request, d.Response, "")
	return
}
func ( d * UserBalanceController ) transferAmount ( ) { var input InputRequest var from = new ( models . UserBalance ) var to = new ( models . UserBalance ) debug , _ := conf . AppConfig . Bool ( " " ) defer LogErr ( ) body , error := ioutil . ReadAll ( d . Request . Body ) error = json . Unmarshal ( body , & input ) if debug { Log . WithField ( " " , string ( body ) ) . Printf ( " " , input ) } if error != nil { Log . WithField ( " " , error ) . Printf ( " " ) } if input . FromUid == 0 || input . Amount == 0 || input . ToUid == 0 { d . makeIncorrectRequestParamsReponse ( " " ) return } from = from . GetById ( input . FromUid ) to = to . GetById ( input . ToUid ) if from . Id == 0 || to . Id == 0 { d . makeNotFound ( " " , " " ) return } from . WithdrawAmount ( input . Amount ) to . AddAmount ( input . Amount ) d . ResponseWriter ( d . Request , d . Response , " " ) return }
transfer amount from between users balance
transfer amount from between users balance