|
Moodle PHP Documentation 4.5
Moodle 4.5.5+ (Build: 20250711) (ce34e8ff087)
|
Helper class for the payment subsystem. More...
Static Public Member Functions | |
| static | add_common_gateway_settings (\admin_settingpage $settings, string $gateway) |
| This functions adds the settings that are common for all payment gateways. | |
| static | delete_payment_account (account $account) |
| Delete a payment account (used in management interface) | |
| static | deliver_order (string $component, string $paymentarea, int $itemid, int $paymentid, int $userid) |
| Delivers what the user paid for. | |
| static | gateways_modal_link_params (string $component, string $paymentarea, int $itemid, string $description) |
| Returns the attributes to place on a pay button. | |
| static | get_available_gateways (string $component, string $paymentarea, int $itemid) |
| Returns the list of gateways that can process payments in the given currency. | |
| static | get_cost_as_string (float $amount, string $currency, float $surcharge=0) |
| Returns human-readable amount with correct number of fractional digits and currency indicator, can also apply surcharge. | |
| static | get_gateway_configuration (string $component, string $paymentarea, int $itemid, string $gatewayname) |
| Returns the gateway configuration for given component and gateway. | |
| static | get_gateway_surcharge (string $gateway) |
| Returns the percentage of surcharge that is applied when using a gateway. | |
| static | get_payable (string $component, string $paymentarea, int $itemid) |
| Asks the payable from the related component. | |
| static | get_payment_accounts_menu (\context $context) |
| Get list of accounts available in the given context. | |
| static | get_payment_accounts_to_manage (\context $context, bool $showarchived=false) |
| Returns the list of payment accounts in the given context (used in management interface) | |
| static | get_rounded_cost (float $amount, string $currency, float $surcharge=0) |
| Rounds the cost based on the currency fractional digits, can also apply surcharge. | |
| static | get_success_url (string $component, string $paymentarea, int $itemid) |
| Fetches the URL of the page the user should be redirected to from the related component. | |
| static | get_supported_currencies () |
| Returns an accumulated list of supported currencies by all payment gateways. | |
| static | restore_payment_account (account $account) |
| Restore archived payment account (used in management interface) | |
| static | save_payment (int $accountid, string $component, string $paymentarea, int $itemid, int $userid, float $amount, string $currency, string $gateway) |
| Stores essential information about the payment and returns the "id" field of the payment record in DB. | |
| static | save_payment_account (\stdClass $data) |
| Save a new or edited payment account (used in management interface) | |
| static | save_payment_gateway (\stdClass $data) |
| Save a payment gateway linked to an existing account (used in management interface) | |
Helper class for the payment subsystem.
|
static |
This functions adds the settings that are common for all payment gateways.
| admin_settingpage | $settings | The settings object |
| string | $gateway | The gateway name prefixed with paygw_ |
|
static |
Delete a payment account (used in management interface)
| account | $account |
|
static |
Delivers what the user paid for.
@uses core_payment\local\callback\service_provider\deliver_order()
| string | $component | Name of the component that the paymentarea and itemid belong to |
| string | $paymentarea | Payment area |
| int | $itemid | An internal identifier that is used by the component |
| int | $paymentid | payment id as inserted into the 'payments' table, if needed for reference |
| int | $userid | The userid the order is going to deliver to |
| bool | Whether successful or not |
|
static |
Returns the attributes to place on a pay button.
| string | $component | Name of the component that the paymentarea and itemid belong to |
| string | $paymentarea | Payment area |
| int | $itemid | An internal identifier that is used by the component |
| string | $description | Description of the payment |
| array |
|
static |
Returns the list of gateways that can process payments in the given currency.
| string | $component | Name of the component that the paymentarea and itemid belong to |
| string | $paymentarea | Payment area |
| int | $itemid | An identifier that is known to the component |
| string[] |
|
static |
Returns human-readable amount with correct number of fractional digits and currency indicator, can also apply surcharge.
| float | $amount | amount in the currency units |
| string | $currency | The currency |
| float | $surcharge | surcharge in percents |
| string |
|
static |
Returns the gateway configuration for given component and gateway.
| string | $component | Name of the component that the paymentarea and itemid belong to |
| string | $paymentarea | Payment area |
| int | $itemid | An identifier that is known to the component |
| string | $gatewayname | The gateway name |
| array |
| moodle_exception |
|
static |
Returns the percentage of surcharge that is applied when using a gateway.
| string | $gateway | Name of the gateway |
| float |
|
static |
Asks the payable from the related component.
| string | $component | Name of the component that the paymentarea and itemid belong to |
| string | $paymentarea | Payment area |
| int | $itemid | An internal identifier that is used by the component |
| local::entities::payable |
|
static |
Get list of accounts available in the given context.
| context | $context |
| array |
|
static |
Returns the list of payment accounts in the given context (used in management interface)
| context | $context |
| account[] |
|
static |
Rounds the cost based on the currency fractional digits, can also apply surcharge.
| float | $amount | amount in the currency units |
| string | $currency | currency, used for calculating the number of fractional digits |
| float | $surcharge | surcharge in percents |
| float |
|
static |
Fetches the URL of the page the user should be redirected to from the related component.
| string | $component | Name of the component that the paymentarea and itemid belong to |
| string | $paymentarea | Payment area |
| int | $itemid | An identifier that is known to the component |
| moodle_url |
|
static |
Returns an accumulated list of supported currencies by all payment gateways.
| string[] | An array of the currency codes in the three-character ISO-4217 format |
|
static |
Restore archived payment account (used in management interface)
| account | $account |
|
static |
Stores essential information about the payment and returns the "id" field of the payment record in DB.
Each payment gateway may then store the additional information their way.
| int | $accountid | Account id |
| string | $component | Name of the component that the paymentarea and itemid belong to |
| string | $paymentarea | Payment area |
| int | $itemid | An internal identifier that is used by the component |
| int | $userid | Id of the user who is paying |
| float | $amount | Amount of payment |
| string | $currency | Currency of payment |
| string | $gateway | The gateway that is used for the payment |
| int |
|
static |
Save a new or edited payment account (used in management interface)
| stdClass | $data |
| account |
|
static |
Save a payment gateway linked to an existing account (used in management interface)
| stdClass | $data |
| account_gateway |