FileAccess Orion

Handler extends SecuredServerPlugin
in package

Implement Stripe handler

This class provides interfaces for Stripe interactions

Tags
category

Plugin

author

Tobias Teichner webmaster@teichner.biz

since

File available since v6.16.0

Table of Contents

$config  : stdClass|null
Buffer for configuration
$defaultPermissions  : array<string|int, mixed>
The default permission set
$dir  : string
The implementation directory
$name  : string
Name of the plugin
$handler  : Stripe|null
The Stripe handler
$verbose  : bool
__construct()  : mixed
Handler constructor.
BasketChangeStatus()  : void
Called on basket status change, reaction is needed on cancel
GetAccessList()  : array<string|int, mixed>
Handler()  : Stripe|null
Get handler instance
Name()  : string
OnAddOrUpdateContent()  : void
Called on save an object
OnAfterBasketRegisterUser()  : void
OnAfterMarkSubscriptionForSwitch()  : void
OnAfterUserAdminSave()  : void
Special operation when user was changed by admin and the subscription start date needs to change
OnAfterUserLoginByPassword()  : void
Called after registration of session, make sure to delete cached methods
OnArticleGetRawPrice()  : void
OnBeforeMarkSubscriptionForSwitch()  : void
OnCheckBasketTransitions()  : void
Process potentially automatic changes on baskets
OnCommandLineInterfaceCall()  : void
Cli to fix and check relation id duplications
OnDeleteContent()  : void
React on basket delete
OnGetEntityAttributes()  : void
Add input field to core object
OnMapArrayIncludes()  : void
Add some scripts to the backend to interact with system frontend hooks
OnMarkSubscriptionForTermination()  : void
Register a plan to terminate the subscription at the nex possible end
OnRegisterWidgetIncludes()  : void
Add custom scripts to certain widgets when present
OnSubscriptionChangePaymentMethod()  : void
OnSubscriptionSwitch()  : void
Handle a subscription model change operation
RegisterHooks()  : array<string|int, mixed>
register system hooks Register a set of handler functions to be called in certain positions.
RegisterPublicAssetBasePath()  : void
Provide deep link access to js template files
RequestOnUrlParsed()  : mixed
ServeRequest()  : mixed
Serve request
settings()  : Result|object
Get/Set the settings
SetupTemplate()  : mixed
UpdateAccessProduct()  : Result
Send an update access price request based on a certain date If no date is given use the next regular phase
handleConfig()  : void
Handle the context requests
hasAccess()  : bool
Check if endpoint is accessible for this user group
isInContext()  : bool
Is in certain context?
setupAttributes()  : void
Set up the permission attribute table
basePath()  : string
Resolve the stripe dashboard base path
correctAnchorPoint()  : Result
createFromOriginal()  : Result
handleAttachUserPaymentMethod()  : void
Attach method to customer
handleConfigPreset()  : mixed
Handle the context requests
handleEndTrail()  : void
handleListCustomer()  : void
Get customer data by customer id
handleListUserInvoices()  : void
Fetch invoices of a user
handleListUserPaymentMethods()  : void
Get users payment methods
handlePriceFetch()  : void
Get resolved price
handlePriceList()  : void
Get list of prices
handleRegisterAsConnected()  : void
handleRegisterCustomer()  : mixed
Register customer or get relevant customer object when linked
handleReplacePSP()  : void
Replace the payment service provider with stripe
handleSettings()  : mixed
handleSetupIntent()  : mixed
handleSetupIntentComplete()  : void
Complete a setup intent
handleUsersCompanies()  : void
handleViewBasketPayment()  : void
View single payment by payment intent id
handleViewBasketRefunds()  : void
Get list of known refunds
handleWebhook()  : Result
Handle the web hook event
mapInvoice()  : array<string|int, mixed>
Convert invoice to our object scheme
mapPaymentMethods()  : void
Map the found payment methods to our structures signature

Properties

$defaultPermissions

The default permission set

protected array<string|int, mixed> $defaultPermissions = [['endpoint' => 'config', 'root' => true, 'admin' => true]]

$handler

The Stripe handler

private Stripe|null $handler = null

?Stripe

$verbose

private bool $verbose = false

Methods

__construct()

Handler constructor.

public __construct() : mixed
Return values
mixed

BasketChangeStatus()

Called on basket status change, reaction is needed on cancel

public BasketChangeStatus( $req) : void
Parameters
$req :

