Documentation

Payment
in package

Payment service manager

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

subpackage

module_shop

version
3.0.0

Table of Contents

Constants

TEXT_NAME  = 'payment_name'
Text keys

Properties

$arrPayments  : array<string|int, mixed>
Array of available payment service data

Methods

add()  : bool
Adds a new Payment method with its data present in the $_POST array, if any
delete()  : bool
Deletes the Payment method with the given ID
errorHandler()  : bool
Handles any kind of database errors
getArray()  : array<string|int, mixed>
Returns the array of available Payment service data
getCountriesRelatedPaymentIdArray()  : array<string|int, mixed>
Returns the countries related payment ID array.
getNameArray()  : array<string|int, mixed>
Returns the array of available Payment names
getNameById()  : string
Get the payment name for the ID given
getPaymentMenu()  : string
Return HTML code for the payment dropdown menu
getPaymentMenuoptions()  : string
Return HTML code for the payment dropdown menu options
getPaymentMethods()  : array<string|int, mixed>
Get the payment methods based on the country id
getPaymentProcessorId()  : int
Returns the ID of the payment processor for the given payment ID
getProperty()  : string
Returns the named property for the given Payment service
init()  : bool
Set up the payment array
reset()  : mixed
Clear the Payments stored in the class
update()  : bool
Updates existing Payments with its data present in the $_POST array, if any
view_settings()  : bool
Sets up the Payment settings view

Constants

Properties

$arrPayments

Array of available payment service data

private static array<string|int, mixed> $arrPayments = null
Tags
access

private

static

Methods

add()

Adds a new Payment method with its data present in the $_POST array, if any

public static add([int $localeId = 0 ]) : bool

Returns null if no new Payment is present.

Parameters
$localeId : int = 0

Optional locale ID. If not set FRONTEND_LANG_ID will be used.

Tags
static
Return values
bool

True on success, false on failure, or null

delete()

Deletes the Payment method with the given ID

public static delete(int $payment_id) : bool

Returns NULL if no valid Payment ID is given. Fails when trying to delete the only active Payment. Add and activate a new one before trying to delete the other.

Parameters
$payment_id : int

The Payment ID

Tags
global

ADOConnection $objDatabase

Return values
bool

True on success, false on failure, or null otherwise (NOOP)

errorHandler()

Handles any kind of database errors

public static errorHandler() : bool

Includes updating the payments table (I guess from version 1.2.0(?), note that this is unconfirmed) to the current structure

Tags
throws
Update_DatabaseException
Return values
bool

False. Always.

getCountriesRelatedPaymentIdArray()

Returns the countries related payment ID array.

public static getCountriesRelatedPaymentIdArray(int $countryId, array<string|int, mixed> $arrCurrencies) : array<string|int, mixed>

If PayPal is the selected payment method, any Currencies not supported will be removed from the Currency array. Returns the Payment IDs allowed for the given Country ID. Note that the Payment IDs are used for both the keys and values of the array returned, like: array( payment_id => payment_id, [...] )

Parameters
$countryId : int

The country ID

$arrCurrencies : array<string|int, mixed>

The currencies array, by reference

Tags
global

ADONewConnection $objDatabase Database connection object

Return values
array<string|int, mixed>

Array of Payment IDs

getNameArray()

Returns the array of available Payment names

public static getNameArray() : array<string|int, mixed>

The array is indexed by the Payment IDs.

Tags
see
Payment::init()
author

Reto Kohli reto.kohli@comvation.com

since
3.0.0
Return values
array<string|int, mixed>

The array of Payment names

getNameById()

Get the payment name for the ID given

public static getNameById(int $paymentId[, int $langId = 0 ]) : string
Parameters
$paymentId : int

The payment ID

$langId : int = 0

Defaults to FRONTEND_LANG_ID

Tags
global

\ADOConnection $objDatabase

Return values
string

The payment name on success, or the empty string

getPaymentMenu()

Return HTML code for the payment dropdown menu

public static getPaymentMenu([string $selectedId = 0 ][, string $onchange = '' ][, int $countryId = 0 ]) : string

See getPaymentMenuoptions() for details.

Parameters
$selectedId : string = 0

Optional preselected payment ID

$onchange : string = ''

Optional onchange function

$countryId : int = 0

Country ID

Tags
global

array $_ARRAYLANG Language array

Return values
string

HTML code for the dropdown menu

getPaymentMenuoptions()

Return HTML code for the payment dropdown menu options

public static getPaymentMenuoptions([string $selectedId = 0 ][, int $countryId = 0 ]) : string

If no valid payment is selected, an additional option representing "please choose" is prepended.

Parameters
$selectedId : string = 0

Optional preselected payment ID

$countryId : int = 0

Country ID

Tags
global

array $_ARRAYLANG Language array

Return values
string

HTML code for the dropdown menu options

getPaymentMethods()

Get the payment methods based on the country id

public static getPaymentMethods([int $countryId = 0 ]) : array<string|int, mixed>
Parameters
$countryId : int = 0

Country ID

Return values
array<string|int, mixed>

array of payment methods

getPaymentProcessorId()

Returns the ID of the payment processor for the given payment ID

public static getPaymentProcessorId(int $paymentId) : int
Parameters
$paymentId : int

The payment ID

Tags
static
global

ADONewConnection $objDatabase Database connection object

Return values
int

The payment processor ID on success, false otherwise

getProperty()

Returns the named property for the given Payment service

public static getProperty(int $payment_id, string $property_name) : string
Parameters
$payment_id : int

The Payment service ID

$property_name : string

The property name

Tags
author

Reto Kohli reto.kohli@comvation.com

since
2.1.0
Return values
string

The property value

init()

Set up the payment array

public static init([int $langId = 0 ]) : bool
Parameters
$langId : int = 0

Defaults to FRONTEND_LANG_ID

Tags
global

\ADOConnection $objDatabase

author

Reto Kohli reto.kohli@comvation.com

since
2.1.0
Return values
bool

True on success

reset()

Clear the Payments stored in the class

public static reset() : mixed

Call this after updating the database. The Payments will be reinitialized on demand.

update()

Updates existing Payments with its data present in the $_POST array, if any

public static update([int $localeId = 0 ]) : bool

Returns null if no Payment data is present.

Parameters
$localeId : int = 0

Optional locale ID. If not set FRONTEND_LANG_ID will be used.

Tags
static
Return values
bool

True on success, false on failure, or null

view_settings()

Sets up the Payment settings view

public static view_settings([Sigma &$objTemplate = null ]) : bool
Parameters
$objTemplate : Sigma = null

The optional Template, by reference

Return values
bool

True on success, false otherwise


        
On this page

Search results