| @@ 715-732 (lines=18) @@ | ||
| 712 | * @return Lead |
|
| 713 | * @throws LPTrackerSDKException |
|
| 714 | */ |
|
| 715 | public function changeLeadFunnel($lead, $newFunnelId) |
|
| 716 | { |
|
| 717 | if ($lead instanceof Lead) { |
|
| 718 | $lead = $lead->getId(); |
|
| 719 | } |
|
| 720 | ||
| 721 | $url = '/lead/'.$lead.'/funnel'; |
|
| 722 | ||
| 723 | $data = [ |
|
| 724 | 'funnel' => $newFunnelId |
|
| 725 | ]; |
|
| 726 | ||
| 727 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 728 | ||
| 729 | $resultLead = new Lead($response); |
|
| 730 | ||
| 731 | return $resultLead; |
|
| 732 | } |
|
| 733 | ||
| 734 | ||
| 735 | /** |
|
| @@ 771-790 (lines=20) @@ | ||
| 768 | * @throws exceptions\LPTrackerResponseException |
|
| 769 | * @throws exceptions\LPTrackerServerException |
|
| 770 | */ |
|
| 771 | public function addCommentToLead($lead, $text) |
|
| 772 | { |
|
| 773 | if ($lead instanceof Lead) { |
|
| 774 | $lead = $lead->getId(); |
|
| 775 | } else { |
|
| 776 | $lead = intval($lead); |
|
| 777 | } |
|
| 778 | ||
| 779 | $url = '/lead/'.$lead.'/comment'; |
|
| 780 | ||
| 781 | $data = [ |
|
| 782 | 'text' => $text |
|
| 783 | ]; |
|
| 784 | ||
| 785 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 786 | ||
| 787 | $comment = new Comment($response); |
|
| 788 | ||
| 789 | return $comment; |
|
| 790 | } |
|
| 791 | ||
| 792 | /** |
|
| 793 | * @param Lead|int $lead |
|