HookArgument

Return values
void

GetAccessList()

public GetAccessList(User $user) : array<string|int, mixed>
Parameters
$user : User
Return values
array<string|int, mixed>

OnAddOrUpdateContent()

Called on save an object

public OnAddOrUpdateContent(HookArgument $param) : void

Update the user data in stripe on users modification

Parameters
$param : HookArgument

A hook argument with user and result

Return values
void

OnAfterMarkSubscriptionForSwitch()

public OnAfterMarkSubscriptionForSwitch(HookArgument $param) : void
Parameters
$param : HookArgument
Return values
void

OnAfterUserAdminSave()

Special operation when user was changed by admin and the subscription start date needs to change

public OnAfterUserAdminSave(HookArgument $param) : void
Parameters
$param : HookArgument
Return values
void

OnAfterUserLoginByPassword()

Called after registration of session, make sure to delete cached methods

public OnAfterUserLoginByPassword(HookArgument $param) : void
Parameters
$param : HookArgument
Return values
void

OnBeforeMarkSubscriptionForSwitch()

public OnBeforeMarkSubscriptionForSwitch(HookArgument $param) : void
Parameters
$param : HookArgument
Return values
void

OnCheckBasketTransitions()

Process potentially automatic changes on baskets

public OnCheckBasketTransitions(HookArgument $param) : void
Parameters
$param : HookArgument
Return values
void

OnCommandLineInterfaceCall()

Cli to fix and check relation id duplications

public OnCommandLineInterfaceCall( $param) : void
Parameters
$param :

HookArgument

Tags
throws
Exception
Return values
void

OnDeleteContent()

React on basket delete

public OnDeleteContent( $param) : void
Parameters
$param :

HookArgument

Return values
void

OnGetEntityAttributes()

Add input field to core object

public OnGetEntityAttributes(HookArgument $reference) : void
Parameters
$reference : HookArgument
Return values
void

OnMapArrayIncludes()

Add some scripts to the backend to interact with system frontend hooks

public OnMapArrayIncludes( $param) : void
Parameters
$param :

HookArgument

Return values
void

OnMarkSubscriptionForTermination()

Register a plan to terminate the subscription at the nex possible end

public OnMarkSubscriptionForTermination(HookArgument $param) : void
Parameters
$param : HookArgument
Return values
void

OnRegisterWidgetIncludes()

Add custom scripts to certain widgets when present

public OnRegisterWidgetIncludes( $param) : void
Parameters
$param :

HookArgument

Return values
void

OnSubscriptionChangePaymentMethod()

public OnSubscriptionChangePaymentMethod(HookArgument $param) : void
Parameters
$param : HookArgument
Return values
void

OnSubscriptionSwitch()

Handle a subscription model change operation

public OnSubscriptionSwitch(HookArgument $param) : void
Parameters
$param : HookArgument
Tags
throws
Exception
Return values
void

RegisterHooks()

register system hooks Register a set of handler functions to be called in certain positions.

public RegisterHooks() : array<string|int, mixed>
Return values
array<string|int, mixed>

A list of hooks to register

RegisterPublicAssetBasePath()

Provide deep link access to js template files

public RegisterPublicAssetBasePath(HookArgument $reference) : void
Parameters
$reference : HookArgument
Return values
void

ServeRequest()

Serve request

public ServeRequest(Request $request, Response $response) : mixed

Serve the request and return appropriate result.

Parameters
$request : Request

The http request object

$response : Response
Return values
mixed

settings()

Get/Set the settings

public settings([null|object $new = null ]) : Result|object

This method is cached per instance

Parameters
$new : null|object = null

New set of settings to store

Return values
Result|object

SetupTemplate()

public SetupTemplate([mixed $data = null ]) : mixed
Parameters
$data : mixed = null
Tags
inheritDoc
Return values
mixed

UpdateAccessProduct()

Send an update access price request based on a certain date If no date is given use the next regular phase

public UpdateAccessProduct(Basket $basket[, bool $live = true ][, string|null $date = null ][, string|null $free_until_date = null ]) : Result
Parameters
$basket : Basket

The basket to update

$live : bool = true

Active external transition

$date : string|null = null

Date of transition

$free_until_date : string|null = null
Return values
Result

A system result

hasAccess()

Check if endpoint is accessible for this user group

protected hasAccess(string|array<string|int, string> $right[, Response|null $response = null ][, User|null $user = null ]) : bool
Parameters
$right : string|array<string|int, string>
$response : Response|null = null
$user : User|null = null
Return values
bool

