mijndomein/dreamcommerce-lms-client

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (7.0) of this package.

An API client for the Dreamcommerce license manager service

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

The API library for the DreamCommerce license manager service (LMS) Client

Usage

Before you can use the license functions in the DreamCommerce LMS Client you will need create the LicenseManagerClient. The client will need an ApiConnection with the api url, username, and password.

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

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

Creating a License

To create a DreamCommerce license there is a createLicense method. It will return a License object with the information of the just created 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);

Removing a License

To remove a DreamCommerce license there is a removeLicense method. It will return a boolean with the result of the operation.

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

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

Suspending a License

To suspend a DreamCommerce license there is a suspendLicense method. It will return a boolean with the result of the operation.

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

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

Un-suspending a License

To suspend a DreamCommerce license there is a unsuspendLicense method. It will return a boolean with the result of the operation.

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

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

Adding a Domain to a License

To add a domain to a DreamCommerce license there is a addDomainToLicense method. It will return a boolean with the result of the operation.

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

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

Removing a Domain from a License

To remove a domain from a DreamCommerce license there is a removeDomainFromLicense method. It will return a boolean with the result of the operation.

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

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

Ordering a Ssl Certificate for a License

To order a ssl certificate for a DreamCommerce license there is a orderSslCertificateForLicense method. It will return a boolean with the result of the operation.

$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);