Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bdex/80773: Toxic Exposure - [Lighthouse API] generatePdf hook up #16411

Merged
merged 10 commits into from
Apr 23, 2024
16 changes: 10 additions & 6 deletions lib/lighthouse/benefits_claims/service.rb
Original file line number Diff line number Diff line change
@@ -126,12 +126,7 @@ def submit526(body, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, o
# making this a jsonapi request body first ({data: {type:, attributes}}),
# this will put it in the correct format for transmission

body = {
data: {
type: 'form/526',
attributes: body
}
}.as_json.deep_transform_keys { |k| k.camelize(:lower) }
body = build_request_body(body)

# Inflection settings force 'current_va_employee' to render as 'currentVAEmployee' in the above camelize() call
# Since Lighthouse needs 'currentVaEmployee', the following workaround renames it.
@@ -152,6 +147,15 @@ def submit526(body, lighthouse_client_id = nil, lighthouse_rsa_key_path = nil, o

private

def build_request_body(body)
{
data: {
type: 'form/526',
attributes: body
}
}.as_json.deep_transform_keys { |k| k.camelize(:lower) }
end

# this gsubbing is to fix an issue where the service that generates the 526PDF was failing due to
# unicoded carriage returns:
# i.e.: \n was throwing: "U+000A ('controlLF') is not available in the font Helvetica, encoding: WinAnsiEncoding"
Loading