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