move to ajax function for every direct debit xml download

automatic_group_order_invoice
viehlieb 2023-11-28 16:39:24 +01:00
parent 636aad0b3e
commit f98d083647
23 changed files with 158 additions and 128 deletions

View File

@ -86,10 +86,10 @@ class GroupOrderInvoicesController < ApplicationController
end
end
def toggle_payed
def toggle_paid
@group_order_invoice = GroupOrderInvoice.find(params[:id])
respond_to do |format|
@group_order_invoice.payed = !@group_order_invoice.payed
@group_order_invoice.paid = !@group_order_invoice.paid
if @group_order_invoice.save!
format.js
else
@ -111,11 +111,11 @@ class GroupOrderInvoicesController < ApplicationController
end
end
def toggle_all_payed
def toggle_all_paid
@order = Order.find(params[:order_id])
@group_order_invoices = @order.group_orders.map(&:group_order_invoice).compact
@group_order_invoices.each do |goi|
goi.payed = !ActiveRecord::Type::Boolean.new.deserialize(params[:payed])
goi.paid = !ActiveRecord::Type::Boolean.new.deserialize(params[:paid])
goi.save!
end
respond_to do |format|

View File

@ -177,17 +177,21 @@ class OrdersController < ApplicationController
export_allowed = !ordergroups.map(&:sepa_possible?).include?(false) && !group_orders.map { |go| go.group_order_invoice.present? }.include?(false)
group_order_ids = group_orders.map { |go| go.id if go.group_order_invoice.present? }
sepa_possible_ordergroup_names = ordergroups.map { |ordergroup| ordergroup.name unless ordergroup.sepa_possible? }.compact_blank
sepa_possible_ordergroup_names = ordergroups.map { |ordergroup| ordergroup.name if ordergroup.sepa_possible? }.compact_blank
sepa_not_possible_ordergroup_names = ordergroups.map(&:name) - sepa_possible_ordergroup_names
if export_allowed && group_orders.present?
respond_to do |format|
format.html do
group_orders.map(&:group_order_invoice).each(&:mark_sepa_downloaded)
collective_debit = OrderCollectiveDirectDebitXml.new(group_orders)
send_data collective_debit.xml_string, filename: @order.name + '_Sammellastschrift' + '.xml', type: 'text/xml'
group_orders.map(&:group_order_invoice).each(&:mark_sepa_downloaded)
rescue SEPA::Error => e
group_orders.map(&:group_order_invoice).each(&:unmark_sepa_downloaded)
redirect_to finance_order_index_path, alert: e.message
rescue StandardError => e
group_orders.map(&:group_order_invoice).each(&:unmark_sepa_downloaded)
redirect_to finance_order_index_path, alert: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_possible_ordergroup_names.join(', '))
redirect_to finance_order_index_path, alert: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_not_possible_ordergroup_names.join(', '), error: e.message)
end
format.xml do
group_orders.map(&:group_order_invoice).each(&:mark_sepa_downloaded)
@ -195,17 +199,20 @@ class OrdersController < ApplicationController
send_data collective_debit.xml_string, filename: @order.name + '_Sammellastschrift' + '.xml', type: 'text/xml'
rescue SEPA::Error => e
group_orders.map(&:group_order_invoice).each(&:unmark_sepa_downloaded)
render json: { error: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_possible_ordergroup_names.join(', ')) }
render json: { error: e.message }
rescue StandardError => e
group_orders.map(&:group_order_invoice).each(&:unmark_sepa_downloaded)
render json: { error: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_not_possible_ordergroup_names.join(', '), error: e.message) }
end
format.js
end
else
respond_to do |format|
format.html do
redirect_to finance_order_index_path, alert: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_possible_ordergroup_names.join(', '))
redirect_to finance_order_index_path, alert: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_not_possible_ordergroup_names.join(', '), error: '')
end
format.xml do
render json: { error: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_possible_ordergroup_names.join(', ')) }
render json: { error: I18n.t('orders.collective_direct_debit.alert', ordergroup_names: sepa_not_possible_ordergroup_names.join(', '), error: '') }
end
format.js
end

View File

