-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [sc-39698] Add Subscription Events for chartmogul PHP library (#99
- Loading branch information
Showing
11 changed files
with
515 additions
and
21 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,29 @@ | ||
<?php | ||
|
||
namespace ChartMogul\Resource; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
|
||
class MetaCollection extends ArrayCollection | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
public $next_key; | ||
/** | ||
* @var int | ||
*/ | ||
public $prev_key; | ||
/** | ||
* @var int | ||
*/ | ||
public $page; | ||
/** | ||
* @var int | ||
*/ | ||
public $total_pages; | ||
/** | ||
* @var string | ||
*/ | ||
public $before_key; | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace ChartMogul\Resource; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
|
||
class SubscriptionEventCollection extends ArrayCollection | ||
{ | ||
/** | ||
* @array | ||
*/ | ||
public $meta; | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace ChartMogul\Service; | ||
|
||
use ChartMogul\Http\ClientInterface; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
trait DestroyWithParamsTrait | ||
{ | ||
/** | ||
* Delete a resource | ||
* @return boolean | ||
*/ | ||
public static function destroyWithParams(array $params = [], ClientInterface $client = null) | ||
{ | ||
return (new RequestService($client)) | ||
->setResourceClass(static::class) | ||
->setResourcePath(static::RESOURCE_PATH) | ||
->destroyWithParams($params); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace ChartMogul\Service; | ||
|
||
use ChartMogul\Http\ClientInterface; | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
trait UpdateWithParamsTrait | ||
{ | ||
/** | ||
* Update a Resource | ||
* @param array $params | ||
* @param ClientInterface|null $client | ||
* @return self | ||
*/ | ||
public static function updateWithParams(array $params = [], ClientInterface $client = null) | ||
{ | ||
return (new RequestService($client)) | ||
->setResourceClass(static::class) | ||
->setResourcePath(static::RESOURCE_PATH) | ||
->updateWithParams($params); | ||
} | ||
} |
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,48 @@ | ||
<?php | ||
|
||
namespace ChartMogul; | ||
|
||
use ChartMogul\Http\ClientInterface; | ||
use ChartMogul\Resource\AbstractResource; | ||
use ChartMogul\Service\AllTrait; | ||
use ChartMogul\Service\CreateTrait; | ||
use ChartMogul\Service\UpdateWithParamsTrait; | ||
use ChartMogul\Service\DestroyWithParamsTrait; | ||
use ChartMogul\Resource\Collection; | ||
use ChartMogul\Resource\SubscriptionEventCollection; | ||
use ChartMogul\Resource\MetaCollection; | ||
|
||
class SubscriptionEvent extends AbstractResource | ||
{ | ||
use AllTrait; | ||
use CreateTrait; | ||
use UpdateWithParamsTrait; | ||
use DestroyWithParamsTrait; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public const RESOURCE_PATH = '/v1/subscription_events'; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public const RESOURCE_NAME = 'SubscriptionEvent'; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
public const ROOT_KEY = 'subscription_events'; | ||
|
||
protected $id; | ||
protected $external_id; | ||
protected $data_source_uuid; | ||
protected $customer_external_id; | ||
protected $event_type; | ||
protected $event_date; | ||
protected $effective_date; | ||
protected $currency; | ||
protected $amount_in_cents; | ||
protected $subscription_external_id; | ||
protected $plan_external_id; | ||
} |
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
Oops, something went wrong.