class CheckoutPaymentProcess in Commerce PayPal 8
Provides the PayPal Checkout payment process pane.
This extends the default "payment_process" pane which cannot work if the "payment_information" pane isn't visible. This is only required in the "shortcut" flow which is used in combination with the "paypal_checkout" Checkout flow this module provides.
Plugin annotation
@CommerceCheckoutPane(
id = "paypal_checkout_payment_process",
label = @Translation("PayPal Checkout payment process"),
default_step = "payment"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase implements CheckoutPaneInterface, ContainerFactoryPluginInterface
- class \Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentProcess
- class \Drupal\commerce_paypal\Plugin\Commerce\CheckoutPane\CheckoutPaymentProcess
- class \Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentProcess
- class \Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase implements CheckoutPaneInterface, ContainerFactoryPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of CheckoutPaymentProcess
File
- src/
Plugin/ Commerce/ CheckoutPane/ CheckoutPaymentProcess.php, line 22
Namespace
Drupal\commerce_paypal\Plugin\Commerce\CheckoutPaneView source
class CheckoutPaymentProcess extends PaymentProcess {
/**
* {@inheritdoc}
*/
public function isVisible() {
if ($this->order
->isPaid() || !$this->order
->getTotalPrice() || $this->order
->getTotalPrice()
->isZero()) {
// No payment is needed if the order is free or has already been paid.
return FALSE;
}
if ($this->checkoutFlow
->getPluginId() !== 'paypal_checkout' || empty($this->order
->getData('commerce_paypal_checkout')) || $this->order
->get('payment_gateway')
->isEmpty()) {
return FALSE;
}
$checkout_data = $this->order
->getData('commerce_paypal_checkout');
/** @var \Drupal\commerce_payment\Entity\PaymentGatewayInterface $payment_gateway */
$payment_gateway = $this->order
->get('payment_gateway')->entity;
return $checkout_data['flow'] === 'shortcut' && $payment_gateway
->getPlugin() instanceof CheckoutInterface;
}
/**
* Gets the step ID that the customer should be sent to on error.
*
* @return string
* The error step ID.
*/
protected function getErrorStepId() {
$visible_steps = $this->checkoutFlow
->getVisibleSteps();
return key($visible_steps);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CheckoutPaneBase:: |
protected | property | The parent checkout flow. | |
CheckoutPaneBase:: |
protected | property | The entity type manager. | |
CheckoutPaneBase:: |
protected | property | The current order. | |
CheckoutPaneBase:: |
public | function |
Builds a summary of the pane values. Overrides CheckoutPaneInterface:: |
3 |
CheckoutPaneBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
CheckoutPaneBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
CheckoutPaneBase:: |
public | function |
Gets the pane display label. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Gets the pane ID. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Gets the pane label. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Gets the pane step ID. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Gets the pane weight. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Gets the pane wrapper element. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
CheckoutPaneBase:: |
public | function |
Sets the current order. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Sets the pane step ID. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Sets the pane weight. Overrides CheckoutPaneInterface:: |
|
CheckoutPaneBase:: |
public | function |
Handles the submission of an pane form. Overrides CheckoutPaneInterface:: |
7 |
CheckoutPaneBase:: |
public | function |
Form validation handler. Overrides PluginFormInterface:: |
|
CheckoutPaneBase:: |
public | function |
Validates the pane form. Overrides CheckoutPaneInterface:: |
4 |
CheckoutPaymentProcess:: |
protected | function |
Gets the step ID that the customer should be sent to on error. Overrides PaymentProcess:: |
|
CheckoutPaymentProcess:: |
public | function |
Determines whether the pane is visible. Overrides PaymentProcess:: |
|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PaymentProcess:: |
protected | property | The inline form manager. | |
PaymentProcess:: |
protected | property | The logger. | |
PaymentProcess:: |
protected | function | Builds the URL to the "cancel" page. | |
PaymentProcess:: |
public | function |
Form constructor. Overrides CheckoutPaneBase:: |
|
PaymentProcess:: |
public | function |
Builds a summary of the pane configuration. Overrides CheckoutPaneBase:: |
|
PaymentProcess:: |
public | function |
Builds the pane form. Overrides CheckoutPaneInterface:: |
|
PaymentProcess:: |
protected | function | Builds the URL to the "return" page. | |
PaymentProcess:: |
public static | function |
Creates an instance of the plugin. Overrides CheckoutPaneBase:: |
|
PaymentProcess:: |
protected | function | Creates the payment to be processed. | |
PaymentProcess:: |
public | function |
Gets default configuration for this plugin. Overrides CheckoutPaneBase:: |
|
PaymentProcess:: |
public | function |
Form submission handler. Overrides CheckoutPaneBase:: |
|
PaymentProcess:: |
public | function |
Constructs a new PaymentProcess object. Overrides CheckoutPaneBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |