Cash
extends BasePaymentMethod
in package
Implement payment method
Tags
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
- $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
- Cash constructor.
- BasketProcessable() : Result
- In cash basically everything can be purchased but this needs manual effort
- CalculatePrice() : Result
- Calculate price Calculate the price for this payment method
- CheckPrice() : Result
- Check if price is too high or too low
- Collect() : Result
- Collect the amount of a marked basket
- Config() : object|null
- connect
- DefaultMode() : string|null
- 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
- 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
- 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
- RegisterOrder() : Result
- register order callback called on register order of related basket
- RegisterReplacementOrder() : Result
- Register a replacement order
- RequireRedirect() : bool
- Requires a redirect to process?
- ResolveBasketUsedMethod() : Data|null
- Get the payment method details for bank and cards
- ReverseCancelOrder() : mixed
- Restore an existing order
- StatusAfterDone() : string
- The status after done
- StoreSettings() : Result
- Store the common settings object
- SupportPartialPayments() : bool
- Has support for partial payments?
- 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
Properties
$config_file
Path to config file or name
protected
string
$config_file
= ''
$default_config_file
Path to default config file
protected
string
$default_config_file
= ''
$name
protected
string|null
$name
= null
$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
$default_mode
The default mode
private
string
$default_mode
= 'live'
$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()
Cash constructor.
public
__construct() : mixed
Return values
mixed —BasketProcessable()
In cash basically everything can be purchased but this needs manual effort
public
BasketProcessable(Basket $basket) : Result
Parameters
- $basket : Basket
Return values
Result —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
CheckPrice()
Check if price is too high or too low
public
CheckPrice(Basket $basket, PriceSummary $snapshot, Result $res) : Result
Parameters
- $basket : Basket
- $snapshot : PriceSummary
- $res : Result
Return values
Result —Collect()
Collect the amount of a marked basket
public
Collect(Basket $basket) : Result
Parameters
- $basket : Basket
Tags
Return values
Result —Config()
connect
public
Config() : object|null
load settings object from local storage this method is cached
Return values
object|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
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 —GetSettings()
get load the common pickup settings object
public
GetSettings() : Result
Return values
Result —A system result object
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 —Name()
Get the name
public
Name() : string
Return values
string —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
Return values
Result —A system result object
Priority()
Get the set priority
public
Priority() : int
Return values
int —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
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
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 —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
Return values
mixed —StatusAfterDone()
The status after done
public
StatusAfterDone(Basket $basket) : string
Parameters
- $basket : Basket
Tags
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
Return values
bool —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