Product
<%= link_to @order.title, "#order_description" %>
<% if is_vendor? || is_admin? %>
Customer
<%= link_to @order.buyer.displayname, profile_path(@order.buyer) %>
<%end%>
<% if !is_vendor? || is_admin? %>
Vendor
<%= link_to @order.vendor.displayname, profile_path(@order.vendor) %>
<%end%>
Order date
<%= @order.created_at.in_time_zone(session_user.timezone).to_s(:FHM) %>
<% if is_admin? %>
Updated at
<%= @order.updated_at.in_time_zone(session_user.timezone).to_s(:FHM) %>
<%end%>
Status
<% labeltype = (@order.status == Order::EXPIRED) ? 'warning' : 'primary' %>
<%= @order.status %>
<% if @order.status == Order::PAYMENT_PENDING && !@order.stock_available? %>
insufficient stock
<%end%>
<%if @order.locked %>
locked
A blockchain re-org has made the payment received invalid. The order cannot be modified until issue resolved by admin.
<%end%>
<% if @order.status == Order::PAYMENT_PENDING %>
Waiting for payment to the <%=@order.payment_method.name%> address. Status will automatically change when full payment received on blockchain.
Multiple payment transactions are summed towards total owing.
<% if @order.payment_received > 0 && @order.payment_received + @order.payment_unconfirmed < @order.btc_price %>
<%# Order is underpaid (since status still PAYMENT_PENDING) and
any additional payments made that are waiting for sufficient confirmations, are still inadequate to cover order price. %>
Requires another payment of <%= @order.btc_price - @order.payment_received %>
<%end%>
<% elsif @order.status == Order::PAID %>
Order is confirmed and waiting for vendor to accept.
<% elsif @order.status == Order::PAID_NO_STOCK %>
Stocks were reduced between when order created and payment received. Therefore this order cannot be fulfilled. Buyer must set refund address.
<% elsif @order.status == Order::ACCEPTED %>
Vendor has accepted order and will update status once shipped.
<% elsif @order.status == Order::REFUND_REQUESTED %>
Waiting for vendor to approve the refund percentage requested.
<% elsif @order.status == Order::SHIPPED %>
Waiting for buyer to finalize or request refund.
<% elsif @order.status == Order::FINALIZED %>
Funds will be paid to vendor.
<% elsif @order.status == Order::REFUND_FINALIZED %>
A percentage of funds will be paid to buyer with remaining going to vendor (less commission).
<% elsif @order.status == Order::DECLINED %>
Vendor unable to fulfil this order. Buyer must set refund address.
<% elsif @order.status == Order::ADMIN_FINALIZED %>
Admin has allocated the escrow to the parties.
<% elsif @order.status == Order::EXPIRED %>
<% if @order.payment_received == 0 %>
No payment was received and the order has expired.
<%elsif @order.payment_received < @order.btc_price %>
Insufficient payment was received and order expired.
<%else%>
<%# sufficient payment received so it must have been paid after expiry %>
Payment was received after the order expired.
<%end%>
<% end %>
<% if @order.admin_set_paid %>
Order set paid by the administrator.
<% end %>
<% if @order.fe_required %>
<%end%>
Unit price
<%= "%g" % @order.unitprice.unit %> <%= @order.product.unitdesc %> /
<%= currency_format(@order.convertCurrency(@order.unitprice.currency, session_user.currency, @order.unitprice.price)) %> <%=session_user.currency%>
Quantity
<%= @order.quantity %>
Total quantity
<%= sprintf("%g", @order.quantity * @order.unitprice.unit) %> <%= @order.product.unitdesc %>
Shipping option
<%= @order.shippingoption.description %>
Shipping price
<%= currency_format( @order.convertCurrency(@order.shippingoption.currency, session_user.currency, @order.shippingoption.price) ) %> <%= session_user.currency %>
Total price
<%= currency_format(@order.total_price_in_currency(session_user.currency)) %> <%= session_user.currency %>
<%=@order.payment_method.name%> price
<%=image_tag("#{@order.payment_method.name.downcase}.svg", class: "small_logo", width: "16", height: "16")%>
<%= @order.btc_price %>
( @<%= currency_format(@order.get_exchange_rate(session_user.currency)) %> <%= session_user.currency %>/<%=@order.payment_method.code%> )
<% if !is_vendor? || is_admin? %>
<%=@order.payment_method.name%> payment address
<% if @order.status != Order::BEFORE_CONFIRMED %>
<%= @order.btc_address.address %>
<% else %>
address not yet assigned
<% end %>
<% if @order.status == Order::PAYMENT_PENDING %>
Please pay <%=@order.btc_price%> <%=@order.payment_method.code%> to the above address before the expiry time
<%= (@order.created_at + Rails.configuration.expire_unpaid_order_duration).in_time_zone(session_user.timezone).to_s(:FHM) %>.
After <%=Rails.configuration.blockchain_confirmations%> blockchain confirmations your order will be marked as paid.
Overpayments are accepted but there is no provision for returning change.
This order does not constitute a reservation of product stock until payment is confirmed.
<%end%>
<% if @order.status != Order::BEFORE_CONFIRMED %>
PGP signature of address
The <%=@order.payment_method.name%> payment address is always signed with this website's key which you should have saved.
You may verify the address with PGP to ensure it is authentic.
<% end %>
<%end%><%# is a buyer or an admin %>
<%=@order.payment_method.name%> payment received
<%= @order.payment_received %>
<% if @order.payment_received == 0 && @order.multipay_group %>
<%# This will show on all orders that were set PAID/PAID_NO_STOCK by multipay job, excluding the primary order which actually received payment. %>
(paid using multipay)
<% elsif @order.multipay_group && @order.multipay_group.primary_order == @order %>
(primary multipay order)
<%end%>
<%# Useful for vendor to see if they tried to pay yet. User might not understand block explorers so this helps them see payment registered. %>
<% if @order.payment_received < @order.btc_price %>
Unconfirmed payments
<%= @order.payment_unconfirmed %> (less than <%=Rails.configuration.blockchain_confirmations%> confirmations)
<% end %>
Shipped date
<% if @order.dispatched_on == nil %>
not shipped yet or was finalized early before shipping
<%else%>
<%= @order.dispatched_on.in_time_zone(session_user.timezone).to_s(:FHM) %>
<%end%>
<% if @order.status == Order::FINALIZED %>
Finalized date
<%= @order.finalized_at.in_time_zone(session_user.timezone).to_s(:FHM) %>
<%else%>
Autofinalize date
<% if @order.fe_required %>
n/a
<% elsif @order.finalize_at.nil? %>
only applicable when order marked shipped
<% else %>
<%= @order.finalize_at.in_time_zone(session_user.timezone).to_s(:FHM) %>
<%end%>
<%end%>
<% if @order.status == Order::DECLINED %>
Decline reason
<%= @order.declined_reason %>
<%end%>
<% if @order.status == Order::REFUND_REQUESTED %>
Requested refund
<%= number_to_percentage(@order.refund_requested_fraction * 100, precision: 0) %>
<%end%>
<% if @order.status == Order::REFUND_FINALIZED %>
Refund proportion
<%= number_to_percentage(@order.refund_requested_fraction * 100, precision: 0) %>
<%end%>
<% if @order.status == Order::ADMIN_FINALIZED %>
Refund proportion
<%= number_to_percentage(@order.admin_finalized_refund_fraction * 100, precision: 0) %>
<%end%>
<% if (is_admin? || !is_vendor?) && @order.buyer_payout && @order.buyer_payout.btc_amount > 0 %>
Refund amount
<%= @order.buyer_payout.btc_amount %> <%=@order.payment_method.code%>
Pay refund to <%=@order.payment_method.code%> address
<%= @order.buyer_payout.btc_address.nil? ? 'none set' : @order.buyer_payout.btc_address %>
<%# the admin view should not allow setting or modifying the payout address. %>
<% if !@order.buyer_payout.paid && !is_admin? %>
<%= link_to 'Set address', '#payout', class: 'btn btn-primary btn-xs' %>
<%end%>
Buyer refund processed
<%= @order.buyer_payout.paid ? 'yes' : 'no' %>
Refund txid
<%= @order.buyer_payout.try(:txid) %>
<% end %>
<% if (is_admin? || is_vendor?) && @order.vendor_payout %>
Pay vendor amount
<%= @order.vendor_payout.btc_amount %> <%=@order.payment_method.code%>
Pay <%=@order.payment_method.name%> address
<%= @order.vendor_payout.btc_address.nil? ? 'none set' : @order.vendor_payout.btc_address %>
<%# the admin view should not show the controls for setting or modifying the payout address since admin controller doesn't support that. %>
<% if !@order.vendor_payout.paid && !is_admin? %>
<%= link_to 'Set address', '#payout', class: 'btn btn-primary btn-xs' %>
<%end%>
Commission
<%= @order.commission %> <%=@order.payment_method.code%>
Vendor payment processed
<%= @order.vendor_payout.paid ? 'yes' : 'no' %>
Vendor payment txid
<%= @order.vendor_payout.try(:txid) %>
<% end %>
<%# Admin will not see this section on feedback. It will only show for vendors & buyers. %>
<% if @order.allow_feedback_submission? %>
<% if feedback_placed = @order.feedbacks.find_by(placedby: session_user) %><%# use find_by so it returns a feedback or nil. %>
<%# Vendor sees after they leave feedback on buyer. Buyer sees this once they leave feedback. %>
Feedback placed
<%= feedback_placed.feedback %>
<%= link_to 'Edit', edit_feedback_path(feedback_placed), class: "btn btn-primary btn-xs" %>
<% unless feedback_placed.response.empty? %>
Response
<%= feedback_placed.response %>
<% end %>
<% end %>
<% if feedback_received = @order.feedbacks.find_by(placedon: session_user) %>
<%# Vendor sees this when buyer leaves feedback. Buyer sees this when vendor has left feedback. %>
Feedback received
<%= feedback_received.feedback %>
<% if feedback_received.response.empty? %>
<%= link_to 'Respond', respond_feedback_path(feedback_received), class: "btn btn-primary btn-xs" %>
<%end%>
<% unless feedback_received.response.empty? %>
Response
<%= feedback_received.response %>
<%= link_to 'Edit', respond_feedback_path(feedback_received), class: "btn btn-primary btn-xs" %>
<% end %>
<% end %>
<% end %>
<%# Modal dialog shows original product description saved when order created. %>
Order description
<%=link_to 'Product', @order.product %> description when order created:
<%= simple_format h(@order.description) %>
<%= link_to 'Close', '#close', class: 'btn btn-default form-button' %>