class ApiSettlements extends ApiBase (View source)

Class to manage MangoPay API for settlements (API V3)

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
GetApiVersion($key)

No description

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
CreateOrUpdateMultipartObject(string $methodKey, string $file, string $fileName, string $responseClassName = null, string $entityId = null, string $idempotencyKey = null)

No description

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

Get entity object from API

from  ApiBase
object
GetObjectManyQueryParams(string $methodKey, object $responseClassName, ...$queryParams)

Get entity object from API endpoint that has a lot of query params

from  ApiBase
object
GetObjectWithPagination(string $methodKey, object $responseClassName, $pagination = null, $filter = null, $entityId = null, $clientIdRequired = true)

Get entity object from API on a request path that contains pagination and other query params

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
UpdateObject($methodKey, $entity, $responseClassName = null, $firstEntityId = null, $secondEntityId = null, $thirdEntityId = null)

Does the same thing as SaveObject above, but keeps natural order of provided entity ids when building the URL

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

No description

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

Executes a POST request

from  ApiBase
CastResponseToError(object $response)

Cast response object to an error object

from  ApiBase
CastResponseToEntity($response, $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
GenerateUploadUrl(Settlement $settlement, string $idempotencyKey = null)

Generate a pre-signed URL to which you can upload your Mangopay-format settlement file

Get(string $settlementId)

Retrieve the settlement data generated from file upload

GenerateNewUploadUrl(Settlement $settlement)

Generate a new pre-signed URL to replace the file of an existing Settlement

GetValidations(string $settlementId, Pagination $pagination = null)

Returns all the possible errors that might have occurred with a Settlement File

Cancel(string $settlementId, string $idempotencyKey = null)

Cancel settlement

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 GetApiVersion($key)

No description

Parameters

$key

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 CreateOrUpdateMultipartObject(string $methodKey, string $file, string $fileName, string $responseClassName = null, string $entityId = null, string $idempotencyKey = null)

No description

Parameters

string $methodKey

Key with request data

string $file

The file content (raw binary string)

string $fileName

The file name

string $responseClassName

Name of entity class from response

string $entityId

Optional entity identifier

string $idempotencyKey

Optional idempotency key

Return Value

object

Response data

Exceptions

Exception

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 GetObjectManyQueryParams(string $methodKey, object $responseClassName, ...$queryParams)

Get entity object from API endpoint that has a lot of query params

Parameters

string $methodKey

Key with request data

object $responseClassName

Name of entity class from response

...$queryParams

Return Value

object

Response data

Exceptions

Exception

protected object GetObjectWithPagination(string $methodKey, object $responseClassName, $pagination = null, $filter = null, $entityId = null, $clientIdRequired = true)

Get entity object from API on a request path that contains pagination and other query params

Parameters

string $methodKey

Key with request data

object $responseClassName

Name of entity class from response

$pagination
$filter
$entityId
$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 UpdateObject($methodKey, $entity, $responseClassName = null, $firstEntityId = null, $secondEntityId = null, $thirdEntityId = null)

Does the same thing as SaveObject above, but keeps natural order of provided entity ids when building the URL

Parameters

$methodKey
$entity
$responseClassName
$firstEntityId
$secondEntityId
$thirdEntityId

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

No description

Parameters

$methodKey
$entity
$responseClassName

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

Executes a POST request

Parameters

mixed $methodKey

Key with request data

mixed $entity

Entity object

mixed $responseClassName

Name of entity class from response

mixed $entityId

Entity identifier

$idempotency_key

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($response, $entityClassName, $asDependentObject = false)

Cast response object to entity object

Parameters

$response
$entityClassName
$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

Settlement GenerateUploadUrl(Settlement $settlement, string $idempotencyKey = null)

Generate a pre-signed URL to which you can upload your Mangopay-format settlement file

Parameters

Settlement $settlement

Settlement object containing 'fileName' (the name of your file, which can be anything you wish. The file extension must be .csv)

string $idempotencyKey

Idempotency key

Return Value

Settlement

Object returned by the API

Exceptions

Exception

Settlement Get(string $settlementId)

Retrieve the settlement data generated from file upload

Parameters

string $settlementId

Settlement identifier

Return Value

Settlement

Recipient object returned from API

Exceptions

Exception

Settlement GenerateNewUploadUrl(Settlement $settlement)

Generate a new pre-signed URL to replace the file of an existing Settlement

Parameters

Settlement $settlement

Settlement object containing 'fileName' (the name of your file, which can be anything you wish. The file extension must be .csv), and the 'id' (settlement identifier)

Return Value

Settlement

Object returned by the API

Exceptions

Exception

SettlementValidation GetValidations(string $settlementId, Pagination $pagination = null)

Returns all the possible errors that might have occurred with a Settlement File

Parameters

string $settlementId

Settlement identifier

Pagination $pagination

Pagination object

Return Value

SettlementValidation

Object returned by the API

Settlement Cancel(string $settlementId, string $idempotencyKey = null)

Cancel settlement

Parameters

string $settlementId

Settlement identifier

string $idempotencyKey

Idempotency key

Return Value

Settlement

Object returned by the API

Exceptions

Exception