mydomain/dreamcommerce-lms-client

此包已被废弃,不再维护。未建议替代包。
最新版本(7.0)的此包没有可用的许可证信息。

Dreamcommerce许可证管理服务API客户端

7.0 2015-05-22 11:49 UTC

This package is not auto-updated.

Last update: 2018-06-08 23:40:51 UTC


README

Build Status

DreamCommerce许可证管理服务(LMS)客户端的API库

用法

在使用DreamCommerce LMS客户端中的许可证功能之前,您需要创建LicenseManagerClient。客户端需要一个带有api url、用户名和密码的ApiConnection

use DreamCommerce\LicenseManager\ApiConnection;
use GuzzleHttp\Client as HttpClient;

$dreamCommerceClient = new LicenseManagerClient(
    new ApiConnection(
        new HttpClient,
        'http://dc-api-url', 
        'username', 
        'password'
    )
);

创建许可证

要创建DreamCommerce许可证,有一个createLicense方法。它将返回一个包含刚创建的许可证信息的License对象。

use DreamCommerce\LicenseManager\Command\CreateLicenseCommand;

$command = new CreateLicenseCommand;
$command->email = 'user-email@test.com';            // user email address
$command->host = 'test-shop';                       // shop address, e.g. "store001.partnerdomain.com" or "store001" and partnerdomain.com will be added automatically
$command->licenseType = 0;                          // license type (0 - trial, 1 - paid version)
$command->shopVersion = 'x.x.x';                    // shop version, if empty latest version will be used (optional)
$command->package = 'silver';                       // package name
$command->periodInMonths = 12;                      // period in months. So 12 when you're offering a year
$command->notes = 'notes';                          // additional notes (optional)
$command->ssoShopSalt = 'sso-hash-data';            // sso hash (optional)
$command->ssoHandshakeRequesterIp = '127.0.0.1/32'; // sso IP address/mask of handshake system (example: 127.0.0.1/32) or list of IP address/mask pairs delimited by semicolon (example 127.0.0.1/32;192.168.0.0/24) (optional)

$license = $dreamCommerceClient->createLicense($command);

删除许可证

要删除DreamCommerce许可证,有一个removeLicense方法。它将返回一个表示操作结果的布尔值。

$command = new RemoveLicenseCommand;
$command->licenseId = 'license-id';

$isRemoved = $dreamCommerceClient->removeLicense($command);

暂停许可证

要暂停DreamCommerce许可证,有一个suspendLicense方法。它将返回一个表示操作结果的布尔值。

$command = new SuspendLicenseCommand;
$command->licenseId = 'license-id';

$isSuspended = $dreamCommerceClient->suspendLicense($command);

恢复许可证

要恢复DreamCommerce许可证,有一个unsuspendLicense方法。它将返回一个表示操作结果的布尔值。

$command = new UnsuspendLicenseCommand;
$command->licenseId = 'license-id';

$isUnsuspended = $dreamCommerceClient->unsuspendLicense($command);

向许可证添加域名

要向DreamCommerce许可证添加域名,有一个addDomainToLicense方法。它将返回一个表示操作结果的布尔值。

$command = new AddDomainToLicenseCommand;
$command->licenseId = 'license-id';
$command->licenseDomain = 'domain.com';

$domainAdded = $dreamCommerceClient->addDomainToLicense($command);

从许可证中删除域名

要从DreamCommerce许可证中删除域名,有一个removeDomainFromLicense方法。它将返回一个表示操作结果的布尔值。

$command = new RemoveDomainFromLicenseCommand;
$command->licenseId = 'license-id';
$command->licenseDomain = 'domain.com';

$domainRemoved = $dreamCommerceClient->removeDomainFromLicense($command);

为许可证订购SSL证书

要为DreamCommerce许可证订购SSL证书,有一个orderSslCertificateForLicense方法。它将返回一个表示操作结果的布尔值。

$command = new OrderCertificateForLicenseCommand;
$command->licenseId = 'license-id';
$command->domainName = 'domain-name.com';
$command->email = 'email@domain-name.com';
$command->company = 'My Company';
$command->firstName = 'First Name';
$command->lastName = 'Last Name';
$command->address = 'Examplestreet 1';
$command->postalCode = '123415';
$command->city = 'City';
$command->state = 'State';
$command->country = 'Country';
$command->phoneNumber = '000000000000';

$certificateOrdered = $dreamCommerceClient->orderSslCertificateForLicense($command);