FileAccess Orion

BsPayOne extends BasePaymentMethod
in package

Implement payment method for PayOne

Tags
category

Interface function

author

Tobias Teichner webmaster@teichner.biz

since

File available since v3.30.10

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
$api_version  : string
Used api version
$debug  : bool
The debug mode
$default_mode  : string
The default mode
$gateway  : string
Path to PayOne api
$git_repo  : array<string|int, mixed>
Array of repo instances
$map  : array<string|int, mixed>
Map of date jump mark identification
$max_id_length  : int
Max id length
$mode  : string
Store the mode for this instance, can be either test or, live
$verbose  : bool
__construct()  : mixed
BsPayOne constructor.
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 subscription
Capture()  : Result
Capture callback
ChangeAccessClearingType()  : Result
Change the clearing type on demand
CheckPrice()  : Result
Check if price is too high or too low
CheckRequestPayload()  : array<string|int, mixed>|null
Get payload for client
Collect()  : Result
Collect the amount of a marked basket
Config()  : Settings|null
connect
DefaultMode()  : string|null
ExternalTransactionDocument()  : Result
Get bill of a subscription
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
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
GetUser()  : Result
Get user info from payone
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
PayPalGet()  : Result
Called when returning successful from paypal page
PlaceOrder()  : Result
Place the order using credit card data
Priority()  : int
Get the set priority
RecreateSubscriptionByBasket()  : Result
RefundAmount()  : Result
Refund a certain amount from transaction
RegisterOrder()  : Result
register order callback called on register order of related basket
RegisterReplacementOrder()  : Result
Switch to different subscription model
RequireRedirect()  : bool
Requires a redirect to process?
ResolveBasketUsedMethod()  : Data|null
ReverseCancelBasket()  : Result
ReverseCancelOrder()  : Result
Restore an order
SettingsValid()  : bool
Check configuration
StatusAfterDone()  : string
The status after done
StoreSettings()  : Result
Store the common settings object
SupportPartialPayments()  : bool
Has support for partial payments?
ThreeDIframe()  : bool
Expose 3d secure config
UnlockBasket()  : Result
Unlock basket in payone
UpdateAccessProduct()  : Result
Send an update access price request based on a certain date
UpdateBankData()  : Result
Update bank data
UpdateCreditCard()  : Result
Update card data on demand
UpdateSubscriptionModel()  : Result
Update model Set new product id, change will transit internally at the time payone calculates it
UpdateUser()  : mixed
Called on after save of customer
extractCustomerOfId()  : array<string, string>
External id resolver with prefix support of stage
loadLocalSettings()  : void
load settings object from local storage
sendWarning()  : mixed
Send an email including the given parameters to admin
addArticles()  : int
Add articles to params
addCustomerInfo()  : mixed
Add information about the customer
addHash()  : mixed
Add hash based on array items to list
addVouchers()  : void
Add vouchers
buildPreAuthoriseRequest()  : mixed
defaultRequestParams()  : array<string|int, mixed>
Prepare the default request parameters
detectClearingType()  : mixed
Detect and register clearing type information
mapInterval()  : mixed|string
Map interval to string
parse()  : array<string|int, mixed>
Pars http query
request()  : Result
Send the request to the api
shortId()  : false|string
Create a short id

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

$api_version

Used api version

private string $api_version = '3.11'

$debug

The debug mode

private bool $debug = FAA_LOG_DEBUG_JOB

$gateway

Path to PayOne api

private string $gateway = 'https://api.pay1.de/post-gateway/'

$git_repo

Array of repo instances

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

$map

Map of date jump mark identification

private array<string|int, mixed> $map = array('month' => 'M', 'year' => 'Y', 'day' => 'D')

$max_id_length

Max id length

private int $max_id_length = 13

$mode

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

private string $mode = 'live'

Methods

__construct()

BsPayOne constructor.

public __construct() : mixed
Return values
mixed

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 subscription

public CancelSubscription(scalar $id) : Result
Parameters
$id : scalar

The remote access id

Return values
Result

The result object

Capture()

Capture callback

public Capture(Basket $basket, array<string|int, mixed> $data, string $mode) : Result

Used in the transaction handler to capture the payment that has been pre authorised first. May be called multiple times when several payments wehere given or, it is linked to an recurring payment.

