SwedbankPay/swedbank-pay-sdk-php

Path to composer.lock

frofrik opened this issue · 4 comments

I know this SDK is still beta only, but I'm using it as a base for our integration.

One error that occurred to me is that in \SwedbankPay\Api\Client\Version you're trying to locate composer.lock using current working directory (getcwd()). In our case that won't work because that is another folder.

For us, using the Laravel helper base_path('composer.lock') works much better.

Just wanted to leave a note here if someone else having problems with this.

Thank you for notifying us of this. We happily accept pull requests, but we will of course fix this as soon as possible.

aait commented

@frofrik Please check that PR 7ef0313

@aait perfect, that would solve the error for me!

Sorry guys, think I was a bit quick in my reply there.
When testing with that fix, it seems like the path to composer.lock is still wrong.

In tryGetVersionNumberFromComposerLock the path is used from $this->getComposerPath()
The path returned there will be the path to the package, like: /vendor/swedbank-pay/swedbank-pay-sdk-php

I guess we need to get above the vendor folder to find composer.lock, right?