commit
7a73db54c8
5 changed files with 10 additions and 10 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue