UserService extends Service
in package
Uses ServiceTrait, AddressTrait, NewsletterTrait, StockAlertsTrait, WishlistTrait

This is the user service class.

This class will retrieve the users from LogiCommerce API and transform them to objects. All the needed users operations previous to Framework must be done here.

Splitted on traits to divide the methods between them.

Tags
see
UserService::getUser()
see
UserService::updateUser()
see
UserService::createUser()
see
UserService::deleteUser()
see
UserService::login()
see
UserService::logout()
see
UserService::getOrders()
see
UserService::getRMAs()
see
UserService::updatePassword()
see
UserService::recoverPassword()
see
UserService::validateRecoverPasswordHash()
see
UserService::setNewPassword()
see
UserService::verify()
see
UserService::resendVerification()
see
UserService::getRelatedItems()
see
UserService::getCustomTags()
see
UserService::getOauth()
see
UserService::salesAgentLogin()
see
UserService::salesAgentLogout()
see
UserService::getSalesAgentCustomers()
see
UserService::getSalesAgentOrders()
see
UserService::getSalesAgentSales()
see
UserService::setLanguage()
see
UserService::setCurrency()
see
UserService::getRewardPoints()
see
UserService::getUserExists()
see
UserService::getVouchers()
see
User
see
UserOrder
see
RelatedItems
see
CustomTag
see
UserService::addGetUser()
see
UserService::addGetOrders()
see
UserService::addGetRMAs()
see
UserService::addGetRelatedItems()
see
UserService::addGetCustomTags()
see
UserService::addGetUserExists()
see
UserService::addGetRewardPoints()
see
UserService::addGetVouchers()
see
UserService::addSalesAgentCustomers()
see
UserService::addSalesAgentOrders()
see
UserService::addSalesAgentSales()
see
BatchRequests
see
AddressTrait::getAddress()
see
AddressTrait::updateAddress()
see
AddressTrait::createBillingAddress()
see
AddressTrait::createShippingAddress()
see
AddressTrait::deleteAddress()
see
AddressTrait::getBillingAddresses()
see
AddressTrait::getShippingAddresses()
see
Address
see
BillingAddress
see
ShippingAddress
see
AddressTrait::addGetAddress()
see
AddressTrait::addGetBillingAddresses()
see
AddressTrait::addGetShippingAddresses()
see
BatchRequests
see
NewsletterTrait::subscribe()
see
NewsletterTrait::unsubscribe()
see
StockAlertsTrait::getStockAlerts()
see
StockAlertsTrait::deleteStockAlerts()
see
UserStockAlert
see
StockAlertsTrait::addGetStockAlerts()
see
BatchRequests
see
WishlistTrait::getWishlist()
see
WishlistTrait::addWishlistProduct()
see
WishlistTrait::deleteWishlistProduct()
see
WishlistTrait::sendWishlist()
see
Product
see
WishlistTrait::addGetWishlist()
see
BatchRequests
see
Service
see
ServiceTrait
see
AddressTrait
see
NewsletterTrait
see
StockAlertsTrait
see
WishlistTrait
uses
ServiceTrait
uses
AddressTrait
uses
NewsletterTrait
uses
StockAlertsTrait
uses
WishlistTrait

Table of Contents