@ -5,41 +5,28 @@ class OrderCollectiveDirectDebitXml
def initialize(group_orders)
batch_booking = group_orders.count > 1 ? true : false
begin
sdd = SEPA::DirectDebit.new(
# Name of the initiating party and creditor, in German: "Auftraggeber"
# String, max. 70 char
#TODO: needed from config
name: FoodsoftConfig[:name],
sdd = SEPA::DirectDebit.new(
# Name of the initiating party and creditor, in German: "Auftraggeber"
# String, max. 70 char
name: FoodsoftConfig[:name],
# OPTIONAL: Business Identifier Code (SWIFT-Code) of the creditor
# String, 8 or 11 char
#TODO: needed - config
bic: FoodsoftConfig[:group_order_invoices][:bic],
#'BANKDEFFXXX',
# OPTIONAL: Business Identifier Code (SWIFT-Code) of the creditor
# String, 8 or 11 char
bic: FoodsoftConfig[:group_order_invoices][:bic],
# International Bank Account Number of the creditor
# String, max. 34 chars
#TODO: needed
iban: FoodsoftConfig[:group_order_invoices][:iban],
#'DE87200500001234567890',
# International Bank Account Number of the creditor
# String, max. 34 chars
iban: FoodsoftConfig[:group_order_invoices][:iban], # remove spaces
# Creditor Identifier, in German: Gläubiger-Identifikationsnummer
# String, max. 35 chars
#TODO: needed - config
creditor_identifier: FoodsoftConfig[:group_order_invoices][:creditor_identifier],
#'DE98ZZZ09999999999'
)
rescue StandardError => e
raise "SEPA Direct Debit XML could not be created: #{e.message}"
end
# Creditor Identifier, in German: Gläubiger-Identifikationsnummer
# String, max. 35 chars
creditor_identifier: FoodsoftConfig[:group_order_invoices][:creditor_identifier],
)
group_orders.each do |group_order|
# Second: Add transactions
# Second: Add transactions
sdd.add_transaction(
# Name of the debtor, in German: "Zahlungspflichtiger"
# String, max. 70 char
#TODO: From ordergroup
name: group_order.ordergroup.name,
#Ende zu Ende Referenz
@ -47,17 +34,14 @@ class OrderCollectiveDirectDebitXml
# OPTIONAL: Business Identifier Code (SWIFT-Code) of the debtor's account
# String, 8 or 11 char
#TODO: needed where does it come from?
bic: group_order.ordergroup.sepa_account_holder.bic,
bic: group_order.ordergroup.sepa_account_holder.bic.gsub(' ', ''),
# International Bank Account Number of the debtor's account
# String, max. 34 chars
#TODO: needed
iban: group_order.ordergroup.sepa_account_holder.iban,
iban: group_order.ordergroup.sepa_account_holder.iban.gsub(' ', ''),
# Amount
# Number with two decimal digit
#TODO: needed comesfrom group_order.price
amount: group_order.price,
# OPTIONAL: Currency, EUR by default (ISO 4217 standard)
@ -66,22 +50,18 @@ class OrderCollectiveDirectDebitXml
# OPTIONAL: Instruction Identification, will not be submitted to the debtor
# String, max. 35 char
#TODO: is this neccessary?
#instruction: '12345',
# OPTIONAL: Unstructured remittance information, in German "Verwendungszweck"
# String, max. 140 char
#TODO: invoice_number + supplier
remittance_information: "#{group_order.group_order_invoice.invoice_number} #{group_order.order.supplier.name}",
# Mandate identifikation, in German "Mandatsreferenz"
# String, max. 35 char
#TODO: get it from fsconfig? rather from SEPA
mandate_id: group_order.ordergroup.sepa_account_holder.mandate_id,
# Mandate Date of signature, in German "Datum, zu dem das Mandat unterschrieben wurde"
# Date
#TODO: neccessary?? if yes, get it from ordergroup
mandate_date_of_signature: group_order.ordergroup.sepa_account_holder.mandate_date_of_signature,
# Local instrument, in German "Lastschriftart"
@ -97,20 +77,18 @@ class OrderCollectiveDirectDebitXml
# 'RCUR' ("Folge-Lastschrift")
# 'OOFF' ("Einmalige Lastschrift")
# 'FNAL' ("Letztmalige Lastschrift")
#TODO: selectable and default RCUR
sequence_type: group_order.group_order_invoice.sepa_sequence_type || 'RCUR',
# OPTIONAL: Requested collection date, in German "Fälligkeitsdatum der Lastschrift"
# Date
#TODO: two weeks from now?
requested_date: Time.zone.today + 2.days,
# OPTIONAL: Enables or disables batch booking, in German "Sammelbuchung / Einzelbuchung"
# True or False
batch_booking: batch_booking
)
# Last: create XML string
# Last: create XML string
end
@xml_string = sdd.to_xml # Use schema pain.008.001.02
@xml_string = sdd.to_xml # Use schema pain.008.001.02
end
end

