Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into liz-btsss/find-appo…
Browse files Browse the repository at this point in the history
…intment
  • Loading branch information
liztownd committed Sep 23, 2024
2 parents e874e7d + f378056 commit a9cb4fd
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -982,23 +982,67 @@ def validate_federal_activation_values(service_information)

form_obj_desc = '/serviceInformation/federalActivation'

# For a valid BDD EP code to be assigned we need these values
validate_required_values_for_federal_activation(federal_activation_date, anticipated_separation_date)

validate_federal_activation_date(federal_activation_date, form_obj_desc)

validate_federal_activation_date_order(federal_activation_date) if federal_activation_date.present?
if anticipated_separation_date.present?
validate_anticipated_separation_date_in_past(anticipated_separation_date)
end
end

def validate_federal_activation_date(federal_activation_date, form_obj_desc)
if federal_activation_date.blank?
collect_error_if_value_not_present('federal activation date',
form_obj_desc)
end
end

return if anticipated_separation_date.blank?

def validate_federal_activation_date_order(federal_activation_date)
# we know the dates are present
if activation_date_not_after_duty_begin_date?(federal_activation_date)
collect_error_messages(
source: '/serviceInformation/federalActivation/',
detail: 'The federalActivation date must be after the earliest service period active duty begin date.'
)
end
end

validate_anticipated_separation_date_in_past(anticipated_separation_date)
# rubocop:disable Metrics/MethodLength
def validate_required_values_for_federal_activation(activation_date, separation_date)
activation_form_obj_desc = 'serviceInformation/federalActivation/'
reserves_dates_form_obj_desc = 'serviceInformation/reservesNationalGuardServce/obligationTermsOfService/'
reserves_unit_form_obj_desc = 'serviceInformation/reservesNationalGuardServce/'

reserves = form_attributes.dig('serviceInformation', 'reservesNationalGuardService')
tos_start_date = reserves&.dig('obligationTermsOfService', 'beginDate')
tos_end_date = reserves&.dig('obligationTermsOfService', 'endDate')
unit_name = reserves&.dig('unitName')

if activation_date.blank?
collect_error_messages(detail: 'activationDate is missing or blank',
source: activation_form_obj_desc)
end
if separation_date.blank?
collect_error_messages(detail: 'anticipatedSeparationDate is missing or blank',
source: activation_form_obj_desc)
end
if tos_start_date.blank?
collect_error_messages(detail: 'beginDate is missing or blank',
source: reserves_dates_form_obj_desc)
end
if tos_end_date.blank?
collect_error_messages(detail: 'endDate is missing or blank',
source: reserves_dates_form_obj_desc)
end
if unit_name.blank?
collect_error_messages(detail: 'unitName is missing or blank',
source: reserves_unit_form_obj_desc)
end
end
# rubocop:enable Metrics/MethodLength

def activation_date_not_after_duty_begin_date?(activation_date)
service_information = form_attributes['serviceInformation']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def generate(claim_id, middle_initial) # rubocop:disable Metrics/MethodLength

file_name = "#{SecureRandom.hex}.pdf"
path = ::Common::FileHelpers.generate_clamav_temp_file(pdf_string, file_name)
# temporary debugging of clam av
log_job_progress(
auto_claim.id,
"526EZ PDF generator PDF existence check: #{File.exist?(path)}, file size : #{File.size?(path)}",
auto_claim.transaction_id
)

