CustomerService

Namespace

IO\Services

Properties
Type Name Description

ContactAccountRepositoryContract

$accountRepository

ContactRepositoryContract

$contactRepository

ContactAddressRepositoryContract

$contactAddressRepository

AddressRepositoryContract

$addressRepository

ContactClassRepositoryContract

$contactClassRepository

SessionStorageService

$sessionStorage

``

$cache

Methods
public __construct($accountRepository, $contactRepository, $contactAddressRepository, $addressRepository, $contactClassRepository, $sessionStorage)

CustomerService constructor.

Parameters

Type

Name

Description

ContactAccountRepositoryContract

$accountRepository

ContactRepositoryContract

$contactRepository

ContactAddressRepositoryContract

$contactAddressRepository

AddressRepositoryContract

$addressRepository

ContactClassRepositoryContract

$contactClassRepository

SessionStorageService

$sessionStorage

public getContactId():int

Get the ID of the current contact from the session

public getContactClassData($contactClassId):array
Parameters

Type

Name

Description

int

$contactClassId

public showNetPrices():bool
public showNetPricesByContactId($contactId):bool
Parameters

Type

Name

Description

int

$contactId

public getContactClassMinimumOrderQuantity():int
public registerCustomer($contactData, $billingAddressData = [], $deliveryAddressData = []):Contact

Create a contact with addresses if specified

Parameters

Type

Name

Description

array

$contactData

array

$billingAddressData

array

$deliveryAddressData

public createAccount($accountData):Account
Parameters

Type

Name

Description

array

$accountData

public createContact($contactData):Contact \| array

Create a new contact

Parameters

Type

Name

Description

array

$contactData

public getContact():Contact

Find the current contact by ID

public getContactClassId():int
public updateContact($contactData):Contact

Update a contact

Parameters

Type

Name

Description

array

$contactData

public updatePassword($newPassword, $contactId, $hash = ""):mixed
Parameters

Type

Name

Description

string

$newPassword

int

$contactId

string

$hash

public getAddresses($typeId = null):array \| Collection

List the addresses of a contact

Parameters

Type

Name

Description

int

$typeId

public getAddress($addressId, $typeId):Address

Get an address by ID

Parameters

Type

Name

Description

int

$addressId

int

$typeId

public createAddress($addressData, $typeId):Address

Create an address with the specified address type

Parameters

Type

Name

Description

array

$addressData

int

$typeId

public updateAddress($addressId, $addressData, $typeId):Address

Update an address

Parameters

Type

Name

Description

int

$addressId

array

$addressData

int

$typeId

public deleteAddress($addressId, $typeId)

Delete an address

Parameters

Type

Name

Description

int

$addressId

int

$typeId

public getOrders($page = 1, $items = 10, $filters = []):array \| PaginatedResult

Get a list of orders for the current contact

Parameters

Type

Name

Description

int

$page

int

$items

array

$filters

public hasReturns():bool
public getReturns($page = 1, $items = 10, $filters = [], $wrapped = true):PaginatedResult
Parameters

Type

Name

Description

int

$page

int

$items

array

$filters

bool

$wrapped

public getLatestOrder():LocalizedOrder

Get the last order created by the current contact

public resetGuestAddresses()
public getEmail():string
public getContactNumber($contactId):string
Parameters

Type

Name

Description

int

$contactId

public deleteGuestAddresses()
public fromMemoryCache()
public resetMemoryCache($key = null)
Parameters

Type

Name

Description

``

$key