Settings module

Learn more about the Settings module.

The Settings module registers the plugin settings. To access the settings, select WooCommerce, select Settings, select Payments, then select Digital River.

Settings

The following fields are registered by the module:

Field Name

Description

Enable/Disable

Enables or disables the Digital River's payment gateway

Title

Title for the Digital River payment gateway. This would be visible on the Checkout page.

Description

Description of the payment gateway. This would be visible on the Checkout page.

Test Mode

If active, use test credentials from Digital River.

Debug Mode

Logs API calls and exceptions. Logged information is available.

Automatic fulfillment

This determines whether to fulfill the orders automatically. This calls for the Digital River fulfillment API to initiate fulfillment. Currently, only third-party fulfillment is considered.

Test public key

Test account's API public key

Test confidential key

Test account's API secret key

Live public key

Production account's API public key

Live confidential key

Production account's API secret key

Webhook secret key

Found in the Digital River Dashboard's Webhook section

Settings Interface

The Settings module implements the following interface:

namespace DigitalRiver\WooCommerce\Interfaces\Modules;

/**
 * Interface Settings.
 *
 * @package DigitalRiver\WooCommerce\Modules
 */
interface Settings {

    /**
     * Registers a new settings field.
     *
     * @param SettingsFieldModel $field Setting field object.
     *
     * @return void
     */
    public function register( SettingsFieldModel $field ): void;

    /**
     * Get settings value by key.
     *
     * @param string $key Settings key.
     *
     * @return Mixed
     */
    public function get( string $key );
}

Method Description

Method

Args, Returns, and Descriptions

register

Arg:SettingsFieldModel

Return: void

Description: Registers the new settings to be added in the Settings panel

get

Arg: string $key (Field Key)

Return: mixed

Description: Returns the value for any registered setting

Settings class

This class takes care of accessing the setting fields and their values.

Method

Args, Returns, and Descriptions

name

Arg: -

Return: string

Description: Returns the name of the module

init

Arg: -

Return: void

Description: Initializes the module

register

Arg: SettingsFieldModel

Return: void

Description: Receives a SettingsFieldModel object and stores it in the $fields private array

register_settings_fields

Arg: -

Return: void

Description: Loops through all the settings fields data, construct SettingsFieldModel object and call register() method on them

add_gateway_class

Arg: array

Return: array

Description: Adds the Digital River gateway to the list of supported payment gateways

get_settings

Arg: -

Return: array

Description: Returns an array of settings fields and their details

get

Arg: String

Return: array

Description: Gets a setting's value using the Settings key

Settings Container class

This class defines all the services required for Settings module.

Method

Args, Returns, and Descriptions

enabled

Arg: -

Return: bool

Description: Returns true if the plugin is enabled, else false

logging

Arg: -

Return: bool

Description: Returns true if logging is enabled, else false

webhook_secret

Arg: -

Return: String

Description: Returns the webhook secret key string

api_keys

Arg: -

Return: array

Description: Returns an array containing the two keys, public and secret

Settings Field Model class

This class represents actual fields on the Settings page.

Method

Args, Returns, and Descriptions

__construct

Arg: array $data

Return: void

Description: Initializes the field and throws InvalidArgumentException if both id and type attributes are not present

get_id

Arg: -

Return: String

Description: Returns the field id

get_type

Arg: -

Return: String

Description: Returns the field type

get_title

Arg: -

Return: String

Description: Returns the field title

get_description

Arg: -

Return: String

Description: Returns the field description

get_desc_tip

Arg: -

Return: String

Description: Returns the field desc_tip_

get_default

Arg: -

Return: String

Description: Returns the field default

get_label

Arg: -

Return: String

Description: Returns the field label

Gateway class

This class registers the Digital River payment gateway.

Method

Args, Returns, and Descriptions

__construct

Arg: -

Return: void

Description: Configures the payment gateway and calls init_form_fields()

init_form_fields

Arg: -

Return: void

Description: Calls Settings::get_settings() and sets the value to form_fields attribute

assets

Arg: String $pagehook

Return: void

Description: Loads the relevant scripts and stylesheets

generate_dr_test_config_btn_html

Arg: $key, array $value

Return: String

Description: Generates test connector button HTML. This function will be called by WooCommerce internally

get_tooltip_html

Arg: array $data

Return: String

Description: Generates the tooltip HTML based on the data passed as the argument

Last updated