class CRM_Contribute_BAO_Contribution_Utils

Methods

static array
processConfirm(CRM_Core_Form $form, array $paymentParams, int $contactID, int $financialTypeID, bool $isTest, bool $isRecur)

Process payment after confirmation.

static bool
isPaymentTransaction(CRM_Core_Form $form)

Is a payment being made.

static array
contributionChartMonthly(int $param)

Get the contribution details by month of the year.

static array
contributionChartYearly()

Get the contribution details by year.

static 
createCMSUser(array $params, int $contactID, $mail)

No description

static bool
_fillCommonParams(array $params, string $type = 'paypal')

No description

static mixed
getFirstLastDetails(int $contactID)

No description

static array
calculateTaxAmount(float $amount, float $taxRate, bool $ugWeDoNotKnowIfItNeedsCleaning_Help = FALSE)

Calculate the tax amount based on given tax rate.

static float
formatAmount(float $amount, int $decimals = 2)

Format monetary amount: round and return to desired decimal place CRM-20145

static array
getContributionStatuses(string $usedFor = 'contribution', int $id = NULL)

Get contribution statuses by entity e.g. contribution, membership or 'participant'

static 
overrideDefaultCurrency(array $params)

CRM-8254 / CRM-6907 - override default currency if applicable these lines exist to support a non-default currency on the form but are probably obsolete & meddling wth the defaultCurrency is not the right approach.

static string
getContributionPageTitle(int $contribution_page_id)

Get either the public title if set or the title of a contribution page for use in workflow message template.

Details

at line 56
static array processConfirm(CRM_Core_Form $form, array $paymentParams, int $contactID, int $financialTypeID, bool $isTest, bool $isRecur)

Process payment after confirmation.

Parameters

CRM_Core_Form $form Form object.
array $paymentParams Array with payment related key. value pairs
int $contactID Contact id.
int $financialTypeID Financial type id.
bool $isTest
bool $isRecur

Return Value

array associated array

Exceptions

CRM_Core_Exception
Exception

at line 255
static protected bool isPaymentTransaction(CRM_Core_Form $form)

Is a payment being made.

Note that setting is_monetary on the form is somewhat legacy and the behaviour around this setting is confusing. It would be preferable to look for the amount only (assuming this cannot refer to payment in goats or other non-monetary currency

Parameters

CRM_Core_Form $form

Return Value

bool

at line 268
static array contributionChartMonthly(int $param)

Get the contribution details by month of the year.

Parameters

int $param Year.

Return Value

array associated array

at line 307
static array contributionChartYearly()

Get the contribution details by year.

Return Value

array associated array

at line 347
static createCMSUser(array $params, int $contactID, $mail)

Parameters

array $params
int $contactID
$mail

at line 370
static bool _fillCommonParams(array $params, string $type = 'paypal')

Parameters

array $params
string $type

Return Value

bool

at line 441
static mixed getFirstLastDetails(int $contactID)

Parameters

int $contactID

Return Value

mixed

at line 502
static array calculateTaxAmount(float $amount, float $taxRate, bool $ugWeDoNotKnowIfItNeedsCleaning_Help = FALSE)

Calculate the tax amount based on given tax rate.

Parameters

float $amount Amount of field.
float $taxRate Tax rate of selected financial account for field.
bool $ugWeDoNotKnowIfItNeedsCleaning_Help This should ALWAYS BE FALSE and then be removed. A 'clean' money string uses a standardised format such as '1000.99' for one thousand $/Euro/CUR and ninety nine cents/units. However, we are in the habit of not necessarily doing that so need to grandfather in the new expectation.

Return Value

array array of tax amount

at line 526
static float formatAmount(float $amount, int $decimals = 2)

Format monetary amount: round and return to desired decimal place CRM-20145

Parameters

float $amount Monetary amount
int $decimals How many decimal places to round to and return

Return Value

float Amount rounded and returned with the desired decimal places

at line 540
static array getContributionStatuses(string $usedFor = 'contribution', int $id = NULL)

Get contribution statuses by entity e.g. contribution, membership or 'participant'

Parameters

string $usedFor
int $id Contribution ID

Return Value

array Array of contribution statuses in array('status id' => 'label') format

at line 658
static overrideDefaultCurrency(array $params)

CRM-8254 / CRM-6907 - override default currency if applicable these lines exist to support a non-default currency on the form but are probably obsolete & meddling wth the defaultCurrency is not the right approach.

...

Parameters

array $params

at line 668
static string getContributionPageTitle(int $contribution_page_id)

Get either the public title if set or the title of a contribution page for use in workflow message template.

Parameters

int $contribution_page_id

Return Value

string