Skip to content

Commit 76f4ee6

Browse files
authored
Merge pull request #54 from cloudblue/v19-dev
Changes for v19
2 parents f55566f + c6aa4b6 commit 76f4ee6

File tree

202 files changed

+4079
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+4079
-329
lines changed

README.md

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class UploadUsage extends \Connect\UsageAutomation
163163
//This is for Provider XYZ, also can be seen from $listing->provider->id and parametrized further via marketplace available at $listing->marketplace->id
164164
date_default_timezone_set('UTC'); //reporting must be always based on UTC
165165
$usages = [];
166+
//Creating QT SCHEMA records, pplease check Connect\Usage\FileUsageRecord for further possible data to be passed
166167
array_push($usages, new Connect\Usage\FileUsageRecord([
167168
'record_id' => 'unique record value',
168169
'item_search_criteria' => 'item.mpn', //Possible values are item.mpn or item.local_id
@@ -174,7 +175,10 @@ class UploadUsage extends \Connect\UsageAutomation
174175
'asset_search_value' => 'tenant2'
175176
]));
176177
$usageFile = new \Connect\Usage\File([
177-
'name' => 'sdk test',
178+
"period" => [
179+
"from"=> date('Y-m-d H:i:s', strtotime("-1 days")),
180+
"to"=> date("Y-m-d H:i:s")
181+
],
178182
'product' => new \Connect\Product(
179183
['id' => $listing->product->id]
180184
),
@@ -248,6 +252,40 @@ try {
248252
}
249253
```
250254

255+
## A simple Example of automating workflow for Tier Account Requests
256+
```php
257+
258+
require_once "vendor/autoload.php";
259+
class ProcessTAR extends \Connect\TierAccountRequestsAutomation
260+
{
261+
public function processTierAccountRequest(\Connect\TierAccountRequest $request)
262+
{
263+
//$request is instance of \Connect\TierAccountRequest
264+
try{
265+
//Get changes
266+
$changes = $request->account->diffWithPreviousVersion();
267+
268+
//Do something with external system to change TA data
269+
270+
throw new \Connect\TierAccountRequestAccept("Proocessed");
271+
}
272+
catch (Exception $e){
273+
throw new \Connect\TierAccountRequestIgnore("Issue while processing, we ignore");
274+
}
275+
}
276+
277+
}
278+
279+
//Main Code Block
280+
281+
try{
282+
$tarProcessor = new ProcessTar();
283+
$tarProcessor->process();
284+
} catch (Exception $e) {
285+
print "error ".$e->getMessage();
286+
}
287+
```
288+
251289
## Client class
252290

253291
Starting with the Connect PHP SDK version 17 the Client class has been introduced. This class allows running multiple operations in Connect like get the list of requests, configurations, etc. Client class may be instantiated from any application to obtain information needed to run an operation, like, for example, get the Asset information in the context of an action. Client will provide access to:
@@ -337,3 +375,60 @@ $requests = $connect->fulfillment->listRequests(['status' => 'approved']);
337375
$connect = new Connect\ConnectClient();
338376
$request = $connect->fulfillment->getRequest('PR-XXXX-XXXX-XXXXX');
339377
```
378+
379+
* List all Tier Accoounts
380+
381+
```php
382+
<?php
383+
$connect = new Connect\ConnectClient();
384+
//List all tier accounts from a given marketplace
385+
$tierAccounts = $connect->directory->listTierAccounts(['marketplace' => 'MP-XXXXXXX']);
386+
```
387+
388+
* Get concrete Tier Account
389+
390+
```php
391+
<?php
392+
$connect = new Connect\ConnectClient();
393+
$tierAccounts = $connect->directory->getTierAccountById('TA-XXXXXX-XXXXX');
394+
```
395+
396+
* List tier account requests
397+
398+
```php
399+
<?php
400+
$connect = new Connect\ConnectClient();
401+
$tar = $connect->directory->listTierAccountRequests(['status' => 'pending']);
402+
```
403+
404+
* List Asset Subscriptions
405+
406+
```php
407+
<?php
408+
$connect = new Connect\ConnectClient();
409+
$billingAssets = $connect->subscriptions->listSubscriptionAssets();
410+
```
411+
412+
* Get Subscription Asset
413+
414+
```php
415+
<?php
416+
$connect = new Connect\ConnectClient();
417+
$billingAsset = $connect->subscriptions->getSubscriptionAssetById('AS-1234-1234');
418+
```
419+
420+
* Get Billing Subscription Requests
421+
422+
```php
423+
<?php
424+
$connect = new Connect\ConnectClient();
425+
$billingRequests = $connect->subscriptions->listSubscriptionRequests();
426+
```
427+
428+
* Get concrete Billing request
429+
430+
```php
431+
<?php
432+
$connect = new Connect\ConnectClient();
433+
$billingAsset = $connect->subscriptions->getSubscriptionRequestById('PR-XXXXX-XXXXX-XXXXX');
434+
```

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"psr/log": "^1.0.0",
1313
"pimple/pimple": "^3.0",
1414
"guzzlehttp/guzzle": "~6.0",
15-
"phpoffice/phpspreadsheet": "^1.6"
15+
"phpoffice/phpspreadsheet": "^1.6",
16+
"lukascivil/treewalker": "^0.9"
1617
},
1718
"require-dev": {
1819
"phpunit/phpunit": "^5.7",
19-
"mockery/mockery": "^1.0",
20-
"lukascivil/treewalker": "^0.9"
20+
"mockery/mockery": "^1.0"
2121
},
2222
"autoload": {
2323
"psr-4": {

phpunit.xml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@
1010
</logging>
1111
<testsuites>
1212
<testsuite name="Directory Services">
13-
<file> tests/Unit/DirectoryTests/AssetTest.php</file>
14-
<file> tests/Unit/DirectoryTests/ProductTest.php</file>
15-
<file> tests/Unit/DirectoryTests/TierConfigTest.php</file>
13+
<file>tests/Unit/DirectoryTests/AssetTest.php</file>
14+
<file>tests/Unit/DirectoryTests/ProductTest.php</file>
15+
<file>tests/Unit/DirectoryTests/TierConfigTest.php</file>
16+
<file>tests/Unit/DirectoryTests/TierAccountsTest.php</file>
17+
</testsuite>
18+
<testsuite name="Subscription Services">
19+
<file>tests/Unit/SubscriptionTests/SubscriptionRequestTest.php</file>
20+
</testsuite>
21+
<testsuite name="Tier Account Requests">
22+
<file>tests/Unit/TierAccountRequests/ResponsesTest.php</file>
23+
<file>tests/Unit/TierAccountRequests/TierAccountRequestsBasicsTest.php</file>
1624
</testsuite>
1725
<testsuite name="Fail">
1826
<file>tests/Unit/FulfillmentTests/FailTest.php</file>

src/Account.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
55
*
6-
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
6+
* @copyright (c) 2018-2020. Ingram Micro. All Rights Reserved.
77
*/
88

99
namespace Connect;

src/Activation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
55
*
6-
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
6+
* @copyright (c) 2018-2020. Ingram Micro. All Rights Reserved.
77
*/
88

99
namespace Connect;

src/ActivationTemplateResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
55
*
6-
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
6+
* @copyright (c) 2018-2020. Ingram Micro. All Rights Reserved.
77
*/
88

99
namespace Connect;

src/ActivationTileResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
55
*
6-
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
6+
* @copyright (c) 2018-2020. Ingram Micro. All Rights Reserved.
77
*/
88

99
namespace Connect;

src/Agreement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
55
*
6-
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
6+
* @copyright (c) 2018-2020. Ingram Micro. All Rights Reserved.
77
*/
88

99
namespace Connect;

src/Asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
55
*
6-
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
6+
* @copyright (c) 2018-2020. Ingram Micro. All Rights Reserved.
77
*/
88

99
namespace Connect;

src/AutomationEngine.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
/**
44
* This file is part of the Ingram Micro Cloud Blue Connect SDK.
55
*
6-
* @copyright (c) 2019. Ingram Micro. All Rights Reserved.
6+
* @copyright (c) 2018-2020. Ingram Micro. All Rights Reserved.
77
*/
88

99
namespace Connect;
1010

1111
use Connect\Modules\Fulfillment;
12+
use Connect\Modules\Subscriptions;
1213
use Connect\Modules\TierConfiguration;
1314
use Connect\Modules\Usage;
1415
use Connect\Modules\Directory;
@@ -27,6 +28,7 @@
2728
* @property TierConfiguration $tierConfiguration
2829
* @property Usage $usage
2930
* @property Directory $directory
31+
* @property Subscriptions $subscriptions
3032
* @package Connect
3133
*/
3234
abstract class AutomationEngine

0 commit comments

Comments
 (0)