Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Info Class Reference

Public Member Functions

 getPaymentInfo (\Magento\Payment\Model\InfoInterface $payment, $labelValuesOnly=false)
 
 getPublicPaymentInfo (\Magento\Payment\Model\InfoInterface $payment, $labelValuesOnly=false)
 
 importToPayment ($from, \Magento\Payment\Model\InfoInterface $payment)
 
exportFromPayment (\Magento\Payment\Model\InfoInterface $payment, $to, array $map=null)
 

Static Public Member Functions

static isPaymentReviewRequired (\Magento\Payment\Model\InfoInterface $payment)
 
static isFraudReviewAllowed (\Magento\Payment\Model\InfoInterface $payment)
 
static isPaymentCompleted (\Magento\Payment\Model\InfoInterface $payment)
 
static isPaymentSuccessful (\Magento\Payment\Model\InfoInterface $payment)
 
static isPaymentFailed (\Magento\Payment\Model\InfoInterface $payment)
 
static explainPendingReason ($code)
 
static explainReasonCode ($code)
 
static isReversalDisputable ($code)
 
static getCaseTypeLabel ($key)
 

Data Fields

const PAYER_ID = 'payer_id'
 
const PAYER_EMAIL = 'email'
 
const PAYER_STATUS = 'payer_status'
 
const ADDRESS_ID = 'address_id'
 
const ADDRESS_STATUS = 'address_status'
 
const PROTECTION_EL = 'protection_eligibility'
 
const FRAUD_FILTERS = 'collected_fraud_filters'
 
const CORRELATION_ID = 'correlation_id'
 
const AVS_CODE = 'avs_result'
 
const AVSADDR = 'avsaddr'
 
const AVSZIP = 'avszip'
 
const IAVS = 'iavs'
 
const CVV2MATCH = 'cvv2match'
 
const CVV_2_MATCH = 'cvv_2_check_result'
 
const BUYER_TAX_ID = 'buyer_tax_id'
 
const BUYER_TAX_ID_TYPE = 'buyer_tax_id_type'
 
const PAYMENT_STATUS = 'payment_status'
 
const PENDING_REASON = 'pending_reason'
 
const IS_FRAUD = 'is_fraud_detected'
 
const PAYMENT_STATUS_GLOBAL = 'paypal_payment_status'
 
const PENDING_REASON_GLOBAL = 'paypal_pending_reason'
 
const IS_FRAUD_GLOBAL = 'paypal_is_fraud_detected'
 
const BUYER_TAX_ID_TYPE_CPF = 'BR_CPF'
 
const BUYER_TAX_ID_TYPE_CNPJ = 'BR_CNPJ'
 
const PAYMENTSTATUS_NONE = 'none'
 
const PAYMENTSTATUS_COMPLETED = 'completed'
 
const PAYMENTSTATUS_DENIED = 'denied'
 
const PAYMENTSTATUS_EXPIRED = 'expired'
 
const PAYMENTSTATUS_FAILED = 'failed'
 
const PAYMENTSTATUS_INPROGRESS = 'in_progress'
 
const PAYMENTSTATUS_PENDING = 'pending'
 
const PAYMENTSTATUS_REFUNDED = 'refunded'
 
const PAYMENTSTATUS_REFUNDEDPART = 'partially_refunded'
 
const PAYMENTSTATUS_REVERSED = 'reversed'
 
const PAYMENTSTATUS_UNREVERSED = 'canceled_reversal'
 
const PAYMENTSTATUS_PROCESSED = 'processed'
 
const PAYMENTSTATUS_VOIDED = 'voided'
 
const PAYMENTSTATUS_REVIEW = 'paymentreview'
 
const TXN_TYPE_ADJUSTMENT = 'adjustment'
 
const TXN_TYPE_NEW_CASE = 'new_case'
 
const PAYMENT_REASON_CODE_REFUND = 'refund'
 
const ORDER_STATUS_REVERSED = 'paypal_reversed'
 
const ORDER_STATUS_CANCELED_REVERSAL = 'paypal_canceled_reversal'
 
const PAYPAL_PAYER_ID = 'paypal_payer_id'
 
const PAYPAL_PAYER_EMAIL = 'paypal_payer_email'
 
const PAYPAL_PAYER_STATUS = 'paypal_payer_status'
 
const PAYPAL_ADDRESS_ID = 'paypal_address_id'
 
const PAYPAL_ADDRESS_STATUS = 'paypal_address_status'
 
const PAYPAL_PROTECTION_ELIGIBILITY = 'paypal_protection_eligibility'
 
const PAYPAL_FRAUD_FILTERS = 'paypal_fraud_filters'
 
const PAYPAL_CORRELATION_ID = 'paypal_correlation_id'
 
const PAYPAL_AVS_CODE = 'paypal_avs_code'
 
const PAYPAL_CVV_2_MATCH = 'paypal_cvv_2_match'
 
