fix(iban): format iban through type_de_champ

This commit is contained in:
Paul Chavard 2024-10-21 11:43:39 +02:00
parent 02934188b4
commit 1ded040730
No known key found for this signature in database
2 changed files with 4 additions and 8 deletions

View file

@ -4,14 +4,6 @@ class Champs::IbanChamp < Champ
validates_with IbanValidator, if: :validate_champ_value_or_prefill? validates_with IbanValidator, if: :validate_champ_value_or_prefill?
after_validation :format_iban after_validation :format_iban
def for_api
to_s.gsub(/\s+/, '')
end
def for_api_v2
for_api
end
private private
def format_iban def format_iban

View file

@ -4,4 +4,8 @@ class TypesDeChamp::IbanTypeDeChamp < TypesDeChamp::TypeDeChampBase
def estimated_fill_duration(revision) def estimated_fill_duration(revision)
FILL_DURATION_MEDIUM FILL_DURATION_MEDIUM
end end
def champ_value_for_api(champ, version: 2)
champ_value(champ).gsub(/\s+/, '')
end
end end