Skip to content

Commit

Permalink
Make it possible to create notes without creating a deal first
Browse files Browse the repository at this point in the history
  • Loading branch information
DerJacques committed Jul 10, 2017
1 parent 824fa9a commit f25af8a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PipedriveChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ private function savePipedriveResources(PipedriveMessage $message)
$activity->setClient($this->client, $this->token);
$activity->save();
}

foreach ($message->notes as $note) {
$note->setClient($this->client, $this->token);
$note->save();
}
}

private function validate($notification)
Expand Down
15 changes: 15 additions & 0 deletions tests/ChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ public function it_can_create_and_update_deals_and_activities()
])
->andReturn($response);

$client->shouldReceive('request')
->once()
->with('POST', 'https://api.pipedrive.com/v1/notes?api_token=PipedriveToken',
[
'form_params' => [
'deal_id' => 1,
'content' => 'Customer bought milk',
],
])
->andReturn($response);

$channel = new PipedriveChannel($client);
$channel->send(new TestNotifiable(), new CreateDealWithActivitiesNotification());
}
Expand Down Expand Up @@ -165,6 +176,10 @@ public function toPipedrive($notifiable)
$activity->subject('Buy milk')
->type('shopping')
->due('2017-12-18');
})
->note(function ($note) {
$note->deal(1)
->content('Customer bought milk');
});
}
}

0 comments on commit f25af8a

Please sign in to comment.