From 1ded040730eae26e890454208a7155d7ae41b144 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Mon, 21 Oct 2024 11:43:39 +0200 Subject: [PATCH] fix(iban): format iban through type_de_champ --- app/models/champs/iban_champ.rb | 8 -------- app/models/types_de_champ/iban_type_de_champ.rb | 4 ++++ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/champs/iban_champ.rb b/app/models/champs/iban_champ.rb index 9c8b24053..cc26eafa8 100644 --- a/app/models/champs/iban_champ.rb +++ b/app/models/champs/iban_champ.rb @@ -4,14 +4,6 @@ class Champs::IbanChamp < Champ validates_with IbanValidator, if: :validate_champ_value_or_prefill? after_validation :format_iban - def for_api - to_s.gsub(/\s+/, '') - end - - def for_api_v2 - for_api - end - private def format_iban diff --git a/app/models/types_de_champ/iban_type_de_champ.rb b/app/models/types_de_champ/iban_type_de_champ.rb index 4fed46419..a5a683f25 100644 --- a/app/models/types_de_champ/iban_type_de_champ.rb +++ b/app/models/types_de_champ/iban_type_de_champ.rb @@ -4,4 +4,8 @@ class TypesDeChamp::IbanTypeDeChamp < TypesDeChamp::TypeDeChampBase def estimated_fill_duration(revision) FILL_DURATION_MEDIUM end + + def champ_value_for_api(champ, version: 2) + champ_value(champ).gsub(/\s+/, '') + end end