const ITEM_LABELS = 'item labels'
 
const PAYPAL_AVSADDR = 'avsaddr'
 
const PAYPAL_AVSZIP = 'avszip'
 
const PAYPAL_IAVS = 'iavs'
 
const PAYPAL_CVV2MATCH = 'cvv2match'
 

Protected Member Functions

 _getFullInfo (array $keys, \Magento\Payment\Model\InfoInterface $payment, $labelValuesOnly)
 
 _getLabel ($key)
 
 _getValue ($value, $key)
 
 _getAvsLabel ($value)
 
 _getCvv2Label ($value)
 
 _getBuyerIdTypeValue ($code)
 

Protected Attributes

 $_paymentMap
 
 $_systemMap
 
 $_paymentPublicMap = ['paypal_payer_email', self::BUYER_TAX_ID, self::BUYER_TAX_ID_TYPE]
 
 $_paymentMapFull = []
 
 $_labelCodesCache = []
 

Detailed Description

PayPal payment information model

Aware of all PayPal payment methods Collects and provides access to PayPal-specific payment data Provides business logic information about payment flow

Definition at line 16 of file Info.php.

Member Function Documentation

◆ _getAvsLabel()

_getAvsLabel (   $value)
protected

Attempt to convert AVS check result code into label

Parameters
string$value
Returns
string &cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes

Definition at line 680 of file Info.php.

681  {
682  if (!isset($this->_labelCodesCache[self::PAYPAL_AVS_CODE])) {
683  $this->_labelCodesCache[self::PAYPAL_AVS_CODE] = [
684  'A' => __('Matched Address only (no ZIP)'), // Visa, MasterCard, Discover and American Express
685  'B' => __('Matched Address only (no ZIP) International'), // international "A"
686  'N' => __('No Details matched'),
687  'C' => __('No Details matched. International'), // international "N"
688  'X' => __('Exact Match.'),
689  'D' => __('Exact Match. Address and Postal Code. International'), // international "X"
690  'F' => __('Exact Match. Address and Postal Code. UK-specific'), // UK-specific "X"
691  'E' => __('N/A. Not allowed for MOTO (Internet/Phone) transactions'),
692  'G' => __('N/A. Global Unavailable'),
693  'I' => __('N/A. International Unavailable'),
694  'Z' => __('Matched five-digit ZIP only (no Address)'),
695  'P' => __('Matched Postal Code only (no Address)'), // international "Z"
696  'R' => __('N/A. Retry'),
697  'S' => __('N/A. Service not Supported'),
698  'U' => __('N/A. Unavailable'),
699  'W' => __('Matched whole nine-digit ZIP (no Address)'),
700  'Y' => __('Yes. Matched Address and five-digit ZIP'),
701  '0' => __('All the address information matched'), // Maestro and Solo
702  '1' => __('None of the address information matched'),
703  '2' => __('Part of the address information matched'),
704  '3' => __('N/A. The merchant did not provide AVS information'),
705  '4' => __('N/A. Address not checked, or acquirer had no response. Service not available'),
706  ];
707  }
708  return isset($this->_labelCodesCache[self::PAYPAL_AVS_CODE][$value])
709  ? $this->_labelCodesCache[self::PAYPAL_AVS_CODE][$value]
710  : $value;
711  }
__()
Definition: __.php:13
$value
Definition: gender.phtml:16

◆ _getBuyerIdTypeValue()

_getBuyerIdTypeValue (   $code)
protected

Retrieve buyer id type value based on code received from PayPal (Brazil only)

Parameters
string$code
Returns
string

Definition at line 751 of file Info.php.

752  {
753  if (!isset($this->_labelCodesCache[self::BUYER_TAX_ID_TYPE])) {
754  $this->_labelCodesCache[self::BUYER_TAX_ID_TYPE] = [
755  self::BUYER_TAX_ID_TYPE_CNPJ => __('CNPJ'),
756  self::BUYER_TAX_ID_TYPE_CPF => __('CPF'),
757  ];
758  }
759  return isset($this->_labelCodesCache[self::BUYER_TAX_ID_TYPE][$code])
760  ? $this->_labelCodesCache[self::BUYER_TAX_ID_TYPE][$code]
761  : '';
762  }
__()
Definition: __.php:13
$code
Definition: info.phtml:12

◆ _getCvv2Label()

_getCvv2Label (   $value)
protected

Attempt to convert CVV2 check result code into label

Parameters
string$value
Returns
string &cmd=_render-content&content_ID=developer/e_howto_api_nvp_AVSResponseCodes

Definition at line 720 of file Info.php.

