<%= link_to payment.number, spree.admin_order_payment_path(@order, payment) %> |
<%= pretty_time(payment.created_at) %> |
<%= text_field_tag :amount, payment.amount, class: 'js-edit-amount edit-payment-amount editing-show' %>
<%= payment.display_amount.to_html %>
|
<%= payment_method_name(payment) %> |
<%= payment.transaction_id %> |
<%= Spree.t(payment.state, scope: :payment_states, default: payment.state.capitalize) %> |
<%= link_to_with_icon 'save', Spree.t('actions.save'), nil, no_text: true, class: "js-save", data: {action: 'save'} %>
<%= link_to_with_icon 'cancel', Spree.t('actions.cancel'), nil, no_text: true, class: "js-cancel", data: {action: 'cancel'} %>
<% if payment.pending? %>
<%= link_to_with_icon 'edit', Spree.t('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', Spree.t(: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, Spree.t(action), fire_admin_order_payment_path(@order, payment, e: action), method: :put, no_text: true, data: {action: action} %>
<% end %>
<% end %>
|
<% end %>