Documentation

OAuthTemplates extends AutoService
in package

Automatically link an OAuth token with a PaymentProcessor.

Usage:

  1. In the OAuthProvider JSON, specify the templates['PaymentProcessor']. This is a list of PaymentProcessor properties to initialize. Ex: ['user_name' => '{{token.raw.stripe_publishable_key}}', 'password' => '{{token.access_token}}']
  2. Initiate OAuth process and set the relevant payment-processor. Ex: OAuthClient::authorizationCode()->setTag('PaymentProcessor:123')->...execute()
  3. Whenever this token is initialized or refreshed, this helper will update the user_name and password for PaymentProcessor:123.
Tags
service

oauth_client.templates

Table of Contents

Methods

evaluate()  : array<string|int, mixed>
Evaluate an array and interpolating bits of data.
getByClientId()  : array<string|int, mixed>|null
Determine which (if any) template is available for a given client.

Methods

evaluate()

Evaluate an array and interpolating bits of data.

public evaluate(array<string|int, mixed> $template, array<string|int, mixed> $vars) : array<string|int, mixed>
Parameters
$template : array<string|int, mixed>

List of key-value expressions. Ex: ['name' => '{{person.first}} {{person.last}}'] Expressions begin with the dotted-name of a variable. Optionally, the value may be piped through other functions

$vars : array<string|int, mixed>

Array tree of data to interpolate.

Return values
array<string|int, mixed>

The template array, with '{{...}}' expressions evaluated.

getByClientId()

Determine which (if any) template is available for a given client.

public getByClientId(int $clientId, string $template) : array<string|int, mixed>|null

TODO: Support contact and mail-settings. Migrate 'contactTemplate' and 'mailSettingsTemplate' to generic 'templates'.

Parameters
$clientId : int

Local ID of the OAuthClient

$template : string

Symbolic name of the template.

Return values
array<string|int, mixed>|null

        
On this page

Search results