721  {
722  if (!isset($this->_labelCodesCache[self::PAYPAL_CVV_2_MATCH])) {
723  $this->_labelCodesCache[self::PAYPAL_CVV_2_MATCH] = [
724  // Visa, MasterCard, Discover and American Express
725  'M' => __('Matched (CVV2CSC)'),
726  'N' => __('No match'),
727  'P' => __('N/A. Not processed'),
728  'S' => __('N/A. Service not supported'),
729  'U' => __('N/A. Service not available'),
730  'X' => __('N/A. No response'),
731  'Y' => __('Matched (CVV2CSC)'),
732  // Maestro and Solo
733  '0' => __('Matched (CVV2)'),
734  '1' => __('No match'),
735  '2' => __('N/A. The merchant has not implemented CVV2 code handling'),
736  '3' => __('N/A. Merchant has indicated that CVV2 is not present on card'),
737  '4' => __('N/A. Service not available'),
738  ];
739  }
740  return isset($this->_labelCodesCache[self::PAYPAL_CVV_2_MATCH][$value])
741  ? $this->_labelCodesCache[self::PAYPAL_CVV_2_MATCH][$value]
742  : $value;
743  }
__()
Definition: __.php:13
$value
Definition: gender.phtml:16

◆ _getFullInfo()

_getFullInfo ( array  $keys,
\Magento\Payment\Model\InfoInterface  $payment,
  $labelValuesOnly 
)
protected

Render info item

Parameters
array$keys
\Magento\Payment\Model\InfoInterface$payment
bool$labelValuesOnly
Returns
array

Definition at line 556 of file Info.php.

557  {
558  $result = [];
559  foreach ($keys as $key) {
560  if (!isset($this->_paymentMapFull[$key])) {
561  $this->_paymentMapFull[$key] = [];
562  }
563  if (!isset($this->_paymentMapFull[$key]['label'])) {
564  if (!$payment->hasAdditionalInformation($key)) {
565  $this->_paymentMapFull[$key]['label'] = false;
566  $this->_paymentMapFull[$key]['value'] = false;
567  } else {
568  $value = $payment->getAdditionalInformation($key);
569  $this->_paymentMapFull[$key]['label'] = (string)$this->_getLabel($key);
570  $this->_paymentMapFull[$key]['value'] = $this->_getValue($value, $key);
571  }
572  }
573  if (!empty($this->_paymentMapFull[$key]['value'])) {
574  if ($labelValuesOnly) {
575  $value = $this->_paymentMapFull[$key]['value'];
576  $value = is_array($value) ? array_map('__', $value) : __($value);
577  $result[$this->_paymentMapFull[$key]['label']] = $value;
578  } else {
579  $result[$key] = $this->_paymentMapFull[$key];
580  }
581  }
582  }
583  return $result;
584  }
__()
Definition: __.php:13
_getValue($value, $key)
Definition: Info.php:644
$payment
Definition: order.php:17
$value
Definition: gender.phtml:16

◆ _getLabel()

_getLabel (   $key)
protected

Render info item labels

Parameters
string$key
Returns
string

Definition at line 592 of file Info.php.

593  {
594  if (!isset($this->_labelCodesCache[self::ITEM_LABELS])) {
595  $this->_labelCodesCache[self::ITEM_LABELS] = [
596  self::PAYPAL_PAYER_ID => __('Payer ID'),
597  self::PAYPAL_PAYER_EMAIL => __('Payer Email'),
598  self::PAYPAL_PAYER_STATUS => __('Payer Status'),
599  self::PAYPAL_ADDRESS_ID => __('Payer Address ID'),
600  self::PAYPAL_ADDRESS_STATUS => __('Payer Address Status'),
601  self::PAYPAL_PROTECTION_ELIGIBILITY => __('Merchant Protection Eligibility'),
602  self::PAYPAL_FRAUD_FILTERS => __('Triggered Fraud Filters'),
603  self::PAYPAL_CORRELATION_ID => __('Last Correlation ID'),
604  self::PAYPAL_AVS_CODE => __('Address Verification System Response'),
605  self::PAYPAL_CVV_2_MATCH => __('CVV2 Check Result by PayPal'),
606  self::PAYPAL_CVV2MATCH => __('CVV2 Check Result by PayPal'),
607  self::PAYPAL_AVSADDR => __('AVS Street Match'),
608  self::PAYPAL_AVSZIP => __('AVS zip'),
609  self::PAYPAL_IAVS => __('International AVS response'),
610  self::BUYER_TAX_ID => __('Buyer\'s Tax ID'),
611  self::BUYER_TAX_ID_TYPE => __('Buyer\'s Tax ID Type'),
612  ];
613  }
614  return isset($this->_labelCodesCache[self::ITEM_LABELS][$key])
615  ? $this->_labelCodesCache[self::ITEM_LABELS][$key]
616  : '';
617  }
__()
Definition: __.php:13

◆ _getValue()

_getValue (   $value,
  $key 
)
protected

Apply a filter upon value getting

Parameters
string$value
string$key
Returns
string @SuppressWarnings(PHPMD.CyclomaticComplexity)

Definition at line 644 of file Info.php.

