class ApiUsers extends ApiBase (View source)

Class to manage MangoPay API calls for the user entity.

Properties

protected MangoPayApi $_root

Root/parent instance that holds the OAuthToken and Configuration instance

from  ApiBase

Methods

mixed
getLogger()

No description

from  ApiBase
__construct(MangoPayApi $root)

Constructor Root/parent instance that holds the OAuthToken and Configuration instance

from  ApiBase
string
GetRequestUrl(string $key)

Get URL for REST Mango Pay API

from  ApiBase
GetRequestType(string $key)

Get request type for REST Mango Pay API

from  ApiBase
object
CreateObject(string $methodKey, object $entity, object $responseClassName = null, string $entityId = null, $subEntityId = null, $idempotencyKey = null)

Create object in API

from  ApiBase
object
GetObject(string $methodKey, object $responseClassName, $firstEntityId = null, $secondEntityId = null, $thirdEntityId = null, $clientIdRequired = true)

Get entity object from API

from  ApiBase
object[]
GetList(string $methodKey, Pagination $pagination, object $responseClassName = null, string $entityId = null, object $filter = null, Sorting $sorting = null, $secondEntityId = null, $clientIdRequired = true)

Get lst with entities object from API

from  ApiBase
object
SaveObject(string $methodKey, object $entity, object $responseClassName = null, $secondEntityId = null, $thirdEntityId = null)

Save object in API

from  ApiBase
DeleteObject($methodKey, $entity, $responseClassName = null)

No description

from  ApiBase
object
ExecutePostRequest($methodKey, $entity, $responseClassName, $entityId = null)

Executes a POST request

from  ApiBase
CastResponseToError(object $response)

Cast response object to an error object

from  ApiBase
CastResponseToEntity(object $response, string $entityClassName, $asDependentObject = false)

Cast response object to entity object

from  ApiBase
array
BuildRequestData(object $entity)

Get array with request data

from  ApiBase
GetObjectForIdempotencyUrl($url)

No description

from  ApiBase
GetAll(Pagination $pagination = null, Sorting $sorting = null)

Get all users

Get(string $userId)

Get natural or legal user by ID

GetSca(string $userId)

Get SCA natural or legal user by ID

GetNatural(string $userId)

Get natural user by ID

GetNaturalSca(string $userId)

Get SCA natural user by ID

GetLegal(string $userId)

Get legal user by ID

GetLegalSca(string $userId)

Get SCA legal user by ID

CreateBankAccount(string $userId, BankAccount $bankAccount, $idempotencyKey = null)

Create bank account for user

GetBankAccounts(string $userId, Pagination $pagination = null, Sorting $sorting = null, FilterBankAccounts $filter = null)

Get all bank accounts for user

GetBankAccount(string $userId, string $bankAccountId)

Get bank account for user

UpdateBankAccount(string $userId, BankAccount $bankAccount)

Save a bank account

Wallet[]
GetWallets(string $userId, Pagination $pagination = null, Sorting $sorting = null, $filter = null)

Get all wallets for user

GetTransactions(string $userId, Pagination $pagination = null, FilterTransactions $filter = null, Sorting $sorting = null)

Get all transactions for user

Card[]
GetCards(string $userId, Pagination $pagination = null, FilterCards $filter = null, Sorting $sorting = null)

Get all cards for user

CreateKycDocument(string $userId, KycDocument $kycDocument, string $idempotencyKey = null)

Create new KYC document

GetKycDocuments(string $userId, Pagination $pagination = null, Sorting $sorting = null, FilterKycDocuments $filter = null)

Get all KYC documents for user

GetKycDocument(string $userId, string $kycDocumentId)

Get KYC document

GetMandates(string $userId, Pagination $pagination = null, FilterTransactions $filter = null, Sorting $sorting = null)

Get all mandates for user

GetMandatesForBankAccount(string $userId, string $bankAccountId, Pagination $pagination = null, FilterTransactions $filter = null, Sorting $sorting = null)

Get mandates for user and bank account

UpdateKycDocument(string $userId, KycDocument $kycDocument)

Save KYC document

true
CreateKycPage(string $userId, string $kycDocumentId, KycPage $kycPage, $idempotencyKey = null)

Create page for Kyc document

true
CreateKycPageFromFile(string $userId, string $kycDocumentId, string $filePath, $idempotencyKey = null)

Create page for Kyc document from file

GetEMoney(string $userId, $year = null, $month = null)

Get user EMoney

