Skip to content

Commit 9fbc99d

Browse files
Began the real manager. Coding blind and don't think it will work
1 parent 66e7de7 commit 9fbc99d

File tree

4 files changed

+108
-1
lines changed

4 files changed

+108
-1
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace ZohoSubscriptionBundle\Manager;
4+
5+
use AddonApi;
6+
use PlanApi;
7+
8+
class ZohoSubscriptionManager
9+
{
10+
/**
11+
* @var AddonApi
12+
*/
13+
protected $addonApi;
14+
15+
/**
16+
* @var bool
17+
*/
18+
protected $cache;
19+
20+
/**
21+
* @var PlanApi
22+
*/
23+
protected $planApi;
24+
25+
/**
26+
* @var Client
27+
*/
28+
protected $redis;
29+
30+
/**
31+
* @var int
32+
*/
33+
protected $ttl;
34+
35+
/**
36+
* @var string
37+
*/
38+
protected $token;
39+
40+
/**
41+
* @var string
42+
*/
43+
protected $organizationId;
44+
45+
/**
46+
* @param Client $redis Redis client
47+
* @param bool $cache Whether the cache is active or not
48+
* @param int $ttl Time to keep the cache in seconds
49+
*/
50+
public function __construct(PlanApi $planApi, AddonApi $addonApi, $cache = false, Client $redis = null, $ttl = 3600, $token, $organizationId)
51+
{
52+
$this->planApi = $planApi;
53+
$this->addonApi = $addonApi;
54+
$this->cache = $cache;
55+
$this->redis = $redis;
56+
$this->ttl = $ttl;
57+
$this->token = $token;
58+
$this->organizationId = $organizationId;
59+
}
60+
}

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# zoho-subscription-bundle
2+
A bundle using an implementation of Zoho API subscription (zoho-subscription-api)
3+
4+
# Installing the Bundle
5+
6+
The recommended way to install it is through Composer.
7+
8+
### Install Composer
9+
10+
```curl -sS https://getcomposer.org/installer | php```
11+
12+
Next, run the Composer command to install the latest version:
13+
14+
```composer.phar require storefactory/zoho-subscription-bundle```
15+
16+
After installing, you need to require Composer's autoloader:
17+
18+
```require 'vendor/autoload.php';```
19+
20+
You can then later update the Bundle using composer:
21+
22+
```composer.phar update```

Resources/config/services.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
5+
<services>
6+
<service id="zoho.subscription_manager" class="ZohoSubscriptionBundle\Manager\ZohoSubscriptionManager">
7+
<argument type="service" id="zoho_subscription.plan"></argument>
8+
<argument type="service" id="zoho_subscription.addon"></argument>
9+
<argument type="service" id="snc_redis.default"></argument>
10+
<argument>%zoho_cache_enabled%</argument>
11+
<argument>%zoho_cache_ttl%</argument>
12+
<argument>%zoho_token%</argument>
13+
<argument>%zoho_organization_id%</argument>
14+
</service>
15+
</services>
16+
</container>

composer.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
2+
"name": "storefactory/zoho-subscription-bundle",
3+
"type": "bundle",
4+
"autoload": {
5+
"psr-4": {
6+
"ZohoSubscriptionBundle": "/"
7+
}
8+
},
9+
"description": "Zoho Subscription Bundle uses the zoho-subscription-api PHP client library",
210
"require": {
311
"storefactory/zoho-subscription-api": "^1.0"
4-
}
12+
},
13+
"minimum-stability": "stable"
514
}

0 commit comments

Comments
 (0)