645  {
646  $label = '';
647  $outputValue = implode(', ', (array) $value);
648  switch ($key) {
649  case self::PAYPAL_IAVS:
650  case self::PAYPAL_AVSZIP:
653  $label = $this->_getAvsLabel($outputValue);
654  break;
657  $label = $this->_getCvv2Label($outputValue);
658  break;
660  if (is_array($value)) {
661  return $value;
662  }
663  break;
665  $outputValue = $this->_getBuyerIdTypeValue($outputValue);
666  // fall-through intentional
667  default:
668  return $outputValue;
669  }
670  return sprintf('#%s%s', $outputValue, $outputValue == $label ? '' : ': ' . $label);
671  }
_getBuyerIdTypeValue($code)
Definition: Info.php:751
$label
Definition: details.phtml:21
$value
Definition: gender.phtml:16

◆ explainPendingReason()

static explainPendingReason (   $code)
static

Explain pending payment reason code

Parameters
string$code
Returns
\Magento\Framework\Phrase &cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails (PHPMD.CyclomaticComplexity)

Definition at line 435 of file Info.php.

436  {
437  switch ($code) {
438  case 'address':
439  return __('This customer didn\'t include a confirmed address.');
440  case 'authorization':
441  case 'order':
442  return __('The payment is authorized but not settled.');
443  case 'echeck':
444  return __('The payment eCheck is not cleared.');
445  case 'intl':
446  return __('The merchant holds a non-U.S. account and doesn\'t have a withdrawal mechanism.');
447  case 'multi-currency':
448  // break is intentionally omitted
449  case 'multi_currency':
450  // break is intentionally omitted
451  case 'multicurrency':
452  return __('The payment currency doesn\'t match any of the merchant\'s balances currency.');
453  case 'paymentreview':
454  return __('The payment is pending while it is being reviewed by PayPal for risk.');
455  case 'unilateral':
456  return __(
457  'The payment is pending because it was made to an email address that '
458  . 'is not yet registered or confirmed.'
459  );
460  case 'verify':
461  return __('The merchant account is not yet verified.');
462  case 'upgrade':
463  return __(
464  'The payment was made via credit card.'
465  . ' In order to receive funds merchant must upgrade account to Business or Premier status.'
466  );
467  case 'none':
468  // break is intentionally omitted
469  case 'other':
470  // break is intentionally omitted
471  default:
472  return __('Sorry, but something went wrong. Please contact PayPal customer service.');
473  }
474  }
__()
Definition: __.php:13
$code
Definition: info.phtml:12

◆ explainReasonCode()

static explainReasonCode (   $code)
static

Explain the refund or chargeback reason code

Parameters
string$code
Returns
string &cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_GetTransactionDetails

Definition at line 484 of file Info.php.

485  {
486  $comments = [
487  'chargeback' => __('A reversal has occurred on this transaction due to a chargeback by your customer.'),
488  'guarantee' => __(
489  'A reversal has occurred on this transaction due to your customer triggering a money-back guarantee.'
490  ),
491  'buyer-complaint' => __(
492  'A reversal has occurred on this transaction due to a'
493  . ' complaint about the transaction from your customer.'
494  ),
495  'buyer_complaint' => __(
496  'A reversal has occurred on this transaction due to a'
497  . ' complaint about the transaction from your customer.'
498  ),
499  'refund' => __(
500  'A reversal has occurred on this transaction because you have given the customer a refund.'
501  ),
502  'adjustment_reversal' => __('Reversal of an adjustment.'),
503  'admin_fraud_reversal' => __('Transaction reversal due to fraud detected by PayPal administrators.'),
504  'admin_reversal' => __('Transaction reversal by PayPal administrators.'),
505  'chargeback_reimbursement' => __('Reimbursement for a chargeback.'),
506  'chargeback_settlement' => __('Settlement of a chargeback.'),
507  'unauthorized_spoof' => __(
508  'A reversal has occurred on this transaction because of a'
509  . ' customer dispute suspecting unauthorized spoof.'
510  ),
511  'non_receipt' => __('Buyer claims that he did not receive goods or service.'),
512  'not_as_described' => __(
513  'Buyer claims that the goods or service received differ from'
514  . ' merchant’s description of the goods or service.'
515  ),
516  'unauthorized' => __('Buyer claims that he/she did not authorize transaction.'),
517  'adjustment_reimburse' => __('A case that has been resolved and close requires a reimbursement.'),
518  'duplicate' => __('Buyer claims that a possible duplicate payment was made to the merchant.'),
519  'merchandise' => __('Buyer claims that the received merchandise is unsatisfactory, defective, or damaged.'),
520  ];
521  return isset($comments[$code])
522  ? $comments[$code]
523  : __('Unknown reason. Please contact PayPal customer service.');
524  }
__()
Definition: __.php:13
$code
Definition: info.phtml:12

◆ exportFromPayment()

& exportFromPayment ( \Magento\Payment\Model\InfoInterface  $payment,
  $to,
array  $map = null 
)

