diff --git a/modules/my_health/app/serializers/my_health/v1/prescription_details_serializer.rb b/modules/my_health/app/serializers/my_health/v1/prescription_details_serializer.rb index d407ca1cc9b..16be2a163c0 100644 --- a/modules/my_health/app/serializers/my_health/v1/prescription_details_serializer.rb +++ b/modules/my_health/app/serializers/my_health/v1/prescription_details_serializer.rb @@ -35,6 +35,11 @@ def rx_rf_records records = object&.rx_rf_records records&.dig(0, 1) || [] end + + def tracking_list + tracking_list = object&.tracking_list + tracking_list&.dig(0, 1) || [] + end end end end diff --git a/modules/my_health/docs/openapi_merged.yaml b/modules/my_health/docs/openapi_merged.yaml index d86db25679e..91d849a8194 100644 --- a/modules/my_health/docs/openapi_merged.yaml +++ b/modules/my_health/docs/openapi_merged.yaml @@ -2535,6 +2535,53 @@ components: associatedBlockedTriageGroups: type: integer example: 1 + PrescriptionTrackingItem: + type: object + properties: + carrier: + type: string + completeDateTime: + type: string + format: datetime + example: '2023-07-24T15:48:49.000Z' + dateLoaded: + type: string + format: datetime + example: '2023-07-24T15:48:49.000Z' + dialDivisionPhone: + type: string + divisionPhone: + type: string + id: + type: integer + isLocalTracking: + type: boolean + ndc: + type: string + othersInSamePackage: + type: boolean + rxNumber: + type: integer + stationNumber: + type: integer + trackingNumber: + type: string + viewImageDisplayed: + type: boolean + example: + carrier: UPS + completeDateTime: '2023-03-28T04:39:11-04:00' + dateLoaded: '2023-06-21T13:05:19-04:00' + dialDivisionPhone: '3082719803' + divisionPhone: (308)271-9803 + id: 3974 + isLocalTracking: false + ndc: '00113002239' + othersInSamePackage: false + rxNumber: 2719799 + stationNumber: 994 + trackingNumber: '772980271979930000002254' + viewImageDisplayed: true PrescriptionDetail: type: object required: @@ -2713,7 +2760,8 @@ components: example: Rx Medication trackingList: type: array - example: [] + items: + $ref: '#/components/schemas/PrescriptionTrackingItem' rxRfRecords: type: array example: [] diff --git a/modules/my_health/docs/schemas/PrescriptionDetail.yml b/modules/my_health/docs/schemas/PrescriptionDetail.yml index 6bf2f7cb2ef..9018f964a17 100644 --- a/modules/my_health/docs/schemas/PrescriptionDetail.yml +++ b/modules/my_health/docs/schemas/PrescriptionDetail.yml @@ -175,7 +175,8 @@ properties: example: "Rx Medication" trackingList: type: array - example: [] + items: + $ref: "./PrescriptionTrackingItem.yml" rxRfRecords: type: array example: [] diff --git a/modules/my_health/docs/schemas/PrescriptionTrackingItem.yml b/modules/my_health/docs/schemas/PrescriptionTrackingItem.yml new file mode 100644 index 00000000000..8a60384b2c9 --- /dev/null +++ b/modules/my_health/docs/schemas/PrescriptionTrackingItem.yml @@ -0,0 +1,46 @@ +type: object +properties: + carrier: + type: string + completeDateTime: + type: string + format: datetime + example: 2023-07-24T15:48:49.000Z + dateLoaded: + type: string + format: datetime + example: 2023-07-24T15:48:49.000Z + dialDivisionPhone: + type: string + divisionPhone: + type: string + id: + type: integer + isLocalTracking: + type: boolean + ndc: + type: string + othersInSamePackage: + type: boolean + rxNumber: + type: integer + stationNumber: + type: integer + trackingNumber: + type: string + viewImageDisplayed: + type: boolean +example: + carrier: 'UPS' + completeDateTime: '2023-03-28T04:39:11-04:00' + dateLoaded: '2023-06-21T13:05:19-04:00' + dialDivisionPhone: '3082719803' + divisionPhone: '(308)271-9803' + id: 3974 + isLocalTracking: false + ndc: '00113002239' + othersInSamePackage: false + rxNumber: 2719799 + stationNumber: 994 + trackingNumber: '772980271979930000002254' + viewImageDisplayed: true diff --git a/modules/my_health/spec/serializer/v1/prescription_details_serializer_spec.rb b/modules/my_health/spec/serializer/v1/prescription_details_serializer_spec.rb index 9b71249de6c..9cf6b3a186b 100644 --- a/modules/my_health/spec/serializer/v1/prescription_details_serializer_spec.rb +++ b/modules/my_health/spec/serializer/v1/prescription_details_serializer_spec.rb @@ -169,4 +169,12 @@ expect(attributes['rx_rf_records']).to be_an(Array) expect(attributes['rx_rf_records']).to all(be_a(Hash)) end + + it 'includes the tracking_list records as an array' do + tracking_list = attributes['tracking_list'] + expect(tracking_list).to be_an(Array) + tracking_item = tracking_list[0] + expect(tracking_item).to be_a(Hash) + expect(tracking_list[0]).to include({ 'carrier' => 'UPS', 'complete_date_time' => '2023-03-28T04:39:11-04:00' }) + end end diff --git a/spec/factories/prescription_details.rb b/spec/factories/prescription_details.rb index 7dc7cf83830..8953687869a 100644 --- a/spec/factories/prescription_details.rb +++ b/spec/factories/prescription_details.rb @@ -91,5 +91,44 @@ ] ] } + tracking_list { + [ + [ + 'tracking', + [ + { + carrier: 'UPS', + completeDateTime: '2023-03-28T04:39:11-04:00', + dateLoaded: '2023-06-21T13:05:19-04:00', + dialDivisionPhone: '3082719803', + divisionPhone: '(308)271-9803', + id: 3974, + isLocalTracking: false, + ndc: '00113002239', + othersInSamePackage: false, + rxNumber: 2_719_799, + stationNumber: 994, + trackingNumber: '772980271979930000002254', + viewImageDisplayed: true + }, + { + carrier: 'FedEx', + completeDateTime: '2023-05-28T04:39:11-04:00', + dateLoaded: '2023-04-21T16:55:19-04:00', + dialDivisionPhone: '4012719804', + divisionPhone: '(401)271-9804', + id: 9878, + isLocalTracking: false, + ndc: '00113002240', + othersInSamePackage: false, + rxNumber: 2_719_780, + stationNumber: 995, + trackingNumber: '332980271979930000002300', + viewImageDisplayed: false + } + ] + ] + ] + } end end