Blesta Source Documentation

Autodebit extends AbstractTask

The autodebit automation task

Table of Contents

Properties

$date
$logger
$options
$task
$companyId
$installedGateways

Methods

__construct() Initialize a new task
loadLanguage() Attempts to load a language file for use
log() Logs the given content for this task
logComplete() Marks the log completed
run() Executes the task
setDate() Sets the date object for date calculations
isCurrentDay() Determines whether today is the day of the month given
isTimeToRun() Determines whether this task can run at the given date
resetErrors() Reset Input errors on a given object
autodebitClients() Processes each clients autodebit payments
chargeCard() Charges a client's card for each of the given currency charges
groupInvoices() Groups invoices into invoice IDs by client and $type
process() Processes the task
Properties

$date

protected Date $date

An instance of Minphp\Date\Date

$options

protected An $options = []

array of options for this task:

  • print_log True to print logged content to stdout, or false otherwise (default false)
  • cli True if this is being run via the Command-Line Interface, or false otherwise (default true)

$companyId

private int $companyId

The ID of the company this task is being processed for

$installedGateways

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

A list of installed gateways keyed by currency code

Methods

__construct()

Initialize a new task

public __construct(AutomationTypeInterface $task[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$task : AutomationTypeInterface

The raw automation task

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

An additional options necessary for the task:

  • print_log True to print logged content to stdout, or false otherwise (default false)
  • cli True if this is being run via the Command-Line Interface, or false otherwise (default true)
  • passphrase The encryption private key passphrase used for allowing payment accounts to be automatically processed

loadLanguage()

Attempts to load a language file for use

public loadLanguage([string $directory = null ][, string $langCode = null ][, string $filename = null ]) : mixed
Parameters
$directory : string = null

The path to the directory containing the language file (optional, defaults to the default language directory)

$langCode : string = null

The ISO 639-1/2 language to load the $filename for (e.g. en_us) (optional, defaults to the current language)

$filename : string = null

The name of the file (without extension) containing the file (optional, attempts to load based on the current task name)

log()

Logs the given content for this task

public log(string $content) : mixed
Parameters
$content : string

The content to log to cron

logComplete()

Marks the log completed

public logComplete() : mixed

run()

Executes the task

public run() : mixed

setDate()

Sets the date object for date calculations

public setDate(Date $date) : mixed
Parameters
$date : Date

An instance of Minphp\Date\Date

isCurrentDay()

Determines whether today is the day of the month given

protected isCurrentDay(int $day) : bool
Parameters
$day : int

The day of the month to check (i.e. in range [1,31])

Return values
bool

True if today is the current day given, false otherwise

isTimeToRun()

Determines whether this task can run at the given date

protected isTimeToRun() : bool
Return values
bool

True if it is time for the task to run, or false otherwise

resetErrors()

Reset Input errors on a given object

protected resetErrors(object $object) : mixed
Parameters
$object : object

An instance of an object containing the Input component

autodebitClients()

Processes each clients autodebit payments

private autodebitClients(array<string|int, mixed> $clients) : mixed
Parameters
$clients : array<string|int, mixed>

A list of invoices grouped by client and delivery method

chargeCard()

Charges a client's card for each of the given currency charges

private chargeCard(stdClass $client, stdClass $debitAccount, stdClass $paymentAccount, array<string|int, mixed> $currencies) : mixed
Parameters
$client : stdClass

The client this charge is for

$debitAccount : stdClass

The client's autodebit account

$paymentAccount : stdClass

The client's payment account

$currencies : array<string|int, mixed>

The charges for this client, sorted by currency

groupInvoices()

Groups invoices into invoice IDs by client and $type

private groupInvoices(array<string|int, mixed> $invoices) : array<string|int, mixed>
Parameters
$invoices : array<string|int, mixed>

A list of stdClass objects representing invoices

Return values
array<string|int, mixed>

A list of invoices grouped by client and delivery method

process()

Processes the task

private process() : mixed
Tags
subpackage

core.Automation.Tasks.Task

copyright

Copyright (c) 2018, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results