View File

@ -2,7 +2,19 @@ class SepaAccountHolder < ApplicationRecord
belongs_to :group
belongs_to :user
validates_with SEPA::IBANValidator, field_name: :iban, if: -> { iban.present? }
validates_with SEPA::BICValidator, field_name: :bic, if: -> { bic.present? }
before_validation :strip_whitespace_from_bic_and_iban
def all_fields_present?
iban.present? && bic.present? && mandate_id.present? && user_id.present? && mandate_date_of_signature.present? && group_id.present?
end
private
def strip_whitespace_from_bic_and_iban
self.iban = iban&.gsub(/\s+/, "")
self.bic = bic&.gsub(/\s+/, "")
end
end

View File

@ -121,9 +121,6 @@ class User < ApplicationRecord
settings.messages['send_as_email'] && email.present?
end
def sepa_possible?
iban.present? && bic.present? && creditor_identifier.present? && mandate_id.present?
end
# Sets the user's password. It will be stored encrypted along with a random salt.
def set_password

View File

@ -1,6 +1,6 @@
- if foodsoft_sepa_ready?
= link_to 'Sammellastschrift für alle (.xml)', collective_direct_debit_order_path(id: order.id, mode: 'all'), class: 'btn btn-block'
= link_to 'Sammellastschrift für ausgewählt (.xml)', collective_direct_debit_order_path(id: order.id, mode: 'selected'), class: 'btn btn-block', data: { turbolinks: false }, id: "collective-direct-debit-link-#{order.id}"
= link_to 'Sammellastschrift für alle (.xml)', collective_direct_debit_order_path(id: order.id, mode: 'all'), class: 'btn btn-block', data: { turbolinks: false }, id: "collective-direct-debit-link-all-#{order.id}"
= link_to 'Sammellastschrift für ausgewählt (.xml)', collective_direct_debit_order_path(id: order.id, mode: 'selected'), class: 'btn btn-block', data: { turbolinks: false }, id: "collective-direct-debit-link-selected-#{order.id}"
- else
%i
= t('activerecord.attributes.group_order_invoice.links.sepa_not_ready')

View File

@ -16,7 +16,7 @@
%thead
%tr
%th=I18n.t('activerecord.attributes.group_order_invoice.links.ordergroup')
%th=I18n.t('activerecord.attributes.group_order_invoice.links.payed')
%th=I18n.t('activerecord.attributes.group_order_invoice.links.paid')
%th=I18n.t('activerecord.attributes.group_order_invoice.links.sepa_downloaded')
%th=I18n.t('activerecord.attributes.group_order_invoice.links.sepa_sequence_type')
%th=I18n.t('activerecord.attributes.group_order_invoice.links.sepa_select')
@ -27,8 +27,8 @@
%tr.order-row
%td= link_to go.ordergroup.name, edit_admin_ordergroup_path(go.ordergroup)
%td
.div{id: "payed_#{go.group_order_invoice.id}"}
= render :partial => "group_order_invoices/toggle_payed", locals: { group_order_invoice: go.group_order_invoice }
.div{id: "paid_#{go.group_order_invoice.id}"}
= render :partial => "group_order_invoices/toggle_paid", locals: { group_order_invoice: go.group_order_invoice }
%td
.div{id: "sepa_downloaded_#{go.group_order_invoice.id}"}
= render :partial => "group_order_invoices/toggle_sepa_downloaded", locals: { group_order_invoice: go.group_order_invoice }
@ -55,8 +55,8 @@
%tr.order-row
%td= I18n.t('activerecord.attributes.group_order_invoice.links.actions_for_all')
%td
.div{id: "toggle_all_payed_#{order.id}"}
= render :partial => 'group_order_invoices/toggle_all_payed', locals: { order: order }
.div{id: "toggle_all_paid_#{order.id}"}
= render :partial => 'group_order_invoices/toggle_all_paid', locals: { order: order }
%td
.div{id: "toggle_all_sepa_downloaded_#{order.id}"}
= render :partial => 'group_order_invoices/toggle_all_sepa_downloaded', locals: { order: order }

