<%= 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') %>
|
<%= 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 %>
|
<% end %>