CRM V4

WPCrmUser
in package
implements JsonSerializable

Class de gestion des users en session avec Wordpress

Tags
category

API

subpackage

Wordpress

author

Jérémy Munsch jeremy.munsch@ldc.fr

license

MIT https://opensource.org/licenses/MIT

link
/

Table of Contents

Interfaces

JsonSerializable

Properties

$address  : string
$address2  : string
$birth_date  : string
$city  : string
$country  : Country
$firstname  : string
$hashcode  : string|null
$last_connection  : string
$lastname  : string
$opt_in  : bool
$password  : string
$pemail  : string|null
$phone  : string
$postcode  : string
$status  : bool
$uuidToken  : string|null
$info  : Customer|null
The CRM customer info (the api response)
$pemail  : string|null
The CRM customer email
$phashcode  : string|null
The CRM hashcode (UUID)
$uuidToken  : string|null
The CRM customer temp uuidToken to validate transactions

Methods

__construct()  : mixed
WPCrmUser construct
__get()  : bool|string|Country|null
Generic accessor
__set()  : void
Generic mutator
activate()  : bool
Activate the account in the crm
delete()  : bool
Delete current customer to the local database and on crm
jsonSerialize()  : array<string|int, mixed>
Serialize this object to an array
parseFromJson()  : WPCrmUser
Generate a user from session data
save()  : bool
Save current customer to the local database and on crm
setInfo()  : void
Set the customer info with api response
toggleOptin()  : bool
Toggle the current user optin value on the current user and the crm

Properties

$address

public string $address

The account address (street number, name, build, flat number)

$address2

public string $address2

— The account phone (address complement)

$birth_date

public string $birth_date

— The account birth date 'yyyy-mm-dd'

$city

public string $city

— The account city name

$firstname

public string $firstname

— The account first name

$hashcode

public string|null $hashcode

— The crm hashcode this is a readonly field

$last_connection

public string $last_connection

the last time user was connected 'yyyy-mm-dd HH:ii:ss'

$lastname

public string $lastname

— The account last name

$opt_in

public bool $opt_in

— true if the account is opt in

$password

public string $password

Required only on create, must have upper and lowers chars, at least 1 number, at leat 1 upper char, at least 1 lower char and at leat 1 special char

$pemail

public string|null $pemail

— Must be a rfc valid email on a valid domain name

$phone

public string $phone

— The account phone

$postcode

public string $postcode

— The account city postcode

$status

public bool $status

— true if the account is activated

$uuidToken

public string|null $uuidToken

— A local transaction token for this user

$pemail

The CRM customer email

protected string|null $pemail = null

$phashcode

The CRM hashcode (UUID)

protected string|null $phashcode = null

$uuidToken

The CRM customer temp uuidToken to validate transactions

protected string|null $uuidToken = null

UUID

Methods

__construct()

WPCrmUser construct

public __construct([string $hashcode = null ][, string $email = null ]) : mixed
Parameters
$hashcode : string = null

The customer hashcode (UUID).

$email : string = null

The customer email.

__get()

Generic accessor

public __get(string $prop) : bool|string|Country|null
Parameters
$prop : string

The prop to get.

Return values
bool|string|Country|null

__set()

Generic mutator

public __set(string $prop, mixed $value) : void
Parameters
$prop : string

The property to assign.

$value : mixed

The value to set.

activate()

Activate the account in the crm

public activate() : bool
Tags
throws
ValidationException

If a customer's hashcode could not be validated.

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. - customerAlreadyActive, It the customer is already activated.

Return values
bool —

true if succeeded

delete()

Delete current customer to the local database and on crm

public delete() : bool
Tags
throws
CrmException

If a critical error occured.

throws
ApiErrorException

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

Return values
bool —

true if the operation succeeded false otherwise

jsonSerialize()

Serialize this object to an array

public jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

parseFromJson()

Generate a user from session data

public static parseFromJson(string $string) : WPCrmUser
Parameters
$string : string

The json data stored in session.

Tags
throws
WpCrmInvalidJsonUserInfo

If the json string does no contain the needed information.

Return values
WPCrmUser

save()

Save current customer to the local database and on crm

public save() : bool
Tags
throws
CrmException

If a critical error occured.

throws
ApiErrorException

If any error or \LDC\LDCCRM\Enums\ApiError occurs. Possibles are : - validationFailed, If provided data is wrong(CRM side). - modelNotFound, If this customer hashcode could not be found.

Return values
bool —

true if the operation succeeded false otherwise

setInfo()

Set the customer info with api response

public setInfo(Customer $customer) : void
Parameters
$customer : Customer

The Api object reponse (user).

toggleOptin()

Toggle the current user optin value on the current user and the crm

public toggleOptin() : bool
Tags
throws
CrmException

If a critical error occured.

throws
ApiErrorException

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

Return values
bool —

true if the operation succeeded


        
On this page

Search results