Skip to content

Commit

Permalink
Update formSubmitTransformers to use v2 logic and remove v1 implement…
Browse files Browse the repository at this point in the history
…ation (#33732)
  • Loading branch information
JunTaoLuo authored Jan 3, 2025
1 parent bd2befb commit dbac3be
Show file tree
Hide file tree
Showing 8 changed files with 291 additions and 1,457 deletions.
2 changes: 1 addition & 1 deletion src/applications/vaos/covid-19-vaccine/redux/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
STARTED_NEW_APPOINTMENT_FLOW,
} from '../../redux/sitewide';
import { createAppointment } from '../../services/appointment';
import { transformFormToVAOSAppointment } from './helpers/formSubmitTransformers.v2';
import { transformFormToVAOSAppointment } from './helpers/formSubmitTransformers';

export const FORM_PAGE_OPENED = 'covid19Vaccine/FORM_PAGE_OPENED';
export const FORM_DATA_UPDATED = 'covid19Vaccine/FORM_DATA_UPDATED';
Expand Down
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,
};
}

This file was deleted.

2 changes: 1 addition & 1 deletion src/applications/vaos/new-appointment/redux/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
transformFormToVAOSAppointment,
transformFormToVAOSCCRequest,
transformFormToVAOSVARequest,
} from './helpers/formSubmitTransformers.v2';
} from './helpers/formSubmitTransformers';
import {
resetDataLayer,
recordItemsRetrieved,
Expand Down
Loading

0 comments on commit dbac3be

Please sign in to comment.