74 $this->
_getResource()->loadByWebsite($this, $strictLoad);
86 if (!$this->getContent()) {
87 throw new \Magento\Framework\Exception\LocalizedException(
__(
'The PayPal certificate does not exist.'));
90 $certFileName = sprintf(
'cert_%s_%s.pem', $this->getWebsiteId(), strtotime($this->getUpdatedAt()));
91 $certFile = self::BASEPATH_PAYPAL_CERT . $certFileName;
93 if (!$this->varDirectory->isExist($certFile)) {
96 return $this->varDirectory->getAbsolutePath($certFile);
107 if ($this->varDirectory->isDirectory(self::BASEPATH_PAYPAL_CERT)) {
110 $this->varDirectory->writeFile($file, $this->encryptor->decrypt($this->getContent()));
120 $pattern = sprintf(
'cert_%s*', $this->getWebsiteId());
121 $entries = $this->varDirectory->search(
$pattern, self::BASEPATH_PAYPAL_CERT);
122 foreach ($entries as $entry) {
123 $this->varDirectory->delete($entry);
loadByWebsite($websiteId, $strictLoad=true)
const BASEPATH_PAYPAL_CERT
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
_removeOutdatedCertFile()