-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Push the risk analysis details to the payment partial
AVS and CVV are a legacy coming from an age in which everything could be done with ActiveMerchant and PCI compliance didn't exist. Moving away from specific risk checks paves the way for payment-method specific risky checks and display, although the underlying tables didn't change.
- Loading branch information
Showing
2 changed files
with
63 additions
and
46 deletions.
There are no files selected for viewing
60 changes: 17 additions & 43 deletions
60
backend/app/views/spree/admin/orders/_risk_analysis.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,26 @@ | ||
<% latest_payment = @order.payments.reorder("created_at DESC").first %> | ||
<details id="risk_analysis"> | ||
<summary><%= t('spree.risk_analysis') %>: <%= t('spree.risky') %></summary> | ||
|
||
<fieldset class="no-border-bottom" id="risk_analysis"> | ||
<legend><%= "#{t('spree.risk_analysis')}: #{t('spree.not') unless @order.is_risky?} #{t('spree.risky')}" %></legend> | ||
<table> | ||
<thead> | ||
<th><%= t('spree.payment')%></th> | ||
<th><%= t('spree.risk')%></th> | ||
<th><%= t('spree.status')%></th> | ||
</thead> | ||
<tbody id="risk-analysis" data-hook="order_details_adjustments" class="with-border"> | ||
<tr class=""> | ||
<td><strong> | ||
<%= t('spree.failed_payment_attempts') %>: | ||
</strong></td> | ||
<td> | ||
<span class="pill pill-<%= @order.payments.failed.count > 0 ? 'warning' : 'complete' %>"> | ||
<%= t( | ||
'spree.payments_failed_count', | ||
count: @order.payments.failed.count | ||
) %> | ||
</span> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td><strong><%= t('spree.avs_response') %>:</strong></td> | ||
<td> | ||
<span class="pill pill-<%= latest_payment.is_avs_risky? ? 'warning' : 'complete' %>"> | ||
<% if latest_payment.is_avs_risky? %> | ||
<%= avs_response_code[latest_payment.avs_response] %> | ||
<% else %> | ||
<%= t('spree.success') %> | ||
<% end %> | ||
</span> | ||
</td> | ||
</tr> | ||
|
||
<tr> | ||
<td><strong><%= t('spree.cvv_response') %>:</strong></td> | ||
<td> | ||
<span class="pill pill-<%= latest_payment.is_cvv_risky? ? 'warning' : 'complete' %>"> | ||
<% if latest_payment.is_cvv_risky? %> | ||
<%= cvv_response_code[latest_payment.cvv_response_code] %> | ||
<% else %> | ||
<%= t('spree.success') %> | ||
<% end %> | ||
</span> | ||
</td> | ||
</tr> | ||
<% @order.payments.risky.each do |payment| %> | ||
<tr class=""> | ||
<td><%= link_to payment.number, admin_order_payment_path(@order, payment) %></td> | ||
<td> | ||
<span class="pill pill-warning"><%= t('spree.risky') %></span> | ||
</td> | ||
<td> | ||
<span class="pill pill-<%= payment.state %>"> | ||
<%= t(payment.state, scope: 'spree.payment_states') %> | ||
</span> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</fieldset> | ||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters