Skip to content

Commit

Permalink
Fix retry of sumup transaction (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilco375 authored Jan 13, 2023
1 parent 9b5a087 commit 398b48a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@ def order_screen # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
@sumup_key = Rails.application.config.x.sumup_key
@sumup_enabled = @sumup_key.present?

@sumup_error_order = if params['sumup_error']
Order.find(params['sumup_error'])
else
false
end
if params['sumup_error']
sumup_order_id = params['sumup_error'].split('-').first
sumup_attempt = if params['sumup_error'].include? '-'
params['sumup_error'].split('-').last.to_i
else
0
end
@sumup_error_order = Order.find(sumup_order_id)
@sumup_tx_id = "#{sumup_order_id}-#{sumup_attempt + 1}"
else
@sumup_error_order = false
end

# Set flags for application.html.slim
@show_navigationbar = false
Expand Down
2 changes: 1 addition & 1 deletion app/views/activities/order_screen.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

<% if @sumup_error_order %>
<b-modal id="sumup-error-modal" ref="sumupErrorModal" title="Sumup betaling mislukt"
ok-title="Nog eens proberen" @ok="startSumupPayment(<%= @sumup_error_order.id %>, <%= @sumup_error_order.order_total %>)"
ok-title="Nog eens proberen" @ok="startSumupPayment('<%= @sumup_tx_id %>', <%= @sumup_error_order.order_total %>)"
cancel-title="Bestelling verwijderen" @cancel="deleteOrder(<%= @sumup_error_order.id %>)">
<div class="modal-body">
De Sumup betaling is mislukt. Wil je de betaling nogmaals proberen of de bestelling verwijderen?
Expand Down

0 comments on commit 398b48a

Please sign in to comment.