upload = ActionDispatch::Http::UploadedFile.new({
filename: file_name,
type: 'application/pdf',
Expand Down
25 changes: 15 additions & 10 deletions modules/claims_api/app/swagger/claims_api/v2/dev/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2947,6 +2947,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -4330,6 +4331,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -5075,7 +5077,7 @@
"202 without a transactionId": {
"value": {
"data": {
"id": "a51ca7e0-180e-4792-b5a4-148a10a9bdae",
"id": "74d7a3b6-8164-49c2-9dfb-fdb3fa019477",
"type": "forms/526",
"attributes": {
"claimId": "600442191",
Expand Down Expand Up @@ -5260,7 +5262,7 @@
},
"federalActivation": {
"activationDate": "2023-10-01",
"anticipatedSeparationDate": "2024-09-18"
"anticipatedSeparationDate": "2024-09-21"
},
"confinements": [
{
Expand Down Expand Up @@ -5306,7 +5308,7 @@
"202 with a transactionId": {
"value": {
"data": {
"id": "3b5398d2-5851-4f40-9b81-9f03717acbff",
"id": "3356c8ae-350b-4a23-aea1-9bb00de306e1",
"type": "forms/526",
"attributes": {
"claimId": "600442191",
Expand Down Expand Up @@ -6488,6 +6490,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -7871,6 +7874,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -10031,6 +10035,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -10521,7 +10526,7 @@
"application/json": {
"example": {
"data": {
"id": "9195a402-a9df-43ea-a62d-715e59db90c9",
"id": "e788a384-ee89-4e9e-9055-b81fa61b166d",
"type": "forms/526",
"attributes": {
"claimProcessType": "STANDARD_CLAIM_PROCESS",
Expand Down Expand Up @@ -14181,8 +14186,8 @@
"id": "1",
"type": "intent_to_file",
"attributes": {
"creationDate": "2024-09-16",
"expirationDate": "2025-09-16",
"creationDate": "2024-09-19",
"expirationDate": "2025-09-19",
"type": "compensation",
"status": "active"
}
Expand Down Expand Up @@ -15078,7 +15083,7 @@
"application/json": {
"example": {
"data": {
"id": "c231aa7f-e16b-4616-9f79-c5c5b4d1f1e3",
"id": "c97b8c40-558a-4d35-af92-57362329173a",
"type": "individual",
"attributes": {
"code": "067",
Expand Down Expand Up @@ -15771,7 +15776,7 @@
"application/json": {
"example": {
"data": {
"id": "1b2bcb3f-8af7-46d1-ba2f-cecbcd87a451",
"id": "8d551fa6-0088-4910-bbd7-08492f1f1dfc",
"type": "organization",
"attributes": {
"code": "083",
Expand Down Expand Up @@ -17722,10 +17727,10 @@
"application/json": {
"example": {
"data": {
"id": "4636c375-2259-4a3c-afe0-79bf01664c7d",
"id": "17c1d357-0b69-4ce1-a7e2-deb13931a6c6",
"type": "claimsApiPowerOfAttorneys",
"attributes": {
"dateRequestAccepted": "2024-09-16",
"dateRequestAccepted": "2024-09-19",
"previousPoa": null,
"representative": {
"serviceOrganization": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -2943,6 +2944,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -3688,7 +3690,7 @@
"202 without a transactionId": {
"value": {
"data": {
"id": "b636aeb7-88c0-4451-bd9b-73fd63697834",
"id": "c57050e5-558e-4f9f-9a6b-68ea79752541",
"type": "forms/526",
"attributes": {
"claimId": "600442191",
Expand Down Expand Up @@ -3873,7 +3875,7 @@
},
"federalActivation": {
"activationDate": "2023-10-01",
"anticipatedSeparationDate": "2024-09-18"
"anticipatedSeparationDate": "2024-09-21"
},
"confinements": [
{
Expand Down Expand Up @@ -3919,7 +3921,7 @@
"202 with a transactionId": {
"value": {
"data": {
"id": "bf5dc2c7-c4f6-497c-b263-c9cf2ef097d0",
"id": "e981c089-c851-4c90-8a76-87a956381c2e",
"type": "forms/526",
"attributes": {
"claimId": "600442191",
Expand Down Expand Up @@ -5101,6 +5103,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -6484,6 +6487,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -8644,6 +8648,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": "object",
"nullable": true,
"additionalProperties": false,
Expand Down Expand Up @@ -9134,7 +9139,7 @@
"application/json": {
"example": {
"data": {
"id": "cc98ad06-eee9-4a56-b089-f891410097a5",
"id": "18853a53-9cc4-479a-8443-0f3c9bdea0af",
"type": "forms/526",
"attributes": {
"claimProcessType": "STANDARD_CLAIM_PROCESS",
Expand Down Expand Up @@ -12794,8 +12799,8 @@
"id": "1",
"type": "intent_to_file",
"attributes": {
"creationDate": "2024-09-16",
"expirationDate": "2025-09-16",
"creationDate": "2024-09-19",
"expirationDate": "2025-09-19",
"type": "compensation",
"status": "active"
}
Expand Down Expand Up @@ -13691,7 +13696,7 @@
"application/json": {
"example": {
"data": {
"id": "46dd81ce-150a-46af-ab26-fd631d7a8c30",
"id": "b06d7ca0-bb23-4481-b9e1-6a15351e0d63",
"type": "individual",
"attributes": {
"code": "067",
Expand Down Expand Up @@ -14384,7 +14389,7 @@
"application/json": {
"example": {
"data": {
"id": "25afc8c7-aeba-47c9-aaec-31654a9c954e",
"id": "4d21ac8b-52eb-48ea-930e-6277a1a272be",
"type": "organization",
"attributes": {
"code": "083",
Expand Down Expand Up @@ -16335,10 +16340,10 @@
"application/json": {
"example": {
"data": {
"id": "0d361496-a409-41d3-9946-5c796ba0febe",
"id": "42002b9e-354f-40b4-a7c2-5b816a934c6b",
"type": "claimsApiPowerOfAttorneys",
"attributes": {
"dateRequestAccepted": "2024-09-16",
"dateRequestAccepted": "2024-09-19",
"previousPoa": null,
"representative": {
"serviceOrganization": {
Expand Down
1 change: 1 addition & 0 deletions modules/claims_api/config/schemas/v2/526.json
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,7 @@
}
},
"federalActivation": {
"description": "If federalActivation is present then reservesNationalGuardService.obligationTermsOfService.beginDate, reservesNationalGuardService.obligationTermsOfService.endDate and reservesNationalGuardService.unitName are required",
"type": ["object", "null"],
"nullable": true,
"additionalProperties": false,
Expand Down
Loading

0 comments on commit a9cb4fd

Please sign in to comment.