webionate/spree_paymill

View on GitHub
app/views/spree/admin/payments/source_views/_paymillcreditcard.html.erb

Summary

Maintainability
Test Coverage
<fieldset>
  <legend><%= t('transactions') %></legend>
  <% payment.log_entries.reverse.each do |log| %>
  <% details = YAML.load(log.details) rescue "" %>
    <table class="index">
      <% if details.is_a? ActiveMerchant::Billing::PaymillResponse %>
        <tr>
          <th colspan="6"><%= t('transaction') %> <%= details.params["transaction_id"] %> -  <%= log.created_at.to_s(:date_time24) %></th>
        </tr>
        <tr>
          <td width="12%;"><label><%= t('type') %>:</label></td>
          <td width="20%;">
            <%= details.params["transaction_type"] %>
          </td>
          <td width="8%;"><label><%= t("result") %>:</label></td>
          <td width="20%;">
            <%= details.success? %>
          </td>
          <td width="15%;"><label><%= t("amount") %>:</label></td>
          <td width="20%;">
            <%= number_to_currency details.params["amount"] %>
          </td>
        </tr>
        <tr>
          <td><label><%= t("paymill_code") %>:</label></td>
          <td colspan="3">
            <%= details.authorization %>
          </td>
          <td><label><%= t("status") %>:</label></td>
          <td>
            <%= details.payment_status %>
          </td>
        </tr>
        <tr>
          <td><label><%= t("comment") %>:</label></td>
          <td colspan="5">
            <%= details.message %>
          </td>
        </tr>
      <% else %>
        <tr>
          <th colspan="6"><%= t('unknown_transaction') %> -  <%= log.created_at.to_s(:date_time24) %></th>
        </tr>
        <tr>
          <td colspan="6"><pre style="overflow: hidden; width:600px;"><%= log.details %></pre></th>
        </tr>
      <% end %>
    </table>
  <% end %>
</fieldset>