SilverCart\Model\Payment\PaymentMethod
Base class for payment.
Every payment module must extend this class.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2018 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class PaymentMethod
extends DataObject
{
- // members
- private static array $db = ;
- private static array $has_one = ;
- private static array $has_many = ;
- private static array $many_many = ;
- private static array $belongs_many_many = ;
- private static array $casting = ;
- private static array $defaults = ;
- private static string $table_name = 'SilvercartPaymentMethod';
- private static string $default_sort = 'Sort';
- private static bool $api_access = true;
- protected string $cancelLink = '';
- protected string $returnLink = '';
- protected string $notificationLink = '';
- protected bool $errorOccured;
- protected array $errorList = ;
- private static array $possible_payment_channels = ;
- protected string $moduleName = '';
- protected Controller $controller;
- protected Member $customerDetails = NULL;
- protected Address $invoiceAddress = NULL;
- protected Address $shippingAddress = NULL;
- protected ShoppingCart $shoppingCart = NULL;
- protected Order $order = NULL;
- protected string $formID = '';
- protected string $uploadsFolder = '';
- protected bool $getCMSFieldsIsCalled = false;
- // methods
- public string singular_name()
- public string plural_name()
- public string getName()
- public string getpaymentDescription()
- public string getLongPaymentDescription()
- public array searchableFields()
- public array fieldLabels()
- public array summaryFields()
- public string getModuleName()
- public string getTitle()
- public string getLogo()
- public string getCancelLink()
- public string getReturnLink()
- public string getNotificationLink()
- public Money getHandlingCost()
- public DBMoney getChargesAndDiscountsForProducts()
- public mixed getChargesAndDiscountsForTotal()
- public int getDescriptionImage()
- public bool getErrorOccured()
- public ArrayList getErrorList()
- public static DataList getActivePaymentMethods()
- public static ArrayList getAllowedPaymentMethodsFor()
- protected boolean isActivationByOrderRestrictionsPossible()
- public ArrayList getAllowedShippingMethods()
- public bool isAvailableForZone()
- public bool isAvailableForShippingMethod()
- public bool isAvailableForAmount()
- public void requireDefaultRecords()
- protected void addTranslationsTo()
- public boolean isExtendingPaymentMethod()
- public array excludeFromScaffolding()
- public void onBeforeWrite()
- public FieldList getCMSFields()
- public void getFieldsForChargesAndDiscounts()
- public FieldList getCMSFieldsForModules()
- public void setCancelLink()
- public void setReturnLink()
- public void setNotificationLink()
- public float getsumModificationValue()
- public void setController()
- public Controller getController()
- public string AttributedCountries()
- public string AttributedZones()
- public CheckboxField activatedStatus()
- public void Log()
- public void addError()
- public void createRequiredPaymentStatus()
- public void createUploadFolder()
- public void createLogoImageObjects()
- protected void addPaymentLogos()
- public void setCustomerDetails()
- public void setInvoiceAddress()
- public void setShippingAddress()
- public void setShoppingCart()
- public void setOrder()
- public Member getCustomerDetails()
- public Address getInvoiceAddress()
- public Address getShippingAddress()
- public ShoppingCart getShoppingCart()
- public Order getOrder()
- public void setCustomerDetailsByCheckoutData()
- public void setInvoiceAddressByCheckoutData()
- public void setShippingAddressByCheckoutData()
- public Address getAddressByCheckoutData()
- public array getPossiblePaymentChannels()
- public bool hasMultiplePaymentChannels()
- public string getPaymentChannelName()
- public bool getNestedFormName()
- public Form CheckoutChoosePaymentMethodForm()
- public void doProcessBeforePaymentProvider()
- public void doProcessAfterPaymentProvider()
- public void doProcessBeforeOrder()
- public void doProcessAfterOrder()
- public string doProcessNotification()
- public bool canProcessBeforePaymentProvider()
- public bool canProcessAfterPaymentProvider()
- public bool canProcessBeforeOrder()
- public bool canProcessAfterOrder()
- public bool canPlaceOrder()
- protected void processBeforeOrder()
- protected void processAfterOrder()
- protected void processBeforePaymentProvider()
- protected void processAfterPaymentProvider()
- protected string processNotification()
- public string processConfirmationText()
- public void resetProgress()
- // Inherited methods from ExtensibleDataObject
- protected void beforeRequireDefaultRecords()
- protected void beforeUpdateCMSActions()
- protected void beforeUpdateFieldLabels()
- protected void beforeUpdateProvidePermissions()
- public array defaultFieldLabels()
- public static void reset_field_labels()
- protected array scaffoldFieldLabels()
Hierarchy
Members
private
- $api_access
—
SilverCart\Model\Payment\bool
Grant API access on this item. - $belongs_many_many
—
array
Defines m:n relations - $casting
—
array
Virtual database columns. - $db
—
array
Defines the attributes of the class - $default_sort
- $defaults
—
array
Default values for new PaymentMethods - $has_many
—
array
Defines 1:n relations - $has_one
—
array
Defines 1:1 relations - $many_many
—
array
Defines n:m relations - $possible_payment_channels
—
array
A list of possible payment channels. - $table_name
—
string
DB table name
protected
- $cancelLink
—
string
The link to direct after cancelling by user or session expiry. - $controller
—
SilverStripe\Control\Controller
Contains a referer to the order object - $customerDetails
—
SilverStripe\Security\Member
Details of customer - $defaultFieldLabels
—
array
Default field labels. - $errorList
—
array
A list of errors. - $errorOccured
—
SilverCart\Model\Payment\bool
Indicates whether an error occured or not. - $formID
—
string
ID of the check out form to render additional form fields - $getCMSFieldsIsCalled
—
SilverCart\Model\Payment\bool
Marker to check whether the CMS fields are called or not - $invoiceAddress
—
SilverCart\Model\Customer\Address
Invoice address - $moduleName
—
string
Contains the module name for display in the admin backend - $notificationLink
—
string
The link to notify shop after payment (push). - $order
—
SilverCart\Model\Order\Order
Order - $returnLink
—
string
The link to redirect back into shop after payment. - $shippingAddress
—
SilverCart\Model\Customer\Address
Shipping address - $shoppingCart
—
SilverCart\Model\Order\ShoppingCart
Shopping cart - $uploadsFolder
—
string
Path to the uploads folder
Methods
protected
- addPaymentLogos() — Adds the given payment logos for the given payment module.
- addTranslationsTo() — Adds the default translations to the given $paymentMethod.
- isActivationByOrderRestrictionsPossible() — Checks if the given member has completed enough orders with a specified status.
- processAfterOrder() — Is called by default checkout right after placing an order.
- processAfterPaymentProvider() — Is called right after returning to the checkout after being redirected to the external payment provider (e.g. like doing the payment at PayPal and then redirecting to the shop).
- processBeforeOrder() — Is called by default checkout right before placing an order.
- processBeforePaymentProvider() — Is called right before redirecting to the external payment provider (e.g. like redirecting to paypal to do the payment).
- processNotification() — Is called when a payment provider sends a background notification to the shop.
public
- AttributedCountries() — Returns the attributed countries as string (limited to 150 chars).
- AttributedZones() — Returns the attributed zones as string (limited to 150 chars).
- CheckoutChoosePaymentMethodForm() — Returns the context/nested CheckoutChoosePaymentMethodForm.
- Log() — writes a log entry
- activatedStatus() — Returns the activation status as HTML-Checkbox-Tag.
- addError() — registers an error
- canPlaceOrder() — Is called by default checkout right before placing an order.
- canProcessAfterOrder() — Returns whether the checkout is ready to call self::processAfterOrder().
- canProcessAfterPaymentProvider() — Returns whether the checkout is ready to call self::processAfterPaymentProvider().
- canProcessBeforeOrder() — Returns whether the checkout is ready to call self::processBeforeOrder().
- canProcessBeforePaymentProvider() — Returns whether the checkout is ready to call self::processBeforePaymentProvider().
- createLogoImageObjects() — Creates the upload folder for payment images if it doesn't exist.
- createRequiredPaymentStatus() — Creates payment status DB objects from the given list.
- createUploadFolder() — Creates the upload folder for payment images if it doesn't exist.
- doProcessAfterOrder() — Is called by default checkout right after placing an order.
- doProcessAfterPaymentProvider() — Is called right after returning to the checkout after being redirected to the external payment provider (e.g. like doing the payment at PayPal and then redirecting to the shop).
- doProcessBeforeOrder() — Is called by default checkout right before placing an order.
- doProcessBeforePaymentProvider() — Is called right before redirecting to the external payment provider (e.g. like redirecting to paypal to do the payment).
- doProcessNotification() — Is called when a payment provider sends a background notification to the shop.
- excludeFromScaffolding() — exclude the following fields
- fieldLabels() — Field labels for display in tables.
- getActivePaymentMethods() — Returns active payment methods.
- getAddressByCheckoutData() — Creates an address using the given checkout data and prefix.
- getAllowedPaymentMethodsFor() — Returns allowed payment methods.
- getAllowedShippingMethods() — Returns allowed shipping methods. Those are
- getCMSFields() — customizes the backends fields, mainly for ModelAdmin
- getCMSFieldsForModules() — Returns modified CMS fields for the payment modules
- getCancelLink() — Returns the link for cancel action or end of session
- getChargesAndDiscountsForProducts() — Returns the charges and discounts for the product values for this payment method.
- getChargesAndDiscountsForTotal() — Returns the charges and discounts for the shopping cart total for this payment method.
- getController() — Returns the controller.
- getCustomerDetails() — Returns the customers details
- getDescriptionImage() — Retunrns a path to a picture with additional information for this payment method
- getErrorList() — Returns a ArrayList with errors
- getErrorOccured() — Returns if an error has occured
- getFieldsForChargesAndDiscounts() — GUI for additional charges / discounts
- getHandlingCost() — Returns handling costs for this payment method
- getInvoiceAddress() — Returns the invoice address
- getLogo() — Returns the path to the payment methods logo
- getLongPaymentDescription() — getter for the multilingual attribute LongPaymentDescription
- getModuleName() — Returns the payment module name.
- getName() — getter for the multilingual attribute name
- getNestedFormName() — Returns an optional payment specific form name to insert into checkout step 3.
- getNotificationLink() — Returns the link to notify the shop (push)
- getOrder() — Returns the order
- getPaymentChannelName() — Returns the i18n title for a payment channel.
- getPossiblePaymentChannels() — Returns all possible payment channels of the current payment module.
- getReturnLink() — Returns the link to get back in the shop
- getShippingAddress() — Returns the shipping address
- getShoppingCart() — Returns the shopping cart
- getTitle() — Returns the title of the payment method
- getpaymentDescription() — getter for the multilingual attribute paymentDescription
- getsumModificationValue() — Returns the sumModificationValue.
- hasMultiplePaymentChannels() — Returns whether this payment method has more than one channel.
- isAvailableForAmount() — Is this payment method allowed for a total amount?
- isAvailableForShippingMethod() — Is this payment method allowed for a shipping method?
- isAvailableForZone() — Returns weather this payment method is available for a zone specified by id or not
- isExtendingPaymentMethod() — find out if we are dealing with an extended class or with PaymentMethod.
- onBeforeWrite() — On before write. Checks for payment method detail request data when creating new payment methods.
- plural_name() — Returns the translated plural name of the object. If no translation exists the class name will be returned.
- processConfirmationText() — Is called before rendering the order confirmation page right after the order placement is finalized.
- requireDefaultRecords() — writes a payment method to the db in case none does exist yet
- resetProgress() — Resets the payment progress (usually hold in session).
- searchableFields() — Searchable fields
- setCancelLink() — set the link to be visited on a cancel action
- setController() — set the controller
- setCustomerDetails() — Sets the customers details
- setCustomerDetailsByCheckoutData() — Sets the customers details by checkout data
- setInvoiceAddress() — Sets the invoice address
- setInvoiceAddressByCheckoutData() — Sets the customers details by checkout data
- setNotificationLink() — sets the link to notify the shop (push)
- setOrder() — Sets the order object
- setReturnLink() — sets the link to return to the shop
- setShippingAddress() — Sets the shipping address
- setShippingAddressByCheckoutData() — Sets the customers details by checkout data
- setShoppingCart() — Sets the shopping cart
- singular_name() — Returns the translated singular name of the object. If no translation exists the class name will be returned.
- summaryFields() — i18n for summary fields
Inherited from SilverCart\ORM\ExtensibleDataObject
protected
- beforeRequireDefaultRecords() — Allows user code to hook into DataObject::requireDefaultRecords() prior to requireDefaultRecords being called on extensions.
- beforeUpdateCMSActions() — Allows user code to hook into DataObject::getCMSActions prior to updateCMSActions being called on extensions.
- beforeUpdateFieldLabels() — Allows user code to hook into DataObject::fieldLabels() prior to updateFieldLabels being called on extensions.
- beforeUpdateProvidePermissions() — Allows user code to hook into DataObject::updateProvidePermissions() prior to providePermissions being called on extensions.
- scaffoldFieldLabels() — Returns the default field labels for this DataObject.
public
- defaultFieldLabels() — Returns the default field labels.
- reset_field_labels() — Resets the field label cache.