FileAccess Orion

Braintree extends BasePaymentMethod
in package

Implement payment method PayPal

Tags
category

Interface function

author

Tobias Teichner webmaster@teichner.biz

since

File available since v0.95

Table of Contents

$config_file  : string
Path to config file or name
$default_config_file  : string
Path to default config file
$name  : string|null
$partial_payments  : bool
Partial payment support
$preset_file  : string
Absolute path to preset file
$settings  : object|null
Setup The local setup object
$default_mode  : string
The default mode
$gateways  : array<string|int, mixed>
Buffer the gateways
$git_repo  : array<string|int, mixed>
Array of repo instances
$mode  : string
Store the mode for this instance, can be either test or, live
__construct()  : mixed
Base construction
BasePath()  : string|null
Resolve the stripe dashboard base path
BasketProcessable()  : Result
Check if the basket can be processed using this method
CalculatePrice()  : Result
Calculate price Calculate the price for this payment method
CancelSubscription()  : Result
Cancel a certain subscription that is tied to a basket
CheckPrice()  : Result
Check if price is too high or too low
Collect()  : Result
Collect the amount of a marked basket
Config()  : Settings|null
connect
DefaultMode()  : string|null
DropCustomer()  : Result
Delete a customer
ExtractCustomerOfUser()  : array<string|int, mixed>|null
Get the customer extracted from user and the mode he is in
FetchLegacyConfiguration()  : Result
Load a legacy configuration to this instance
GetCustomerOfUser()  : Result
Extract the customer account of a user
GetDefaultSettings()  : Result
Load defaults
GetFormPreset()  : Result
preset load the common pickup settings preset for generation a form
GetSetting()  : mixed|null
Get a single setting with support fallback to defaults
GetSettings()  : Result
get load the common pickup settings object
GetSubscriptionDetails()  : Result
GitRepo()  : Git
Git object
IsTest()  : bool
Is in test system, identify by flag
MaximumPrice()  : float|null
Get the max overall price
MinimumPrice()  : float|null
Get the min overall price
Mode()  : string
Getter/Setter for mode
Name()  : string
Get the name
ParsePayPalWebhook()  : Result
Webhook event verification by postback
ParseWebhook()  : Result
PlaceOrder()  : Result
Place order call Called on place order of related basket, either pays it immediately or registers for later collection
Priority()  : int
Get the set priority
RefundAmount()  : Result
Refund a certain transaction on a linked basket
RegisterOrder()  : Result
register order callback called on register order of related basket
RegisterReplacementOrder()  : Result
Register a replacement order
RegisterUserAsCustomer()  : Result
Register a customer based on our user instance
RequireRedirect()  : bool
Requires a redirect to process?
ResolveBasketUsedMethod()  : Data|null
Get the payment method details for bank and cards
RetrieveClassicClientToken()  : Result
Classic paypal integration
RetrieveClientToken()  : Result
Trigger setup intent for new method
ReverseCancelOrder()  : mixed
Restore an existing order
SearchPlans()  : Result
Search prices table with products
SettingsValid()  : bool
Check configuration
StatusAfterDone()  : string
The status after done
StoreSettings()  : Result
Store the common settings object
SupportPartialPayments()  : bool
Has support for partial payments?
UpdateSubscriptionPayment()  : Result
UpdateSubscriptionPrice()  : Result
UpdateUserAsCustomer()  : Result
UserAddPaymentMethod()  : Result
UserPaymentMethods()  : Result
Get list of customers payment methods
extractCustomerOfId()  : array<string, string>
External id resolver with prefix support of stage
loadLocalSettings()  : void
connect load settings object from local storage
sendWarning()  : mixed
Send an email including the given parameters to admin
gateway()  : null|Gateway
Get context Get the api context
paypalToken()  : string|null

Properties

$default_config_file

Path to default config file

protected string $default_config_file = ''

$partial_payments

Partial payment support

protected bool $partial_payments = false

$preset_file

Absolute path to preset file

protected string $preset_file = ''

$settings

Setup The local setup object

protected object|null $settings = null

A setup object

$gateways

Buffer the gateways

private array<string|int, mixed> $gateways = []

$git_repo

Array of repo instances

private array<string|int, mixed> $git_repo = []

$mode

Store the mode for this instance, can be either test or, live

private string $mode = 'live'

Methods

__construct()

Base construction

public __construct() : mixed
Return values
mixed

BasePath()

Resolve the stripe dashboard base path

public BasePath([string|null $mode = null ]) : string|null
Parameters
$mode : string|null = null

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

