Skip to content

Commit

Permalink
4195 beneficiary endpoint fix (#12846)
Browse files Browse the repository at this point in the history
* fixed naming in beneficiary to match old schema

* updated specs

* fixed order changes to match docs
  • Loading branch information
cadibemma authored Jun 1, 2023
1 parent 207be63 commit e9abb7c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
15 changes: 13 additions & 2 deletions modules/mobile/app/models/mobile/v0/adapters/letter_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class LetterInfo
def parse(letter_info)
Mobile::V0::LetterInfo.new(
benefit_information: benefit_information(letter_info[:benefitInformation]),
military_service: letter_info[:militaryService]
military_service: military_service(letter_info[:militaryService])
)
end

Expand All @@ -16,7 +16,7 @@ def parse(letter_info)
def benefit_information(benefits)
BenefitInformation.new(
award_effective_date: benefits[:awardEffectiveDate],
has_chapter_35_eligibility: benefits[:hasChapter35Eligibility],
has_chapter35_eligibility: benefits[:hasChapter35Eligibility],
monthly_award_amount: benefits[:monthlyAwardAmount].to_f,
service_connected_percentage: benefits[:serviceConnectedPercentage],
has_death_result_of_disability: benefits[:hasDeathResultOfDisability],
Expand All @@ -29,6 +29,17 @@ def benefit_information(benefits)
has_special_monthly_compensation: benefits[:hasSpecialMonthlyCompensation]
)
end

def military_service(military_services)
military_services.map do |military_service|
{
branch: military_service[:branch],
character_of_service: military_service[:characterOfService],
entered_date: military_service[:enteredDate],
released_date: military_service[:releasedDate]
}
end
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion modules/mobile/app/models/mobile/v0/benefit_information.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Mobile
module V0
class BenefitInformation < Common::Resource
attribute :award_effective_date, Types::DateTime
attribute :has_chapter_35_eligibility, Types::Bool
attribute :has_chapter35_eligibility, Types::Bool
attribute :monthly_award_amount, Types::Float
attribute :service_connected_percentage, Types::Integer
attribute :has_death_result_of_disability, Types::Bool
Expand Down
34 changes: 17 additions & 17 deletions modules/mobile/spec/request/letters_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,23 @@
{ 'data' =>
{ 'id' => '3097e489-ad75-5746-ab1a-e0aabc1b426a',
'type' => 'LettersBeneficiaryResponses',
'attributes' => {
'benefitInformation' =>
{ 'awardEffectiveDate' => '2016-02-04T17:51:56Z',
'hasChapter35Eligibility' => true,
'monthlyAwardAmount' => 2673.0,
'serviceConnectedPercentage' => 2,
'hasDeathResultOfDisability' => false,
'hasSurvivorsIndemnityCompensationAward' => false,
'hasSurvivorsPensionAward' => false,
'hasAdaptedHousing' => false,
'hasIndividualUnemployabilityGranted' => false,
'hasNonServiceConnectedPension' => false,
'hasServiceConnectedDisabilities' => true,
'hasSpecialMonthlyCompensation' => false },
'militaryService' => [{ 'branch' => 'Army', 'characterOfService' => 'HONORABLE',
'enteredDate' => '2016-02-04T17:51:56Z', 'releasedDate' => '2016-02-04T17:51:56Z' }]
} } }
'attributes' =>
{ 'benefitInformation' =>
{ 'awardEffectiveDate' => '2016-02-04T17:51:56Z',
'hasChapter35Eligibility' => true,
'monthlyAwardAmount' => 2673.0,
'serviceConnectedPercentage' => 2,
'hasDeathResultOfDisability' => false,
'hasSurvivorsIndemnityCompensationAward' => false,
'hasSurvivorsPensionAward' => false,
'hasAdaptedHousing' => false,
'hasIndividualUnemployabilityGranted' => false,
'hasNonServiceConnectedPension' => false,
'hasServiceConnectedDisabilities' => true,
'hasSpecialMonthlyCompensation' => false },
'militaryService' =>
[{ 'branch' => 'Army', 'characterOfService' => 'HONORABLE',
'enteredDate' => '2016-02-04T17:51:56Z', 'releasedDate' => '2016-02-04T17:51:56Z' }] } } }
end

before do
Expand Down

0 comments on commit e9abb7c

Please sign in to comment.