badleyy / rtapi

The backend api for raft
0 stars 0 forks source link

refunding tickets #4

Closed dadleyy closed 8 years ago

dadleyy commented 8 years ago

@cpb2948 for the refund functionality, I think we should consider using

DELETE /tickets/{ticket_id}

instead of

POST /tickets/{ticket_id}

what do you think?

p.s I'm putting this here because I'm thinking we should could use github issues to talk about things before we actually track them in jira.

cpb2948 commented 8 years ago

We could, i'm not really a fan of those obscure HTTP methods and shit ( PUT, PATCH, etc). I haven't really seem them used a lot. I guess here that makes sense, i'm just wondering if will ever need to post data.

dadleyy commented 8 years ago

I usually don't see many POST requests to endpoints dealing with a specific record - usually its PATCH, PUT or UPDATE.

But yea, instead delete, you could imagine if we had a status column on the ticket table, the concept of refunding things could be:

PATCH /tickets/1

{
  "status": "REFUND_PENDING"
}
dadleyy commented 8 years ago

also can we pluralize the user endpoint to keep it consistent?

cpb2948 commented 8 years ago

that's not a bad idea. So when you register a user, you would essential make a PUT request then to create a user?

PUT /users

and it would create the users resource then?

dadleyy commented 8 years ago

post to create, put to update

POST /users

{
  "username": "....",
  "email": "....",
  "password": "...."
}
PUT /users/1

{
  "password": "new_password"
}
cpb2948 commented 8 years ago

alright, yeah i can implement that, along with the DELETE functionality for refunding. The DELETE endpoint can be use to initiate a refund.

if you want the status of the ticket refund

GET /tickets/1

{ "status": "REFUND_PENDING" }
dadleyy commented 8 years ago

right. that would include everything else though, not just the status column though right? raffle_id, user_id, etc...

cpb2948 commented 8 years ago

yeah

dadleyy commented 8 years ago

so once you make a jira ticket(s) for whatever you gotta do, lets close out these gihub issues.