View File

@ -3,63 +3,89 @@
- content_for :javascript do
:javascript
$(document).ready(function() {
$("#order_#{order.id}_modal").on('click', "#collective-direct-debit-link-#{order.id}", function(e) {
// Function For Downloading the xml
function doTheDownload(selectedGroupOrderIds, url, mode="all"){
if(mode == "all")
{
var data = { order_id: "#{order.id}" }
}
else
{
var data = { group_order_ids: selectedGroupOrderIds }
}
if(mode == "all" || selectedGroupOrderIds.length > 0)
{
//suppress generic error warning
$.ajaxSetup({
global: false,
});
$.ajax({
url: url,
method: 'GET', // You may adjust the HTTP method as needed
data: data,
dataType: 'xml',
success: function(response) {
// Handle success response
// Convert XML response to a Blob
var blob = new Blob([new XMLSerializer().serializeToString(response)], { type: 'text/xml' });
var order_id ="#{order.id}"
// Create a temporary link element
var link = document.createElement('a');
link.href = URL.createObjectURL(blob);
if(selectedGroupOrderIds.length > 1){
link.download = "#{order.supplier.name}-#{order.id}-Sammellastschrift.xml";
} else {
link.download = "#{order.supplier.name}-#{order.id}-Lastschrift.xml";
}
// Append the link to the document and trigger the click event
document.body.appendChild(link);
link.click();
// Clean up
document.body.removeChild(link);
$("group-order-invoices-for-order-#{order.id}" + " .expand-trigger a").click();
$("#order_" + order_id + "_modal").load(window.location + " #order_" + order_id + "_modal");
},
error: function(error) {
// Handle error
if (error.responseJSON) {
alert('AJAX request error:' + "\n" + error.responseJSON.message);
} else{
var errorText = JSON.parse(error.responseText).error;
var alertDiv = '<div class="alert fade in alert-error"><button class="close" data-dismiss="alert">×</button>' + errorText + '</div>';
$('.page-header').before(alertDiv);
$('modal_')
}
}
});
}
else{
var errorText = "Nothing selected";
var alertDiv = '<div class="alert fade in alert-error"><button class="close" data-dismiss="alert">×</button>' + errorText + '</div>';
$('.page-header').before(alertDiv);
}
}
// register onClick listener for selected group_orders
$("#order_#{order.id}_modal").on('click', "#collective-direct-debit-link-selected-#{order.id}", function(e) {
e.preventDefault();
console.log("hi");
// Extract selected group_order_ids
var selectedGroupOrderIds = $('input[name^="group_order_ids_for_order_#{order.id}"]:checked').map(function() {
return $(this).val();
}).get();
// Log the selected IDs (for testing purposes)
console.log('Selected Group Order IDs:', selectedGroupOrderIds);
var url = $(this).closest('a').attr('href');
//suppress generic error warning
$.ajaxSetup({
global: false,
});
$.ajax({
url: url,
method: 'GET', // You may adjust the HTTP method as needed
data: { group_order_ids: selectedGroupOrderIds },
dataType: 'xml',
success: function(response) {
// Handle success response
console.log('AJAX request successful:', response);
// Convert XML response to a Blob
var blob = new Blob([new XMLSerializer().serializeToString(response)], { type: 'text/xml' });
doTheDownload(selectedGroupOrderIds, url, "selected");
});
// Create a temporary link element
var link = document.createElement('a');
link.href = URL.createObjectURL(blob);
if(selectedGroupOrderIds.length > 1){
link.download = "#{order.supplier.name}-#{order.id}-Sammellastschrift.xml";
} else {
link.download = "#{order.supplier.name}-#{order.id}-Lastschrift.xml";
}
// Append the link to the document and trigger the click event
document.body.appendChild(link);
link.click();
// Clean up
document.body.removeChild(link);
$("group-order-invoices-for-order-#{order.id}" + " .expand-trigger a").click();
},
error: function(error) {
// Handle error
if (error.responseJSON) {
alert('AJAX request error:' + "\n" + error.responseJSON.message);
} else{
var errorText = JSON.parse(error.responseText).error;
var alertDiv = '<div class="alert fade in alert-error"><button class="close" data-dismiss="alert">×</button>' + errorText + '</div>';
$('.page-header').before(alertDiv);
}
}
});
});});
// register onClick listener for all group_orders
$("#order_#{order.id}_modal").on('click', "#collective-direct-debit-link-all-#{order.id}", function(e) {
e.preventDefault();
var url = $(this).closest('a').attr('href');
doTheDownload([], url, "all");
});
});
- content_for :javascript do
:javascript

