add ltv method
This commit is contained in:
@@ -48,9 +48,11 @@ module Submissions
|
|||||||
|
|
||||||
document.sign(io, **sign_params)
|
document.sign(io, **sign_params)
|
||||||
|
|
||||||
|
Submissions::GenerateResultAttachments.maybe_enable_ltv(io, sign_params)
|
||||||
|
|
||||||
ActiveStorage::Attachment.create!(
|
ActiveStorage::Attachment.create!(
|
||||||
blob: ActiveStorage::Blob.create_and_upload!(
|
blob: ActiveStorage::Blob.create_and_upload!(
|
||||||
io: StringIO.new(io.string), filename: "Audit Log - #{submission.template.name}.pdf"
|
io: io.tap(&:rewind), filename: "Audit Log - #{submission.template.name}.pdf"
|
||||||
),
|
),
|
||||||
name: 'audit_trail',
|
name: 'audit_trail',
|
||||||
record: submission
|
record: submission
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ module Submissions
|
|||||||
|
|
||||||
pdf.sign(io, **sign_params)
|
pdf.sign(io, **sign_params)
|
||||||
|
|
||||||
|
Submissions::GenerateResultAttachments.maybe_enable_ltv(io, sign_params)
|
||||||
|
|
||||||
ActiveStorage::Attachment.create!(
|
ActiveStorage::Attachment.create!(
|
||||||
blob: ActiveStorage::Blob.create_and_upload!(
|
blob: ActiveStorage::Blob.create_and_upload!(
|
||||||
io: StringIO.new(io.string), filename: "#{submission.template.name}.pdf"
|
io: io.tap(&:rewind), filename: "#{submission.template.name}.pdf"
|
||||||
),
|
),
|
||||||
name: 'combined_document',
|
name: 'combined_document',
|
||||||
record: submission
|
record: submission
|
||||||
|
|||||||
@@ -349,6 +349,8 @@ module Submissions
|
|||||||
|
|
||||||
pdf.sign(io, write_options: { validate: false, incremental: false }, **sign_params)
|
pdf.sign(io, write_options: { validate: false, incremental: false }, **sign_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
maybe_enable_ltv(io, sign_params)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
pdf.write(io, incremental: true, validate: false)
|
pdf.write(io, incremental: true, validate: false)
|
||||||
@@ -358,10 +360,9 @@ module Submissions
|
|||||||
pdf.write(io, incremental: false, validate: false)
|
pdf.write(io, incremental: false, validate: false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics
|
|
||||||
|
|
||||||
ActiveStorage::Attachment.new(
|
ActiveStorage::Attachment.new(
|
||||||
blob: ActiveStorage::Blob.create_and_upload!(io: StringIO.new(io.string), filename: "#{name}.pdf"),
|
blob: ActiveStorage::Blob.create_and_upload!(io: io.tap(&:rewind), filename: "#{name}.pdf"),
|
||||||
metadata: { original_uuid: uuid,
|
metadata: { original_uuid: uuid,
|
||||||
analyzed: true,
|
analyzed: true,
|
||||||
sha256: Base64.urlsafe_encode64(Digest::SHA256.digest(io.string)) },
|
sha256: Base64.urlsafe_encode64(Digest::SHA256.digest(io.string)) },
|
||||||
@@ -369,6 +370,11 @@ module Submissions
|
|||||||
record: submitter
|
record: submitter
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics
|
||||||
|
|
||||||
|
def maybe_enable_ltv(io, _sign_params)
|
||||||
|
io
|
||||||
|
end
|
||||||
|
|
||||||
def build_signing_params(pkcs, tsa_url)
|
def build_signing_params(pkcs, tsa_url)
|
||||||
params = {
|
params = {
|
||||||
|
|||||||
Reference in New Issue
Block a user