PHP code example of oxygensuite / digital-client-list
1. Go to this page and download the library: Download oxygensuite/digital-client-list library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
oxygensuite / digital-client-list example snippets
use OxygenSuite\DigitalClient\Http\DCLRequest;
// Initialize with your credentials
$env = 'dev'; // 'production' for production environment
$userId = 'your-user-id';
$subscriptionKey = 'your-subscription-key';
DCLRequest::init($userId, $subscriptionKey, $env);
use OxygenSuite\DigitalClient\Enums\ClientServiceType;
use OxygenSuite\DigitalClient\Http\SendClient;
use OxygenSuite\DigitalClient\Models\DigitalClient;
use OxygenSuite\DigitalClient\Models\Workshop;
// Create a new digital client
$dcl = DigitalClient::create()
->setClientServiceType(ClientServiceType::WORKSHOP)
->setBranch(1)
->setComments('Your comments here')
->setUseCase(
(new Workshop())
->setVehicleRegistrationNumber('REGISTRATION_NUMBER')
->setVehicleCategory('CATEGORY')
->setVehicleFactory('FACTORY'),
);
// Send the client to DCL
$request = new SendClient();
try {
$responses = $request->handle($dcl);
foreach ($responses as $response) {
if ($response->isSuccessful()) {
// Get the new client DCL ID
$dclId = $response->getNewClientDclID();
// Process successful response
} else {
// Handle errors
foreach ($response->getErrors() as $error) {
// Process error
}
}
}
} catch (DCLException $e) {
// Handle communication error
echo "Communication error: " . $e->getMessage();
}
use OxygenSuite\DigitalClient\Enums\ClientServiceType;
use OxygenSuite\DigitalClient\Enums\InvoiceType;
use OxygenSuite\DigitalClient\Enums\ProvidedCategoryServiceType;
use OxygenSuite\DigitalClient\Http\UpdateClient;
use OxygenSuite\DigitalClient\Models\DigitalClient;
// Update an existing digital client
$updateClient = DigitalClient::update()
->setInitialDclId('your-dcl-id')
->setClientServiceType(ClientServiceType::WORKSHOP)
->setEntryCompletion(true)
->setAmount(150.25)
->setIsDiffVehReturnLocation(false)
->setProvidedServiceCategory(ProvidedCategoryServiceType::WORK_WITH_PARTS)
->setInvoiceKind(InvoiceType::RETAIL)
->setComments('Update comments');
// Send the update request
$request = new UpdateClient();
try {
$responses = $request->handle($updateClient);
foreach ($responses as $response) {
if ($response->isSuccessful()) {
// Get the updated client DCL ID
$updatedDclId = $response->getUpdatedClientDclID();
// Process successful response
} else {
// Handle errors
foreach ($response->getErrors() as $error) {
// Process error
}
}
}
} catch (DCLException $e) {
// Handle communication error
echo "Communication error: " . $e->getMessage();
}
use OxygenSuite\DigitalClient\Http\ClientCorrelations;
use OxygenSuite\DigitalClient\Models\ClientCorrelation;
// Create a correlation
$correlateClient = (new ClientCorrelation())
->setMark('your-mark-number')
->addCorrelatedDCLid('your-dcl-id');
// Send the correlation request
$request = new ClientCorrelations();
try {
$responses = $request->handle($correlateClient);
if ($responses->isSuccessful()) {
// Process successful response
$correlateId = $response->getClientCorrelationId();
} else {
// Handle errors
}
} catch (DCLException $e) {
// Handle communication error
echo "Communication error: " . $e->getMessage();
}
use OxygenSuite\DigitalClient\Http\CancelClient;
// Create a cancel request
$request = new CancelClient();
try {
$response = $request->handle('your-dcl-id');
if ($response->isSuccessful()) {
// Get the cancellation ID
$cancellationId = $response->getCancellationID();
// Process successful response
} else {
// Handle errors
foreach ($response->getErrors() as $error) {
// Process error
}
}
} catch (DCLException $e) {
// Handle communication error
echo "Communication error: " . $e->getMessage();
}
use OxygenSuite\DigitalClient\Http\RequestClients;
$request = new RequestClients();
try {
$response = $request->handle(100000000028013);
print_r($response->toArray());
} catch (DCLException $e) {
echo $e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.