View File

@ -0,0 +1,2 @@
= link_to toggle_all_paid_group_order_invoices_path(order_id: order.id, paid: order.group_orders.map(&:group_order_invoice).compact.map(&:paid)&.all? ), remote: true, method: :patch, data: { confirm: I18n.t('ui.confirm_mark_all', name: order.group_orders.map(&:group_order_invoice).compact.map(&:paid)&.all? ? I18n.t('activerecord.attributes.group_order_invoice.links.not_paid'): I18n.t('activerecord.attributes.group_order_invoice.links.paid') ) } do
= check_box_tag :paid, '1', order.group_orders.map(&:group_order_invoice).compact.map(&:paid)&.all? , class: 'form-check-input', id: "paid_all_#{order.id}"

View File

@ -1,2 +0,0 @@
= link_to toggle_all_payed_group_order_invoices_path(order_id: order.id, payed: order.group_orders.map(&:group_order_invoice).compact.map(&:payed)&.all? ), remote: true, method: :patch, data: { confirm: I18n.t('ui.confirm_mark_all', name: "payed" ) } do
= check_box_tag :payed, '1', order.group_orders.map(&:group_order_invoice).compact.map(&:payed)&.all? , class: 'form-check-input', id: "payed_all_#{order.id}"

View File

@ -1,2 +1,2 @@
= link_to toggle_all_sepa_downloaded_group_order_invoices_path(order_id: order.id, sepa_downloaded: order.group_orders.map(&:group_order_invoice).compact.map(&:sepa_downloaded)&.all? ), remote: true, method: :patch, data: { confirm: I18n.t('ui.confirm_mark_all', name: "sepa_downloaded" ) } do
= link_to toggle_all_sepa_downloaded_group_order_invoices_path(order_id: order.id, sepa_downloaded: order.group_orders.map(&:group_order_invoice).compact.map(&:sepa_downloaded)&.all? ), remote: true, method: :patch, data: { confirm: I18n.t('ui.confirm_mark_all', name: order.group_orders.map(&:group_order_invoice).compact.map(&:sepa_downloaded)&.all? ? I18n.t('activerecord.attributes.group_order_invoice.links.sepa_not_downloaded') : I18n.t('activerecord.attributes.group_order_invoice.links.sepa_downloaded')) } do
= check_box_tag :sepa_downloaded, '1', order.group_orders.map(&:group_order_invoice).compact.map(&:sepa_downloaded)&.all? , class: 'form-check-input', id: "sepa_downloaded_all_#{order.id}"

View File

@ -0,0 +1,2 @@
= link_to toggle_paid_group_order_invoice_path(group_order_invoice), remote: true, method: :patch, data: { turbolinks: false } do
= check_box_tag 'paid', '1', group_order_invoice.paid , class: 'form-check-input', id: "paid_#{group_order_invoice.id}"

View File

@ -1,2 +0,0 @@
= link_to toggle_payed_group_order_invoice_path(group_order_invoice), remote: true, method: :patch, data: { turbolinks: false } do
= check_box_tag 'payed', '1', group_order_invoice.payed , class: 'form-check-input', id: "payed_#{group_order_invoice.id}"

View File

@ -0,0 +1,4 @@
<% @group_order_invoices.each do |group_order_invoice| %>
$("#paid_<%= group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_paid', locals: { group_order_invoice: group_order_invoice }) %>");
<% end %>
$("#toggle_all_paid_<%= @order.id %>").html("<%= escape_javascript(render partial: 'toggle_all_paid', locals: { order: @order }) %>");

View File

