-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update formSubmitTransformers to use v2 logic and remove v1 implement…
…ation (#33732)
- Loading branch information
Showing
8 changed files
with
291 additions
and
1,457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 11 additions & 33 deletions
44
src/applications/vaos/covid-19-vaccine/redux/helpers/formSubmitTransformers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,23 @@ | ||
import moment from 'moment'; | ||
import { | ||
getChosenClinicInfo, | ||
getChosenSlot, | ||
selectCovid19VaccineFormData, | ||
} from '../selectors'; | ||
import { getClinicId, getSiteCode } from '../../../services/healthcare-service'; | ||
import { getClinicId } from '../../../services/healthcare-service'; | ||
|
||
export function transformFormToAppointment(state) { | ||
const clinic = getChosenClinicInfo(state); | ||
export function transformFormToVAOSAppointment(state) { | ||
const data = selectCovid19VaccineFormData(state); | ||
|
||
const clinic = getChosenClinicInfo(state); | ||
const slot = getChosenSlot(state); | ||
const appointmentLength = moment(slot.end).diff(slot.start, 'minutes'); | ||
|
||
return { | ||
appointmentType: 'Vaccine', | ||
clinic: { | ||
siteCode: getSiteCode(clinic), | ||
clinicId: getClinicId(clinic), | ||
clinicName: clinic.serviceName, | ||
clinicFriendlyLocationName: clinic.serviceName, | ||
institutionName: clinic.stationName, | ||
institutionCode: clinic.stationId, | ||
kind: 'clinic', | ||
status: 'booked', | ||
clinic: getClinicId(clinic), | ||
slot: { id: slot.id }, | ||
extension: { | ||
desiredDate: slot.start, | ||
}, | ||
|
||
// These times are a lie, they're actually in local time, but the upstream | ||
// service expects the 0 offset. | ||
desiredDate: `${moment(slot.start).format('YYYY-MM-DD')}T00:00:00+00:00`, | ||
dateTime: `${slot.start}+00:00`, | ||
duration: appointmentLength, | ||
bookingNotes: '', | ||
preferredEmail: data.email, | ||
// defaulted values | ||
apptType: 'P', | ||
purpose: '9', | ||
lvl: '1', | ||
ekg: '', | ||
lab: '', | ||
xRay: '', | ||
schedulingRequestType: 'NEXT_AVAILABLE_APPT', | ||
type: 'REGULAR', | ||
appointmentKind: 'TRADITIONAL', | ||
schedulingMethod: 'direct', | ||
locationId: data.vaFacility, | ||
}; | ||
} |
23 changes: 0 additions & 23 deletions
23
src/applications/vaos/covid-19-vaccine/redux/helpers/formSubmitTransformers.v2.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.