class BasePaymentGateway extends ModelAction

Base Payment Gateway Class

Traits

Extension trait

Properties

string $configPath from  ConfigMaker
protected $configFileExtension from  ConfigMaker
static protected array $extensionCallbacks from  ExtensionTrait
static string $extendableStaticCalledClass from  ExtensionTrait
protected $extensionHidden from  ExtensionTrait
protected Payments_model|Model $model
protected array $requiredProperties from  ModelAction
protected $orderModel
protected $orderStatusModel
protected $configFields
protected $configValidationAttributes
protected $configValidationMessages
protected $configRules

Methods

array
loadConfig(array $configFile = [], array $requiredConfig = [], null $index = null)

Reads the contents of the supplied file and applies it to this object.

array
makeConfig(string|array $configFile, array $requiredConfig = [])

Reads the contents of the supplied file and applies it to this object.

array
mergeConfig($configLeft, $configRight)

Merges two configuration sources, either prepared or not, and returns them as a single configuration object.

string
getConfigPath(string $fileName, mixed $configPath = null)

Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.

string
guessConfigPath(string $suffix = '')

Guess the package path for the called class.

string
guessConfigPathFrom(string $class, string $suffix = '')

Guess the package path from a specified class.

static void
extensionExtendCallback(callable $callback)

Helper method for ::extend() static method

extensionHideField($name)

No description

extensionHideMethod($name)

No description

extensionIsHiddenField($name)

No description

extensionIsHiddenMethod($name)

No description

static 
getCalledExtensionClass()

No description

__construct(null $model = null)

Class constructor

array
initialize($host)

Initialize method called when the payment gateway is first loaded with an existing model.

initConfigData(Model $host)

Initializes configuration data when the payment method is first created.

defineFieldsConfig()

Extra field configuration for the payment type.

getConfigFields()

Returns the form configuration used by this payment type.

getConfigRules()

Returns the form validation rules used by this payment type.

getConfigValidationAttributes()

Returns the form validation attributes used by this model.

getConfigValidationMessages()

Returns the form validation messages used by this model.

array
registerEntryPoints()

Registers a entry page with specific URL. For example, PayPal needs a landing page for the auto-return feature.

string
makeEntryPointUrl(string $code)

Utility function, creates a link to a registered entry point.

bool
isApplicable(float $total, $host)

Returns true if the payment type is applicable for a specified order amount

bool
hasApplicableFee($host = null)

Returns true if the payment type has additional fee

string
getFormattedApplicableFee($host = null)

Returns the payment type additional fee

completesPaymentOnClient()

This method should return TRUE if the gateway completes the payment on the client's browsers.

processPaymentForm(array $data, Model $host, Model $order)

Processes payment using passed data.

beforeRenderPaymentForm($host, $controller)

Executed when this gateway is rendered on the checkout page.

getHostObject()

No description

supportsPaymentProfiles()

This method should return TRUE if the gateway supports user payment profiles.

updatePaymentProfile(Customers_model $customer, array $data)

Creates a customer profile on the payment gateway or update if the profile already exists.

deletePaymentProfile(Customers_model $customer, Payment_profiles_model $profile)

Deletes a customer payment profile from the payment gateway.

payFromPaymentProfile(Orders_model $order, array $data = [])

Creates a payment transaction from an existing payment profile.

processRefundForm($data, $order, $paymentLog)

No description

createOrderModel()

Creates an instance of the order model

createOrderStatusModel()

Creates an instance of the order status model

Details

in ConfigMaker at line 27
array loadConfig(array $configFile = [], array $requiredConfig = [], null $index = null)

Reads the contents of the supplied file and applies it to this object.

Parameters

array $configFile
array $requiredConfig
null $index

Return Value

array

in ConfigMaker at line 46
array makeConfig(string|array $configFile, array $requiredConfig = [])

Reads the contents of the supplied file and applies it to this object.

Parameters

string|array $configFile
array $requiredConfig

Return Value

array

Exceptions

SystemException

in ConfigMaker at line 97
array mergeConfig($configLeft, $configRight)

Merges two configuration sources, either prepared or not, and returns them as a single configuration object.

Parameters

$configLeft
$configRight

Return Value

array

The config array

in ConfigMaker at line 116
string getConfigPath(string $fileName, mixed $configPath = null)

Locates a file based on it's definition. If the file starts with the ~ symbol it will be returned in context of the application base path, otherwise it will be returned in context of the config path.

Parameters

string $fileName

File to load.

mixed $configPath

Explicitly define a config path.

Return Value

string

Full path to the config file.

in ConfigMaker at line 154
string guessConfigPath(string $suffix = '')

Guess the package path for the called class.

Parameters

string $suffix

An extra path to attach to the end

