diff --git a/src/Contracts/ZoopPlans.php b/src/Contracts/ZoopPlans.php new file mode 100644 index 0000000..de4ab46 --- /dev/null +++ b/src/Contracts/ZoopPlans.php @@ -0,0 +1,49 @@ +APIResource = $APIResource; + } + + /** + * @param array $post + * @return mixed + */ + public function create($post = []){ + $api = 'plans'; + return $this->APIResource->createAPI($api, $post); + } + + /** + * @param string $planID + * @param array $post + * @return mixed + */ + public function update($planID, $post){ + $api = 'plans/' . $planID; + return $this->APIResource->updateAPI($api, $post); + } + + /** + * @param string $planID + * @return mixed + */ + public function delete($planID){ + $api = 'plans/' . $planID; + return $this->APIResource->deleteAPI($api); + } + + /** + * @param string $planID + * @return mixed + */ + public function get($planID){ + $api = 'plans/' . $planID; + return $this->APIResource->searchAPI($api); + } + + /** + * @return mixed + */ + public function getAll(){ + $api = 'plans'; + return $this->APIResource->searchAPI($api); + } +} \ No newline at end of file diff --git a/src/Lib/ZoopSubscriptions.php b/src/Lib/ZoopSubscriptions.php new file mode 100644 index 0000000..c127e8e --- /dev/null +++ b/src/Lib/ZoopSubscriptions.php @@ -0,0 +1,87 @@ +APIResource = $APIResource; + } + + /** + * @param array $post + * @return mixed + */ + public function create($post = []){ + $api = 'subscriptions'; + return $this->APIResource->createAPI($api, $post); + } + + /** + * @param string $subscriptionID + * @param array $post + * @return mixed + */ + public function update($subscriptionID, $post){ + $api = 'subscriptions/' . $subscriptionID; + return $this->APIResource->updateAPI($api, $post); + } + + /** + * @param string $subscriptionID + * @param array $post + * @return mixed + */ + public function suspend($subscriptionID){ + $api = 'subscriptions/' . $subscriptionID . '/suspend'; + return $this->APIResource->createAPI($api); + } + + /** + * @param string $subscriptionID + * @param array $post + * @return mixed + */ + public function reactivate($subscriptionID){ + $api = 'subscriptions/' . $subscriptionID . '/reactivate'; + return $this->APIResource->createAPI($api); + } + + /** + * @param string $subscriptionID + * @return mixed + */ + public function delete($subscriptionID){ + $api = 'subscriptions/' . $subscriptionID; + return $this->APIResource->deleteAPI($api); + } + + /** + * @param string $subscriptionID + * @return mixed + */ + public function get($subscriptionID){ + $api = 'subscriptions/' . $subscriptionID; + return $this->APIResource->searchAPI($api); + } + + /** + * @return mixed + */ + public function getAll(){ + $api = 'subscriptions'; + return $this->APIResource->searchAPI($api); + } +} \ No newline at end of file diff --git a/src/ZoopServiceProvider.php b/src/ZoopServiceProvider.php index f054067..9754a81 100644 --- a/src/ZoopServiceProvider.php +++ b/src/ZoopServiceProvider.php @@ -13,6 +13,8 @@ use Zoop\Lib\ZoopSplitTransactions; use Zoop\Lib\ZoopTokens; use Zoop\Lib\ZoopTransfers; +use Zoop\Lib\ZoopPlans; +use Zoop\Lib\ZoopSubscriptions; class ZoopServiceProvider extends ServiceProvider { @@ -51,19 +53,27 @@ public function register(){ }); $this->app->singleton('ZoopSellers', function () use ($service) { - return new ZoopSellers(APIResource::getSingleton($service)); + return new ZoopSellers(APIResource::getSingleton($service)); }); $this->app->singleton('ZoopSplitTransactions', function () use ($service) { - return new ZoopSplitTransactions(APIResource::getSingleton($service)); + return new ZoopSplitTransactions(APIResource::getSingleton($service)); }); $this->app->singleton('ZoopTokens', function () use ($service) { - return new ZoopTokens(APIResource::getSingleton($service)); + return new ZoopTokens(APIResource::getSingleton($service)); }); $this->app->singleton('ZoopTransfers', function () use ($service) { - return new ZoopTransfers(APIResource::getSingleton($service)); + return new ZoopTransfers(APIResource::getSingleton($service)); + }); + + $this->app->singleton('ZoopPlans', function () use ($service) { + return new ZoopPlans(APIResource::getSingleton($service)); + }); + + $this->app->singleton('ZoopSubscriptions', function () use ($service) { + return new ZoopSubscriptions(APIResource::getSingleton($service)); }); } @@ -78,7 +88,9 @@ public function provides(){ ZoopChargesCNP::class, ZoopSellers::class, ZoopTokens::class, - ZoopTransfers::class + ZoopTransfers::class, + ZoopPlans::class + ZoopSubscriptions::class ]; }