Skip to content

Commit

Permalink
Fixed package version info
Browse files Browse the repository at this point in the history
  • Loading branch information
krzGablo committed Jul 29, 2024
1 parent fae136a commit 48e356f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
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';
}
}

0 comments on commit 48e356f

Please sign in to comment.