BillingController
extends BaseApiController
in package
Billing Controller.
Mock to receive the payload from eventus
Table of Contents
- IGNORED_EVENT_TYPE = ['audit.http.request', 'audit.http.response']
- $errorLogName : string
- $warningLogName : string
- $apiVersionManager : ApiVersionManager
- This service manages the api versions
- $ensureApiVersions : array<string|int, mixed>
- Array of api versions for which, the controller that extends this Base, is available
- $jobsLogName : string
- The name of the log in which we are going to log actions performed by jobs
- __construct() : mixed
- generic401JsonError() : JsonResponse
- This function can be used anywhere in the code if you need to return a standard 401 unauth response
- generic403JsonError() : JsonResponse
- This function can be used anywhere in the code if you need to return a standard 403 unauth response
- generic404JsonError() : JsonResponse
- This function can be used anywhere in the code if you need to return a standard 404 unauth response
- generic500JsonError() : JsonResponse
- This function can be used anywhere in code if there is an application error
- ingest() : JsonResponse
- Ingest action messages
- jsonResponse() : JsonResponse
- logEntry() : Activity
- logEntryWithoutModel() : Activity
- logError() : Activity
- logWarning() : Activity
- validationJsonError() : JsonResponse
- Returns a 422 error
- can() : mixed
- This function will check if the user can, given the policy for the $model, do the specified $action In case it will satisfy the requirements the $callback will be used to build a response, otherwise a json with the system wide defined response will be used as a return value.
- ensureApiVersions() : void
- This method will just save the apiVersions that have to checked.
- log() : array<string|int, Activity>
- jsonError() : JsonResponse
Constants
IGNORED_EVENT_TYPE
public
mixed
IGNORED_EVENT_TYPE
= ['audit.http.request', 'audit.http.response']
Properties
$errorLogName
public
static string
$errorLogName
= "error"
$warningLogName
public
static string
$warningLogName
= "warning"
$apiVersionManager
This service manages the api versions
protected
ApiVersionManager
$apiVersionManager
$ensureApiVersions
Array of api versions for which, the controller that extends this Base, is available
protected
array<string|int, mixed>
$ensureApiVersions
$jobsLogName
The name of the log in which we are going to log actions performed by jobs
protected
string
$jobsLogName
= "jobs"
Methods
__construct()
public
__construct(ApiVersionManager $apiVersionManager) : mixed
Parameters
- $apiVersionManager : ApiVersionManager
Return values
mixed —generic401JsonError()
This function can be used anywhere in the code if you need to return a standard 401 unauth response
public
static generic401JsonError() : JsonResponse
Return values
JsonResponse —generic403JsonError()
This function can be used anywhere in the code if you need to return a standard 403 unauth response
public
static generic403JsonError() : JsonResponse
Return values
JsonResponse —generic404JsonError()
This function can be used anywhere in the code if you need to return a standard 404 unauth response
public
static generic404JsonError() : JsonResponse
Return values
JsonResponse —generic500JsonError()
This function can be used anywhere in code if there is an application error
public
static generic500JsonError(array<string|int, mixed> $errors) : JsonResponse
Parameters
- $errors : array<string|int, mixed>
Return values
JsonResponse —ingest()
Ingest action messages
public
ingest(Request $request, string $module) : JsonResponse
Parameters
- $request : Request
- $module : string
Return values
JsonResponse —jsonResponse()
public
static jsonResponse(array<string|int, mixed> $data) : JsonResponse
Parameters
- $data : array<string|int, mixed>
Return values
JsonResponse —logEntry()
public
static logEntry(Model $model, array<string|int, mixed> $properties, string $description, string $event, string $logName) : Activity
Parameters
- $model : Model
- $properties : array<string|int, mixed>
- $description : string
- $event : string
- $logName : string
Return values
Activity —logEntryWithoutModel()
public
static logEntryWithoutModel(array<string|int, mixed> $properties, string $description, string $event, string $logName) : Activity
Parameters
- $properties : array<string|int, mixed>
- $description : string
- $event : string
- $logName : string
Return values
Activity —logError()
public
static logError(Model $model, array<string|int, mixed> $properties, string $description, string $event) : Activity
Parameters
- $model : Model
- $properties : array<string|int, mixed>
- $description : string
- $event : string
Return values
Activity —logWarning()
public
static logWarning(Model $model, array<string|int, mixed> $properties, string $description, string $event) : Activity
Parameters
- $model : Model
- $properties : array<string|int, mixed>
- $description : string
- $event : string
Return values
Activity —validationJsonError()
Returns a 422 error
public
static validationJsonError(array<string|int, mixed> $data, string $errorKey, string $message) : JsonResponse
Parameters
- $data : array<string|int, mixed>
- $errorKey : string
- $message : string
Return values
JsonResponse —can()
This function will check if the user can, given the policy for the $model, do the specified $action In case it will satisfy the requirements the $callback will be used to build a response, otherwise a json with the system wide defined response will be used as a return value.
protected
can(Request $request, string $action, string|Model $model, $callback[, bool $forceYes = false ]) : mixed
This function will also check if the current apiVersion is one of those for which the controller that extends this Base is available.
Parameters
- $request : Request
- $action : string
- $model : string|Model
- $callback :
- $forceYes : bool = false
-
If this parameter is true this function will not check the policy
Return values
mixed —ensureApiVersions()
This method will just save the apiVersions that have to checked.
protected
ensureApiVersions(array<string|int, mixed> $versions) : void
The real check will be done in the "can" function
Parameters
- $versions : array<string|int, mixed>
Return values
void —log()
protected
log(Model|array<string|int, mixed> $models, array<string|int, mixed> $properties, string $description[, null $logName = null ]) : array<string|int, Activity>
Parameters
- $models : Model|array<string|int, mixed>
- $properties : array<string|int, mixed>
- $description : string
- $logName : null = null
Return values
array<string|int, Activity> —jsonError()
private
static jsonError(int $code, array<string|int, mixed> $errors) : JsonResponse
Parameters
- $code : int
- $errors : array<string|int, mixed>