Parameters
$basket : Basket

The basket object to handle

$data : array<string|int, mixed>

The post request data sequencenumber string Sequence number for this transaction within the payment process (1..n) txid string The pay one transaction id

$mode : string

The mode, either shop or account

Return values
Result

A system result object

ChangeAccessClearingType()

Change the clearing type on demand

public ChangeAccessClearingType(int $id,  $user_id, string $type) : Result
Parameters
$id : int

The access id in payone

$user_id :
$type : string

The type to change to either elv or, cc

Return values
Result

CheckRequestPayload()

Get payload for client

public CheckRequestPayload([bool $shop = true ]) : array<string|int, mixed>|null

Get the payload for client lib to check for validity of credit cards

Parameters
$shop : bool = true
Return values
array<string|int, mixed>|null

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() : Settings|null

load settings object from local storage this method is cached

Return values
Settings|null

DefaultMode()

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

ExternalTransactionDocument()

Get bill of a subscription

public ExternalTransactionDocument(array<string|int, mixed> &$transaction[, Basket $basket = null ]) : Result
Parameters
$transaction : array<string|int, mixed>
$basket : Basket = null
Return values
Result

The result object

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

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

GetUser()

Get user info from payone

public GetUser(scalar $id[, string|null $mode = null ]) : Result
Parameters
$id : scalar
$mode : string|null = null
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

PayPalGet()

Called when returning successful from paypal page

public PayPalGet(Basket $basket) : Result

Will trigger the second call to paypal to get the payment details and then it will call the pre authorise endpoint using the paypal mode

Parameters
$basket : Basket

The fetched basket object

Return values
Result

A system result object

PlaceOrder()

Place the order using credit card data

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

This method uses similar information than paypal but requires the cc.pseudo_card_pan to be present in the request body as well as the cc.truncated_card_pan. It supports recurring payments for single article baskets and full feature for regular baskets

Parameters
$basket : Basket
$request : Request
$collect_later : bool
Return values
Result

Priority()

Get the set priority

public Priority() : int
Return values
int

RecreateSubscriptionByBasket()

public RecreateSubscriptionByBasket(Basket $basket) : Result
Parameters
$basket : Basket
Return values
Result

RefundAmount()

Refund a certain amount from transaction

public RefundAmount(string $id, string $basket_id, float $amount[, int|string $seq = 2 ][, bool $with_debit = false ]) : Result
Parameters
$id : string

The PayOne transaction id

$basket_id : string

Our basket id

$amount : float

The amount as float in euro

$seq : int|string = 2

Additional sequence number

$with_debit : bool = false

Use debit instead of refund operation

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()

Switch to different subscription model

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

RequireRedirect()

Requires a redirect to process?

public RequireRedirect() : bool
Return values
bool

ResolveBasketUsedMethod()

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

ReverseCancelBasket()

public ReverseCancelBasket(Basket $basket) : Result
Parameters
$basket : Basket
Return values
Result

ReverseCancelOrder()

Restore an order

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

The new basket (helper entry from frontend)

$original : Basket

The original subscription basket

Return values
Result

SettingsValid()

Check configuration

public SettingsValid() : bool

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

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

ThreeDIframe()

Expose 3d secure config

public ThreeDIframe() : bool

Show the upstream caller whether the 3d secure iframe mode is enabled or, not

Return values
bool

UnlockBasket()

Unlock basket in payone

public UnlockBasket(Basket $basket[, bool $ignore_status_reason = false ]) : Result
Parameters
$basket : Basket

The basket object to unlock

$ignore_status_reason : bool = false

Ignore certain error codes

Return values
Result

UpdateAccessProduct()

Send an update access price request based on a certain date

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

The basket to update

$live : bool = true

Active external transition

$date : string|null = null

Date of transition

Return values
Result

A system result

UpdateBankData()

Update bank data

public UpdateBankData(int $id, array<string|int, mixed> $data) : Result
Parameters
$id : int

The user id in payone

$data : array<string|int, mixed>

The new bank data mostly the iban is required

Return values
Result

A system result

UpdateCreditCard()

Update card data on demand

public UpdateCreditCard(string|int $id, array<string|int, mixed> $data) : Result
Parameters
$id : string|int

