Blesta Source Documentation

PaymentReminders extends AbstractTask

The payment_reminders automation task

Table of Contents

Properties

$date
$logger
$options
$task
$companyId

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
getAutodebitAccount() Gets the given client's default autodebit account
process() Processes the task
sendAutodebitNotice() Sends an autodebit notice to the given contact regarding this invoice
sendNotices() Send an autodebit or payment notice for the given client and invoice
sendPaymentNotice() Sends a payment notice to the given contact regarding this invoice
shouldSendReminder() Determines whether or not to send a payment reminder notice for an invoice
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

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)
  • timezone The timezone of the company for which this task is being processed
  • client_uri The URI of the client interface

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

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

getAutodebitAccount()

Gets the given client's default autodebit account

private getAutodebitAccount(stdClass $client, array<string|int, mixed> $autodebit_accounts, array<string|int, mixed> $ccTypes, array<string|int, mixed> $achTypes) : stdClass
Parameters
$client : stdClass

The client to whom the account belongs

$autodebit_accounts : array<string|int, mixed>

A list of already known autodebit accounts

$ccTypes : array<string|int, mixed>

A list of credit card account types

$achTypes : array<string|int, mixed>

A list of ach account types

Return values
stdClass

An object representing the client's autodebit account

sendAutodebitNotice()

Sends an autodebit notice to the given contact regarding this invoice

private sendAutodebitNotice(stdClass $client, stdClass $contact, stdClass $invoice[, mixed $autodebit_account = null ]) : mixed
Parameters
$client : stdClass

The client object

$contact : stdClass

The contact object representing one of the client's contacts

$invoice : stdClass

The invoice to send a payment notice about, belonging to this client

$autodebit_account : mixed = null
Tags
see
Cron::paymentReminders()
Return values
mixed

An array of errors on failure, or false on success

sendNotices()

Send an autodebit or payment notice for the given client and invoice

private sendNotices(stdClass $client, stdClass $invoice, stdClass $autodebit_account[, string $action = null ]) : mixed
Parameters
$client : stdClass

The client to send this notice to

$invoice : stdClass

The invoice this notice is being sent for

$autodebit_account : stdClass

The client's autodebit account

$action : string = null

The type of payment notice to send (optional)

sendPaymentNotice()

Sends a payment notice to the given contact regarding this invoice

private sendPaymentNotice(string $action, stdClass $client, stdClass $contact, stdClass $invoice[, mixed $autodebit_account = null ]) : mixed
Parameters
$action : string

The payment notice setting (i.e. one of "notice1", "notice2", "notice3")

$client : stdClass

The client object

$contact : stdClass

The contact object representing one of the client's contacts

$invoice : stdClass

The invoice to send a payment notice about, belonging to this client

$autodebit_account : mixed = null
Tags
see
Cron::paymentReminders()
Return values
mixed

An array of errors on failure, or false on success

shouldSendReminder()

Determines whether or not to send a payment reminder notice for an invoice

private shouldSendReminder(stdClass $invoice, stdClass $client, string $action) : bool
Parameters
$invoice : stdClass

An invoice object

$client : stdClass

The client object that the invoice belongs to

$action : string

The email notice action

Tags
see
Cron::paymentReminders()
Return values
bool

True if a reminder should be sent out for this invoice, false otherwise

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