GetPreAuthorizations(string $userId, Pagination $pagination = null, FilterPreAuthorizations $filter = null, Sorting $sorting = null)

Gets a list with PreAuthorizations belonging to a specific user

GetBlockStatus(string $userId)

Get the Block Status of a User

GetRegulatory(string $userId)

Get the Block Status Regulatory of a User

ValidateTheFormatOfUserData($companyNumberDetails)

This call allows you to check the validity of the format of a piece of user data, and to retrieve the validation rules applied to it.

Enroll(string $userId, $idempotencyKey = null)

If UserCategory is OWNER, this endpoint allows you to enroll a user in SCA.

Close(UserLegal|UserNatural|UserLegalSca|UserNaturalSca $user)

Close user (change status to CLOSED). The resource remains available for historical purposes.

Details

protected mixed getLogger()

No description

Return Value

mixed

__construct(MangoPayApi $root)

Constructor Root/parent instance that holds the OAuthToken and Configuration instance

Parameters

MangoPayApi $root

protected string GetRequestUrl(string $key)

Get URL for REST Mango Pay API

Parameters

string $key

Key with data

Return Value

string

protected RequestType GetRequestType(string $key)

Get request type for REST Mango Pay API

Parameters

string $key

Key with data

Return Value

RequestType

protected object CreateObject(string $methodKey, object $entity, object $responseClassName = null, string $entityId = null, $subEntityId = null, $idempotencyKey = null)

Create object in API

Parameters

string $methodKey

Key with request data

object $entity

Entity object

object $responseClassName

Name of entity class from response

string $entityId

Entity identifier

$subEntityId
$idempotencyKey

Return Value

object

Response data

protected object GetObject(string $methodKey, object $responseClassName, $firstEntityId = null, $secondEntityId = null, $thirdEntityId = null, $clientIdRequired = true)

Get entity object from API

Parameters

string $methodKey

Key with request data

object $responseClassName

Name of entity class from response

$firstEntityId
$secondEntityId
$thirdEntityId
$clientIdRequired

Return Value

object

Response data

Exceptions

Exception

protected object[] GetList(string $methodKey, Pagination $pagination, object $responseClassName = null, string $entityId = null, object $filter = null, Sorting $sorting = null, $secondEntityId = null, $clientIdRequired = true)

Get lst with entities object from API

Parameters

string $methodKey

Key with request data

Pagination $pagination

Pagination object

object $responseClassName

Name of entity class from response

string $entityId

Entity identifier

object $filter

Object to filter data

Sorting $sorting

Object to sorting data

$secondEntityId
$clientIdRequired

Return Value

object[]

Response data

protected object SaveObject(string $methodKey, object $entity, object $responseClassName = null, $secondEntityId = null, $thirdEntityId = null)

Save object in API

Parameters

string $methodKey

Key with request data

object $entity

Entity object to save

object $responseClassName

Name of entity class from response

$secondEntityId
$thirdEntityId

Return Value

object

Response data

protected DeleteObject($methodKey, $entity, $responseClassName = null)

No description

Parameters

$methodKey
$entity
$responseClassName

protected object ExecutePostRequest($methodKey, $entity, $responseClassName, $entityId = null)

Executes a POST request

Parameters

$methodKey

Key with request data

$entity

Entity object

$responseClassName

Name of entity class from response

$entityId

Entity identifier

Return Value

object

Response data

protected Error CastResponseToError(object $response)

Cast response object to an error object

Parameters

object $response

Object from API response

Return Value

Error

The error

protected CastResponseToEntity(object $response, string $entityClassName, $asDependentObject = false)

Cast response object to entity object

Parameters

object $response

Object from API response

string $entityClassName

Name of entity class to cast

$asDependentObject

protected array BuildRequestData(object $entity)

Get array with request data

Parameters

object $entity

Entity object to send as request data

Return Value

array

protected GetObjectForIdempotencyUrl($url)

No description

Parameters

$url

UserLegal|UserNatural|UserNaturalSca|UserLegalSca Create(UserLegal|UserNatural|UserNaturalSca|UserLegalSca $user, $idempotencyKey = null)

Create a new user

Parameters

UserLegal|UserNatural|UserNaturalSca|UserLegalSca $user
$idempotencyKey

Return Value

UserLegal|UserNatural|UserNaturalSca|UserLegalSca

User object returned from API

Exceptions

Exception

UserLegal[]|UserNatural[] GetAll(Pagination $pagination = null, Sorting $sorting = null)

Get all users

Parameters

Pagination $pagination

Pagination object

