<% payments.each do |payment| %> <% end %>
<%= Spree::Payment.human_attribute_name(:number) %> <%= Spree::Payment.human_attribute_name(:created_at) %> <%= Spree::PaymentMethod.model_name.human %> <%= Spree::Payment.human_attribute_name(:response_code) %> <%= Spree::Payment.human_attribute_name(:state) %> <%= Spree::Payment.human_attribute_name(:amount) %>
<%= link_to payment.number, spree.admin_order_payment_path(@order, payment) %> <%= l(payment.created_at, format: :short) %> <%= payment.payment_method.name %> <%= payment.transaction_id %> <%= t(payment.state, scope: 'spree.payment_states') %>
<%= ::Money::Currency.find(@order.currency).symbol %>
<%= text_field_tag :amount, payment.amount, class: 'js-edit-amount align-right form-control' %>
<%= payment.display_amount.to_html %>
<%= link_to_with_icon 'save', t('spree.actions.save'), nil, no_text: true, class: "js-save", data: {action: 'save'} %> <%= link_to_with_icon 'cancel', t('spree.actions.cancel'), nil, no_text: true, class: "js-cancel", data: {action: 'cancel'} %>
<% if payment.pending? %> <%= link_to_with_icon 'edit', t('spree.actions.edit'), nil, no_text: true, class: "js-edit", data: {action: 'edit'} %> <% end %> <% allowed_actions = payment.actions.select { |a| can?(a.to_sym, payment) } %> <% allowed_actions.each do |action| %> <% if action == 'credit' %> <%= link_to_with_icon 'reply', t('spree.refund'), new_admin_order_payment_refund_path(@order, payment), no_text: true %> <% elsif action == 'capture' && !@order.completed? %> <%# no capture prior to completion. payments get captured when the order completes. %> <% else %> <%= link_to_with_icon action, t(action, scope: 'spree'), fire_admin_order_payment_path(@order, payment, e: action), method: :put, no_text: true, data: {action: action} %> <% end %> <% end %>