-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Customer Note and Call Log for ChartMogul PHP (#116)
* feat: Add Customer Note and Call Log for ChartMogul PHP [sc-55269] https://app.shortcut.com/chartmogul/story/55269/php-client-notes-and-call-logs-api-support --------- Co-authored-by: SoeunSona <78331453+SoeunSona@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
405 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace ChartMogul; | ||
|
||
use ChartMogul\Resource\AbstractResource; | ||
use ChartMogul\Service\AllTrait; | ||
use ChartMogul\Service\CreateTrait; | ||
use ChartMogul\Service\UpdateTrait; | ||
use ChartMogul\Service\DestroyTrait; | ||
use ChartMogul\Service\GetTrait; | ||
use ChartMogul\Service\FromArrayTrait; | ||
|
||
/** | ||
* @property-read string $uuid | ||
* @property-read string $customer_uuid | ||
* @property-read string $type | ||
* @property-read string $text | ||
* @property-read integer $call_duration | ||
* @property-read string $author | ||
* @property-read string $created_at | ||
* @property-read string $updated_at | ||
*/ | ||
class CustomerNote extends AbstractResource | ||
{ | ||
use AllTrait; | ||
use CreateTrait; | ||
use GetTrait; | ||
use DestroyTrait; | ||
use UpdateTrait; | ||
use FromArrayTrait; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public const RESOURCE_NAME = 'CustomerNote'; | ||
/** | ||
* @ignore | ||
*/ | ||
public const RESOURCE_PATH = '/v1/customer_notes'; | ||
public const RESOURCE_ID = 'note_uuid'; | ||
public const ROOT_KEY = 'entries'; | ||
|
||
protected $uuid; | ||
protected $customer_uuid; | ||
protected $type; | ||
protected $text; | ||
protected $call_duration; | ||
protected $author; | ||
protected $created_at; | ||
protected $updated_at; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace ChartMogul\Service; | ||
|
||
use ChartMogul\Resource\CollectionWithCursor; | ||
use ChartMogul\Http\ClientInterface; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
trait FromArrayTrait | ||
{ | ||
/** | ||
* Overrides fromArray so that it will return a collection with cursor instead. | ||
* | ||
* @param array $data | ||
* @param ClientInterface|null $client | ||
* @return CollectionWithCursor|static | ||
*/ | ||
public static function fromArray(array $data, ClientInterface $client = null) | ||
{ | ||
if (isset($data[static::ROOT_KEY])) { | ||
$array = new CollectionWithCursor( | ||
array_map( | ||
function ($data) use ($client) { | ||
return static::fromArray($data, $client); | ||
}, | ||
$data[static::ROOT_KEY] | ||
) | ||
); | ||
|
||
if (isset($data['cursor'])) { | ||
$array->cursor = $data['cursor']; | ||
} | ||
|
||
if (isset($data['has_more'])) { | ||
$array->has_more = $data['has_more']; | ||
} | ||
|
||
return $array; | ||
} | ||
|
||
return new static($data, $client); | ||
} | ||
} |
Oops, something went wrong.