private function PayflowLink::canReferencePayment in Commerce PayPal 8
Checks whether the given payment can be referenced.
Parameters
\Drupal\commerce_payment\Entity\PaymentInterface $payment: The payment to reference.
Return value
bool Result.
1 call to PayflowLink::canReferencePayment()
- PayflowLink::buildPaymentOperations in src/
Plugin/ Commerce/ PaymentGateway/ PayflowLink.php - Builds the available operations for the given payment.
File
- src/
Plugin/ Commerce/ PaymentGateway/ PayflowLink.php, line 1050
Class
- PayflowLink
- Provides the PayPal Payflow Link payment gateway.
Namespace
Drupal\commerce_paypal\Plugin\Commerce\PaymentGatewayCode
private function canReferencePayment(PaymentInterface $payment) {
// Return FALSE if the payment isn't valid for reference transactions:
// Sale, Authorization, Delayed Capture, Void, or Credit. This list includes
// both the Payflow Link codes and Express Checkout statuses.
$supported_states = [
'S',
'A',
'D',
'V',
'C',
'Pending',
'Completed',
'Voided',
'Refunded',
];
if (!in_array($payment
->getRemoteState(), $supported_states)) {
return FALSE;
}
// Return FALSE if it is more than 365 days since the original transaction.
if ($payment
->getCompletedTime() && $payment
->getCompletedTime() < strtotime('-365 days')) {
return FALSE;
}
// Return FALSE if the payment gateway's instance does not have reference
// transaction support enabled.
if (empty($this
->getConfiguration()['reference_transactions'])) {
return FALSE;
}
return TRUE;
}