Return values
string|null

The base path with domain and protocol

BasketProcessable()

Check if the basket can be processed using this method

public BasketProcessable(Basket $basket) : Result

This method supports all known delivery methods and recurring payments

Parameters
$basket : Basket

A system basket object

Return values
Result

A system result object

CalculatePrice()

Calculate price Calculate the price for this payment method

public CalculatePrice(array<string|int, ArticleAssignment$articles) : Result

ToDo: The delivery and packaging fee taxes should be equally split among the taxes of the shipped items

Parameters
$articles : array<string|int, ArticleAssignment>

A list of basic contents

Return values
Result

A system result object

CancelSubscription()

Cancel a certain subscription that is tied to a basket

public CancelSubscription(string $id, Basket $basket) : Result
Parameters
$id : string
$basket : Basket
Return values
Result

Collect()

Collect the amount of a marked basket

public Collect(Basket $basket) : Result
Parameters
$basket : Basket
Tags
inheritDoc
Return values
Result

Config()

connect

public Config([string|null $mode = null ]) : Settings|null

load settings object from local storage this method is cached

Parameters
$mode : string|null = null
Return values
Settings|null

DefaultMode()

public DefaultMode() : string|null
Return values
string|null

ExtractCustomerOfUser()

Get the customer extracted from user and the mode he is in

public ExtractCustomerOfUser([User|null $user = null ][, bool $fb = false ][, string|null $name = null ]) : array<string|int, mixed>|null
Parameters
$user : User|null = null
$fb : bool = false
$name : string|null = null
Return values
array<string|int, mixed>|null

FetchLegacyConfiguration()

Load a legacy configuration to this instance

public FetchLegacyConfiguration(string $hash) : Result
Parameters
$hash : string

A git hash with the used delivery method version

Return values
Result

A system result object

GetCustomerOfUser()

Extract the customer account of a user

public GetCustomerOfUser(User $user) : Result
Parameters
$user : User
Return values
Result

GetDefaultSettings()

Load defaults

public GetDefaultSettings() : Result

Load the default settings for this delivery method

Return values
Result

A system result object

GetFormPreset()

preset load the common pickup settings preset for generation a form

public GetFormPreset() : Result
Return values
Result

A system result object

GetSetting()

Get a single setting with support fallback to defaults

public GetSetting(string $name) : mixed|null
Parameters
$name : string

The key of the name

Return values
mixed|null

GetSubscriptionDetails()

public GetSubscriptionDetails(string $id, Basket $basket) : Result
Parameters
$id : string
$basket : Basket
Return values
Result

GitRepo()

Git object

public GitRepo([string $path = 'data' ]) : Git

Gets the widget git instance, either for config or, for data repo

Parameters
$path : string = 'data'

The target repo, default is data

Return values
Git

A system git object with data folder as start point

IsTest()

Is in test system, identify by flag

public IsTest(Basket $basket) : bool
Parameters
$basket : Basket
Return values
bool

MaximumPrice()

Get the max overall price

public MaximumPrice() : float|null
Return values
float|null

MinimumPrice()

Get the min overall price

public MinimumPrice() : float|null
Return values
float|null

Mode()

Getter/Setter for mode

public Mode([string|null $mode = null ]) : string
Parameters
$mode : string|null = null
Return values
string

ParsePayPalWebhook()

Webhook event verification by postback

public ParsePayPalWebhook(string $id, string $algo, string $cert_url, string $tid, string $sig, string $time, string $body, bool $fallback_verify) : Result
Parameters
$id : string

The id of the webhook

$algo : string

The algorithm (currently static)

$cert_url : string

Url to PayPal cert, must be cached and validated

$tid : string

The transmission id

$sig : string

The signature calculated by PayPal

$time : string

The request time from PayPal header

$body : string

The raw body directly fetched from

$fallback_verify : bool
Return values
Result

ParseWebhook()

public ParseWebhook(mixed $bt_signature, mixed $bt_payload) : Result
Parameters
$bt_signature : mixed
$bt_payload : mixed
Return values
Result

PlaceOrder()

Place order call Called on place order of related basket, either pays it immediately or registers for later collection

public PlaceOrder(Basket $basket, Request $request, bool $collect_later) : Result
Parameters
$basket : Basket

A system basket object

$request : Request

The related http request

$collect_later : bool

Register but collect later manually

Tags
inheritDoc
Return values
Result

A system result object

Priority()

Get the set priority

public Priority() : int
Return values
int

RefundAmount()

