Skip to content

Commit

Permalink
Revert "don't take this out yet, get below LOC threshold"
Browse files Browse the repository at this point in the history
This reverts commit 3c33b04.
  • Loading branch information
liztownd committed Nov 15, 2024
1 parent 1f7e7b3 commit 6123ac4
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions modules/travel_pay/app/services/travel_pay/claims_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,6 @@ def get_claim_by_id(claim_id)
end
end

def get_claims_by_date_range(params = {})
validate_date_params(params['start_date'], params['end_date'])

@auth_manager.authorize => { veis_token:, btsss_token: }
faraday_response = client.get_claims_by_date(veis_token, btsss_token, params)

if faraday_response.body['data']
raw_claims = faraday_response.body['data'].deep_dup

{
metadata: {
'status' => faraday_response.body['statusCode'],
'success' => faraday_response.body['success'],
'message' => faraday_response.body['message']
},
data: raw_claims&.map do |sc|
sc['claimStatus'] = sc['claimStatus'].underscore.titleize
sc
end
}
end
# Because we're appending this to the Appointments object, we need to not just throw an exception
# TODO: Integrate error handling from the token client through every subsequent client/service
rescue Faraday::Error
nil
end

def create_new_claim(params = {})
# ensure appt ID is the right format, allowing any version
uuid_all_version_format = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[89ABCD][0-9A-F]{3}-[0-9A-F]{12}$/i
Expand Down Expand Up @@ -107,20 +80,6 @@ def filter_by_date(date_string, claims)
claims
end

def validate_date_params(start_date, end_date)
if start_date && end_date
DateTime.parse(start_date.to_s) && DateTime.parse(end_date.to_s)
else
raise ArgumentError,
message: "Both start and end dates are required, got #{start_date}-#{end_date}."
end
rescue Date::Error => e
Rails.logger.debug(message:
"#{e}. Invalid date(s) provided (given: #{start_date} & #{end_date}).")
raise ArgumentError,
message: "#{e}. Invalid date(s) provided (given: #{start_date} & #{end_date})."
end

def client
TravelPay::ClaimsClient.new
end
Expand Down

0 comments on commit 6123ac4

Please sign in to comment.