Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Static Protected Member Functions | Protected Attributes
Payflowpro Class Reference
Inheritance diagram for Payflowpro:
GatewayInterface Transparent Payflowlink Payflowadvanced

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, \Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Store\Model\StoreManagerInterface $storeManager, ConfigInterfaceFactory $configFactory, Gateway $gateway, HandlerInterface $errorHandler, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
 
 isAvailable (\Magento\Quote\Api\Data\CartInterface $quote=null)
 
 isActive ($storeId=null)
 
 getConfigPaymentAction ()
 
 authorize (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 capture (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 void (\Magento\Payment\Model\InfoInterface $payment)
 
 canVoid ()
 
 cancel (\Magento\Payment\Model\InfoInterface $payment)
 
 refund (\Magento\Payment\Model\InfoInterface $payment, $amount)
 
 fetchTransactionInfo (InfoInterface $payment, $transactionId)
 
 getConfig ()
 
 postRequest (DataObject $request, ConfigInterface $config)
 
 processErrors (DataObject $response)
 
 acceptPayment (InfoInterface $payment)
 
 denyPayment (InfoInterface $payment)
 
 reviewPayment (InfoInterface $payment, $action)
 
 setBilling (DataObject $request, $billing)
 
 setShipping ($request, $shipping)
 
 mapGatewayResponse (array $postData, DataObject $response)
 
 setTransStatus ($payment, $response)
 
 fillCustomerContacts (DataObject $order, DataObject $request)
 
 addRequestOrderInfo (DataObject $request, Order $order)
 
 assignData (DataObject $data)
 

Data Fields

const TRXTYPE_AUTH_ONLY = 'A'
 
const TRXTYPE_SALE = 'S'
 
const TRXTYPE_CREDIT = 'C'
 
const TRXTYPE_DELAYED_CAPTURE = 'D'
 
const TRXTYPE_DELAYED_VOID = 'V'
 
const TRXTYPE_DELAYED_VOICE = 'F'
 
const TRXTYPE_DELAYED_INQUIRY = 'I'
 
const TRXTYPE_ACCEPT_DENY = 'U'
 
const UPDATEACTION_APPROVED = 'APPROVE'
 
const UPDATEACTION_DECLINED_BY_MERCHANT = 'FPS_MERCHANT_DECLINE'
 
const TENDER_CC = 'C'
 
const TRANSACTION_URL = 'https://payflowpro.paypal.com/transaction'
 
const TRANSACTION_URL_TEST_MODE = 'https://pilot-payflowpro.paypal.com/transaction'
 
const RESPONSE_CODE_APPROVED = 0
 
const RESPONSE_CODE_INVALID_AMOUNT = 4
 
const RESPONSE_CODE_FRAUDSERVICE_FILTER = 126
 
const RESPONSE_CODE_DECLINED = 12
 
const RESPONSE_CODE_DECLINED_BY_FILTER = 125
 
const RESPONSE_CODE_DECLINED_BY_MERCHANT = 128
 
const RESPONSE_CODE_CAPTURE_ERROR = 111
 
const RESPONSE_CODE_VOID_ERROR = 108
 
const PNREF = 'pnref'
 

Protected Member Functions

 _getCaptureAmount ($amount)
 
 _buildPlaceRequest (DataObject $payment, $amount)
 
 transactionInquiryRequest (InfoInterface $payment, $transactionId)
 

Static Protected Member Functions

static _isTransactionUnderReview ($status)
 

Protected Attributes

 $_responseParamsMappings
 
 $_code = \Magento\Paypal\Model\Config::METHOD_PAYFLOWPRO
 
 $_isGateway = true
 
 $_canAuthorize = true
 
 $_canCapture = true
 
 $_canCapturePartial = true
 
 $_canRefund = true
 
 $_canRefundInvoicePartial = true
 
 $_canVoid = true
 
 $_canUseInternal = true
 
 $_canUseCheckout = true
 
 $_canSaveCc = false
 
 $_isProxy = false
 
 $_canFetchTransactionInfo = true
 
 $_canReviewPayment = true
 
 $_clientTimeout = 45
 
 $_debugReplacePrivateDataKeys = ['user', 'pwd', 'acct', 'expdate', 'cvv2']
 
 $storeManager
 
 $configFactory
 

Detailed Description

Payflow Pro payment gateway model @SuppressWarnings(PHPMD.TooManyFields) @SuppressWarnings(PHPMD.CouplingBetweenObjects)

Definition at line 30 of file Payflowpro.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,
\Magento\Framework\Module\ModuleListInterface  $moduleList,
\Magento\Framework\Stdlib\DateTime\TimezoneInterface  $localeDate,
\Magento\Store\Model\StoreManagerInterface  $storeManager,
ConfigInterfaceFactory  $configFactory,
Gateway  $gateway,
HandlerInterface  $errorHandler,
\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
\Magento\Framework\Module\ModuleListInterface$moduleList
\Magento\Framework\Stdlib\DateTime\TimezoneInterface$localeDate
\Magento\Store\Model\StoreManagerInterface$storeManager
ConfigInterfaceFactory$configFactory
Gateway$gateway
HandlerInterface$errorHandler
\Magento\Framework\Model\ResourceModel\AbstractResource$resource
\Magento\Framework\Data\Collection\AbstractDb$resourceCollection
array$data@SuppressWarnings(PHPMD.ExcessiveParameterList)

Definition at line 297 of file Payflowpro.php.

314  {
315  $this->storeManager = $storeManager;
316  $this->configFactory = $configFactory;
317  $this->gateway = $gateway;
318  parent::__construct(
319  $context,
320  $registry,
321  $extensionFactory,
322  $customAttributeFactory,
323  $paymentData,
324  $scopeConfig,
325  $logger,
326  $moduleList,
327  $localeDate,
328  $resource,
329  $resourceCollection,
330  $data
331  );
332  $this->errorHandler = $errorHandler;
333  }
$resource
Definition: bulk.php:12
$logger

Member Function Documentation

◆ _buildPlaceRequest()

_buildPlaceRequest ( DataObject  $payment,
  $amount 
)
protected

Return request object with information for 'authorization' or 'sale' action

Parameters
Object | Payment$payment
float$amount
Returns
DataObject

Definition at line 608 of file Payflowpro.php.

609  {
610  $request = $this->buildBasicRequest();
611  $request->setAmt($this->formatPrice($amount));
612  $request->setAcct($payment->getCcNumber());
613  $request->setExpdate(sprintf('%02d', $payment->getCcExpMonth()) . substr($payment->getCcExpYear(), -2, 2));
614  $request->setCvv2($payment->getCcCid());
615 
616  $order = $payment->getOrder();
617  $request->setCurrency($order->getBaseCurrencyCode());
619  return $request;
620  }
$order
Definition: order.php:55
fillCustomerContacts(DataObject $order, DataObject $request)
Definition: Payflowpro.php:855
$amount
Definition: order.php:14
$payment
Definition: order.php:17

◆ _getCaptureAmount()

_getCaptureAmount (   $amount)
protected

Get capture amount

Parameters
float$amount
Returns
float|int

Definition at line 398 of file Payflowpro.php.

399  {
400  $infoInstance = $this->getInfoInstance();
401  $amountToPay = $amount;
402  $authorizedAmount = $infoInstance->getAmountAuthorized();
403  return abs($amountToPay - $authorizedAmount) < 0.00001 ? 0 : $amountToPay;
404  }
$amount
Definition: order.php:14

◆ _isTransactionUnderReview()

static _isTransactionUnderReview (   $status)
staticprotected

Check whether the transaction is in payment review status

Parameters
string$status
Returns
bool

Definition at line 558 of file Payflowpro.php.

559  {
560  if (in_array($status, [self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_DECLINED_BY_MERCHANT])) {
561  return false;
562  }
563  return true;
564  }
$status
Definition: order_status.php:8

◆ acceptPayment()

acceptPayment ( InfoInterface  $payment)

Attempt to accept a pending payment

Parameters
InfoInterface$payment
Returns
bool

Definition at line 674 of file Payflowpro.php.

675  {
676  return $this->reviewPayment($payment, self::UPDATEACTION_APPROVED);
677  }
reviewPayment(InfoInterface $payment, $action)
Definition: Payflowpro.php:697
$payment
Definition: order.php:17

◆ addRequestOrderInfo()

addRequestOrderInfo ( DataObject  $request,
Order  $order 
)

Add order details to payment request

Parameters
DataObject$request
Order$order
Returns
void

Definition at line 876 of file Payflowpro.php.

877  {
878  $id = $order->getId();
879  // for auth request order id is not exists yet
880  if (!empty($id)) {
881  $request->setPonum($id);
882  }
883  $orderIncrementId = $order->getIncrementId();
884  $request->setCustref($orderIncrementId)
885  ->setInvnum($orderIncrementId)
886  ->setComment1($orderIncrementId);
887  }
$id
Definition: fieldset.phtml:14
$order
Definition: order.php:55

◆ assignData()

assignData ( DataObject  $data)

Assign data to info model instance

Parameters
array | DataObject$data
Returns
$this
Exceptions

Definition at line 896 of file Payflowpro.php.

897  {
898  $this->_eventManager->dispatch(
899  'payment_method_assign_data_' . $this->getCode(),
900  [
902  AbstractDataAssignObserver::MODEL_CODE => $this->getInfoInstance(),
904  ]
905  );
906 
907  $this->_eventManager->dispatch(
908  'payment_method_assign_data',
909  [
911  AbstractDataAssignObserver::MODEL_CODE => $this->getInfoInstance(),
913  ]
914  );
915 
916  return $this;
917  }

◆ authorize()

authorize ( \Magento\Payment\Model\InfoInterface  $payment,
  $amount 
)

Authorize payment

Parameters
InfoInterface | Payment | Object$payment
float$amount
Returns
$this
Exceptions

Definition at line 381 of file Payflowpro.php.

382  {
384  $this->addRequestOrderInfo($request, $payment->getOrder());
385  $request->setTrxtype(self::TRXTYPE_AUTH_ONLY);
386  $response = $this->postRequest($request, $this->getConfig());
387  $this->processErrors($response);
389  return $this;
390  }
$response
Definition: 404.php:11
$amount
Definition: order.php:14
$payment
Definition: order.php:17
addRequestOrderInfo(DataObject $request, Order $order)
Definition: Payflowpro.php:876
processErrors(DataObject $response)
Definition: Payflowpro.php:653
_buildPlaceRequest(DataObject $payment, $amount)
Definition: Payflowpro.php:608
postRequest(DataObject $request, ConfigInterface $config)
Definition: Payflowpro.php:589
setTransStatus($payment, $response)
Definition: Payflowpro.php:824

◆ cancel()

cancel ( \Magento\Payment\Model\InfoInterface  $payment)

Attempt to void the authorization on cancelling

Parameters
InfoInterface | Object$payment
Returns
$this

Definition at line 493 of file Payflowpro.php.

494  {
495  if (!$payment->getOrder()->getInvoiceCollection()->count()) {
496  return $this->void($payment);
497  }
498 
499  return false;
500  }
$payment
Definition: order.php:17
void(\Magento\Payment\Model\InfoInterface $payment)
Definition: Payflowpro.php:452

◆ canVoid()

canVoid ( )

Check void availability

Returns
bool
Exceptions

Definition at line 478 of file Payflowpro.php.

479  {
480  if ($this->getInfoInstance()->getAmountPaid()) {
481  $this->_canVoid = false;
482  }
483 
484  return $this->_canVoid;
485  }

◆ capture()

capture ( \Magento\Payment\Model\InfoInterface  $payment,
  $amount 
)

Capture payment

Parameters
InfoInterface | Payment | Object$payment
float$amount
Returns
$this
Exceptions

Definition at line 415 of file Payflowpro.php.

416  {
417  if ($payment->getAdditionalInformation(self::PNREF)) {
418  $request = $this->buildBasicRequest();
419  $request->setAmt($this->formatPrice($amount));
420  $request->setTrxtype(self::TRXTYPE_SALE);
421  $request->setOrigid($payment->getAdditionalInformation(self::PNREF));
422  $payment->unsAdditionalInformation(self::PNREF);
423  } elseif ($payment->getParentTransactionId()) {
424  $request = $this->buildBasicRequest();
425  $request->setOrigid($payment->getParentTransactionId());
426  $captureAmount = $this->_getCaptureAmount($amount);
427  if ($captureAmount) {
428  $request->setAmt($this->formatPrice($captureAmount));
429  }
430  $trxType = $this->getInfoInstance()->hasAmountPaid() ? self::TRXTYPE_SALE : self::TRXTYPE_DELAYED_CAPTURE;
431  $request->setTrxtype($trxType);
432  } else {
434  $request->setTrxtype(self::TRXTYPE_SALE);
435  }
436  $this->addRequestOrderInfo($request, $payment->getOrder());
437 
438  $response = $this->postRequest($request, $this->getConfig());
439  $this->processErrors($response);
440  $this->setTransStatus($payment, $response);
441  return $this;
442  }
$response
Definition: 404.php:11
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$amount
Definition: order.php:14
$payment
Definition: order.php:17
addRequestOrderInfo(DataObject $request, Order $order)
Definition: Payflowpro.php:876
processErrors(DataObject $response)
Definition: Payflowpro.php:653
_buildPlaceRequest(DataObject $payment, $amount)
Definition: Payflowpro.php:608
postRequest(DataObject $request, ConfigInterface $config)
Definition: Payflowpro.php:589
setTransStatus($payment, $response)
Definition: Payflowpro.php:824

◆ denyPayment()

denyPayment ( InfoInterface  $payment)

Attempt to deny a pending payment

Parameters
InfoInterface$payment
Returns
bool

Definition at line 685 of file Payflowpro.php.

686  {
687  return $this->reviewPayment($payment, self::UPDATEACTION_DECLINED_BY_MERCHANT);
688  }
reviewPayment(InfoInterface $payment, $action)
Definition: Payflowpro.php:697
$payment
Definition: order.php:17

◆ fetchTransactionInfo()

fetchTransactionInfo ( InfoInterface  $payment,
  $transactionId 
)

Fetch transaction details info

Parameters
InfoInterface$payment
string$transactionId
Returns
array

Definition at line 533 of file Payflowpro.php.

534  {
535  $response = $this->transactionInquiryRequest($payment, $transactionId);
536 
537  $this->processErrors($response);
538 
539  if (!$this->_isTransactionUnderReview($response->getOrigresult())) {
540  $payment->setTransactionId($response->getOrigpnref())->setIsTransactionClosed(0);
541  if ($response->getOrigresult() == self::RESPONSE_CODE_APPROVED) {
542  $payment->setIsTransactionApproved(true);
544  $payment->setIsTransactionDenied(true);
545  }
546  }
547 
548  $rawData = $response->getData();
549  return $rawData ? $rawData : [];
550  }
$response
Definition: 404.php:11
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
transactionInquiryRequest(InfoInterface $payment, $transactionId)
Definition: Payflowpro.php:925
$payment
Definition: order.php:17
static _isTransactionUnderReview($status)
Definition: Payflowpro.php:558
processErrors(DataObject $response)
Definition: Payflowpro.php:653

◆ fillCustomerContacts()

fillCustomerContacts ( DataObject  $order,
DataObject  $request 
)
Parameters
DataObject$order
DataObject$request
Returns
DataObject

Definition at line 855 of file Payflowpro.php.

856  {
857  $billing = $order->getBillingAddress();
858  if (!empty($billing)) {
859  $request = $this->setBilling($request, $billing);
860  $request->setEmail($order->getCustomerEmail());
861  }
862  $shipping = $order->getShippingAddress();
863  if (!empty($shipping)) {
864  $request = $this->setShipping($request, $shipping);
865  return $request;
866  }
867  return $request;
868  }
$order
Definition: order.php:55
setBilling(DataObject $request, $billing)
Definition: Payflowpro.php:727
setShipping($request, $shipping)
Definition: Payflowpro.php:753

◆ getConfig()

getConfig ( )

Get Config instance

Returns
PayflowConfig

Definition at line 571 of file Payflowpro.php.

572  {
573  if (!$this->config) {
574  $storeId = $this->storeManager->getStore($this->getStore())->getId();
575 
576  $this->config = $this->configFactory->create();
577 
578  $this->config->setStoreId($storeId);
579  $this->config->setMethodInstance($this);
580  $this->config->setMethod($this);
581  }
582 
583  return $this->config;
584  }
$config
Definition: fraud_order.php:17

◆ getConfigPaymentAction()

getConfigPaymentAction ( )

Payment action getter compatible with payment model

Returns
string

Definition at line 367 of file Payflowpro.php.

368  {
369  return $this->getConfig()->getPaymentAction();
370  }

◆ isActive()

isActive (   $storeId = null)

Is active

Parameters
int | null$storeId
Returns
bool

Definition at line 353 of file Payflowpro.php.

354  {
355  $pathPayflowPro = 'payment/' . Config::METHOD_PAYFLOWPRO . '/active';
356  $pathPaymentPro = 'payment/' . Config::METHOD_PAYMENT_PRO . '/active';
357 
358  return (bool)(int) $this->_scopeConfig->getValue($pathPayflowPro, ScopeInterface::SCOPE_STORE, $storeId)
359  || (bool)(int) $this->_scopeConfig->getValue($pathPaymentPro, ScopeInterface::SCOPE_STORE, $storeId);
360  }

◆ isAvailable()

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

Check whether payment method can be used

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

Definition at line 342 of file Payflowpro.php.

343  {
344  return parent::isAvailable($quote) && $this->getConfig()->isMethodAvailable($this->getCode());
345  }
$quote

◆ mapGatewayResponse()

mapGatewayResponse ( array  $postData,
DataObject  $response 
)

Fill response with data.

Parameters
array$postData
DataObject$response
Returns
DataObject

Definition at line 781 of file Payflowpro.php.

782  {
783  $response->setData(array_change_key_case($postData));
784 
785  foreach ($this->_responseParamsMappings as $originKey => $key) {
786  if ($response->getData($key) !== null) {
787  $response->setData($originKey, $response->getData($key));
788  }
789  }
790 
791  $response->setData(
792  'avsdata',
793  $this->mapResponseAvsData(
794  $response->getData('avsaddr'),
795  $response->getData('avszip')
796  )
797  );
798 
799  $response->setData(
800  'name',
801  $this->mapResponseBillToName(
802  $response->getData('billtofirstname'),
803  $response->getData('billtolastname')
804  )
805  );
806 
807  $response->setData(
809  $this->mapResponseCreditCardType(
811  )
812  );
813 
814  return $response;
815  }
$response
Definition: 404.php:11

◆ postRequest()

postRequest ( DataObject  $request,
ConfigInterface  $config 
)

{inheritdoc}

Implements GatewayInterface.

Definition at line 589 of file Payflowpro.php.

590  {
591  try {
592  return $this->gateway->postRequest($request, $config);
593  } catch (\Zend_Http_Client_Exception $e) {
594  throw new LocalizedException(
595  __('Payment Gateway is unreachable at the moment. Please use another payment option.'),
596  $e
597  );
598  }
599  }
$config
Definition: fraud_order.php:17
__()
Definition: __.php:13

◆ processErrors()

processErrors ( DataObject  $response)

If response is failed throw exception

Parameters
DataObject$response
Returns
void
Exceptions

Definition at line 653 of file Payflowpro.php.

654  {
655  if ($response->getResultCode() == self::RESPONSE_CODE_VOID_ERROR) {
656  throw new \Magento\Framework\Exception\State\InvalidTransitionException(
657  __("The verification transaction can't be voided. ")
658  );
659  } elseif ($response->getResultCode() != self::RESPONSE_CODE_APPROVED &&
661  ) {
662  throw new \Magento\Payment\Gateway\Command\CommandException(__($response->getRespmsg()));
664  throw new \Magento\Payment\Gateway\Command\CommandException(__($response->getRespmsg()));
665  }
666  }
$response
Definition: 404.php:11
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
__()
Definition: __.php:13

◆ refund()

refund ( \Magento\Payment\Model\InfoInterface  $payment,
  $amount 
)

Refund capture

Parameters
InfoInterface | Payment | Object$payment
float$amount
Returns
$this
Exceptions

Definition at line 511 of file Payflowpro.php.

512  {
513  $request = $this->buildBasicRequest();
514  $request->setTrxtype(self::TRXTYPE_CREDIT);
515  $request->setOrigid($payment->getParentTransactionId());
516  $request->setAmt($this->formatPrice($amount));
517  $response = $this->postRequest($request, $this->getConfig());
518  $this->processErrors($response);
519 
520  if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED) {
521  $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(true);
522  }
523  return $this;
524  }
$response
Definition: 404.php:11
$amount
Definition: order.php:14
$payment
Definition: order.php:17
processErrors(DataObject $response)
Definition: Payflowpro.php:653
postRequest(DataObject $request, ConfigInterface $config)
Definition: Payflowpro.php:589

◆ reviewPayment()

reviewPayment ( InfoInterface  $payment,
  $action 
)

Perform the payment review

Parameters
InfoInterface$payment
string$action
Returns
bool

Definition at line 697 of file Payflowpro.php.

698  {
699  $request = $this->buildBasicRequest();
700  $transactionId = ($payment->getCcTransId()) ? $payment->getCcTransId() : $payment->getLastTransId();
701  $request->setTrxtype(self::TRXTYPE_ACCEPT_DENY);
702  $request->setOrigid($transactionId);
703  $request->setUpdateaction($action);
704 
705  $response = $this->postRequest($request, $this->getConfig());
706  $payment->setAdditionalInformation((array)$response->getData());
707  $this->processErrors($response);
708 
709  if (!$this->_isTransactionUnderReview($response->getOrigresult())) {
710  $payment->setTransactionId($response->getOrigpnref())->setIsTransactionClosed(0);
711  if ($response->getOrigresult() == self::RESPONSE_CODE_APPROVED) {
712  $payment->setIsTransactionApproved(true);
714  $payment->setIsTransactionDenied(true);
715  }
716  }
717  $rawData = $response->getData();
718  return ($rawData) ? $rawData : [];
719  }
$response
Definition: 404.php:11
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$payment
Definition: order.php:17
static _isTransactionUnderReview($status)
Definition: Payflowpro.php:558
processErrors(DataObject $response)
Definition: Payflowpro.php:653
postRequest(DataObject $request, ConfigInterface $config)
Definition: Payflowpro.php:589

◆ setBilling()

setBilling ( DataObject  $request,
  $billing 
)
Parameters
DataObject$request
DataObject$billing
Returns
Object

Definition at line 727 of file Payflowpro.php.

728  {
729  $request->setFirstname(
730  $billing->getFirstname()
731  )->setLastname(
732  $billing->getLastname()
733  )->setStreet(
734  implode(' ', $billing->getStreet())
735  )->setCity(
736  $billing->getCity()
737  )->setState(
738  $billing->getRegionCode()
739  )->setZip(
740  $billing->getPostcode()
741  )->setCountry(
742  $billing->getCountryId()
743  );
744  return $request;
745  }

◆ setShipping()

setShipping (   $request,
  $shipping 
)
Parameters
DataObject$request
DataObject$shipping
Returns
Object

Definition at line 753 of file Payflowpro.php.

754  {
755  $request->setShiptofirstname(
756  $shipping->getFirstname()
757  )->setShiptolastname(
758  $shipping->getLastname()
759  )->setShiptostreet(
760  implode(' ', $shipping->getStreet())
761  )->setShiptocity(
762  $shipping->getCity()
763  )->setShiptostate(
764  $shipping->getRegionCode()
765  )->setShiptozip(
766  $shipping->getPostcode()
767  )->setShiptocountry(
768  $shipping->getCountryId()
769  );
770  return $request;
771  }

◆ setTransStatus()

setTransStatus (   $payment,
  $response 
)
Parameters
DataObject$payment
DataObject$response
Returns
Object
Exceptions

Definition at line 824 of file Payflowpro.php.

825  {
826  if ($payment instanceof InfoInterface) {
827  $this->errorHandler->handle($payment, $response);
828  }
829 
830  switch ($response->getResultCode()) {
832  $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
833  break;
836  $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
837  $payment->setIsTransactionPending(true);
838  $payment->setIsFraudDetected(true);
839  break;
841  throw new \Magento\Framework\Exception\LocalizedException(
842  __($response->getRespmsg())
843  );
844  default:
845  break;
846  }
847  return $payment;
848  }
$response
Definition: 404.php:11
__()
Definition: __.php:13
$payment
Definition: order.php:17

◆ transactionInquiryRequest()

transactionInquiryRequest ( InfoInterface  $payment,
  $transactionId 
)
protected
Parameters
InfoInterface$payment
string$transactionId
Returns
DataObject
Exceptions
LocalizedException

Definition at line 925 of file Payflowpro.php.

926  {
927  $request = $this->buildBasicRequest();
928  $request->setTrxtype(self::TRXTYPE_DELAYED_INQUIRY);
929  $transactionId = $payment->getCcTransId() ? $payment->getCcTransId() : $transactionId;
930  $request->setOrigid($transactionId);
931  $response = $this->postRequest($request, $this->getConfig());
932 
933  return $response;
934  }
$response
Definition: 404.php:11
$payment
Definition: order.php:17
postRequest(DataObject $request, ConfigInterface $config)
Definition: Payflowpro.php:589

◆ void()

Void payment

Parameters
InfoInterface | Payment | Object$payment
Returns
$this
Exceptions

Definition at line 452 of file Payflowpro.php.

453  {
454  $request = $this->buildBasicRequest();
455  $request->setTrxtype(self::TRXTYPE_DELAYED_VOID);
456  $request->setOrigid($payment->getParentTransactionId());
457  $response = $this->postRequest($request, $this->getConfig());
458  $this->processErrors($response);
459 
460  if ($response->getResultCode() == self::RESPONSE_CODE_APPROVED) {
461  $payment->setTransactionId(
462  $response->getPnref()
463  )->setIsTransactionClosed(
464  1
465  )->setShouldCloseParentTransaction(
466  1
467  );
468  }
469 
470  return $this;
471  }
$response
Definition: 404.php:11
$payment
Definition: order.php:17
processErrors(DataObject $response)
Definition: Payflowpro.php:653
postRequest(DataObject $request, ConfigInterface $config)
Definition: Payflowpro.php:589

Field Documentation

◆ $_canAuthorize

$_canAuthorize = true
protected

Definition at line 160 of file Payflowpro.php.

◆ $_canCapture

$_canCapture = true
protected

Definition at line 167 of file Payflowpro.php.

◆ $_canCapturePartial

$_canCapturePartial = true
protected

Definition at line 174 of file Payflowpro.php.

◆ $_canFetchTransactionInfo

$_canFetchTransactionInfo = true
protected

Definition at line 230 of file Payflowpro.php.

◆ $_canRefund

$_canRefund = true
protected

Definition at line 181 of file Payflowpro.php.

◆ $_canRefundInvoicePartial

$_canRefundInvoicePartial = true
protected

Definition at line 188 of file Payflowpro.php.

◆ $_canReviewPayment

$_canReviewPayment = true
protected

Definition at line 237 of file Payflowpro.php.

◆ $_canSaveCc

$_canSaveCc = false
protected

Definition at line 216 of file Payflowpro.php.

◆ $_canUseCheckout

$_canUseCheckout = true
protected

Definition at line 209 of file Payflowpro.php.

◆ $_canUseInternal

$_canUseInternal = true
protected

Definition at line 202 of file Payflowpro.php.

◆ $_canVoid

$_canVoid = true
protected

Definition at line 195 of file Payflowpro.php.

◆ $_clientTimeout

$_clientTimeout = 45
protected

Definition at line 244 of file Payflowpro.php.

◆ $_code

Definition at line 146 of file Payflowpro.php.

◆ $_debugReplacePrivateDataKeys

$_debugReplacePrivateDataKeys = ['user', 'pwd', 'acct', 'expdate', 'cvv2']
protected

Definition at line 251 of file Payflowpro.php.

◆ $_isGateway

$_isGateway = true
protected

Definition at line 153 of file Payflowpro.php.

◆ $_isProxy

$_isProxy = false
protected

Definition at line 223 of file Payflowpro.php.

◆ $_responseParamsMappings

$_responseParamsMappings
protected

#-

Definition at line 91 of file Payflowpro.php.

◆ $configFactory

$configFactory
protected

Definition at line 261 of file Payflowpro.php.

◆ $storeManager

$storeManager
protected

Definition at line 256 of file Payflowpro.php.

◆ PNREF

const PNREF = 'pnref'

Definition at line 88 of file Payflowpro.php.

◆ RESPONSE_CODE_APPROVED

const RESPONSE_CODE_APPROVED = 0

#+ Response code

Definition at line 72 of file Payflowpro.php.

◆ RESPONSE_CODE_CAPTURE_ERROR

const RESPONSE_CODE_CAPTURE_ERROR = 111

Definition at line 84 of file Payflowpro.php.

◆ RESPONSE_CODE_DECLINED

const RESPONSE_CODE_DECLINED = 12

Definition at line 78 of file Payflowpro.php.

◆ RESPONSE_CODE_DECLINED_BY_FILTER

const RESPONSE_CODE_DECLINED_BY_FILTER = 125

Definition at line 80 of file Payflowpro.php.

◆ RESPONSE_CODE_DECLINED_BY_MERCHANT

const RESPONSE_CODE_DECLINED_BY_MERCHANT = 128

Definition at line 82 of file Payflowpro.php.

◆ RESPONSE_CODE_FRAUDSERVICE_FILTER

const RESPONSE_CODE_FRAUDSERVICE_FILTER = 126

Definition at line 76 of file Payflowpro.php.

◆ RESPONSE_CODE_INVALID_AMOUNT

const RESPONSE_CODE_INVALID_AMOUNT = 4

Definition at line 74 of file Payflowpro.php.

◆ RESPONSE_CODE_VOID_ERROR

const RESPONSE_CODE_VOID_ERROR = 108

Definition at line 86 of file Payflowpro.php.

◆ TENDER_CC

const TENDER_CC = 'C'

Tender type codes

Definition at line 60 of file Payflowpro.php.

◆ TRANSACTION_URL

const TRANSACTION_URL = 'https://payflowpro.paypal.com/transaction'

Gateway request URLs

Definition at line 65 of file Payflowpro.php.

◆ TRANSACTION_URL_TEST_MODE

const TRANSACTION_URL_TEST_MODE = 'https://pilot-payflowpro.paypal.com/transaction'

Definition at line 67 of file Payflowpro.php.

◆ TRXTYPE_ACCEPT_DENY

const TRXTYPE_ACCEPT_DENY = 'U'

Definition at line 51 of file Payflowpro.php.

◆ TRXTYPE_AUTH_ONLY

const TRXTYPE_AUTH_ONLY = 'A'

Transaction action codes

Definition at line 37 of file Payflowpro.php.

◆ TRXTYPE_CREDIT

const TRXTYPE_CREDIT = 'C'

Definition at line 41 of file Payflowpro.php.

◆ TRXTYPE_DELAYED_CAPTURE

const TRXTYPE_DELAYED_CAPTURE = 'D'

Definition at line 43 of file Payflowpro.php.

◆ TRXTYPE_DELAYED_INQUIRY

const TRXTYPE_DELAYED_INQUIRY = 'I'

Definition at line 49 of file Payflowpro.php.

◆ TRXTYPE_DELAYED_VOICE

const TRXTYPE_DELAYED_VOICE = 'F'

Definition at line 47 of file Payflowpro.php.

◆ TRXTYPE_DELAYED_VOID

const TRXTYPE_DELAYED_VOID = 'V'

Definition at line 45 of file Payflowpro.php.

◆ TRXTYPE_SALE

const TRXTYPE_SALE = 'S'

Definition at line 39 of file Payflowpro.php.

◆ UPDATEACTION_APPROVED

const UPDATEACTION_APPROVED = 'APPROVE'

Definition at line 53 of file Payflowpro.php.

◆ UPDATEACTION_DECLINED_BY_MERCHANT

const UPDATEACTION_DECLINED_BY_MERCHANT = 'FPS_MERCHANT_DECLINE'

Definition at line 55 of file Payflowpro.php.


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