Return Value

string

in ConfigMaker at line 169
string guessConfigPathFrom(string $class, string $suffix = '')

Guess the package path from a specified class.

Parameters

string $class

Class to guess path from.

string $suffix

An extra path to attach to the end

Return Value

string

in ExtensionTrait at line 32
extensionApplyInitCallbacks()

No description

in ExtensionTrait at line 51
static void extensionExtendCallback(callable $callback)

Helper method for ::extend() static method

Parameters

callable $callback

Return Value

void

in ExtensionTrait at line 64
protected extensionHideField($name)

No description

Parameters

$name

in ExtensionTrait at line 69
protected extensionHideMethod($name)

No description

Parameters

$name

in ExtensionTrait at line 74
extensionIsHiddenField($name)

No description

Parameters

$name

in ExtensionTrait at line 79
extensionIsHiddenMethod($name)

No description

Parameters

$name

in ExtensionTrait at line 84
static getCalledExtensionClass()

No description

at line 39
__construct(null $model = null)

Class constructor

Parameters

null $model

at line 63
array initialize($host)

Initialize method called when the payment gateway is first loaded with an existing model.

Parameters

$host

Return Value

array

at line 75
initConfigData(Model $host)

Initializes configuration data when the payment method is first created.

Parameters

Model $host

at line 82
defineFieldsConfig()

Extra field configuration for the payment type.

at line 90
getConfigFields()

Returns the form configuration used by this payment type.

at line 98
getConfigRules()

Returns the form validation rules used by this payment type.

at line 106
getConfigValidationAttributes()

Returns the form validation attributes used by this model.

at line 114
getConfigValidationMessages()

Returns the form validation messages used by this model.

at line 129
array registerEntryPoints()

Registers a entry page with specific URL. For example, PayPal needs a landing page for the auto-return feature.

Important! Payment module access point names should have a prefix.

Return Value

array

Returns an array containing page URLs and methods to call for each URL: return ['paypal_return'=>'processPaypalReturn']. The processing methods must be declared in the payment type class. Processing methods must accept one parameter - an array of URL segments following the access point. For example, if URL is /paypal_return/12/34 an array ['12', '34'] will be passed to processPaypalReturn method.

at line 141
string makeEntryPointUrl(string $code)

Utility function, creates a link to a registered entry point.

Parameters

string $code

Key used to define the entry point

Return Value

string

at line 154
bool isApplicable(float $total, $host)

Returns true if the payment type is applicable for a specified order amount

Parameters

float $total

Specifies an order amount

$host

Model object to add fields to

Return Value

bool

at line 165
bool hasApplicableFee($host = null)

Returns true if the payment type has additional fee

Parameters

$host

Model object to add fields to

Return Value

bool

at line 178
string getFormattedApplicableFee($host = null)

Returns the payment type additional fee

Parameters

$host

Model object to add fields to

Return Value

string

at line 191
completesPaymentOnClient()

This method should return TRUE if the gateway completes the payment on the client's browsers.

Allows the system to take extra steps during checkout before completing the payment

at line 203
processPaymentForm(array $data, Model $host, Model $order)

Processes payment using passed data.

Parameters

array $data

Posted payment form data.

Model $host

Type model object containing configuration fields values.

Model $order

Order model object.

at line 210
beforeRenderPaymentForm($host, $controller)

Executed when this gateway is rendered on the checkout page.

Parameters

$host
$controller

at line 217
Payments_model getHostObject()

No description

Return Value

Payments_model

at line 230
supportsPaymentProfiles()

This method should return TRUE if the gateway supports user payment profiles.

The payment gateway must implement the updatePaymentProfile(), deletePaymentProfile() and payFromPaymentProfile() methods if this method returns true.

at line 241
Payment_profiles_model|object updatePaymentProfile(Customers_model $customer, array $data)

Creates a customer profile on the payment gateway or update if the profile already exists.

Parameters

Customers_model $customer

Customer model to create a profile for

array $data

Posted payment form data

Return Value

Payment_profiles_model|object

Returns the customer payment profile model

at line 251
deletePaymentProfile(Customers_model $customer, Payment_profiles_model $profile)

Deletes a customer payment profile from the payment gateway.

Parameters

Customers_model $customer

Customer model

Payment_profiles_model $profile

Payment profile model

at line 261
payFromPaymentProfile(Orders_model $order, array $data = [])

Creates a payment transaction from an existing payment profile.

Parameters

Orders_model $order

An order object to pay

array $data

at line 270
processRefundForm($data, $order, $paymentLog)

No description

Parameters

$data
$order
$paymentLog

at line 277
protected createOrderModel()

Creates an instance of the order model

at line 287
protected createOrderStatusModel()

Creates an instance of the order status model