You are here

interface PaymentGatewayInterface in Commerce Core 8.2

Same name in this branch
  1. 8.2 modules/payment/src/Entity/PaymentGatewayInterface.php \Drupal\commerce_payment\Entity\PaymentGatewayInterface
  2. 8.2 modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php \Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\PaymentGatewayInterface

Defines the base interface for payment gateways.

Hierarchy

Expanded class hierarchy of PaymentGatewayInterface

All classes that implement PaymentGatewayInterface

File

modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php, line 16

Namespace

Drupal\commerce_payment\Plugin\Commerce\PaymentGateway
View source
interface PaymentGatewayInterface extends PluginWithFormsInterface, ConfigurableInterface, DependentPluginInterface, PluginFormInterface, DerivativeInspectionInterface {

  /**
   * Gets the payment gateway label.
   *
   * The label is admin-facing and usually includes the name of the used API.
   * For example: "Braintree (Hosted Fields)".
   *
   * @return mixed
   *   The payment gateway label.
   */
  public function getLabel();

  /**
   * Gets the payment gateway display label.
   *
   * The display label is customer-facing and more generic.
   * For example: "Braintree".
   *
   * @return string
   *   The payment gateway display label.
   */
  public function getDisplayLabel();

  /**
   * Gets the mode in which the payment gateway is operating.
   *
   * @return string
   *   The machine name of the mode.
   */
  public function getMode();

  /**
   * Gets the supported modes.
   *
   * @return string[]
   *   The mode labels keyed by machine name.
   */
  public function getSupportedModes();

  /**
   * Gets the JS library ID.
   *
   * This is usually an external library defined in the module's
   * libraries.yml file. Included by the PaymentInformation pane
   * to get around core bug #1988968.
   * Example: 'commerce_braintree/braintree'.
   *
   * @return string|null
   *   The JS library ID, or NULL if not available.
   */
  public function getJsLibrary();

  /**
   * Gets the payment type used by the payment gateway.
   *
   * @return \Drupal\commerce_payment\Plugin\Commerce\PaymentType\PaymentTypeInterface
   *   The payment type.
   */
  public function getPaymentType();

  /**
   * Gets the payment method types handled by the payment gateway.
   *
   * @return \Drupal\commerce_payment\Plugin\Commerce\PaymentMethodType\PaymentMethodTypeInterface[]
   *   The payment method types.
   */
  public function getPaymentMethodTypes();

  /**
   * Gets the default payment method type.
   *
   * @return \Drupal\commerce_payment\Plugin\Commerce\PaymentMethodType\PaymentMethodTypeInterface
   *   The default payment method type.
   */
  public function getDefaultPaymentMethodType();

  /**
   * Gets the credit card types handled by the gateway.
   *
   * @return \Drupal\commerce_payment\CreditCardType[]
   *   The credit card types.
   */
  public function getCreditCardTypes();

  /**
   * Gets whether the payment gateway collects billing information.
   *
   * @return bool
   *   TRUE if the payment gateway collects billing information,
   *   FALSE otherwise.
   */
  public function collectsBillingInformation();

  /**
   * Builds the available operations for the given payment.
   *
   * @param \Drupal\commerce_payment\Entity\PaymentInterface $payment
   *   The payment.
   *
   * @return array
   *   The operations.
   *   Keyed by operation ID, each value is an array with the following keys:
   *   - title: The operation title.
   *   - page_title: The operation page title.
   *   - plugin_form: The plugin form ID.
   *   - access: Whether the operation is allowed for the given payment.
   */
  public function buildPaymentOperations(PaymentInterface $payment);

  /**
   * Builds a label for the given AVS response code and card type.
   *
   * @param string $avs_response_code
   *   The AVS response code.
   * @param string $card_type
   *   The card type.
   *
   * @return string|null
   *   The label, or NULL if not available.
   */
  public function buildAvsResponseCodeLabel($avs_response_code, $card_type);

  /**
   * Converts the given amount to its minor units.
   *
   * For example, 9.99 USD becomes 999.
   *
   * @param \Drupal\commerce_price\Price $amount
   *   The amount.
   *
   * @return int
   *   The amount in minor units, as an integer.
   *
   * @deprecated
   *   This method was replaced with MinorUnitsConverter::toMinorUnits().
   *
   * @see \Drupal\commerce_price\MinorUnitsConverter::toMinorUnits()
   */
  public function toMinorUnits(Price $amount);

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigurableInterface::defaultConfiguration public function Gets default configuration for this plugin. 11
ConfigurableInterface::getConfiguration public function Gets this plugin's configuration. 12
ConfigurableInterface::setConfiguration public function Sets the configuration for this plugin instance. 12
DependentPluginInterface::calculateDependencies public function Calculates dependencies for the configured plugin. 19
DerivativeInspectionInterface::getBaseId public function Gets the base_plugin_id of the plugin instance. 1
DerivativeInspectionInterface::getDerivativeId public function Gets the derivative_id of the plugin instance. 1
PaymentGatewayInterface::buildAvsResponseCodeLabel public function Builds a label for the given AVS response code and card type. 1
PaymentGatewayInterface::buildPaymentOperations public function Builds the available operations for the given payment. 1
PaymentGatewayInterface::collectsBillingInformation public function Gets whether the payment gateway collects billing information. 1
PaymentGatewayInterface::getCreditCardTypes public function Gets the credit card types handled by the gateway. 1
PaymentGatewayInterface::getDefaultPaymentMethodType public function Gets the default payment method type. 1
PaymentGatewayInterface::getDisplayLabel public function Gets the payment gateway display label. 1
PaymentGatewayInterface::getJsLibrary public function Gets the JS library ID. 1
PaymentGatewayInterface::getLabel public function Gets the payment gateway label. 1
PaymentGatewayInterface::getMode public function Gets the mode in which the payment gateway is operating. 1
PaymentGatewayInterface::getPaymentMethodTypes public function Gets the payment method types handled by the payment gateway. 1
PaymentGatewayInterface::getPaymentType public function Gets the payment type used by the payment gateway. 1
PaymentGatewayInterface::getSupportedModes public function Gets the supported modes. 1
PaymentGatewayInterface::toMinorUnits Deprecated public function Converts the given amount to its minor units. 1
PluginFormInterface::buildConfigurationForm public function Form constructor. 36
PluginFormInterface::submitConfigurationForm public function Form submission handler. 32
PluginFormInterface::validateConfigurationForm public function Form validation handler. 18
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
PluginWithFormsInterface::getFormClass public function Gets the form class for the given operation.
PluginWithFormsInterface::hasFormClass public function Gets whether the plugin has a form class for the given operation.