Skip to content

Commit

Permalink
display formatted xml_payload when exists
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinmerbach committed Dec 15, 2023
1 parent edcdd52 commit 3749e10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/transmittable/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,12 @@ def error_messages

transmittable_errors&.map {|error| "#{error.key}: #{error.message}"}&.join(";")
end

def formatted_xml_payload
return false unless xml_payload
doc = Nokogiri::XML(xml_payload)
return if doc.errors
doc&.to_xhtml(indent: 2)
end
end
end
4 changes: 4 additions & 0 deletions app/views/transmittable/transactions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<h3>JSON Payload</h3>
<pre><%= raw(ap(@transaction.json_payload, index: false)) %></pre>
<% end %>
<% if @transaction.xml_payload %>
<h3>XML Payload</h3>
<pre><%= @transaction.formatted_xml_payload ? @transaction.formatted_xml_payload : @transaction.xml_payload %></pre>
<% end %>
<div class="accordion" style="margin-top: 1em">
<input type="checkbox" id="transactionInfo">
<label for="transactionInfo">All Transaction Attributes +</label>
Expand Down

0 comments on commit 3749e10

Please sign in to comment.