CRM V2

CrmApiV2
in package

This is the main class to interact with the CRM

Table of Contents

$apiInterface  : ApiInterface
The Api object that will handle requests and responses
__construct()  : mixed
CrmApiV2
getCustomer()  : Customer|null
Get a customer from its hashcode or email If it does not exists a new instance will be returned. You would have to call its save method later on.
getCustomerOrNew()  : Customer
Get a customer from its hashcode or email If it does not exists a new instance will be returned. You would have to call its save method later on.
login()  : bool
Test a customer credentials to see if it can login
ping()  : bool
Use this the ping the crm and know its current status
setStatus()  : bool
Set the single optin status for an email

Properties

$apiInterface

The Api object that will handle requests and responses

private static ApiInterface $apiInterface

Methods

__construct()

CrmApiV2

public __construct([string|null $endpoint = null ][, string|null $bearerToken = null ][, string|null $bearerPwd = null ]) : mixed
Parameters
$endpoint : string|null = null
$bearerToken : string|null = null
$bearerPwd : string|null = null
Return values
mixed —

getCustomer()

Get a customer from its hashcode or email If it does not exists a new instance will be returned. You would have to call its save method later on.

public getCustomer(string $identification) : Customer|null
Parameters
$identification : string

The customer hashcode or email.

Tags
throws
CrmException

If an error occurs on server side or on getting response.

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs. Possibles are : - modelNotFound, If this customer hashcode could not be found.

phpcs:ignore

Squiz.Commenting.FunctionCommentThrowTag.WrongNumber

Return values
Customer|null —

Return null if the customer was not found

getCustomerOrNew()

Get a customer from its hashcode or email If it does not exists a new instance will be returned. You would have to call its save method later on.

public getCustomerOrNew(string $identification) : Customer
Parameters
$identification : string

The customer hashcode or email.

Tags
throws
CrmException

If an error occurs on server side or on getting response.

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs.

phpcs:ignore

Squiz.Commenting.FunctionComment.EmptyThrows

Return values
Customer —

A client Customer model.

login()

Test a customer credentials to see if it can login

public static login(string $email, string $password) : bool
Parameters
$email : string
$password : string
Tags
throws
CrmException

If an error occurs on server side or on getting response.

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs. Possibles are : - authFailed, If credentials are not valid. - customerNotActivated, If the account is not activated.

phpcs:ignore

Squiz.Commenting.FunctionCommentThrowTag.WrongNumber

Return values
bool —

ping()

Use this the ping the crm and know its current status

public ping() : bool
Tags
throws
CrmException

If an error occurs on server side or on getting response.

Return values
bool —

setStatus()

Set the single optin status for an email

public static setStatus(string $email, bool $opt_in) : bool
Parameters
$email : string
$opt_in : bool
Tags
throws
CrmException

If an error occurs on server side or on getting response.

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs. Possibles are : - singleOptinCustomerExists, If a customer exists with this email.

phpcs:ignore

Squiz.Commenting.FunctionCommentThrowTag.WrongNumber

Return values
bool —

true if succeeded

Search results