Merge pull request #2044 from betagouv/fix-1736

Fix #1736
This commit is contained in:
gregoirenovel 2018-06-07 16:06:57 +02:00 committed by GitHub
commit 7a73db54c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 10 deletions

View file

@ -10,7 +10,7 @@ module Manager
if administrateur.errors.empty?
PipedriveAcceptsDealsJob.perform_later(
create_administrateur_params[:person_id],
Pipedrive::DealAdapter::PIPEDRIVE_CAMILLE_ID,
current_administration.id,
create_administrateur_params[:stage_id]
)
@ -26,7 +26,7 @@ module Manager
def refuse_administrateur
PipedriveRefusesDealsJob.perform_later(
refuse_administrateur_params[:person_id],
Pipedrive::DealAdapter::PIPEDRIVE_CAMILLE_ID
current_administration.id
)
AdministrationMailer

View file

@ -1,5 +1,5 @@
class PipedriveAcceptsDealsJob < ApplicationJob
def perform(person_id, owner_id, stage_id)
PipedriveService.accept_demande_from_person(person_id, owner_id, stage_id)
def perform(person_id, administration_id, stage_id)
PipedriveService.accept_demande_from_person(person_id, administration_id, stage_id)
end
end

View file

@ -1,5 +1,5 @@
class PipedriveRefusesDealsJob < ApplicationJob
def perform(person_id, owner_id)
PipedriveService.refuse_demande_from_person(person_id, owner_id)
def perform(person_id, administration_id)
PipedriveService.refuse_demande_from_person(person_id, administration_id)
end
end

View file

@ -10,8 +10,6 @@ class Pipedrive::DealAdapter
PIPEDRIVE_LOST_STATUS = "lost"
PIPEDRIVE_LOST_REASON = "refusé depuis DS"
PIPEDRIVE_CAMILLE_ID = '3189424'
def self.refuse_deal(deal_id, owner_id)
params = {
user_id: owner_id,

View file

@ -1,11 +1,13 @@
class PipedriveService
def self.accept_demande_from_person(person_id, owner_id, stage_id)
def self.accept_demande_from_person(person_id, administration_id, stage_id)
owner_id = BizDev.pipedrive_id(administration_id)
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.update_deal_owner_and_stage(deal_id, owner_id, stage_id) }
Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id)
end
def self.refuse_demande_from_person(person_id, owner_id)
def self.refuse_demande_from_person(person_id, administration_id)
owner_id = BizDev.pipedrive_id(administration_id)
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.refuse_deal(deal_id, owner_id) }
Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id)