2023-05-25 15:29:16 +02:00
|
|
|
class APIEntreprise::TvaAdapter < APIEntreprise::Adapter
|
2023-05-26 10:06:01 +02:00
|
|
|
# Doc métier : https://entreprise.api.gouv.fr/catalogue/commission_europeenne/numero_tva
|
|
|
|
# Swagger : https://entreprise.api.gouv.fr/developpeurs/openapi#tag/Informations-generales/paths/~1v3~1european_commission~1unites_legales~1%7Bsiren%7D~1numero_tva/get
|
|
|
|
|
2023-05-25 15:29:16 +02:00
|
|
|
private
|
|
|
|
|
|
|
|
def get_resource
|
|
|
|
api(@procedure_id).tva(siren)
|
|
|
|
end
|
|
|
|
|
|
|
|
def process_params
|
2023-05-26 12:16:44 +02:00
|
|
|
Sentry.with_scope do |scope|
|
|
|
|
data = data_source[:data]
|
|
|
|
scope.set_tags(siret: @siret)
|
|
|
|
scope.set_extras(source: data)
|
|
|
|
|
|
|
|
result = {}
|
|
|
|
if data
|
|
|
|
result[:entreprise_numero_tva_intracommunautaire] = data[:tva_number]
|
|
|
|
end
|
|
|
|
result
|
2023-05-25 15:29:16 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|