DELETE  = \SDK\Core\Enums\MethodType::DELETE
GET  = \SDK\Core\Enums\MethodType::GET
ITEMS  = 'items'
POST  = \SDK\Core\Enums\MethodType::POST
PUT  = \SDK\Core\Enums\MethodType::PUT
addGetAddress() Add the request to get the address identified by the given id  : void
addGetBillingAddresses() Add the request to get the billing addresses for the current user  : void
addGetCustomTags() Add the request to get the custom tags filtered with the given parameters for the current user  : void
addGetOrders() Add the request to get the orders filtered with the given parameters for the current user  : void
addGetRelatedItems() Add the request to get the user related items  : void
addGetRewardPoints() Add the request to get the reward points filtered with the given parameters for the current user  : void
addGetRMAs() Add the request to get returnable products filtered with the given parameters  : void
addGetSalesAgentCustomers() Add the request to get sales agent customers with the given parameters for the current user  : void
addGetSalesAgentOrders() Add the request to get the orders filtered with the given parameters for the current user  : void
addGetSalesAgentSales() Add the request to get the orders filtered with the given parameters for the current user  : void
addGetShippingAddresses() Add the request to get the shipping addresses for the current user  : void
addGetStockAlerts() Add the request to get the areas filtered with the given parameters  : void
addGetUser() Add the request to get the current user information.  : void
addGetUserExists() Add the request to get the check that sets if there is a user identified with the given parameter.  : UserExists|null
addGetVouchers() Add the request to get the vouchers filtered with the given parameters for the current user  : void
addGetWishlist() Add the request to add the request to get the areas filtered with the given parameters  : void
addWishlistProduct() Add product to the user wishlist  : Status|null
createBillingAddress() Create new billing for the current user.  : Address|null
createShippingAddress() Create new shipping address for the current user.  : Address|null
createUser() Create the current user information.  : Basket|null
deleteAddress() Delete the user address identified by the given id  : Status|null
deleteStockAlerts() Delete the user address identified by the given id  : Status|null
deleteUser() Delete the current user.  : Basket|null
deleteWishlistProduct() Remove product to the user wishlist  : Status|null
getAddress() Returns the address identified by the given id  : Address|null
getBillingAddresses() Returns the billing addresses for the current user  : ElementCollection|null
getCustomTags() Returns the custom tags filtered with the given parameters for the current user  : ElementCollection|null
getInstance() Returns the requested model instance.  : Service
getOauth() Returns the current user information.  : UserOauthUrl|null
getOrders() Returns the orders filtered with the given parameters for the current user  : ElementCollection|null
getRelatedItems() Returns the user related items  : ElementCollection|null
getRewardPoints() Returns the reward points filtered with the given parameters for the current user  : ElementCollection|null
getRMAs() Returns the RMAs for the current user  : ElementCollection|null
getSalesAgentCustomers() Return current sales agent customers  : ElementCollection|null
getSalesAgentOrders() For a sales agent, returns the given customer's orders  : ElementCollection|null
getSalesAgentSales() Return current sales agent sales  : ElementCollection|null
getShippingAddresses() Returns the shipping addresses for the current user  : ElementCollection|null
getStockAlerts() Returns the areas filtered with the given parameters  : ElementCollection|null
getUser() Returns the current user information.  : User|null
getUserExists() Check if there is a user identified with the given parameter.  : UserExists|null
getVouchers() Returns the vouchers filtered with the given parameters for the current user  : ElementCollection|null
getWishlist() Returns the areas filtered with the given parameters  : ElementCollection|null
login() User login  : Basket|null
logout() User logout  : Basket|null
newsletterCheckStatus() Check status user in the newsletter  : NewsletterSubscription|null
newsletterSubscribe() Subscribe user to the newsletter  : NewsletterSubscription|null
newsletterUnsubscribe() Unsubscribe user to the newsletter  : NewsletterSubscription|null
recoverPassword() Recover the current user password (this will send an email to recover the password).  : Status|null
resendVerification() Resend the verification email.  : Status|null
salesAgentLogin() Sales Agent - Login simulated user  : Basket|null
salesAgentLogout() Sales Agent - Logout simulated user  : Basket|null
sendWishlist() Send the newsletter to the given email  : Status|null
setCurrency() Sets a new navigation currency for the current user  : Basket|null
setLanguage() Sets a new navigation language for the current user  : Basket|null
setNewPassword() Change the user password (the action is done with the hash inside de received email).  : Status|null
setOauth() Returns the current user information.  : UserOauth|null
updateAddress() Update the address identified by the given id.  : Address|null
updatePassword() Update the current user password.  : Status|null
updateUser() Update the current user information.  : Basket|null
validateRecoverPasswordHash() Validate if the given token stills valid  : Status|null
verify() Verify the user that matches the given uniqueId.  : Status|null
__construct()  : mixed
call()  : array<string|int, mixed>
extractParameters()  : array<string|int, mixed>
getCollection()  : mixed
getConnection()  : Connection
getElement()  : Element|null
getElements()  : ElementCollection|null
getResourceElement()  : Element|null
getResponse()  : ElementCollection|null
prepareElement()  : Element|null
prepareElements()  : array<string|int, mixed>
replaceWildcards()  : string

Constants

DELETE

protected mixed DELETE = \SDK\Core\Enums\MethodType::DELETE

GET

protected mixed GET = \SDK\Core\Enums\MethodType::GET

ITEMS

protected mixed ITEMS = 'items'

POST

protected mixed POST = \SDK\Core\Enums\MethodType::POST

PUT

protected mixed PUT = \SDK\Core\Enums\MethodType::PUT

Methods

addGetAddress()

Add the request to get the address identified by the given id