The user id in payone

$data : array<string|int, mixed>

The new credit card data namely the pseudo-card-pan

Return values
Result

A system result

UpdateSubscriptionModel()

Update model Set new product id, change will transit internally at the time payone calculates it

public UpdateSubscriptionModel( $access_id,  $product_id, Basket $basket) : Result
Parameters
$access_id :
$product_id :
$basket : Basket
Return values
Result

UpdateUser()

Called on after save of customer

public UpdateUser(User $owner, Result &$result[, bool $all_errors = false ]) : mixed
Parameters
$owner : User

A system user

$result : Result

A hook result object

$all_errors : bool = false
Return values
mixed

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()

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

addArticles()

Add articles to params

private addArticles(array<string|int, mixed> &$params, array<string|int, Article$articles, string $l[, string $prefix = '' ][, null|string $date = null ][, bool $no_empty_items = false ]) : int
Parameters
$params : array<string|int, mixed>

The parsed parameters so far

$articles : array<string|int, Article>

The list of articles

$l : string

The target language

$prefix : string = ''

When given the goods type wont be included

$date : null|string = null

The date for the price

$no_empty_items : bool = false

No empty / 0.00€ items e.g. for paypal these are problematic

Return values
int

The count of articles added

addCustomerInfo()

Add information about the customer

private addCustomerInfo(array<string|int, mixed> &$params, array<string|int, mixed> $bill, array<string|int, mixed> $delivery[, string $l = FAA_DEFAULT_LANGUAGE ]) : mixed
Parameters
$params : array<string|int, mixed>

The request to payone

$bill : array<string|int, mixed>

The billing data

$delivery : array<string|int, mixed>

The delivery address or, null

$l : string = FAA_DEFAULT_LANGUAGE

The language

Return values
mixed

addHash()

Add hash based on array items to list

private addHash(array<string|int, mixed> &$data[, bool $md5 = false ][, bool $shop = true ]) : mixed
Parameters
$data : array<string|int, mixed>

The data

$md5 : bool = false

Use mdf hash algorithm

$shop : bool = true

Is for shop

Return values
mixed

addVouchers()

Add vouchers

private addVouchers(array<string|int, mixed> &$params, array<string|int, Voucher$vouchers, string $l, int $index) : void
Parameters
$params : array<string|int, mixed>

The parsed parameters so far

$vouchers : array<string|int, Voucher>

The list of vouchers

$l : string

The target language

$index : int

Th items count before

Return values
void

The vouchers count

buildPreAuthoriseRequest()

private buildPreAuthoriseRequest(bool $shop, Basket $basket, array<string|int, mixed> &$params, User $owner, string $l, array<string|int, Article$list[, bool $no_empty_items = false ]) : mixed
Parameters
$shop : bool

Is shop or account/subscription

$basket : Basket

The currently processed basket

$params : array<string|int, mixed>

The list of params

$owner : User

The owner

$l : string

Language for this basket

$list : array<string|int, Article>

The list of articles

$no_empty_items : bool = false

No empty / 0.00€ items e.g. for paypal these are problematic

Return values
mixed

defaultRequestParams()

Prepare the default request parameters

private defaultRequestParams([string|null $mode = null ]) : array<string|int, mixed>
Parameters
$mode : string|null = null
Return values
array<string|int, mixed>

detectClearingType()

Detect and register clearing type information

private detectClearingType(array<string|int, mixed> $prepared_data, array<string|int, mixed> &$params, Basket $basket, Result $result) : mixed
Parameters
$prepared_data : array<string|int, mixed>

The request body

$params : array<string|int, mixed>

The payone request data

$basket : Basket

The current basket object

$result : Result

A system result type

Return values
mixed

mapInterval()

Map interval to string

private mapInterval( $key) : mixed|string
Parameters
$key :
Return values
mixed|string

parse()

Pars http query

private parse(string $str) : array<string|int, mixed>
Parameters
$str : string

The post/query string

Return values
array<string|int, mixed>

request()

Send the request to the api

private request( $params[, null $path = null ][, null $header = null ]) : Result
Parameters
$params :
$path : null = null
$header : null = null
Return values
Result

shortId()

Create a short id

private shortId(string $id) : false|string
Parameters
$id : string
Return values
false|string

Search results