@ -1,4 +0,0 @@
<% @group_order_invoices.each do |group_order_invoice| %>
$("#payed_<%= group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_payed', locals: { group_order_invoice: group_order_invoice }) %>");
<% end %>
$("#toggle_all_payed_<%= @order.id %>").html("<%= escape_javascript(render partial: 'toggle_all_payed', locals: { order: @order }) %>");

View File

@ -0,0 +1 @@
$("#paid_<%= @group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_paid', locals: {group_order_invoice: @group_order_invoice}) %>");

View File

@ -1 +0,0 @@
$("#payed_<%= @group_order_invoice.id %>").html("<%= escape_javascript(render partial: 'toggle_payed', locals: {group_order_invoice: @group_order_invoice}) %>");

View File

@ -106,8 +106,10 @@ de:
generate_with_date: setzen & erzeugen
invoice_date: Datum der Bestellgruppenrechnung
ordergroup: Bestellgruppe
payed: Bezahlt
paid: Bezahlt
not_paid: Nicht Bezahlt
sepa_downloaded: SEPA exportiert
sepa_not_downloaded: SEPA nicht exportiert
sepa_not_ready: Wichtige Einstellungen für SEPA Export in Administration -> Einstellungen-> Finanzen fehlen
sepa_select: Für SEPA Export markieren
sepa_sequence_type: SEPA Typ
@ -1991,6 +1993,7 @@ de:
close: Schließen
confirm_delete: Willst du %{name} wirklich löschen?
confirm_restore: Willst du %{name} wirklich wiederherstellen?
confirm_mark_all: Willst du wirklich '%{name}' für alle einstellen?
copy: Kopieren
delete: Löschen
download: Herunterladen

View File

@ -106,8 +106,10 @@ en:
generate_with_date: set & generate
invoice_date: date of group order invoice
ordergroup: Ordergroup
payed: payed
paid: paid
not_paid: unpaid
sepa_downloaded: SEPA exported
sepa_not_downloaded: SEPA not exported
sepa_not_ready: Configurations for SEPA are missing in Admin->Settings->Finances
sepa_select: mark for SEPA export
sepa_sequence_type: SEPA type
@ -1966,7 +1968,7 @@ en:
cancel: Cancel
close: Close
confirm_delete: Do you really want to delete %{name}?
confirm_mark_all: Do you want to mark all as %{name}?
confirm_mark_all: Do you really want to set '%{name}' for all?
confirm_restore: Do you really want to restore %{name}?
copy: Copy
delete: Delete

View File

@ -155,13 +155,13 @@ Rails.application.routes.draw do
resources :group_order_invoices do
member do
patch :select_sepa_sequence_type
patch :toggle_payed
patch :toggle_paid
patch :toggle_sepa_downloaded
end
collection do
patch :select_all_sepa_sequence_type
patch :toggle_all_sepa_downloaded
patch :toggle_all_payed
patch :toggle_all_paid
end
end

View File

@ -0,0 +1,5 @@
class RenamePayedToPaidOnGroupOrderInvoices < ActiveRecord::Migration[7.0]
def change
rename_column :group_order_invoices, :payed, :paid
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_11_10_131415) do
ActiveRecord::Schema[7.0].define(version: 2023_11_28_133642) do
create_table "action_text_rich_texts", charset: "utf8mb4", force: :cascade do |t|
t.string "name", null: false
t.text "body", size: :long
@ -199,7 +199,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_11_10_131415) do
t.string "payment_method"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.boolean "payed", default: false
t.boolean "paid", default: false
t.boolean "sepa_downloaded", default: false
t.string "sepa_sequence_type", default: "RCUR"
t.index ["group_order_id"], name: "index_group_order_invoices_on_group_order_id", unique: true

View File

@ -103,7 +103,7 @@ feature GroupOrderInvoice, type: :feature, js: true do
click_link_or_button 'Toggle details'
click_link_or_button I18n.t('activerecord.attributes.group_order_invoice.links.generate')
sleep 1
expect(page).to have_selector(:link_or_button, "collective-direct-debit-link-#{order.id}")
expect(page).to have_selector(:link_or_button, "collective-direct-debit-link-selected-#{order.id}")
expect(page).to have_selector(".ajax-update-all-link-#{order.id}")
end
end