HashtagSell / posting-api

API for storage and retrieval of posting details for Hashtagsell
0 stars 0 forks source link

Transaction ID API needs. #50

Closed that1guy closed 8 years ago

that1guy commented 9 years ago

Here's what we need to complete online payment workflow correctly and securely.

When two users (buyer and seller) agree to meet, (AKA a posting object has an offer on it with an "acceptedAt" property on it) we need to generate a unique transactionID for that possible future transaction.

If a GET request is performed to lookup a transactionID we should get back the following information.

The transactionID should have an PUT request that accepts and stores the following information.

Also the transactionID should have different states.

It makes sense that the transaction ID is what governs if the item should continue to show up in results or if has been sold and should no longer show up in results. We should consider storing the item for sale in database and changing it's owner the new buyer to maintain an inventory of what each user has bought and sold.

brozeph commented 9 years ago

Schema for transactions:

{
  "transactionId" : "abc123",
  "buyer" : {
    /* open schema - any details submitted by client about buyer */
  },
  "buyerUsername" : "joshua@hashtagsell.com",
  "createdAt" : "2015-05-08T09:24.000Z", // system managed
  "modifiedAt" : "2015-05-08T09:24.000Z", // system managed
  "offer" : {
    /* open schema - should be the `offer` model from `/v1/postings/:postingId/offers/:offerId` resource */
  },
  "offerId" : "123abc",
  "paymentConfirmation" : {
    /* open schema - not required (empty when transaction is pending) - intended to store results from BrainTree */
  },
  "posting" : {
    /* open schema - should be the `posting` model from `/v1/postings/:postingId` resource */
  },
  "postingId" : "987zxy",
  "seller" : {
    /* open schema - any details submitted by client about seller */
  },
  "sellerUsername" : "brad@hashtagsell.com",
  "status" : "pending | completed | expired"
}
that1guy commented 9 years ago

This looks perfect. Next time I open request like this I'll submit suggested schema too. Easier to convey needs.

brozeph commented 9 years ago

Schema for reviews:

{
  "reviewId" : "def456",
  "createdAt" : "2015-05-08T09:24.000Z", // system managed
  "modifiedAt" : "2015-05-08T09:24.000Z", // system managed
  "isBuyer" : true,
  "transactionId" : "abc123",
  "username" : "that1guy",
  "value" : "A++ would buy again!"
}
brozeph commented 9 years ago

Routes and models are now available in the API. Here is high level guide:

To create a transaction in pending state, submit a POST to /v1/transactions with the following fields:

Once the item is sold and transaction details are received, submit a PUT to /v1/transactions/:transactionId with the following fields:

note: The API will automatically change the status to completed when a PUT is performed and the paymentConfirmation body is populated with any data

Once the transaction is completed, complete reviews by performing a POST to /v1/reviews

that1guy commented 9 years ago

Fantastic! Implementation today with Braintree marketplace begins today. Thanks josh!

that1guy commented 9 years ago

Got distracted with million other things. Lets keep this open for a little longer so it stands out. Thanks Josh.

that1guy commented 8 years ago

Okay, tested this and seems to be working as expected.

We've Implemented Venmo for MVP release, so this wont be used heavily until braintree rollout.