Grab data from payment and map it into target

Parameters
\Magento\Payment\Model\InfoInterface$payment
array | \Magento\Framework\DataObject | callback$to
array | null$map
Returns
array|\Magento\Framework\DataObject

Definition at line 321 of file Info.php.

322  {
323  $fullMap = array_merge($this->_paymentMap, $this->_systemMap);
324  \Magento\Framework\DataObject\Mapper::accumulateByMap(
325  [$payment, 'getAdditionalInformation'],
326  $to,
327  $map ? $map : array_flip($fullMap)
328  );
329  return $to;
330  }
$payment
Definition: order.php:17

◆ getCaseTypeLabel()

static getCaseTypeLabel (   $key)
static

Get case type label

Parameters
string$key
Returns
string

Definition at line 625 of file Info.php.

626  {
627  $labels = [
628  'chargeback' => __('Chargeback'),
629  'complaint' => __('Complaint'),
630  'dispute' => __('Dispute'),
631  ];
632  $value = isset($labels[$key]) ? $labels[$key] : '';
633  return $value;
634  }
__()
Definition: __.php:13
$value
Definition: gender.phtml:16

◆ getPaymentInfo()

getPaymentInfo ( \Magento\Payment\Model\InfoInterface  $payment,
  $labelValuesOnly = false 
)

All available payment info getter

Parameters
\Magento\Payment\Model\InfoInterface$payment
bool$labelValuesOnly
Returns
array

Definition at line 268 of file Info.php.

269  {
270  // collect paypal-specific info
271  $result = $this->_getFullInfo(array_values($this->_paymentMap), $payment, $labelValuesOnly);
272 
273  // add last_trans_id
274  $label = __('Last Transaction ID');
275  $value = $payment->getLastTransId();
276  if ($labelValuesOnly) {
277  $result[(string)$label] = $value;
278  } else {
279  $result['last_trans_id'] = ['label' => $label, 'value' => $value];
280  }
281 
282  return $result;
283  }
_getFullInfo(array $keys, \Magento\Payment\Model\InfoInterface $payment, $labelValuesOnly)
Definition: Info.php:556
__()
Definition: __.php:13
$payment
Definition: order.php:17
$label
Definition: details.phtml:21
$value
Definition: gender.phtml:16

◆ getPublicPaymentInfo()

getPublicPaymentInfo ( \Magento\Payment\Model\InfoInterface  $payment,
  $labelValuesOnly = false 
)

Public payment info getter

Parameters
\Magento\Payment\Model\InfoInterface$payment
bool$labelValuesOnly
Returns
array

Definition at line 292 of file Info.php.

293  {
294  return $this->_getFullInfo($this->_paymentPublicMap, $payment, $labelValuesOnly);
295  }
_getFullInfo(array $keys, \Magento\Payment\Model\InfoInterface $payment, $labelValuesOnly)
Definition: Info.php:556
$payment
Definition: order.php:17

◆ importToPayment()

importToPayment (   $from,
\Magento\Payment\Model\InfoInterface  $payment 
)

Grab data from source and map it into payment

Parameters
array | \Magento\Framework\DataObject | callback$from
\Magento\Payment\Model\InfoInterface$payment
Returns
void

Definition at line 304 of file Info.php.

305  {
306  $fullMap = array_merge($this->_paymentMap, $this->_systemMap);
307  if (is_object($from)) {
308  $from = [$from, 'getDataUsingMethod'];
309  }
310  \Magento\Framework\DataObject\Mapper::accumulateByMap($from, [$payment, 'setAdditionalInformation'], $fullMap);
311  }
$payment
Definition: order.php:17

◆ isFraudReviewAllowed()

static isFraudReviewAllowed ( \Magento\Payment\Model\InfoInterface  $payment)
static

Check whether fraud order review detected and can be reviewed

Parameters
\Magento\Payment\Model\InfoInterface$payment
Returns
bool

Definition at line 354 of file Info.php.

355  {
357  $payment
358  ) && 1 == $payment->getAdditionalInformation(
359  self::IS_FRAUD_GLOBAL
360  );
361  }
static isPaymentReviewRequired(\Magento\Payment\Model\InfoInterface $payment)
Definition: Info.php:338
$payment
Definition: order.php:17

◆ isPaymentCompleted()

static isPaymentCompleted ( \Magento\Payment\Model\InfoInterface  $payment)
static

Check whether the payment is completed

Parameters
\Magento\Payment\Model\InfoInterface$payment
Returns
bool

Definition at line 369 of file Info.php.

370  {
371  $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
372  return self::PAYMENTSTATUS_COMPLETED === $paymentStatus;
373  }
$payment
Definition: order.php:17

◆ isPaymentFailed()

static isPaymentFailed ( \Magento\Payment\Model\InfoInterface  $payment)
static

Check whether the payment was processed unsuccessfully or failed