Sorting $sorting

Object to sorting data

Return Value

UserLegal[]|UserNatural[]

Array with users

UserLegal|UserNatural Get(string $userId)

Get natural or legal user by ID

Parameters

string $userId

User identifier

Return Value

UserLegal|UserNatural

User object returned from API

UserNaturalSca|UserLegalSca GetSca(string $userId)

Get SCA natural or legal user by ID

Parameters

string $userId

User identifier

Return Value

UserNaturalSca|UserLegalSca

User object returned from API

UserNatural GetNatural(string $userId)

Get natural user by ID

Parameters

string $userId

User identifier

Return Value

UserNatural

User object returned from API

UserNaturalSca GetNaturalSca(string $userId)

Get SCA natural user by ID

Parameters

string $userId

User identifier

Return Value

UserNaturalSca

User object returned from API

UserLegal GetLegal(string $userId)

Get legal user by ID

Parameters

string $userId

User identifier

Return Value

UserLegal

User object returned from API

UserLegalSca GetLegalSca(string $userId)

Get SCA legal user by ID

Parameters

string $userId

User identifier

Return Value

UserLegalSca

User object returned from API

UserLegal|UserNatural Update(UserLegal|UserNatural $user)

Save user

Parameters

UserLegal|UserNatural $user

Return Value

UserLegal|UserNatural

User object returned from API

Exceptions

Exception

UserLegalSca|UserNaturalSca UpdateSca(UserLegalSca|UserNaturalSca $user)

Update SCA user

Parameters

UserLegalSca|UserNaturalSca $user

Return Value

UserLegalSca|UserNaturalSca

User object returned from API

Exceptions

Exception

UserLegalSca|UserNaturalSca|UserLegal|UserNatural Categorize(UserLegalSca|UserNaturalSca|UserLegal|UserNatural $user)

Transition a Natural/Legal Payer to Owner (SCA).

Some parameters may be required based on the kind of transition you do.

Parameters

UserLegalSca|UserNaturalSca|UserLegal|UserNatural $user

Return Value

UserLegalSca|UserNaturalSca|UserLegal|UserNatural

User object returned from API

Exceptions

Exception

BankAccount CreateBankAccount(string $userId, BankAccount $bankAccount, $idempotencyKey = null)

Create bank account for user

Parameters

string $userId

User Id

BankAccount $bankAccount

Entity of bank account object

$idempotencyKey

Return Value

BankAccount

Create bank account object

BankAccount[] GetBankAccounts(string $userId, Pagination $pagination = null, Sorting $sorting = null, FilterBankAccounts $filter = null)

Get all bank accounts for user

Parameters

string $userId

User Id

Pagination $pagination

Pagination object

Sorting $sorting

Object to sorting data

FilterBankAccounts $filter

Filtering object

Return Value

BankAccount[]

Array with bank account entities

BankAccount GetBankAccount(string $userId, string $bankAccountId)

Get bank account for user

Parameters

string $userId

User Id

string $bankAccountId

Bank account Id

Return Value

BankAccount

Entity of bank account object

BankAccount UpdateBankAccount(string $userId, BankAccount $bankAccount)

Save a bank account

Parameters

string $userId
BankAccount $bankAccount

Return Value

BankAccount

Entity of bank account object

Wallet[] GetWallets(string $userId, Pagination $pagination = null, Sorting $sorting = null, $filter = null)

Get all wallets for user

Parameters

string $userId

User Id

Pagination $pagination

Pagination object

Sorting $sorting

Object to sorting data

$filter

Return Value

Wallet[]

Array with objects returned from API

Transaction[] GetTransactions(string $userId, Pagination $pagination = null, FilterTransactions $filter = null, Sorting $sorting = null)

Get all transactions for user

Parameters

string $userId

User Id

Pagination $pagination

Pagination object

FilterTransactions $filter

Object to filter data

Sorting $sorting

Object to sorting data

Return Value

Transaction[]

Transactions for user returned from API

Card[] GetCards(string $userId, Pagination $pagination = null, FilterCards $filter = null, Sorting $sorting = null)

Get all cards for user

Parameters

string $userId

User Id

Pagination $pagination

Pagination object

FilterCards $filter

Object to filter data

Sorting $sorting

Object to sorting data

Return Value

Card[]

Cards for user returned from API

KycDocument CreateKycDocument(string $userId, KycDocument $kycDocument, string $idempotencyKey = null)

Create new KYC document

Parameters

string $userId

User Id

KycDocument $kycDocument
string $idempotencyKey