public addGetAddress(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$id : int
Return values
void

addGetBillingAddresses()

Add the request to get the billing addresses for the current user

public addGetBillingAddresses(BatchRequests $batchRequests, string $batchName) : void
Parameters
$batchRequests : BatchRequests
$batchName : string
Return values
void

addGetCustomTags()

Add the request to get the custom tags filtered with the given parameters for the current user

public addGetCustomTags(BatchRequests $batchRequests, string $batchName[, UserCustomTagsParametersGroup $params = null ]) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$params : UserCustomTagsParametersGroup = null

object with the needed filters to send to the API user resource

Return values
void

addGetOrders()

Add the request to get the orders filtered with the given parameters for the current user

public addGetOrders(BatchRequests $batchRequests, string $batchName[, OrderParametersGroup $params = null ]) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$params : OrderParametersGroup = null

object with the needed filters to send to the API user orders resource

Return values
void

addGetRelatedItems()

Add the request to get the user related items

public addGetRelatedItems(BatchRequests $batchRequests, string $batchName[, string $type = '' ][, RelatedItemsParametersGroup $params = null ]) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$type : string = ''

Optional. This param will set the kind of related we want to retrieve. Valid values are inside RelatedItemsType class. If not given all the related items will be returned inside the RelatedItems object.

$params : RelatedItemsParametersGroup = null
Return values
void

addGetRewardPoints()

Add the request to get the reward points filtered with the given parameters for the current user

public addGetRewardPoints(BatchRequests $batchRequests, string $batchName[, RewardPointsParametersGroup $params = null ]) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$params : RewardPointsParametersGroup = null

object with the needed filters to send to the API user resource

Return values
void

addGetRMAs()

Add the request to get returnable products filtered with the given parameters

public addGetRMAs(BatchRequests $batchRequests, string $batchName) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

Return values
void

addGetSalesAgentCustomers()

Add the request to get sales agent customers with the given parameters for the current user

public addGetSalesAgentCustomers(BatchRequests $batchRequests, string $batchName[, SalesAgentCustomersParametersGroup $params = null ]) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$params : SalesAgentCustomersParametersGroup = null

object with the needed filters to send to the API user resource

Return values
void

addGetSalesAgentOrders()

Add the request to get the orders filtered with the given parameters for the current user

public addGetSalesAgentOrders(BatchRequests $batchRequests, string $batchName, int $customerId[, SalesAgentCustomersParametersGroup $params = null ]) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$customerId : int
$params : SalesAgentCustomersParametersGroup = null
Return values
void

addGetShippingAddresses()

Add the request to get the shipping addresses for the current user

public addGetShippingAddresses(BatchRequests $batchRequests, string $batchName) : void
Parameters
$batchRequests : BatchRequests
$batchName : string
Return values
void

addGetStockAlerts()

Add the request to get the areas filtered with the given parameters

public addGetStockAlerts(BatchRequests $batchRequests, string $batchName) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

Return values
void

addGetUser()

Add the request to get the current user information.

public addGetUser(BatchRequests $batchRequests, string $batchName) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

Return values
void

addGetUserExists()

Add the request to get the check that sets if there is a user identified with the given parameter.

public addGetUserExists(BatchRequests $batchRequests, string $batchName, string $userIdentifier) : UserExists|null
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$userIdentifier : string

this parameter can match the email or the public id of the user. Depends on the ecommerce settings.

Return values
UserExists|null

addGetVouchers()

Add the request to get the vouchers filtered with the given parameters for the current user

public addGetVouchers(BatchRequests $batchRequests, string $batchName[, UserVouchersParametersGroup $params = null ]) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

$params : UserVouchersParametersGroup = null

object with the needed filters to send to the API user resource

Return values
void

addGetWishlist()

Add the request to add the request to get the areas filtered with the given parameters

public addGetWishlist(BatchRequests $batchRequests, string $batchName) : void
Parameters
$batchRequests : BatchRequests
$batchName : string

the name that will identify the request on the batch return.

Return values
void

addWishlistProduct()

Add product to the user wishlist

public addWishlistProduct(int $id) : Status|null
Parameters
$id : int

The identifier of the product we want to add to the wishlist

Return values
Status|null

deleteAddress()

Delete the user address identified by the given id

public deleteAddress(int $id) : Status|null
Parameters
$id : int
Return values
Status|null

deleteStockAlerts()

Delete the user address identified by the given id

public deleteStockAlerts(int $id) : Status|null
Parameters
$id : int
Return values
Status|null

deleteUser()

Delete the current user.

public deleteUser(string $password) : Basket|null
Parameters
$password : string
Return values
Basket|null

deleteWishlistProduct()

Remove product to the user wishlist

public deleteWishlistProduct(int $id) : Status|null
Parameters
$id : int

The identifier of the product we want to remove from wishlist

Return values
Status|null

getAddress()

Returns the address identified by the given id

public getAddress(int $id) : Address|null
Parameters
$id : int
Return values
Address|null

getInstance()

Returns the requested model instance.

public static getInstance() : Service

If is not setted, this method will set it.

Return values
Service

getRelatedItems()

Returns the user related items

public getRelatedItems([string $type = '' ][, RelatedItemsParametersGroup $params = null ]) : ElementCollection|null
Parameters
$type : string = ''

Optional. This param will set the kind of related we want to retrieve. Valid values are inside RelatedItemsType class. If not given all the related items will be returned inside the RelatedItems object.

$params : RelatedItemsParametersGroup = null
Return values
ElementCollection|null

getUser()

Returns the current user information.

public getUser() : User|null
Return values
User|null

getUserExists()

Check if there is a user identified with the given parameter.

public getUserExists(string $userIdentifier) : UserExists|null
Parameters
$userIdentifier : string

this parameter can match the email or the public id of the user. Depends on the ecommerce settings.

Return values
UserExists|null

recoverPassword()

Recover the current user password (this will send an email to recover the password).

public recoverPassword(string $email) : Status|null
Parameters
$email : string
Return values
Status|null

resendVerification()

Resend the verification email.

public resendVerification(string $email) : Status|null
Parameters
$email : string
Return values
Status|null

salesAgentLogin()

Sales Agent - Login simulated user

public salesAgentLogin(int $customerId) : Basket|null
Parameters
$customerId : int
Return values
Basket|null

salesAgentLogout()

Sales Agent - Logout simulated user

public salesAgentLogout() : Basket|null
Return values
Basket|null

setCurrency()

Sets a new navigation currency for the current user

public setCurrency(string $currencyInitials) : Basket|null
Parameters
$currencyInitials : string
Return values
Basket|null

setLanguage()

Sets a new navigation language for the current user

public setLanguage(string $languageCode) : Basket|null
Parameters
$languageCode : string
Return values
Basket|null

setNewPassword()

Change the user password (the action is done with the hash inside de received email).

public setNewPassword(string $password, string $hash) : Status|null
Parameters
$password : string
$hash : string
Return values
Status|null

setOauth()

Returns the current user information.

public setOauth(string $pluginModule, string $code) : UserOauth|null
Parameters
$pluginModule : string
$code : string
Return values
UserOauth|null

validateRecoverPasswordHash()

Validate if the given token stills valid

public validateRecoverPasswordHash(string $hash) : Status|null
Parameters
$hash : string
Return values
Status|null

verify()

Verify the user that matches the given uniqueId.

public verify(string $uniqueId) : Status|null
Parameters
$uniqueId : string
Return values
Status|null

__construct()

protected __construct() : mixed
Return values
mixed

call()

protected call(Request $request[, string $apiUrl = null ]) : array<string|int, mixed>
Parameters
$request : Request
$apiUrl : string = null
Return values
array<string|int, mixed>

extractParameters()

protected extractParameters([ParametersGroup|null $parametersGroup = null ]) : array<string|int, mixed>
Parameters
$parametersGroup : ParametersGroup|null = null
Return values
array<string|int, mixed>

getCollection()

protected getCollection(array<string|int, mixed> $data, string $class) : mixed
Parameters
$data : array<string|int, mixed>
$class : string
Return values
mixed

getElement()

protected getElement(string $class, string $resource[, int $id = null ][, mixed $params = null ]) : Element|null
Parameters
$class : string
$resource : string
$id : int = null
$params : mixed = null
Return values
Element|null

getResourceElement()

protected getResourceElement(string $class, string $resource[, mixed $params = [] ]) : Element|null
Parameters
$class : string
$resource : string
$params : mixed = []
Return values
Element|null

getResponse()

protected getResponse(array<string|int, mixed> $data, string $class) : ElementCollection|null
Parameters
$data : array<string|int, mixed>
$class : string
Return values
ElementCollection|null

prepareElement()

protected prepareElement(array<string|int, mixed> $data, string $class) : Element|null
Parameters
$data : array<string|int, mixed>
$class : string
Return values
Element|null

prepareElements()

protected prepareElements(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
$class : string
Return values
array<string|int, mixed>

replaceWildcards()

protected replaceWildcards(string $resource, array<string|int, mixed> $wildcards) : string
Parameters
$resource : string
$wildcards : array<string|int, mixed>
Return values
string

Search results