Parameters
\Magento\Payment\Model\InfoInterface$payment
Returns
bool

Definition at line 411 of file Info.php.

412  {
413  $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
414  return in_array(
415  $paymentStatus,
416  [
417  self::PAYMENTSTATUS_DENIED,
418  self::PAYMENTSTATUS_EXPIRED,
419  self::PAYMENTSTATUS_FAILED,
420  self::PAYMENTSTATUS_REVERSED,
421  self::PAYMENTSTATUS_VOIDED
422  ]
423  );
424  }
$payment
Definition: order.php:17

◆ isPaymentReviewRequired()

static isPaymentReviewRequired ( \Magento\Payment\Model\InfoInterface  $payment)
static

Check whether the payment is in review state

Parameters
\Magento\Payment\Model\InfoInterface$payment
Returns
bool

Definition at line 338 of file Info.php.

339  {
340  $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
341  if (self::PAYMENTSTATUS_PENDING === $paymentStatus) {
342  $pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL);
343  return !in_array($pendingReason, ['authorization', 'order']);
344  }
345  return false;
346  }
$payment
Definition: order.php:17

◆ isPaymentSuccessful()

static isPaymentSuccessful ( \Magento\Payment\Model\InfoInterface  $payment)
static

Check whether the payment was processed successfully

Parameters
\Magento\Payment\Model\InfoInterface$payment
Returns
bool

Definition at line 381 of file Info.php.

382  {
383  $paymentStatus = $payment->getAdditionalInformation(self::PAYMENT_STATUS_GLOBAL);
384  if (in_array(
385  $paymentStatus,
386  [
387  self::PAYMENTSTATUS_COMPLETED,
388  self::PAYMENTSTATUS_INPROGRESS,
389  self::PAYMENTSTATUS_REFUNDED,
390  self::PAYMENTSTATUS_REFUNDEDPART,
391  self::PAYMENTSTATUS_UNREVERSED,
392  self::PAYMENTSTATUS_PROCESSED
393  ]
394  )
395  ) {
396  return true;
397  }
398  $pendingReason = $payment->getAdditionalInformation(self::PENDING_REASON_GLOBAL);
399  return self::PAYMENTSTATUS_PENDING === $paymentStatus && in_array(
400  $pendingReason,
401  ['authorization', 'order']
402  );
403  }
$payment
Definition: order.php:17

◆ isReversalDisputable()

static isReversalDisputable (   $code)
static

Whether a reversal/refund can be disputed with PayPal

Parameters
string$code
Returns
bool;

Definition at line 532 of file Info.php.

533  {
534  $listOfDisputeCodes = [
535  'none' => true,
536  'other' => true,
537  'chargeback' => true,
538  'buyer-complaint' => true,
539  'adjustment_reversal' => true,
540  'guarantee' => false,
541  'refund' => false,
542  'chargeback_reimbursement' => false,
543  'chargeback_settlement' => false,
544  ];
545  return isset($listOfDisputeCodes[$code]) ? $listOfDisputeCodes[$code] : false;
546  }
$code
Definition: info.phtml:12

Field Documentation

◆ $_labelCodesCache

$_labelCodesCache = []
protected

Definition at line 184 of file Info.php.

◆ $_paymentMap

$_paymentMap
protected
Initial value:
= [
self::PAYER_ID => self::PAYPAL_PAYER_ID,
self::PAYER_EMAIL => self::PAYPAL_PAYER_EMAIL,
self::PAYER_STATUS => self::PAYPAL_PAYER_STATUS,
self::ADDRESS_ID => self::PAYPAL_ADDRESS_ID,
self::ADDRESS_STATUS => self::PAYPAL_ADDRESS_STATUS,
self::PROTECTION_EL => self::PAYPAL_PROTECTION_ELIGIBILITY,
self::FRAUD_FILTERS => self::PAYPAL_FRAUD_FILTERS,
self::CORRELATION_ID => self::PAYPAL_CORRELATION_ID,
self::AVS_CODE => self::PAYPAL_AVS_CODE,
self::CVV_2_MATCH => self::PAYPAL_CVV_2_MATCH,
self::BUYER_TAX_ID => self::BUYER_TAX_ID,
self::BUYER_TAX_ID_TYPE => self::BUYER_TAX_ID_TYPE,
self::AVSADDR => self::PAYPAL_AVSADDR,
self::AVSZIP => self::PAYPAL_AVSZIP,
self::IAVS => self::PAYPAL_IAVS,
self::CVV2MATCH => self::PAYPAL_CVV2MATCH
]

Definition at line 80 of file Info.php.

◆ $_paymentMapFull

$_paymentMapFull = []
protected

Definition at line 177 of file Info.php.

◆ $_paymentPublicMap

$_paymentPublicMap = ['paypal_payer_email', self::BUYER_TAX_ID, self::BUYER_TAX_ID_TYPE]
protected

