Swedbank-SPP / swedbank-payment-portal

Swedbank Payment Portal API library for PHP
Other
36 stars 21 forks source link

Fatal error, if directory "/tmp/banklink" is not writable. #25

Open arnisjuraga opened 4 years ago

arnisjuraga commented 4 years ago

I am using SAPP with logging an code look like this:

[...]

$hpsTxn = new Transaction\HPSTxn(
        $this->url->link('extension/payment/swedbank_portal/callback_failure', '', 'SSL'), // expire url
        $this->url->link('extension/payment/swedbank_portal/callback_success', '', 'SSL'), // return url
        $this->url->link('extension/payment/swedbank_portal/callback_failure', '', 'SSL'), // error url
        $this->pagesets_card[$this->env][$this->code],
            new Transaction\DynamicData(
                null,
                $this->return_url_from_gateway
            ));

$transaction = new Transaction($txnDetails, $hpsTxn, new CardTxn());
$setupRequest = new SetupRequest($this->auth, $transaction);

$response = $spp->getPaymentCardHostedPagesGateway()->initPayment(
            $setupRequest,
            new Swedbank_Ordering_Handler_PaymentCompletedCallback( $ORDER_NUMBER )
);

// ---------->>>>>>>>>>>>>>>>>>>
// following code gives fatal error, if `/tmp/banklink` does not exist or is not writable!
$response = $spp->getPaymentCardHostedPagesGateway()->initPayment(
            $setupRequest,
            new Swedbank_Ordering_Handler_PaymentCompletedCallback( $ORDER_NUMBER )
        );

The ERROR:

InvalidArgumentException
The directory "/tmp/banklink" is not writable.

Comes from: vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php


    public function __construct($directory, $extension = '', $umask = 0002)
    {
        // YES, this needs to be *before* createPathIfNeeded()
        if (! is_int($umask)) {
            throw new InvalidArgumentException(sprintf(
                'The umask parameter is required to be integer, was: %s',
                gettype($umask)
            ));
        }
        $this->umask = $umask;

        if (! $this->createPathIfNeeded($directory)) {
            throw new InvalidArgumentException(sprintf(
                'The directory "%s" does not exist and could not be created.',
                $directory
            ));
        }

        if (! is_writable($directory)) {
            throw new InvalidArgumentException(sprintf(
                'The directory "%s" is not writable.',
                $directory
            ));
        }
JanisE commented 4 years ago

@Swedbank-SPP , it would nice to have an example of alternative storage for the TransactionRepository than FilesystemCache (like a database, memcache etc.), and to have a configurable path for FilesystemCache.

JanisE commented 4 years ago

Oh, I just found you've shown in #2 how to use a custom cache.