Key for response replication

Return Value

KycDocument

Document returned from API

KycDocument[] GetKycDocuments(string $userId, Pagination $pagination = null, Sorting $sorting = null, FilterKycDocuments $filter = null)

Get all KYC documents for user

Parameters

string $userId

User Id

Pagination $pagination

Pagination object

Sorting $sorting

Object to sorting data

FilterKycDocuments $filter

Object to filter data

Return Value

KycDocument[]

Array with KYC documents entities

KycDocument GetKycDocument(string $userId, string $kycDocumentId)

Get KYC document

Parameters

string $userId

User Id

string $kycDocumentId

Document identifier

Return Value

KycDocument

Document returned from API

Mandate[] GetMandates(string $userId, Pagination $pagination = null, FilterTransactions $filter = null, Sorting $sorting = null)

Get all mandates for user

Parameters

string $userId

User Id

Pagination $pagination

Pagination object

FilterTransactions $filter

Object to filter data

Sorting $sorting

Object to sorting data

Return Value

Mandate[]

Array with mandate entities

Mandate[] GetMandatesForBankAccount(string $userId, string $bankAccountId, Pagination $pagination = null, FilterTransactions $filter = null, Sorting $sorting = null)

Get mandates for user and bank account

Parameters

string $userId

User Id

string $bankAccountId

Bank account Id

Pagination $pagination

Pagination object

FilterTransactions $filter

Object to filter data

Sorting $sorting

Object to sorting data

Return Value

Mandate[]

Array with mandate entities

KycDocument UpdateKycDocument(string $userId, KycDocument $kycDocument)

Save KYC document

Parameters

string $userId

User Id

KycDocument $kycDocument

Document to save

Return Value

KycDocument

Document returned from API

true CreateKycPage(string $userId, string $kycDocumentId, KycPage $kycPage, $idempotencyKey = null)

Create page for Kyc document

Parameters

string $userId

User Id

string $kycDocumentId

KYC Document Id

KycPage $kycPage

KYC Page

$idempotencyKey

Return Value

true

always true. If an error occurred, a \MangoPay\Libraries\Exception is thrown

Exceptions

Exception

true CreateKycPageFromFile(string $userId, string $kycDocumentId, string $filePath, $idempotencyKey = null)

Create page for Kyc document from file

Parameters

string $userId

User Id

string $kycDocumentId

KYC Document Id

string $filePath

File path

$idempotencyKey

Return Value

true

always true. If an error occurred, a \MangoPay\Libraries\Exception is thrown

Exceptions

Exception

EMoney GetEMoney(string $userId, $year = null, $month = null)

Get user EMoney

Parameters

string $userId

User Id

$year
$month

Return Value

EMoney

EMoney object returned from API

Exceptions

Exception

CardPreAuthorization[] GetPreAuthorizations(string $userId, Pagination $pagination = null, FilterPreAuthorizations $filter = null, Sorting $sorting = null)

Gets a list with PreAuthorizations belonging to a specific user

Parameters

string $userId

ID of the user whose PreAuthorizations to retrieve

Pagination $pagination

Pagination object

FilterPreAuthorizations $filter

Filtering object

Sorting $sorting

Sorting object

Return Value

CardPreAuthorization[]

The user's PreAuthorizations

UserBlockStatus GetBlockStatus(string $userId)

Get the Block Status of a User

Parameters

string $userId

User identifier

Return Value

UserBlockStatus

User object returned from API

UserBlockStatus GetRegulatory(string $userId)

Get the Block Status Regulatory of a User

Parameters

string $userId

User identifier

Return Value

UserBlockStatus

User object returned from API

CompanyNumberDetails ValidateTheFormatOfUserData($companyNumberDetails)

This call allows you to check the validity of the format of a piece of user data, and to retrieve the validation rules applied to it.

Parameters

$companyNumberDetails

Return Value

CompanyNumberDetails

UserEnrollmentResult Enroll(string $userId, $idempotencyKey = null)

If UserCategory is OWNER, this endpoint allows you to enroll a user in SCA.

Your platform needs to retrieve the returned PendingUserAction.RedirectUrl, add an encoded returnUrl query parameter for them to be returned to after the SCA session, and redirect the user.

Parameters

string $userId
$idempotencyKey

Return Value

UserEnrollmentResult

User object returned from API

Exceptions

Exception

Close(UserLegal|UserNatural|UserLegalSca|UserNaturalSca $user)

Close user (change status to CLOSED). The resource remains available for historical purposes.