Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
PayflowExpress Class Reference
Inheritance diagram for PayflowExpress:
Express AbstractMethod AbstractExtensibleModel MethodInterface PaymentMethodInterface AbstractModel CustomAttributesDataInterface DataObject ExtensibleDataInterface

Public Member Functions

 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Logger $logger, ProFactory $proFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\UrlInterface $urlBuilder, CartFactory $cartFactory, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\Exception\LocalizedExceptionFactory $exception, \Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository, \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $transactionBuilder, InfoFactory $paypalInfoFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 isAvailable (\Magento\Quote\Api\Data\CartInterface $quote=null)
 
 getCheckoutRedirectUrl ()
 
- Public Member Functions inherited from Express
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Logger $logger, ProFactory $proFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Paypal\Model\CartFactory $cartFactory, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\Exception\LocalizedExceptionFactory $exception, \Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository, \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $transactionBuilder, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 setStore ($store)
 
 canUseCheckout ()
 
 canUseForCurrency ($currencyCode)
 
 getConfigPaymentAction ()
 
 isAvailable (\Magento\Quote\Api\Data\CartInterface $quote=null)
 
 getConfigData ($field, $storeId=null)
 
 order (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 authorize (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 void (\Magento\Payment\Model\InfoInterface $payment)
 
 capture (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 refund (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 cancel (\Magento\Payment\Model\InfoInterface $payment)
 
 canReviewPayment ()
 
 acceptPayment (\Magento\Payment\Model\InfoInterface $payment)
 
 denyPayment (\Magento\Payment\Model\InfoInterface $payment)
 
 getCheckoutRedirectUrl ()
 
 fetchTransactionInfo (\Magento\Payment\Model\InfoInterface $payment, $transactionId)
 
 getApi ()
 
 assignData (\Magento\Framework\DataObject $data)
 
 canVoid ()
 
 canCapture ()
 
 isActive ($storeId=null)
 
- Public Member Functions inherited from AbstractMethod
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Logger $logger, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], DirectoryHelper $directory=null)
 
 setStore ($storeId)
 
 getStore ()
 
 canOrder ()
 
 canAuthorize ()
 
 canCapture ()
 
 canCapturePartial ()
 
 canCaptureOnce ()
 
 canRefund ()
 
 canRefundPartialPerInvoice ()
 
 canVoid ()
 
 canUseInternal ()
 
 canUseCheckout ()
 
 canEdit ()
 
 canFetchTransactionInfo ()
 
 fetchTransactionInfo (InfoInterface $payment, $transactionId)
 
 isGateway ()
 
 isOffline ()
 
 isInitializeNeeded ()
 
 canUseForCountry ($country)
 
 canUseForCurrency ($currencyCode)
 
 getCode ()
 
 getFormBlockType ()
 
 getInfoBlockType ()
 
 getInfoInstance ()
 
 setInfoInstance (InfoInterface $info)
 
 validate ()
 
 order (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 authorize (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 capture (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 refund (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 cancel (\Magento\Payment\Model\InfoInterface $payment)
 
 void (\Magento\Payment\Model\InfoInterface $payment)
 
 canReviewPayment ()
 
 acceptPayment (InfoInterface $payment)
 
 denyPayment (InfoInterface $payment)
 
 getTitle ()
 
 getConfigData ($field, $storeId=null)
 
 assignData (\Magento\Framework\DataObject $data)
 
 isAvailable (\Magento\Quote\Api\Data\CartInterface $quote=null)
 
 isActive ($storeId=null)
 
 initialize ($paymentAction, $stateObject)
 
 getConfigPaymentAction ()
 
 getDebugFlag ()
 
 debugData ($debugData)
 
 getDebugReplacePrivateDataKeys ()
 
- Public Member Functions inherited from AbstractExtensibleModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 getCustomAttributes ()
 
 getCustomAttribute ($attributeCode)
 
 setCustomAttributes (array $attributes)
 
 setCustomAttribute ($attributeCode, $attributeValue)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 setId ($value)
 
 __sleep ()
 
 __wakeup ()
 
- Public Member Functions inherited from AbstractModel
 __construct (\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 __sleep ()
 
 __wakeup ()
 
 setIdFieldName ($name)
 
 getIdFieldName ()
 
 getId ()
 
 setId ($value)
 
 isDeleted ($isDeleted=null)
 
 hasDataChanges ()
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 setDataChanges ($value)
 
 getOrigData ($key=null)
 
 setOrigData ($key=null, $data=null)
 
 dataHasChangedFor ($field)
 
 getResourceName ()
 
 getResourceCollection ()
 
 getCollection ()
 
 load ($modelId, $field=null)
 
 beforeLoad ($identifier, $field=null)
 
 afterLoad ()
 
 isSaveAllowed ()
 
 setHasDataChanges ($flag)
 
 save ()
 
 afterCommitCallback ()
 
 isObjectNew ($flag=null)
 
 beforeSave ()
 
 validateBeforeSave ()
 
 getCacheTags ()
 
 cleanModelCache ()
 
 afterSave ()
 
 delete ()
 
 beforeDelete ()
 
 afterDelete ()
 
 afterDeleteCommit ()
 
 getResource ()
 
 getEntityId ()
 
 setEntityId ($entityId)
 
 clearInstance ()
 
 getStoredData ()
 
 getEventPrefix ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from MethodInterface
 order (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 authorize (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 capture (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 refund (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 cancel (\Magento\Payment\Model\InfoInterface $payment)
 
 void (\Magento\Payment\Model\InfoInterface $payment)
 
 assignData (DataObject $data)
 
 isAvailable (CartInterface $quote=null)
 
- Public Member Functions inherited from PaymentMethodInterface
 getStoreId ()
 
 getIsActive ()
 

Protected Member Functions

 _importToPayment ($api, $payment)
 
- Protected Member Functions inherited from Express
 _setApiProcessableErrors ()
 
 _placeOrder (Payment $payment, $amount)
 
 _importToPayment ($api, $payment)
 
 _callDoAuthorize ($amount, $payment, $parentTransactionId)
 
 _isTransactionExpired (Transaction $transaction, $period)
 
 getOrderTransaction ($payment)
 
- Protected Member Functions inherited from AbstractMethod
 initializeData ($data=[])
 
 _debug ($debugData)
 
- Protected Member Functions inherited from AbstractExtensibleModel
 filterCustomAttributes ($data)
 
 initializeCustomAttributes ()
 
 convertCustomAttributeValues (array &$customAttributes)
 
 getCustomAttributesCodes ()
 
 _setExtensionAttributes (\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
 
 _getExtensionAttributes ()
 
- Protected Member Functions inherited from AbstractModel
 _construct ()
 
 _init ($resourceModel)
 
 _setResourceModel ($resourceName, $collectionName=null)
 
 _getResource ()
 
 _getEventData ()
 
 _beforeLoad ($modelId, $field=null)
 
 _afterLoad ()
 
 _hasModelChanged ()
 
 _getValidatorBeforeSave ()
 
 _createValidatorBeforeSave ()
 
 _getValidationRulesBeforeSave ()
 
 _clearReferences ()
 
 _clearData ()
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_code = Config::METHOD_WPP_PE_EXPRESS
 
 $_formBlockType = \Magento\Paypal\Block\PayflowExpress\Form::class
 
 $_ecInstance = null
 
 $_paypalInfoFactory
 
 $_canFetchTransactionInfo = false
 
 $_canReviewPayment = false
 
- Protected Attributes inherited from Express
 $_code = \Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS
 
 $_formBlockType = \Magento\Paypal\Block\Express\Form::class
 
 $_infoBlockType = \Magento\Paypal\Block\Payment\Info::class
 
 $_isGateway = false
 
 $_canOrder = true
 
 $_canAuthorize = true
 
 $_canCapture = true
 
 $_canCapturePartial = true
 
 $_canRefund = true
 
 $_canRefundInvoicePartial = true
 
 $_canVoid = true
 
 $_canUseInternal = false
 
 $_canUseCheckout = true
 
 $_canFetchTransactionInfo = true
 
 $_canReviewPayment = true
 
 $_pro
 
 $_isOrderPaymentActionKey = 'is_order_action'
 
 $_authorizationCountKey = 'authorization_count'
 
 $_storeManager
 
 $_urlBuilder
 
 $_cartFactory
 
 $_checkoutSession
 
 $_exception
 
 $transactionRepository
 
 $transactionBuilder
 
- Protected Attributes inherited from AbstractMethod
 $_code
 
 $_formBlockType = \Magento\Payment\Block\Form::class
 
 $_infoBlockType = \Magento\Payment\Block\Info::class
 
 $_isGateway = false
 
 $_isOffline = false
 
 $_canOrder = false
 
 $_canAuthorize = false
 
 $_canCapture = false
 
 $_canCapturePartial = false
 
 $_canCaptureOnce = false
 
 $_canRefund = false
 
 $_canRefundInvoicePartial = false
 
 $_canVoid = false
 
 $_canUseInternal = true
 
 $_canUseCheckout = true
 
 $_isInitializeNeeded = false
 
 $_canFetchTransactionInfo = false
 
 $_canReviewPayment = false
 
 $_canCancelInvoice = false
 
 $_debugReplacePrivateDataKeys = []
 
 $_paymentData
 
 $_scopeConfig
 
 $logger
 
- Protected Attributes inherited from AbstractExtensibleModel
 $extensionAttributesFactory
 
 $extensionAttributes
 
 $customAttributeFactory
 
 $customAttributesCodes = null
 
 $customAttributesChanged = false
 
- Protected Attributes inherited from AbstractModel
 $_eventPrefix = 'core_abstract'
 
 $_eventObject = 'object'
 
 $_idFieldName = 'id'
 
 $_hasDataChanges = false
 
 $_origData
 
 $_isDeleted = false
 
 $_resource
 
 $_resourceCollection
 
 $_resourceName
 
 $_collectionName
 
 $_cacheTag = false
 
 $_dataSaveAllowed = true
 
 $_isObjectNew = null
 
 $_validatorBeforeSave = null
 
 $_eventManager
 
 $_cacheManager
 
 $_registry
 
 $_logger
 
 $_appState
 
 $_actionValidator
 
 $storedData = []
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Data Fields inherited from AbstractMethod
const STATUS_UNKNOWN = 'UNKNOWN'
 
const STATUS_APPROVED = 'APPROVED'
 
const STATUS_ERROR = 'ERROR'
 
const STATUS_DECLINED = 'DECLINED'
 
const STATUS_VOID = 'VOID'
 
const STATUS_SUCCESS = 'SUCCESS'
 
- Data Fields inherited from CustomAttributesDataInterface
const CUSTOM_ATTRIBUTES = 'custom_attributes'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 
- Data Fields inherited from MethodInterface
const ACTION_ORDER = 'order'
 
const ACTION_AUTHORIZE = 'authorize'
 
const ACTION_AUTHORIZE_CAPTURE = 'authorize_capture'
 
const CHECK_USE_FOR_COUNTRY = 'country'
 
const CHECK_USE_FOR_CURRENCY = 'currency'
 
const CHECK_USE_CHECKOUT = 'checkout'
 
const CHECK_USE_INTERNAL = 'internal'
 
const CHECK_ORDER_TOTAL_MIN_MAX = 'total'
 
const CHECK_ZERO_TOTAL = 'zero_total'
 
const GROUP_OFFLINE = 'offline'
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

@SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 14 of file PayflowExpress.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\Model\Context  $context,
\Magento\Framework\Registry  $registry,
\Magento\Framework\Api\ExtensionAttributesFactory  $extensionFactory,
\Magento\Framework\Api\AttributeValueFactory  $customAttributeFactory,
\Magento\Payment\Helper\Data  $paymentData,
\Magento\Framework\App\Config\ScopeConfigInterface  $scopeConfig,
\Magento\Payment\Model\Method\Logger  $logger,
ProFactory  $proFactory,
\Magento\Store\Model\StoreManagerInterface  $storeManager,
\Magento\Framework\UrlInterface  $urlBuilder,
CartFactory  $cartFactory,
\Magento\Checkout\Model\Session  $checkoutSession,
\Magento\Framework\Exception\LocalizedExceptionFactory  $exception,
\Magento\Sales\Api\TransactionRepositoryInterface  $transactionRepository,
\Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface  $transactionBuilder,
InfoFactory  $paypalInfoFactory,
\Magento\Framework\Model\ResourceModel\AbstractResource  $resource = null,
\Magento\Framework\Data\Collection\AbstractDb  $resourceCollection = null,
array  $data = [] 
)
Parameters
\Magento\Framework\Model\Context$context
\Magento\Framework\Registry$registry
\Magento\Framework\Api\ExtensionAttributesFactory$extensionFactory
\Magento\Framework\Api\AttributeValueFactory$customAttributeFactory
\Magento\Payment\Helper\Data$paymentData
\Magento\Framework\App\Config\ScopeConfigInterface$scopeConfig
\Magento\Payment\Model\Method\Logger$logger
ProFactory$proFactory
\Magento\Store\Model\StoreManagerInterface$storeManager
\Magento\Framework\UrlInterface$urlBuilder
CartFactory$cartFactory
\Magento\Checkout\Model\Session$checkoutSession
\Magento\Framework\Exception\LocalizedExceptionFactory$exception
\Magento\Sales\Api\TransactionRepositoryInterface$transactionRepository
Transaction\BuilderInterface$transactionBuilder
InfoFactory$paypalInfoFactory
\Magento\Framework\Model\ResourceModel\AbstractResource$resource
\Magento\Framework\Data\Collection\AbstractDb$resourceCollection
array$data@SuppressWarnings(PHPMD.ExcessiveParameterList)

Definition at line 74 of file PayflowExpress.php.

94  {
95  parent::__construct(
96  $context,
97  $registry,
98  $extensionFactory,
100  $paymentData,
101  $scopeConfig,
102  $logger,
103  $proFactory,
105  $urlBuilder,
106  $cartFactory,
107  $checkoutSession,
108  $exception,
111  $resource,
112  $resourceCollection,
113  $data
114  );
115  $this->_paypalInfoFactory = $paypalInfoFactory;
116  }
$storeManager
$resource
Definition: bulk.php:12

Member Function Documentation

◆ _importToPayment()

_importToPayment (   $api,
  $payment 
)
protected

Import payment info to payment

Parameters
Api\Nvp$api
\Magento\Sales\Model\Order\Payment$payment
Returns
void

Definition at line 147 of file PayflowExpress.php.

148  {
149  $payment->setTransactionId(
150  $api->getPaypalTransactionId()
151  )->setIsTransactionClosed(
152  0
153  )->setAdditionalInformation(
155  $api->getRedirectRequired() || $api->getRedirectRequested()
156  )->setIsTransactionPending(
157  $api->getIsPaymentPending()
158  )->setTransactionAdditionalInfo(
159  Payflow\Pro::TRANSPORT_PAYFLOW_TXN_ID,
160  $api->getTransactionId()
161  );
162  $payment->setPreparedMessage(__('Payflow PNREF: #%1.', $api->getTransactionId()));
163  $this->_paypalInfoFactory->create()->importToPayment($api, $payment);
164  }
__()
Definition: __.php:13
$payment
Definition: order.php:17

◆ getCheckoutRedirectUrl()

getCheckoutRedirectUrl ( )

Checkout redirect URL getter for onepage checkout (hardcode)

See also
\Magento\Checkout\Controller\Onepage::savePaymentAction()
\Magento\Quote\Model\Quote\Payment::getCheckoutRedirectUrl()
Returns
string

Definition at line 173 of file PayflowExpress.php.

174  {
175  return $this->_urlBuilder->getUrl('paypal/payflowexpress/start');
176  }

◆ isAvailable()

isAvailable ( \Magento\Quote\Api\Data\CartInterface  $quote = null)

EC PE won't be available if the EC is available

Parameters
\Magento\Quote\Api\Data\CartInterface | \Magento\Quote\Model\Quote | null$quote
Returns
bool

Definition at line 124 of file PayflowExpress.php.

125  {
126  if (!parent::isAvailable($quote)) {
127  return false;
128  }
129  if (!$this->_ecInstance) {
130  $this->_ecInstance = $this->_paymentData->getMethodInstance(
132  );
133  }
134  if ($quote) {
135  $this->_ecInstance->setStore($quote->getStoreId());
136  }
137  return !$this->_ecInstance->isAvailable();
138  }
$quote

Field Documentation

◆ $_canFetchTransactionInfo

$_canFetchTransactionInfo = false
protected

Definition at line 43 of file PayflowExpress.php.

◆ $_canReviewPayment

$_canReviewPayment = false
protected

Definition at line 50 of file PayflowExpress.php.

◆ $_code

$_code = Config::METHOD_WPP_PE_EXPRESS
protected

Definition at line 19 of file PayflowExpress.php.

◆ $_ecInstance

$_ecInstance = null
protected

Definition at line 31 of file PayflowExpress.php.

◆ $_formBlockType

$_formBlockType = \Magento\Paypal\Block\PayflowExpress\Form::class
protected

Definition at line 24 of file PayflowExpress.php.

◆ $_paypalInfoFactory

$_paypalInfoFactory
protected

Definition at line 36 of file PayflowExpress.php.


The documentation for this class was generated from the following file: