SilverStripe\Omnipay\Model\Payment
Payment DataObject
This class is used for storing a payment amount, and it's status of being
paid or not, and the gateway used to make payment.
Synopsis
class Payment
extends DataObject
implements
PermissionProvider
{
- // members
- private static array $db = ;
- private static array $has_one = ;
- private static array $has_many = ;
- private static array $defaults = ;
- private static array $casting = ;
- private static array $summary_fields = ;
- private static array $indexes = ;
- private static string $table_name = 'Omnipay_Payment';
- private static string $default_sort = '"Created" DESC, "ID" DESC';
- private static integer $payment_identifier_length = 30;
- private static array $allowed_gateways = ;
- // methods
- public void getCMSFields()
- public void getDefaultSearchContext()
- public $this init()
- public $this setSuccessUrl()
- public $this setFailureUrl()
- public string getTitle()
- public Payment setGateway()
- public string getGatewayTitle()
- public string getPaymentStatus()
- public string getAmount()
- public Payment setAmount()
- public string getCurrency()
- public $this setCurrency()
- public boolean isComplete()
- public mixed getLatestMessageOfType()
- public DataList|null getPartialPayments()
- public bool isPartial()
- public boolean isCaptured()
- public void forTemplate()
- public int|string getMaxCaptureAmount()
- public bool canCapture()
- public bool canVoid()
- public bool canRefund()
- public array providePermissions()
- public void setIdentifier()
- public void provideI18nEntities()
- protected void onBeforeWrite()
- protected string generateUniquePaymentIdentifier()
- protected array getStatusValues()
Hierarchy
Extends
- SilverStripe\ORM\DataObject
Implements
- SilverStripe\Security\PermissionProvider
Members
private
- $allowed_gateways
—
array
The allowed payment gateways - $casting
- $db
- $default_sort
- $defaults
- $has_many
- $has_one
- $indexes
- $payment_identifier_length
—
int
Length of payment identifier sent to gateway. - $summary_fields
- $table_name
Methods
protected
- generateUniquePaymentIdentifier() — Generate an internally unique string that identifies a payment, and can be used in URLs.
- getStatusValues() — Get an array of status enum value to translated string.
- onBeforeWrite()
public
- canCapture() — Whether or not this payment can be captured
- canRefund() — Whether or not this payment can be refunded
- canVoid() — Whether or not this payment can be voided
- forTemplate()
- getAmount() — Get the payment amount
- getCMSFields()
- getCurrency() — Get just the currency of this payment's money component
- getDefaultSearchContext() — Change search context to use a dropdown for list of gateways.
- getGatewayTitle() — The payment gateway title (localized, if available)
- getLatestMessageOfType() — Get a message of a given type
- getMaxCaptureAmount() — Calculate the max amount that can be captured for this payment.
- getPartialPayments() — Get partial payments that have this payment as initial payment.
- getPaymentStatus() — Get the payment status. This will return a localized value if available.
- getTitle() — Locale aware title for a payment.
- init() — Set gateway, amount, and currency in one function.
- isCaptured() — Check the payment is captured.
- isComplete() — This payment requires no more processing.
- isPartial() — Whether or not this payment is a partial payment of another payment
- provideI18nEntities()
- providePermissions() — Provide payment related permissions. The permissions are: * `REFUND_PAYMENTS` can refund payments * `CAPTURE_PAYMENTS` can capture payments * `VOID_PAYMENTS` can void payments
- setAmount() — Set the payment amount, but only when the status is 'Created'.
- setCurrency() — Set the payment currency, but only when the status is 'Created'.
- setFailureUrl() — Set the url to redirect to after payment is cancelled.
- setGateway() — Set the payment gateway
- setIdentifier() — Only allow setting identifier, if one doesn't exist yet.
- setSuccessUrl() — Set the url to redirect to after payment is made/attempted.