2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-08-05 18:40:47 +02:00
|
|
|
class APIEntreprise::AttestationFiscaleAdapter < APIEntreprise::Adapter
|
2023-05-28 18:03:45 +02:00
|
|
|
# Doc métier : https://entreprise.api.gouv.fr/catalogue/dgfip/attestations_fiscales
|
|
|
|
# Swagger : https://entreprise.api.gouv.fr/developpeurs/openapi#tag/Attestations-sociales-et-fiscales/paths/~1v4~1dgfip~1unites_legales~1%7Bsiren%7D~1attestation_fiscale/get
|
|
|
|
|
2020-05-14 14:41:54 +02:00
|
|
|
def initialize(siret, procedure_id, user_id)
|
|
|
|
@siret = siret
|
2020-04-29 17:34:54 +02:00
|
|
|
@procedure_id = procedure_id
|
|
|
|
@user_id = user_id
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def get_resource
|
2022-07-20 14:52:17 +02:00
|
|
|
api(@procedure_id).attestation_fiscale(siren, @user_id)
|
2020-04-29 17:34:54 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def process_params
|
2023-05-28 18:03:45 +02:00
|
|
|
data = data_source[:data]
|
|
|
|
|
|
|
|
Sentry.with_scope do |scope|
|
|
|
|
scope.set_tags(siret: @siret)
|
|
|
|
scope.set_extras(source: data)
|
|
|
|
|
|
|
|
if data && data[:document_url].present?
|
|
|
|
{
|
|
|
|
entreprise_attestation_fiscale_url: data[:document_url]
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{}
|
|
|
|
end
|
2020-04-29 17:34:54 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|