SilverStripe\Omnipay\GatewayInfo
Provides information about gateways.
Use this class in YAML to configure your gateway settings.
<code>
SilverStripe\Omnipay\GatewayInfo:
PayPal_Express:
use_authorize: true
parameters:
username: 'my.user.name'
# more parameters…
</code>
The following config settings are allowed per gateway:
* `is_manual` *boolean*: Set this to true if this gateway should be considered a "Manual" Payment (eg. Invoice)
* `is_offsite` *boolean*: Set this to true if this gateway is an offsite gateway (you can force this setting if the automatic detection fails)
* `use_authorize` *boolean*: Whether or not this Gateway should prefer authorize over purchase
* `use_async_notification` *boolean*: When set to true, this Gateway will receive asynchronous notifications from the Payment provider
* `token_key` *string*: Key for the token parameter
* `required_fields` *array*: An array of required form-fields
* `parameters` *map*: All gateway parameters that will be passed along to the Omnipay Gateway instance
* `can_capture` *string|boolean*: Set how/if authorized payments can be captured. Defaults to "partial"
Valid values are "off" or `false` (capturing disabled), "full" (can only capture full amounts), "partial" or `true` (can capture partially) and "multiple" which allows multiple partial captures.
* `can_refund` *string|boolean*: Set how/if captured payments can be refunded. Defaults to "partial"
Valid values are "off" or `false` (refunding disabled), "full" (can only refund full amounts), "partial" or `true` (can refund partially) and "multiple" which allows multiple partial refunds.
* `can_void` *boolean*: Whether or not voiding of authorized payments should be allowed. Defaults to true.
* `max_capture` *mixed*: configuration for excess capturing of authorized amounts.
Config examples for `max_capture`:
<code>
------
# Allow excess capture with max. 15%
max_capture: '15%'
------
# Allow excess capture of max 40 units (default currency)
max_capture: 40
------
# Allow excess capture of max 20%, but no more than 70
# eg. $1000.00 has a max. capture of $1070.00 and $200 has a max. capture of $240.00
max_capture:
percent: '20%'
amount: 70
------
# Allow excess capture of max 20%, but no more than USD 70 or EUR 60.
# The amount field can contain values for all currencies that should be handled by this module
max_capture:
percent: '20%'
amount:
USD: 70
EUR: 60
</code>
Synopsis
- // constants
- const OFF = 'off';
- const FULL = 'full';
- const PARTIAL = 'partial';
- const MULTIPLE = 'multiple';
- // methods
- public static array getSupportedGateways()
- public static string niceTitle()
- public static boolean isSupported()
- public static boolean isOffsite()
- public static boolean isManual()
- public static boolean shouldUseAuthorize()
- public static boolean shouldUseAsyncNotifications()
- public static bool allowVoid()
- public static string captureMode()
- public static bool allowCapture()
- public static bool allowPartialCapture()
- public static int|string maxExcessCapturePercent()
- public static int|string maxExcessCaptureAmount()
- public static string refundMode()
- public static bool allowRefund()
- public static bool allowPartialRefund()
- public static string getTokenKey()
- public static array requiredFields()
- public static array|null getParameters()
- public static mixed getConfigSetting()
- protected static string configToConstant()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
Constants
Name | Value |
---|---|
OFF | 'off' |
FULL | 'full' |
PARTIAL | 'partial' |
MULTIPLE | 'multiple' |
Methods
protected
- configToConstant() — Helper method to convert a config setting to a predefined constant for values that can have the three states: OFF, FULL, PARTIAL or MULTIPLE
public
- allowCapture() — Whether or not the given gateway should allow capturing of payments
- allowPartialCapture() — Whether or not the given gateway should allow partial capturing of payments
- allowPartialRefund() — Whether or not the given gateway should allow partial refunding of payments
- allowRefund() — Whether or not the given gateway should allow refunding of payments
- allowVoid() — Whether or not the given gateway should allow voiding of payments
- captureMode() — The can_capture config setting for the given Gateway
- getConfigSetting() — Get a single config setting for a gateway
- getParameters() — Get the gateway config-parameters.
- getSupportedGateways() — Get the available configured payment types, optionally with i18n readable names.
- getTokenKey() — Get the token key value configured for the given gateway
- isManual() — Check for special 'manual' payment type.
- isOffsite() — Checks if the given gateway name is an off-site gateway.
- isSupported() — Find out if the given gateway is supported.
- maxExcessCaptureAmount() — Get the max excess capture amount for the given gateway and an optional currency.
- maxExcessCapturePercent() — Get the max excess capture percentage for the given gateway.
- niceTitle() — Get a locale aware title for the given gateway.
- refundMode() — The can_refund config setting for the given Gateway
- requiredFields() — Get the required parameters for a given gateway
- shouldUseAsyncNotifications() — Check if the given gateway should use asynchronous notifications
- shouldUseAuthorize() — Check if the given gateway should use authorize payments