department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
283 stars 204 forks source link

Modify MDOT Submission Endpoint - Add Address Info #6687

Closed voidspooks closed 4 years ago

voidspooks commented 4 years ago

User Story or Problem Statement

As a backend engineer, I need to supply a submission endpoint for the Medical Device Ordering Tool that will allow the front end team to submit orders to the DLC.

This functionality was added previously but removed - was removed because of a misunderstanding with the form system.

See the previous implementation: https://github.com/department-of-veterans-affairs/vets-api/pull/4024/files#diff-6abe1721abf666d1bd05e9b827c352a4L13

The POST endpoint we are implementing is documented here: https://github.com/department-of-veterans-affairs/va.gov-team/blob/master/products/medical-device-tool/api/plan.md

Goal

Supply submission endpoint for MDOT

Objectives or Key Results this is meant to further

Acceptance Criteria

leahkeeler commented 4 years ago

@lihanli Is this still in progress? or completed?

lihanli commented 4 years ago

@leahkeeler it's still in progress, will update this ticket when i've validated in staging that it's working

leahkeeler commented 4 years ago

@lihanli Thanks! I am going to move it over to in progress.

lihanli commented 4 years ago

@mr0sari0 @mojaray2k endpoint is working on staging (must be logged in)

let body = {
  "permanentAddress": {
    "street": "101 Example Street",
    "street2": "Apt 2",
    "city": "Kansas City",
    "state": "MO",
    "country": "USA",
    "postalCode": "64117"
  },
  "usePermanentAddress": true,
  "useTemporaryAddress": false,
  "order": [
    {
      "productId": "1"
    },
    {
      "productId": "4"
    }
  ],
  "additionalRequests": ""
}

fetch(
  "https://staging-api.va.gov/v0/mdot/supplies",
  {
    "method":"POST",
    mode: 'cors',
    credentials: 'include',
    headers: {
      'X-Key-Inflection': 'camel',
      "content-type":"application/json"
    },
    body: JSON.stringify(body)
  }
).then((data) => {
  return data.json();
}).then((json) => {
  console.log(json)
});