Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed package version info #17

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.9.4]

### Fixed

- Fixed package version info

## [1.9.3]

### Added
Expand Down
16 changes: 14 additions & 2 deletions tpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function __construct()
{
$this->name = 'tpay';
$this->tab = 'payments_gateways';
$this->version = '1.9.3';
$this->version = '1.9.4';
$this->author = 'Krajowy Integrator Płatności S.A.';
$this->need_instance = 0;
$this->ps_versions_compliancy = [
Expand Down Expand Up @@ -190,7 +190,7 @@ public function buildInfo(): string
"prestashop:%s|tpay-prestashop:%s|tpay-openapi-php:%s|PHP:%s",
$this->getPrestaVersion(),
$this->version,
\Composer\InstalledVersions::getPrettyVersion('tpay-com/tpay-openapi-php'),
$this->getPackageVersion(),
phpversion()
);
}
Expand Down Expand Up @@ -481,4 +481,16 @@ private function getAuthTokenCacheKey()
))
);
}

private function getPackageVersion(): string
{
$dir = __DIR__ . '/composer.json';
if (file_exists($dir)) {
$composerJson = json_decode(file_get_contents($dir), true)['require'] ?? [];

return $composerJson['tpay-com/tpay-openapi-php'];
}

return 'n/a';
}
}
Loading