Definition at line 170 of file Info.php.

◆ $_systemMap

$_systemMap
protected
Initial value:
= [
self::PAYMENT_STATUS => self::PAYMENT_STATUS_GLOBAL,
self::PENDING_REASON => self::PENDING_REASON_GLOBAL,
self::IS_FRAUD => self::IS_FRAUD_GLOBAL,
]

Definition at line 104 of file Info.php.

◆ ADDRESS_ID

const ADDRESS_ID = 'address_id'

Definition at line 29 of file Info.php.

◆ ADDRESS_STATUS

const ADDRESS_STATUS = 'address_status'

Definition at line 31 of file Info.php.

◆ AVS_CODE

const AVS_CODE = 'avs_result'

Definition at line 39 of file Info.php.

◆ AVSADDR

const AVSADDR = 'avsaddr'

Definition at line 41 of file Info.php.

◆ AVSZIP

const AVSZIP = 'avszip'

Definition at line 43 of file Info.php.

◆ BUYER_TAX_ID

const BUYER_TAX_ID = 'buyer_tax_id'

Definition at line 52 of file Info.php.

◆ BUYER_TAX_ID_TYPE

const BUYER_TAX_ID_TYPE = 'buyer_tax_id_type'

Definition at line 54 of file Info.php.

◆ BUYER_TAX_ID_TYPE_CNPJ

const BUYER_TAX_ID_TYPE_CNPJ = 'BR_CNPJ'

Definition at line 73 of file Info.php.

◆ BUYER_TAX_ID_TYPE_CPF

const BUYER_TAX_ID_TYPE_CPF = 'BR_CPF'

Possible buyer's tax id types (Brazil only)

Definition at line 71 of file Info.php.

◆ CORRELATION_ID

const CORRELATION_ID = 'correlation_id'

Definition at line 37 of file Info.php.

◆ CVV2MATCH

const CVV2MATCH = 'cvv2match'

Definition at line 47 of file Info.php.

◆ CVV_2_MATCH

const CVV_2_MATCH = 'cvv_2_check_result'

Definition at line 49 of file Info.php.

◆ FRAUD_FILTERS

const FRAUD_FILTERS = 'collected_fraud_filters'

Definition at line 35 of file Info.php.

◆ IAVS

const IAVS = 'iavs'

Definition at line 45 of file Info.php.

◆ IS_FRAUD

const IS_FRAUD = 'is_fraud_detected'

Definition at line 60 of file Info.php.

◆ IS_FRAUD_GLOBAL

const IS_FRAUD_GLOBAL = 'paypal_is_fraud_detected'

Definition at line 66 of file Info.php.

◆ ITEM_LABELS

const ITEM_LABELS = 'item labels'

Item labels key for label codes cache

Definition at line 239 of file Info.php.

◆ ORDER_STATUS_CANCELED_REVERSAL

const ORDER_STATUS_CANCELED_REVERSAL = 'paypal_canceled_reversal'

PayPal order status for Canceled Reversal payment status

Definition at line 163 of file Info.php.

◆ ORDER_STATUS_REVERSED

const ORDER_STATUS_REVERSED = 'paypal_reversed'

PayPal order status for Reverse payment status

Definition at line 158 of file Info.php.

◆ PAYER_EMAIL

const PAYER_EMAIL = 'email'

Definition at line 25 of file Info.php.

◆ PAYER_ID

const PAYER_ID = 'payer_id'

Definition at line 23 of file Info.php.

◆ PAYER_STATUS

const PAYER_STATUS = 'payer_status'

Definition at line 27 of file Info.php.

◆ PAYMENT_REASON_CODE_REFUND

const PAYMENT_REASON_CODE_REFUND = 'refund'

PayPal payment reason code when payment_status is Reversed, Refunded, or Canceled_Reversal.

Definition at line 153 of file Info.php.

◆ PAYMENT_STATUS

const PAYMENT_STATUS = 'payment_status'

Definition at line 56 of file Info.php.

◆ PAYMENT_STATUS_GLOBAL

const PAYMENT_STATUS_GLOBAL = 'paypal_payment_status'

Definition at line 62 of file Info.php.

◆ PAYMENTSTATUS_COMPLETED

const PAYMENTSTATUS_COMPLETED = 'completed'

Definition at line 117 of file Info.php.

◆ PAYMENTSTATUS_DENIED

const PAYMENTSTATUS_DENIED = 'denied'

Definition at line 119 of file Info.php.

◆ PAYMENTSTATUS_EXPIRED

const PAYMENTSTATUS_EXPIRED = 'expired'

Definition at line 121 of file Info.php.

◆ PAYMENTSTATUS_FAILED

const PAYMENTSTATUS_FAILED = 'failed'

Definition at line 123 of file Info.php.

◆ PAYMENTSTATUS_INPROGRESS

const PAYMENTSTATUS_INPROGRESS = 'in_progress'

Definition at line 125 of file Info.php.

