diff --git a/src/PayPal/Order/Cache/PayPalOrderCache.php b/src/PayPal/Order/Cache/PayPalOrderCache.php index 46ddcfd73..ca6402fce 100644 --- a/src/PayPal/Order/Cache/PayPalOrderCache.php +++ b/src/PayPal/Order/Cache/PayPalOrderCache.php @@ -39,7 +39,7 @@ class PayPalOrderCache extends ChainCache /** * @param string $key - * @param $value + * @param mixed $value * @param int $ttl Time To Live in seconds. Defines how long the value will be stored in the cache. * * @return bool diff --git a/src/PayPal/Order/PaypalOrderDataProvider.php b/src/PayPal/Order/PaypalOrderDataProvider.php index 344d71fd3..ca9d884e7 100644 --- a/src/PayPal/Order/PaypalOrderDataProvider.php +++ b/src/PayPal/Order/PaypalOrderDataProvider.php @@ -158,18 +158,18 @@ public function isTokenSaved() public function getPaymentTokenIdentifier() { - $fundingSource = $this->payPalOrder->getFundingSource(); - - if ($this->payPalOrder && isset($this->payPalOrder->getPaymentSource()[$fundingSource])) { - $paymentSource = $this->payPalOrder->getPaymentSource()[$fundingSource]; - - if ($fundingSource === 'card') { - return (isset($paymentSource['brand']) ? $paymentSource['brand'] : '') . (isset($paymentSource['last_digits']) ? ' *' . $paymentSource['last_digits'] : ''); - } else { - return isset($paymentSource['email_address']) ? $paymentSource['email_address'] : ''; + if ($this->payPalOrder) { + $fundingSource = $this->payPalOrder->getFundingSource(); + if (isset($this->payPalOrder->getPaymentSource()[$fundingSource])) { + $paymentSource = $this->payPalOrder->getPaymentSource()[$fundingSource]; + + if ($fundingSource === 'card') { + return (isset($paymentSource['brand']) ? $paymentSource['brand'] : '') . (isset($paymentSource['last_digits']) ? ' *' . $paymentSource['last_digits'] : ''); + } else { + return isset($paymentSource['email_address']) ? $paymentSource['email_address'] : ''; + } } } - return ''; } }