// GetTransaction retrieves an existing Transaction based on its ID func GetTransaction(transactionID bson.ObjectId) api.Response { dbTransaction, err := transactionservice.GetTransaction(transactionID) if err != nil || dbTransaction == nil { return api.NotFound(api.ErrEntityNotFound) } transaction := &models.Transaction{} transaction.Expand(dbTransaction) return api.JSONResponse(http.StatusOK, transaction) }
// GetTransaction endpoint retrieves a certain transaction based on its Id func (t *TransactionsAPI) GetTransaction(params *api.Request) api.Response { transactionID, found, err := filter.GetIDParameter("transactionId", params.Form) if err != nil { return api.BadRequest(err) } if !found { return api.NotFound(err) } return bll.GetTransaction(transactionID) }