◆ PAYMENTSTATUS_NONE

const PAYMENTSTATUS_NONE = 'none'

Definition at line 115 of file Info.php.

◆ PAYMENTSTATUS_PENDING

const PAYMENTSTATUS_PENDING = 'pending'

Definition at line 127 of file Info.php.

◆ PAYMENTSTATUS_PROCESSED

const PAYMENTSTATUS_PROCESSED = 'processed'

Definition at line 137 of file Info.php.

◆ PAYMENTSTATUS_REFUNDED

const PAYMENTSTATUS_REFUNDED = 'refunded'

Definition at line 129 of file Info.php.

◆ PAYMENTSTATUS_REFUNDEDPART

const PAYMENTSTATUS_REFUNDEDPART = 'partially_refunded'

Definition at line 131 of file Info.php.

◆ PAYMENTSTATUS_REVERSED

const PAYMENTSTATUS_REVERSED = 'reversed'

Definition at line 133 of file Info.php.

◆ PAYMENTSTATUS_REVIEW

const PAYMENTSTATUS_REVIEW = 'paymentreview'

Definition at line 141 of file Info.php.

◆ PAYMENTSTATUS_UNREVERSED

const PAYMENTSTATUS_UNREVERSED = 'canceled_reversal'

Definition at line 135 of file Info.php.

◆ PAYMENTSTATUS_VOIDED

const PAYMENTSTATUS_VOIDED = 'voided'

Definition at line 139 of file Info.php.

◆ PAYPAL_ADDRESS_ID

const PAYPAL_ADDRESS_ID = 'paypal_address_id'

Paypal address id code key

Definition at line 204 of file Info.php.

◆ PAYPAL_ADDRESS_STATUS

const PAYPAL_ADDRESS_STATUS = 'paypal_address_status'

Paypal address status code key

Definition at line 209 of file Info.php.

◆ PAYPAL_AVS_CODE

const PAYPAL_AVS_CODE = 'paypal_avs_code'

Paypal avs code key

Definition at line 229 of file Info.php.

◆ PAYPAL_AVSADDR

const PAYPAL_AVSADDR = 'avsaddr'

Paypal avs street code key

Definition at line 244 of file Info.php.

◆ PAYPAL_AVSZIP

const PAYPAL_AVSZIP = 'avszip'

Paypal avs zip code key

Definition at line 249 of file Info.php.

◆ PAYPAL_CORRELATION_ID

const PAYPAL_CORRELATION_ID = 'paypal_correlation_id'

Paypal correlation id code key

Definition at line 224 of file Info.php.

◆ PAYPAL_CVV2MATCH

const PAYPAL_CVV2MATCH = 'cvv2match'

Paypal cvv2 code key

Definition at line 259 of file Info.php.

◆ PAYPAL_CVV_2_MATCH

const PAYPAL_CVV_2_MATCH = 'paypal_cvv_2_match'

Paypal cvv2 code key

Definition at line 234 of file Info.php.

◆ PAYPAL_FRAUD_FILTERS

const PAYPAL_FRAUD_FILTERS = 'paypal_fraud_filters'

Paypal fraud filters code key

Definition at line 219 of file Info.php.

◆ PAYPAL_IAVS

const PAYPAL_IAVS = 'iavs'

Paypal avs international code key

Definition at line 254 of file Info.php.

◆ PAYPAL_PAYER_EMAIL

const PAYPAL_PAYER_EMAIL = 'paypal_payer_email'

Paypal payer email code key

Definition at line 194 of file Info.php.

◆ PAYPAL_PAYER_ID

const PAYPAL_PAYER_ID = 'paypal_payer_id'

Paypal payer id code key

Definition at line 189 of file Info.php.

◆ PAYPAL_PAYER_STATUS

const PAYPAL_PAYER_STATUS = 'paypal_payer_status'

Paypal payer status code key

Definition at line 199 of file Info.php.

◆ PAYPAL_PROTECTION_ELIGIBILITY

const PAYPAL_PROTECTION_ELIGIBILITY = 'paypal_protection_eligibility'

Paypal protection eligibility code key

Definition at line 214 of file Info.php.

◆ PENDING_REASON

const PENDING_REASON = 'pending_reason'

Definition at line 58 of file Info.php.

◆ PENDING_REASON_GLOBAL

const PENDING_REASON_GLOBAL = 'paypal_pending_reason'

Definition at line 64 of file Info.php.

◆ PROTECTION_EL

const PROTECTION_EL = 'protection_eligibility'

Definition at line 33 of file Info.php.

◆ TXN_TYPE_ADJUSTMENT

const TXN_TYPE_ADJUSTMENT = 'adjustment'

PayPal payment transaction type

Definition at line 146 of file Info.php.

◆ TXN_TYPE_NEW_CASE

const TXN_TYPE_NEW_CASE = 'new_case'

Definition at line 148 of file Info.php.


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