Refund a certain transaction on a linked basket

public RefundAmount(string $transaction, Basket $basket, float $amount) : Result
Parameters
$transaction : string
$basket : Basket
$amount : float
Return values
Result

RegisterOrder()

register order callback called on register order of related basket

public RegisterOrder(Basket $basket, Request $request) : Result
Parameters
$basket : Basket

A system basket object

$request : Request

The related http request

Tags
inheritDoc
Return values
Result

A system result object

RegisterReplacementOrder()

Register a replacement order

public RegisterReplacementOrder(Basket $basket, Basket $original[, array<string|int, mixed> $params = [] ]) : Result
Parameters
$basket : Basket

The new basket (helper entry from frontend)

$original : Basket

The original subscription basket

$params : array<string|int, mixed> = []

Extra arguments dependant on implementation

Tags
inheritDoc
Return values
Result

RegisterUserAsCustomer()

Register a customer based on our user instance

public RegisterUserAsCustomer(User $user) : Result
Parameters
$user : User
Return values
Result

RequireRedirect()

Requires a redirect to process?

public RequireRedirect() : bool
Return values
bool

ResolveBasketUsedMethod()

Get the payment method details for bank and cards

public ResolveBasketUsedMethod(Basket $basket) : Data|null
Parameters
$basket : Basket
Return values
Data|null

RetrieveClassicClientToken()

Classic paypal integration

public RetrieveClassicClientToken([User|null $user = null ]) : Result
Parameters
$user : User|null = null
Return values
Result

RetrieveClientToken()

Trigger setup intent for new method

public RetrieveClientToken([User|null $user = null ]) : Result
Parameters
$user : User|null = null
Return values
Result

ReverseCancelOrder()

Restore an existing order

public ReverseCancelOrder(Basket $basket, Basket $original) : mixed
Parameters
$basket : Basket

The new basket (helper entry from frontend)

$original : Basket

The original subscription basket

Tags
inheritDoc
Return values
mixed

SearchPlans()

Search prices table with products

public SearchPlans(int $start[, int $length = 10 ]) : Result
Parameters
$start : int
$length : int = 10
Return values
Result

SettingsValid()

Check configuration

public SettingsValid([Settings|null $cfg = null ]) : bool

Make sure that either a shop or an account portal is completely configured

Parameters
$cfg : Settings|null = null
Return values
bool

StatusAfterDone()

The status after done

public StatusAfterDone(Basket $basket) : string
Parameters
$basket : Basket
Tags
inheritDoc
Return values
string

The status when successfully

StoreSettings()

Store the common settings object

public StoreSettings(array<string|int, mixed> $values) : Result
Parameters
$values : array<string|int, mixed>

The configuration values

Return values
Result

$result A system result object

SupportPartialPayments()

Has support for partial payments?

public SupportPartialPayments() : bool
Tags
inheritDoc
Return values
bool

UpdateSubscriptionPayment()

public UpdateSubscriptionPayment(string $subscription_id, string $token, Basket $basket) : Result
Parameters
$subscription_id : string
$token : string
$basket : Basket
Return values
Result

UpdateSubscriptionPrice()

public UpdateSubscriptionPrice(Basket $basket, string $id, string $model) : Result
Parameters
$basket : Basket
$id : string
$model : string
Return values
Result

UserAddPaymentMethod()

public UserAddPaymentMethod(User $owner, string $token_or_nonce) : Result
Parameters
$owner : User
$token_or_nonce : string
Return values
Result

UserPaymentMethods()

Get list of customers payment methods

public UserPaymentMethods(User $user[, array<string|int, mixed>|null $filter = null ]) : Result
Parameters
$user : User
$filter : array<string|int, mixed>|null = null
Return values
Result

extractCustomerOfId()

External id resolver with prefix support of stage

protected extractCustomerOfId(string $ext_id) : array<string, string>
Parameters
$ext_id : string

The external id, with or without mode

Return values
array<string, string>

The parsed id

loadLocalSettings()

connect load settings object from local storage

protected loadLocalSettings() : void
Return values
void

sendWarning()

Send an email including the given parameters to admin

protected sendWarning(string|Result $message) : mixed
Parameters
$message : string|Result
Return values
mixed

gateway()

Get context Get the api context

private gateway([string|null $mode = null ]) : null|Gateway
Parameters
$mode : string|null = null
Return values
null|Gateway

The context

paypalToken()

private paypalToken([string|null $mode = null ]) : string|null
Parameters
$mode : string|null = null
Return values
string|null

Search results