isInContext()

Is in certain context?

protected isInContext(HookArgument $param, string $type, string $widget) : bool
Parameters
$param : HookArgument

The hook argument

$type : string

The type can be scss, css and js to search in widgets or _ to search in global includes

$widget : string

The widget to search for

Return values
bool

setupAttributes()

Set up the permission attribute table

protected setupAttributes( &$attributes,  $l) : void
Parameters
$attributes :

array List of attributes

$l :

string The language

Return values
void

basePath()

Resolve the stripe dashboard base path

private basePath([string|null $mode = null ]) : string
Parameters
$mode : string|null = null

Either test or live, when not set we use the configured default

Return values
string

The base path with domain and protocol

correctAnchorPoint()

private correctAnchorPoint(Basket $subs[, bool $exec = true ]) : Result
Parameters
$subs : Basket
$exec : bool = true
Return values
Result

createFromOriginal()

private createFromOriginal(Basket $subs) : Result
Parameters
$subs : Basket
Return values
Result

handleAttachUserPaymentMethod()

Attach method to customer

private handleAttachUserPaymentMethod(string $id, string $method_id, Response $resp) : void
Parameters
$id : string
$method_id : string
$resp : Response
Return values
void

handleConfigPreset()

Handle the context requests

private handleConfigPreset(Request $request, Response $response) : mixed
Parameters
$request : Request
$response : Response
Return values
mixed

handleEndTrail()

private handleEndTrail(User|null $user, Response $response) : void
Parameters
$user : User|null
$response : Response
Return values
void

handleListCustomer()

Get customer data by customer id

private handleListCustomer(string $id, Response $resp) : void
Parameters
$id : string
$resp : Response
Return values
void

handleListUserPaymentMethods()

Get users payment methods

private handleListUserPaymentMethods(string $id, Response $resp, Request $request[, bool $self = false ]) : void

Will add temporarily prepared methods as well

Parameters
$id : string
$resp : Response
$request : Request
$self : bool = false
Return values
void

handleRegisterAsConnected()

private handleRegisterAsConnected(string $action, string $id, Response $response, Request $request) : void
Parameters
$action : string
$id : string
$response : Response
$request : Request
Return values
void

handleRegisterCustomer()

Register customer or get relevant customer object when linked

private handleRegisterCustomer(Request $request, string $id, Response $resp) : mixed
Parameters
$request : Request
$id : string
$resp : Response
Return values
mixed

handleReplacePSP()

Replace the payment service provider with stripe

private handleReplacePSP(string $id, array<string|int, mixed> $body, Response $resp) : void

Only as customer and only for subscriptions

Parameters
$id : string

The Original basket id

$body : array<string|int, mixed>

The payload from form like register

$resp : Response

Response object

Return values
void

handleSettings()

private handleSettings(Request $request, string $mode, Response $resp) : mixed
Parameters
$request : Request
$mode : string
$resp : Response
Return values
mixed

handleSetupIntent()

private handleSetupIntent(string|null $id, Response $resp) : mixed
Parameters
$id : string|null
$resp : Response
Return values
mixed

handleSetupIntentComplete()

Complete a setup intent

private handleSetupIntentComplete(Request $request, string|null $id, Response $resp) : void

Either link a payment method to a customer or, make sure it is logged in session for further use

Parameters
$request : Request

The request object

$id : string|null

The user id or null

$resp : Response

The response

Return values
void

handleViewBasketPayment()

View single payment by payment intent id

private handleViewBasketPayment(string|null $id, Response $resp) : void
Parameters
$id : string|null
$resp : Response
Return values
void

handleViewBasketRefunds()

Get list of known refunds

private handleViewBasketRefunds(string $id, Response $resp) : void
Parameters
$id : string
$resp : Response
Return values
void

handleWebhook()

Handle the web hook event

private handleWebhook(Event $event) : Result
Parameters
$event : Event
Return values
Result

mapInvoice()

Convert invoice to our object scheme

private mapInvoice(Invoice $given) : array<string|int, mixed>
Parameters
$given : Invoice
Return values
array<string|int, mixed>

mapPaymentMethods()

Map the found payment methods to our structures signature

private mapPaymentMethods(Result $res, Response $resp) : void
Parameters
$res : Result

The fetch result

$resp : Response

The response to write to

Return values
void

Search results