move to ajax function for every direct debit xml download

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

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