Compare commits

...

167 Commits
5.x ... 6.x

Author SHA1 Message Date
dependabot[bot]
a7baf9f7a0 Bump actions/cache from 4.3.0 to 5.0.1 in /.github/workflows
Bumps [actions/cache](https://github.com/actions/cache) from 4.3.0 to 5.0.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0057852bfa...9255dc7a25)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: 5.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-25 17:11:46 +01:00
dependabot[bot]
18af858930 Bump softprops/action-gh-release in /.github/workflows
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.4.2 to 2.5.0.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](5be0e66d93...a06a81a03e)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: 2.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-12 15:06:04 +01:00
dependabot[bot]
1db3592baf Bump zizmorcore/zizmor-action from 0.2.0 to 0.3.0 in /.github/workflows
Bumps [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](e673c3917a...e639db9933)

---
updated-dependencies:
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-12 15:05:31 +01:00
BitcoinMitchell
cc2cef162f dev: Fix comments with pinact 2025-11-28 15:09:35 +01:00
BitcoinMitchell
9dc2f2cedd Update validate.yml 2025-11-28 15:09:35 +01:00
BitcoinMitchell
12ea23fd7d Update security.yml 2025-11-28 15:09:35 +01:00
BitcoinMitchell
12bb7e853c dev: Use hash for actions/checkout 2025-11-28 15:09:35 +01:00
dependabot[bot]
df87beb4e3 Bump actions/checkout from 5.0.0 to 6.0.0 in /.github/workflows
Bumps [actions/checkout](https://github.com/actions/checkout) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-28 15:09:35 +01:00
BitcoinMitchell
bf71d966a6 dev: Set cooldown for dependabot 2025-11-28 15:01:40 +01:00
BitcoinMitchell
cb98dafc12 dev: Lockdown pipelines 2025-11-28 15:01:40 +01:00
dependabot[bot]
411ff22a98 Bump actions/checkout from 5 to 6 in /.github/workflows
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 15:20:28 +01:00
dependabot[bot]
f9e10eddbe Bump dealerdirect/phpcodesniffer-composer-installer from 1.1.2 to 1.2.0
Bumps [dealerdirect/phpcodesniffer-composer-installer](https://github.com/PHPCSStandards/composer-installer) from 1.1.2 to 1.2.0.
- [Release notes](https://github.com/PHPCSStandards/composer-installer/releases)
- [Changelog](https://github.com/PHPCSStandards/composer-installer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/composer-installer/compare/v1.1.2...v1.2.0)

---
updated-dependencies:
- dependency-name: dealerdirect/phpcodesniffer-composer-installer
  dependency-version: 1.2.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 15:17:33 +01:00
dependabot[bot]
bd5100461c Bump symfony/http-foundation from 5.4.46 to 5.4.50 in /modules/btcpay
Bumps [symfony/http-foundation](https://github.com/symfony/http-foundation) from 5.4.46 to 5.4.50.
- [Release notes](https://github.com/symfony/http-foundation/releases)
- [Changelog](https://github.com/symfony/http-foundation/blob/7.3/CHANGELOG.md)
- [Commits](https://github.com/symfony/http-foundation/compare/v5.4.46...v5.4.50)

---
updated-dependencies:
- dependency-name: symfony/http-foundation
  dependency-version: 5.4.50
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 15:16:51 +01:00
dependabot[bot]
5caa02768c Bump composer/semver from 3.4.3 to 3.4.4 in /modules/btcpay
Bumps [composer/semver](https://github.com/composer/semver) from 3.4.3 to 3.4.4.
- [Release notes](https://github.com/composer/semver/releases)
- [Changelog](https://github.com/composer/semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/composer/semver/compare/3.4.3...3.4.4)

---
updated-dependencies:
- dependency-name: composer/semver
  dependency-version: 3.4.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 15:09:26 +01:00
dependabot[bot]
bc4a5744e8 Bump ergebnis/composer-normalize in /modules/btcpay
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.45.0 to 2.48.2.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.45.0...2.48.2)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-version: 2.48.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 15:06:26 +01:00
dependabot[bot]
27a97c56b1 Bump stechstudio/backoff from 1.5 to 1.6 in /modules/btcpay
Bumps [stechstudio/backoff](https://github.com/stechstudio/backoff) from 1.5 to 1.6.
- [Release notes](https://github.com/stechstudio/backoff/releases)
- [Commits](https://github.com/stechstudio/backoff/compare/1.5...1.6)

---
updated-dependencies:
- dependency-name: stechstudio/backoff
  dependency-version: '1.6'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 15:06:13 +01:00
BitcoinMitchell
0a15854dab
Update validate.yml (#204) 2025-09-22 11:28:17 +02:00
BitcoinMitchell
1bf5e7ce81 Prepare for v6.3.1
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2025-09-19 10:09:41 +02:00
BitcoinMitchell
55b3fcf3c8 fix: Ensure currency is properly displayed when using BTCPay Server v2 2025-09-19 10:09:41 +02:00
BitcoinMitchell
bf39f3d622 fix: Ensure icons work on PS 9 2025-09-19 10:09:41 +02:00
BitcoinMitchell
466a38f7c1 fix: Only call parent::__construct(); for PS 8.0 2025-09-19 10:09:41 +02:00
BitcoinMitchell
1dd151bcf2 fix: redirectLink is deprecated 2025-09-19 10:09:41 +02:00
BitcoinMitchell
a2609ff54c fix: Actually log error when caught 2025-09-19 10:09:41 +02:00
dependabot[bot]
f47b9964da Bump actions/checkout from 4 to 5 in /.github/workflows
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-16 21:24:45 +02:00
dependabot[bot]
fd891f545e Bump dealerdirect/phpcodesniffer-composer-installer from 1.1.0 to 1.1.2
Bumps [dealerdirect/phpcodesniffer-composer-installer](https://github.com/PHPCSStandards/composer-installer) from 1.1.0 to 1.1.2.
- [Release notes](https://github.com/PHPCSStandards/composer-installer/releases)
- [Changelog](https://github.com/PHPCSStandards/composer-installer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/composer-installer/compare/v1.1.0...v1.1.2)

---
updated-dependencies:
- dependency-name: dealerdirect/phpcodesniffer-composer-installer
  dependency-version: 1.1.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-16 21:22:46 +02:00
dependabot[bot]
ed50d43628 Bump phpoffice/phpspreadsheet from 1.29.9 to 1.30.0
Bumps [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) from 1.29.9 to 1.30.0.
- [Release notes](https://github.com/PHPOffice/PhpSpreadsheet/releases)
- [Changelog](https://github.com/PHPOffice/PhpSpreadsheet/blob/1.30.0/CHANGELOG.md)
- [Commits](https://github.com/PHPOffice/PhpSpreadsheet/compare/1.29.9...1.30.0)

---
updated-dependencies:
- dependency-name: phpoffice/phpspreadsheet
  dependency-version: 1.30.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-16 21:19:55 +02:00
dependabot[bot]
0253f05742 Bump ergebnis/composer-normalize from 2.47.0 to 2.48.2
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.47.0 to 2.48.2.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.47.0...2.48.2)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-version: 2.48.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-16 21:18:03 +02:00
dependabot[bot]
599a382869 Bump dealerdirect/phpcodesniffer-composer-installer from 1.0.0 to 1.1.0
Bumps [dealerdirect/phpcodesniffer-composer-installer](https://github.com/PHPCSStandards/composer-installer) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/PHPCSStandards/composer-installer/releases)
- [Changelog](https://github.com/PHPCSStandards/composer-installer/blob/main/.github_changelog_generator)
- [Commits](https://github.com/PHPCSStandards/composer-installer/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: dealerdirect/phpcodesniffer-composer-installer
  dependency-version: 1.1.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 12:50:14 +02:00
dependabot[bot]
651e3eaff5 Bump squizlabs/php_codesniffer from 3.13.1 to 3.13.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.13.1 to 3.13.2.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.13.1...3.13.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-version: 3.13.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-30 12:48:58 +02:00
dependabot[bot]
7af60e0ed6 Bump squizlabs/php_codesniffer from 3.13.0 to 3.13.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.13.0 to 3.13.1.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.13.0...3.13.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-version: 3.13.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-13 15:24:37 +02:00
dependabot[bot]
d6030dc3df Bump squizlabs/php_codesniffer from 3.12.2 to 3.13.0
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.12.2 to 3.13.0.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.2...3.13.0)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-version: 3.13.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-12 16:02:02 +02:00
dependabot[bot]
f9d6f2fd7a Bump ergebnis/composer-normalize from 2.46.0 to 2.47.0
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.46.0 to 2.47.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.46.0...2.47.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-version: 2.47.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-15 16:03:51 +02:00
dependabot[bot]
b5d3a66ccc Bump squizlabs/php_codesniffer from 3.12.1 to 3.12.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.12.1 to 3.12.2.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.1...3.12.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-version: 3.12.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-14 15:41:45 +02:00
dependabot[bot]
ac3d652500 Bump ergebnis/composer-normalize from 2.45.0 to 2.46.0
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.45.0 to 2.46.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.45.0...2.46.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-version: 2.46.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-14 10:16:48 +02:00
dependabot[bot]
c0d91bee7c Bump squizlabs/php_codesniffer from 3.12.0 to 3.12.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.12.0 to 3.12.1.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.0...3.12.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-version: 3.12.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-08 12:22:16 +02:00
dependabot[bot]
e7c39dc951 Bump squizlabs/php_codesniffer from 3.11.3 to 3.12.0
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.3 to 3.12.0.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.3...3.12.0)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-18 15:00:13 +01:00
dependabot[bot]
05dbfcd026 Bump stechstudio/backoff from 1.4 to 1.5 in /modules/btcpay
Bumps [stechstudio/backoff](https://github.com/stechstudio/backoff) from 1.4 to 1.5.
- [Release notes](https://github.com/stechstudio/backoff/releases)
- [Commits](https://github.com/stechstudio/backoff/compare/1.4...1.5)

---
updated-dependencies:
- dependency-name: stechstudio/backoff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 14:35:58 +01:00
dependabot[bot]
cdaa853138 Bump phpoffice/phpspreadsheet from 1.29.8 to 1.29.9
Bumps [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) from 1.29.8 to 1.29.9.
- [Release notes](https://github.com/PHPOffice/PhpSpreadsheet/releases)
- [Changelog](https://github.com/PHPOffice/PhpSpreadsheet/blob/1.29.9/CHANGELOG.md)
- [Commits](https://github.com/PHPOffice/PhpSpreadsheet/compare/1.29.8...1.29.9)

---
updated-dependencies:
- dependency-name: phpoffice/phpspreadsheet
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 18:06:48 +01:00
dependabot[bot]
2c2bfcc456 Bump phpoffice/phpspreadsheet from 1.29.7 to 1.29.8
Bumps [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) from 1.29.7 to 1.29.8.
- [Release notes](https://github.com/PHPOffice/PhpSpreadsheet/releases)
- [Changelog](https://github.com/PHPOffice/PhpSpreadsheet/blob/1.29.8/CHANGELOG.md)
- [Commits](https://github.com/PHPOffice/PhpSpreadsheet/compare/1.29.7...1.29.8)

---
updated-dependencies:
- dependency-name: phpoffice/phpspreadsheet
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 17:05:46 +01:00
dependabot[bot]
27f6f6939f Bump squizlabs/php_codesniffer from 3.11.2 to 3.11.3
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.2 to 3.11.3.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.2...3.11.3)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-27 17:03:32 +01:00
BitcoinMitchell
fcb52555aa Updated to 2025 2025-01-03 19:39:56 +01:00
dependabot[bot]
a81a5463a0 Bump phpoffice/phpspreadsheet from 1.29.4 to 1.29.7
Bumps [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) from 1.29.4 to 1.29.7.
- [Release notes](https://github.com/PHPOffice/PhpSpreadsheet/releases)
- [Changelog](https://github.com/PHPOffice/PhpSpreadsheet/blob/1.29.7/CHANGELOG.md)
- [Commits](https://github.com/PHPOffice/PhpSpreadsheet/compare/1.29.4...1.29.7)

---
updated-dependencies:
- dependency-name: phpoffice/phpspreadsheet
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-03 19:29:25 +01:00
dependabot[bot]
3350cd7d22 Bump squizlabs/php_codesniffer from 3.11.1 to 3.11.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.1 to 3.11.2.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.1...3.11.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-27 21:08:31 +01:00
dependabot[bot]
e82faa3163 Bump tecnickcom/tcpdf from 6.7.7 to 6.8.0
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.7.7 to 6.8.0.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/compare/6.7.7...6.8.0)

---
updated-dependencies:
- dependency-name: tecnickcom/tcpdf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-27 21:07:22 +01:00
dependabot[bot]
5fda99976f Bump ergebnis/composer-normalize from 2.44.0 to 2.45.0
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.44.0 to 2.45.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.44.0...2.45.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-05 15:57:22 +01:00
dependabot[bot]
56f204d744 Bump ergebnis/composer-normalize in /modules/btcpay
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.44.0 to 2.45.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.44.0...2.45.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-05 15:55:07 +01:00
dependabot[bot]
fef984c483 Bump tecnickcom/tcpdf from 6.7.5 to 6.7.7
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.7.5 to 6.7.7.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/compare/6.7.5...6.7.7)

---
updated-dependencies:
- dependency-name: tecnickcom/tcpdf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-27 15:01:09 +01:00
BitcoinMitchell
0142dd0c4d Ensure BTCPayServer 2.0 compatibility
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-11-25 15:52:36 +01:00
dependabot[bot]
712219bd23 Bump btcpayserver/btcpayserver-greenfield-php in /modules/btcpay
Bumps [btcpayserver/btcpayserver-greenfield-php](https://github.com/btcpayserver/btcpayserver-greenfield-php) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/btcpayserver/btcpayserver-greenfield-php/releases)
- [Commits](https://github.com/btcpayserver/btcpayserver-greenfield-php/compare/v2.8.0...v2.8.1)

---
updated-dependencies:
- dependency-name: btcpayserver/btcpayserver-greenfield-php
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-25 15:17:38 +01:00
dependabot[bot]
b2ebded790 Bump phpoffice/phpspreadsheet from 1.29.2 to 1.29.4
Bumps [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) from 1.29.2 to 1.29.4.
- [Release notes](https://github.com/PHPOffice/PhpSpreadsheet/releases)
- [Changelog](https://github.com/PHPOffice/PhpSpreadsheet/blob/1.29.4/CHANGELOG.md)
- [Commits](https://github.com/PHPOffice/PhpSpreadsheet/compare/1.29.2...1.29.4)

---
updated-dependencies:
- dependency-name: phpoffice/phpspreadsheet
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 21:45:47 +01:00
dependabot[bot]
d30a0b205b Bump squizlabs/php_codesniffer from 3.11.0 to 3.11.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.0 to 3.11.1.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.11.0...3.11.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 21:40:36 +01:00
dependabot[bot]
218427da0b Bump squizlabs/php_codesniffer from 3.10.3 to 3.11.0
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.3 to 3.11.0.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.3...3.11.0)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-13 10:04:07 +01:00
BitcoinMitchell
48c26171ba Updated README.md 2024-11-08 20:36:43 +01:00
BitcoinMitchell
29cad33c1b Delete .github/workflows/dependencies.yml
Local PHP Security Checker is outdated. Will replace with different check later
2024-11-06 22:11:07 +01:00
dependabot[bot]
2a3ea675b5 Bump btcpayserver/btcpayserver-greenfield-php in /modules/btcpay
Bumps [btcpayserver/btcpayserver-greenfield-php](https://github.com/btcpayserver/btcpayserver-greenfield-php) from 2.7.1 to 2.8.0.
- [Release notes](https://github.com/btcpayserver/btcpayserver-greenfield-php/releases)
- [Commits](https://github.com/btcpayserver/btcpayserver-greenfield-php/compare/v2.7.1...v2.8.0)

---
updated-dependencies:
- dependency-name: btcpayserver/btcpayserver-greenfield-php
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-06 21:50:48 +01:00
dependabot[bot]
51177d0ca9 Bump twig/twig from 3.11.1 to 3.11.2
Bumps [twig/twig](https://github.com/twigphp/Twig) from 3.11.1 to 3.11.2.
- [Changelog](https://github.com/twigphp/Twig/blob/v3.11.2/CHANGELOG)
- [Commits](https://github.com/twigphp/Twig/compare/v3.11.1...v3.11.2)

---
updated-dependencies:
- dependency-name: twig/twig
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-06 21:50:37 +01:00
dependabot[bot]
895fe2a450 Bump twig/twig from 3.11.1 to 3.11.2 in /modules/btcpay
Bumps [twig/twig](https://github.com/twigphp/Twig) from 3.11.1 to 3.11.2.
- [Changelog](https://github.com/twigphp/Twig/blob/v3.11.2/CHANGELOG)
- [Commits](https://github.com/twigphp/Twig/compare/v3.11.1...v3.11.2)

---
updated-dependencies:
- dependency-name: twig/twig
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-06 21:50:30 +01:00
dependabot[bot]
07e4112ebf Bump symfony/http-foundation from 5.4.42 to 5.4.46 in /modules/btcpay
Bumps [symfony/http-foundation](https://github.com/symfony/http-foundation) from 5.4.42 to 5.4.46.
- [Release notes](https://github.com/symfony/http-foundation/releases)
- [Changelog](https://github.com/symfony/http-foundation/blob/7.1/CHANGELOG.md)
- [Commits](https://github.com/symfony/http-foundation/compare/v5.4.42...v5.4.46)

---
updated-dependencies:
- dependency-name: symfony/http-foundation
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-06 21:50:21 +01:00
dependabot[bot]
35b1a0bbea Bump ergebnis/composer-normalize from 2.43.0 to 2.44.0
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.43.0 to 2.44.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.43.0...2.44.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 17:24:30 +02:00
dependabot[bot]
9f0ecff2f8 Bump ergebnis/composer-normalize in /modules/btcpay
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.43.0 to 2.44.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.43.0...2.44.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 17:23:04 +02:00
dependabot[bot]
f550891a60 Bump phpoffice/phpspreadsheet from 1.29.1 to 1.29.2
Bumps [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet) from 1.29.1 to 1.29.2.
- [Release notes](https://github.com/PHPOffice/PhpSpreadsheet/releases)
- [Changelog](https://github.com/PHPOffice/PhpSpreadsheet/blob/1.29.2/CHANGELOG.md)
- [Commits](https://github.com/PHPOffice/PhpSpreadsheet/compare/1.29.1...1.29.2)

---
updated-dependencies:
- dependency-name: phpoffice/phpspreadsheet
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 17:21:03 +02:00
BitcoinMitchell
31efe2d408 Update btcpay.php to v6.2.1
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-09-20 22:06:15 +02:00
dependabot[bot]
1527d8c098 Bump composer/semver from 3.4.2 to 3.4.3 in /modules/btcpay
Bumps [composer/semver](https://github.com/composer/semver) from 3.4.2 to 3.4.3.
- [Release notes](https://github.com/composer/semver/releases)
- [Changelog](https://github.com/composer/semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/composer/semver/compare/3.4.2...3.4.3)

---
updated-dependencies:
- dependency-name: composer/semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-20 15:32:07 +02:00
dependabot[bot]
1c07520f6a Bump squizlabs/php_codesniffer from 3.10.2 to 3.10.3
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.2 to 3.10.3.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.2...3.10.3)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-18 15:43:43 +02:00
BitcoinMitchell
fd3410b3eb Update README.md 2024-09-17 13:55:55 +02:00
dependabot[bot]
9cbad690bb Bump btcpayserver/btcpayserver-greenfield-php in /modules/btcpay
Bumps [btcpayserver/btcpayserver-greenfield-php](https://github.com/btcpayserver/btcpayserver-greenfield-php) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/btcpayserver/btcpayserver-greenfield-php/releases)
- [Commits](https://github.com/btcpayserver/btcpayserver-greenfield-php/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: btcpayserver/btcpayserver-greenfield-php
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-17 12:18:12 +02:00
BitcoinMitchell
cabf7c2ee8 Updated all dependencies
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-09-16 22:35:33 +02:00
dependabot[bot]
1505153bbc Bump btcpayserver/btcpayserver-greenfield-php in /modules/btcpay
Bumps [btcpayserver/btcpayserver-greenfield-php](https://github.com/btcpayserver/btcpayserver-greenfield-php) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/btcpayserver/btcpayserver-greenfield-php/releases)
- [Commits](https://github.com/btcpayserver/btcpayserver-greenfield-php/compare/v2.6.0...v2.7.0)

---
updated-dependencies:
- dependency-name: btcpayserver/btcpayserver-greenfield-php
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-16 15:43:35 +02:00
dependabot[bot]
db6cd92f78 Bump twig/twig from 3.10.3 to 3.11.1 in /modules/btcpay
Bumps [twig/twig](https://github.com/twigphp/Twig) from 3.10.3 to 3.11.1.
- [Changelog](https://github.com/twigphp/Twig/blob/v3.11.1/CHANGELOG)
- [Commits](https://github.com/twigphp/Twig/compare/v3.10.3...v3.11.1)

---
updated-dependencies:
- dependency-name: twig/twig
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-10 19:49:50 +02:00
dependabot[bot]
5f1a1dbfa9 Bump twig/twig from 3.10.3 to 3.11.1
Bumps [twig/twig](https://github.com/twigphp/Twig) from 3.10.3 to 3.11.1.
- [Changelog](https://github.com/twigphp/Twig/blob/v3.11.1/CHANGELOG)
- [Commits](https://github.com/twigphp/Twig/compare/v3.10.3...v3.11.1)

---
updated-dependencies:
- dependency-name: twig/twig
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-10 19:35:00 +02:00
dependabot[bot]
2a6578bdb8 Bump stechstudio/backoff from 1.3 to 1.4 in /modules/btcpay
Bumps [stechstudio/backoff](https://github.com/stechstudio/backoff) from 1.3 to 1.4.
- [Release notes](https://github.com/stechstudio/backoff/releases)
- [Commits](https://github.com/stechstudio/backoff/compare/1.3...1.4)

---
updated-dependencies:
- dependency-name: stechstudio/backoff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-30 16:06:08 +02:00
dependabot[bot]
c66c49e30b Bump squizlabs/php_codesniffer from 3.10.1 to 3.10.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.1 to 3.10.2.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.1...3.10.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-22 19:16:17 +02:00
dependabot[bot]
019f297b94 Bump composer/semver from 3.4.0 to 3.4.2 in /modules/btcpay
Bumps [composer/semver](https://github.com/composer/semver) from 3.4.0 to 3.4.2.
- [Release notes](https://github.com/composer/semver/releases)
- [Changelog](https://github.com/composer/semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/composer/semver/compare/3.4.0...3.4.2)

---
updated-dependencies:
- dependency-name: composer/semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-12 15:52:45 +02:00
BitcoinMitchell
86efeb7422 [Configuration] Ensure ConfigureController works on PS 8.0
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-07-05 09:27:17 +02:00
dependabot[bot]
3915ebd46f Bump ergebnis/composer-normalize from 2.42.0 to 2.43.0
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.42.0 to 2.43.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.42.0...2.43.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 15:43:15 +02:00
dependabot[bot]
c503994389 Bump ergebnis/composer-normalize in /modules/btcpay
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.42.0 to 2.43.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.42.0...2.43.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-17 15:09:20 +02:00
dependabot[bot]
65d7a5db87 Bump symfony/debug-bundle from 5.4.39 to 5.4.40 in /modules/btcpay
Bumps [symfony/debug-bundle](https://github.com/symfony/debug-bundle) from 5.4.39 to 5.4.40.
- [Release notes](https://github.com/symfony/debug-bundle/releases)
- [Changelog](https://github.com/symfony/debug-bundle/blob/7.1/CHANGELOG.md)
- [Commits](https://github.com/symfony/debug-bundle/compare/v5.4.39...v5.4.40)

---
updated-dependencies:
- dependency-name: symfony/debug-bundle
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 16:01:55 +02:00
dependabot[bot]
c17acb2ed8 Bump symfony/var-dumper from 5.4.39 to 5.4.40 in /modules/btcpay
Bumps [symfony/var-dumper](https://github.com/symfony/var-dumper) from 5.4.39 to 5.4.40.
- [Release notes](https://github.com/symfony/var-dumper/releases)
- [Changelog](https://github.com/symfony/var-dumper/blob/7.1/CHANGELOG.md)
- [Commits](https://github.com/symfony/var-dumper/compare/v5.4.39...v5.4.40)

---
updated-dependencies:
- dependency-name: symfony/var-dumper
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 16:01:42 +02:00
dependabot[bot]
7b793d1acf Bump smarty/smarty from 4.5.2 to 4.5.3
Bumps [smarty/smarty](https://github.com/smarty-php/smarty) from 4.5.2 to 4.5.3.
- [Release notes](https://github.com/smarty-php/smarty/releases)
- [Changelog](https://github.com/smarty-php/smarty/blob/v4.5.3/CHANGELOG.md)
- [Commits](https://github.com/smarty-php/smarty/compare/v4.5.2...v4.5.3)

---
updated-dependencies:
- dependency-name: smarty/smarty
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-29 20:48:13 +02:00
dependabot[bot]
eb57c0b117 Bump squizlabs/php_codesniffer from 3.10.0 to 3.10.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.10.0 to 3.10.1.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.10.0...3.10.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 15:44:57 +02:00
dependabot[bot]
4a95f790d2 Bump prestashop/php-dev-tools from 4.3.0 to 5
Bumps [prestashop/php-dev-tools](https://github.com/PrestaShop/php-dev-tools) from 4.3.0 to 5.
- [Release notes](https://github.com/PrestaShop/php-dev-tools/releases)
- [Commits](https://github.com/PrestaShop/php-dev-tools/compare/v4.3.0...v5)

---
updated-dependencies:
- dependency-name: prestashop/php-dev-tools
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-23 15:43:27 +02:00
dependabot[bot]
8e035725d7 Bump squizlabs/php_codesniffer from 3.9.2 to 3.10.0
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.2 to 3.10.0.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.2...3.10.0)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 15:38:07 +02:00
BitcoinMitchell
e6f0f4cf88 Removed feature-request.yml 2024-05-06 00:06:09 +02:00
BitcoinMitchell
a635a5ba2e Update config.yml 2024-05-06 00:06:09 +02:00
BitcoinMitchell
5400690620 Update README.md 2024-05-06 00:06:09 +02:00
dependabot[bot]
68c91cd773 Bump symfony/debug-bundle from 4.4.37 to 5.4.39 in /modules/btcpay
Bumps [symfony/debug-bundle](https://github.com/symfony/debug-bundle) from 4.4.37 to 5.4.39.
- [Release notes](https://github.com/symfony/debug-bundle/releases)
- [Changelog](https://github.com/symfony/debug-bundle/blob/7.0/CHANGELOG.md)
- [Commits](https://github.com/symfony/debug-bundle/compare/v4.4.37...v5.4.39)

---
updated-dependencies:
- dependency-name: symfony/debug-bundle
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 15:38:40 +02:00
dependabot[bot]
a4ff72ab3d Bump btcpayserver/btcpayserver-greenfield-php in /modules/btcpay
Bumps [btcpayserver/btcpayserver-greenfield-php](https://github.com/btcpayserver/btcpayserver-greenfield-php) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/btcpayserver/btcpayserver-greenfield-php/releases)
- [Commits](https://github.com/btcpayserver/btcpayserver-greenfield-php/compare/v2.5.0...v2.6.0)

---
updated-dependencies:
- dependency-name: btcpayserver/btcpayserver-greenfield-php
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-25 21:10:39 +02:00
dependabot[bot]
f4ed7e3dce Bump squizlabs/php_codesniffer from 3.9.1 to 3.9.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.1...3.9.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-24 15:45:28 +02:00
BitcoinMitchell
18c71a2ba1 [DX] Use mailpit over mailhog 2024-04-10 16:08:16 +02:00
BitcoinMitchell
0ea3887f25 [Core] Version bump
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-04-08 14:31:29 +02:00
BitcoinMitchell
f4570c3576 [Core] Updated dependencies 2024-04-08 14:31:29 +02:00
BitcoinMitchell
1a9b2eece9 [Core] Ensure module warnings do not error out when configuration is invalid 2024-04-08 14:31:29 +02:00
BitcoinMitchell
a13be64da8 [UX] Added button to go to Dashboard 2024-04-08 14:31:29 +02:00
BitcoinMitchell
0ee632af25 [UX] When clicking on the linked store, go to the actual store instead of the the instance homepage 2024-04-08 14:31:29 +02:00
BitcoinMitchell
33b52d97a2 [UX] Improved API key error message slightly 2024-04-08 14:31:29 +02:00
BitcoinMitchell
b713c4a0fd [DX] Added an validator error typehint 2024-04-08 14:31:29 +02:00
BitcoinMitchell
2c60973224 [Configure] Get the store as soon as possible 2024-04-08 14:31:29 +02:00
BitcoinMitchell
6740d86cb1 [Configuration] Reset the API key if it is invalid 2024-04-08 14:31:29 +02:00
dependabot[bot]
9e876d325d Bump symfony/var-dumper from 4.4.47 to 5.4.38 in /modules/btcpay
Bumps [symfony/var-dumper](https://github.com/symfony/var-dumper) from 4.4.47 to 5.4.38.
- [Release notes](https://github.com/symfony/var-dumper/releases)
- [Changelog](https://github.com/symfony/var-dumper/blob/7.0/CHANGELOG.md)
- [Commits](https://github.com/symfony/var-dumper/compare/v4.4.47...v5.4.38)

---
updated-dependencies:
- dependency-name: symfony/var-dumper
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-04 19:35:29 +02:00
dependabot[bot]
9efc69dcd8 Bump btcpayserver/btcpayserver-greenfield-php in /modules/btcpay
Bumps [btcpayserver/btcpayserver-greenfield-php](https://github.com/btcpayserver/btcpayserver-greenfield-php) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/btcpayserver/btcpayserver-greenfield-php/releases)
- [Commits](https://github.com/btcpayserver/btcpayserver-greenfield-php/compare/v2.4.0...v2.5.0)

---
updated-dependencies:
- dependency-name: btcpayserver/btcpayserver-greenfield-php
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-03 15:09:58 +02:00
dependabot[bot]
b002e106e7 Bump squizlabs/php_codesniffer from 3.9.0 to 3.9.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.0 to 3.9.1.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.0...3.9.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 16:00:20 +02:00
dependabot[bot]
8550a91500 Bump stechstudio/backoff from 1.2.1 to 1.3 in /modules/btcpay
Bumps [stechstudio/backoff](https://github.com/stechstudio/backoff) from 1.2.1 to 1.3.
- [Release notes](https://github.com/stechstudio/backoff/releases)
- [Commits](https://github.com/stechstudio/backoff/compare/1.2.1...1.3)

---
updated-dependencies:
- dependency-name: stechstudio/backoff
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-29 14:25:24 +01:00
dependabot[bot]
f9b2914c14 Bump btcpayserver/btcpayserver-greenfield-php in /modules/btcpay
Bumps [btcpayserver/btcpayserver-greenfield-php](https://github.com/btcpayserver/btcpayserver-greenfield-php) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/btcpayserver/btcpayserver-greenfield-php/releases)
- [Commits](https://github.com/btcpayserver/btcpayserver-greenfield-php/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: btcpayserver/btcpayserver-greenfield-php
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-27 14:25:29 +01:00
dependabot[bot]
2259d61806 Bump php-parallel-lint/php-parallel-lint from 1.3.2 to 1.4.0
Bumps [php-parallel-lint/php-parallel-lint](https://github.com/php-parallel-lint/PHP-Parallel-Lint) from 1.3.2 to 1.4.0.
- [Release notes](https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases)
- [Changelog](https://github.com/php-parallel-lint/PHP-Parallel-Lint/blob/v1.4.0/CHANGELOG.md)
- [Commits](https://github.com/php-parallel-lint/PHP-Parallel-Lint/compare/v1.3.2...v1.4.0)

---
updated-dependencies:
- dependency-name: php-parallel-lint/php-parallel-lint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-27 14:23:20 +01:00
BitcoinMitchell
b37761e103 [Versioning] Re-use the existing CurlClient for version checking
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
Less depedencies, more better
2024-03-14 11:55:46 +01:00
BitcoinMitchell
26c0c168f7 Update README.md 2024-03-12 22:52:48 +01:00
dependabot[bot]
14e8f40f98 Bump softprops/action-gh-release from 1 to 2 in /.github/workflows
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-11 15:22:30 +01:00
dependabot[bot]
873f3225f9 Bump stechstudio/backoff from 1.2 to 1.2.1 in /modules/btcpay
Bumps [stechstudio/backoff](https://github.com/stechstudio/backoff) from 1.2 to 1.2.1.
- [Release notes](https://github.com/stechstudio/backoff/releases)
- [Commits](https://github.com/stechstudio/backoff/compare/1.2...1.2.1)

---
updated-dependencies:
- dependency-name: stechstudio/backoff
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-10 23:23:59 +01:00
BitcoinMitchell
93a32d7ddd [GitHub] Use github.ref_name instead of github.ref 2024-02-28 22:18:55 +01:00
BitcoinMitchell
7e4336095a [Core] Version bump
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-02-28 22:10:06 +01:00
BitcoinMitchell
caa5289ac6 [Core] Add the README.md to /docs as well 2024-02-28 22:10:06 +01:00
BitcoinMitchell
b948ad38e5 [Core] Ensure all TPL variables are escaped 2024-02-28 22:10:06 +01:00
BitcoinMitchell
da640a7c36 [Core] Ensure all folders have index.php 2024-02-28 22:10:06 +01:00
BitcoinMitchell
8ed68bc353 [Core] Ensure all PHP files contain defined('_PS_VERSION_') 2024-02-28 22:10:06 +01:00
BitcoinMitchell
85ff776e7f [Core] Added our module key 2024-02-28 22:10:06 +01:00
BitcoinMitchell
28fc02d9a7 Update README.md 2024-02-27 14:02:44 +01:00
BitcoinMitchell
596d4fa01c [Core] Ensure relevant polyfills are replaced
Executed `composer normalize` as well
2024-02-22 15:18:58 +01:00
BitcoinMitchell
8b64109de3 [Core] Lock Symfony to 4.4.* 2024-02-22 14:57:54 +01:00
dependabot[bot]
4a8f9942ac Bump actions/checkout from 2 to 4 in /.github/workflows
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-22 14:54:03 +01:00
dependabot[bot]
3325af8ec4 Bump actions/cache from 3 to 4 in /.github/workflows
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-22 14:52:36 +01:00
BitcoinMitchell
270c17984e Update dependencies.yml
[GitHub] Ensure logical name for dependencies workflow
2024-02-22 14:50:11 +01:00
BitcoinMitchell
7584858250 Updated GitHub relevant files 2024-02-22 14:39:40 +01:00
BitcoinMitchell
daac5df679
[Core] Resolve installation failure (#101)
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-02-22 00:35:09 +01:00
BitcoinMitchell
5497847d6e Updated README/LICENSE to 2024 2024-02-21 22:36:44 +01:00
BitcoinMitchell
51196354b4 [Core] Ensure sane repositories
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-02-21 20:42:43 +01:00
BitcoinMitchell
73ef8ceb3f [Order] Show payment info if order was created via BTCPay Server 2024-02-21 20:42:43 +01:00
BitcoinMitchell
4d8d0c48c7 [Versioning] Show module warning for latest version if no other warnings set 2024-02-21 20:42:43 +01:00
BitcoinMitchell
776a08bea5 [OrderStates] Ensure customers can download the invoice when marked as paid 2024-02-21 20:42:43 +01:00
BitcoinMitchell
e11f8c8f7b [Processor] Improved order handling, add payments, ensure clear warnings 2024-02-21 20:42:43 +01:00
BitcoinMitchell
480881538e [Order] Protect order status changes when already paid
Enabled by default
2024-02-21 20:42:43 +01:00
BitcoinMitchell
4ffeafbb3e [Developer] Added missing bcmath dependency 2024-02-21 20:42:43 +01:00
BitcoinMitchell
79011fa65c [Developer] Added simple bitcoin-cli script for bitcoind inside docker
Only accepts the commands you really need
2024-02-21 20:42:43 +01:00
BitcoinMitchell
dac5503784 [Developer] Use docker-compose.override.yml instead of .dist 2024-02-21 20:42:43 +01:00
dependabot[bot]
72a798226e
Bump squizlabs/php_codesniffer from 3.8.1 to 3.9.0 (#97)
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.8.1 to 3.9.0.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.8.1...3.9.0)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-20 20:23:27 +01:00
BitcoinMitchell
fc0713a022 Removed unused code 2024-02-19 16:43:19 +01:00
BitcoinMitchell
eda842fe9c Updated module warnings 2024-02-19 16:43:19 +01:00
BitcoinMitchell
0367537a2b Improved the configuration page 2024-02-19 16:43:19 +01:00
BitcoinMitchell
ef3a93aa28 Improved configuration layout 2024-02-19 16:43:19 +01:00
BitcoinMitchell
d9fbbbe478 Upgraded to latest dependencies
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2024-02-19 14:54:18 +01:00
dependabot[bot]
87d41f086c Bump ergebnis/composer-normalize from 2.31.0 to 2.42.0
Bumps [ergebnis/composer-normalize](https://github.com/ergebnis/composer-normalize) from 2.31.0 to 2.42.0.
- [Release notes](https://github.com/ergebnis/composer-normalize/releases)
- [Changelog](https://github.com/ergebnis/composer-normalize/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ergebnis/composer-normalize/compare/2.31.0...2.42.0)

---
updated-dependencies:
- dependency-name: ergebnis/composer-normalize
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-08 19:40:38 +01:00
dependabot[bot]
5026f592f9 Bump squizlabs/php_codesniffer from 3.8.0 to 3.8.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.8.0 to 3.8.1.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.8.0...3.8.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-12 14:28:13 +01:00
dependabot[bot]
f3d0e0c88b Bump squizlabs/php_codesniffer from 3.7.2 to 3.8.0
Bumps [squizlabs/php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) from 3.7.2 to 3.8.0.
- [Release notes](https://github.com/squizlabs/PHP_CodeSniffer/releases)
- [Commits](https://github.com/squizlabs/PHP_CodeSniffer/commits)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-08 23:40:55 +01:00
Mitchell
70f263b5fa Removed the displayPaymentEU hook
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2023-11-15 21:54:44 +01:00
Mitchell
c9eecba5b5 FIX: Ensure client is available in validation.php
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2023-11-15 21:47:37 +01:00
dependabot[bot]
05f4108874 Bump symfony/symfony from 4.4.50 to 4.4.51
Bumps [symfony/symfony](https://github.com/symfony/symfony) from 4.4.50 to 4.4.51.
- [Release notes](https://github.com/symfony/symfony/releases)
- [Changelog](https://github.com/symfony/symfony/blob/v4.4.51/CHANGELOG-4.4.md)
- [Commits](https://github.com/symfony/symfony/compare/v4.4.50...v4.4.51)

---
updated-dependencies:
- dependency-name: symfony/symfony
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-12 17:21:15 +01:00
dependabot[bot]
c0fe58ddd6 Bump symfony/twig-bridge from 5.4.22 to 5.4.31 in /modules/btcpay
Bumps [symfony/twig-bridge](https://github.com/symfony/twig-bridge) from 5.4.22 to 5.4.31.
- [Release notes](https://github.com/symfony/twig-bridge/releases)
- [Changelog](https://github.com/symfony/twig-bridge/blob/6.3/CHANGELOG.md)
- [Commits](https://github.com/symfony/twig-bridge/compare/v5.4.22...v5.4.31)

---
updated-dependencies:
- dependency-name: symfony/twig-bridge
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-12 17:18:32 +01:00
Mitchell
5a36fd0b28 Show more information
Some checks failed
Release / Release a new ZIP (push) Has been cancelled
2023-07-14 13:24:01 +02:00
Mitchell
81cea88a6d Revert "Use a null check instead an empty check" 2023-07-14 13:24:01 +02:00
Mitchell
79499ae5a5 Use a null check instead an empty check 2023-07-14 13:24:01 +02:00
Mitchell
cdb08b59cf Remove the set API key if the store isn't fully ready yet
The API key is automatically saved once set, so we must manually remove it
2023-07-14 13:24:01 +02:00
Mitchell
f77e5a6e1b Valid clients can reach the server and the store 2023-07-14 13:24:01 +02:00
Mitchell
eeec2640a9 Use str_contains over strpos, since we require PHP8 2023-07-14 13:24:01 +02:00
Mitchell
27950d30d0 Log more errors and ensure all to have a proper level 2023-07-14 13:24:01 +02:00
Mitchell
62645b2a3e Always check for null after building the Client 2023-07-14 13:24:01 +02:00
ndeet
7e79e66c6d Fix stuff breaking on PS8 on install/uninstall and webhook creation flow causing exceptions. 2023-07-14 13:24:01 +02:00
Mitchell
ac3d5ad40d Updated dependencies 2023-07-14 13:24:01 +02:00
Mitchell
16c3b476ab Updated autocomplete.php 2023-07-14 13:24:01 +02:00
Mitchell
86179f5d58 Updated dependencies 2023-07-14 13:24:01 +02:00
Mitchell
e945c3f260 Ensure the upgrade can be run 2023-07-14 13:24:01 +02:00
Mitchell
359fbd5431 Require BTCPay Server 1.7.0 and up 2023-07-14 13:24:01 +02:00
Mitchell
88ec4142b4 Upgrade to PrestaShop 8.0 2023-07-14 13:24:01 +02:00
dependabot[bot]
020297d48c Bump smarty/smarty from 4.2.1 to 4.3.1
Bumps [smarty/smarty](https://github.com/smarty-php/smarty) from 4.2.1 to 4.3.1.
- [Release notes](https://github.com/smarty-php/smarty/releases)
- [Changelog](https://github.com/smarty-php/smarty/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smarty-php/smarty/compare/v4.2.1...v4.3.1)

---
updated-dependencies:
- dependency-name: smarty/smarty
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-14 13:24:01 +02:00
dependabot[bot]
2b1411dded Bump squizlabs/php_codesniffer from 3.7.1 to 3.7.2
Bumps [squizlabs/php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) from 3.7.1 to 3.7.2.
- [Release notes](https://github.com/squizlabs/PHP_CodeSniffer/releases)
- [Commits](https://github.com/squizlabs/PHP_CodeSniffer/compare/3.7.1...3.7.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-14 13:24:01 +02:00
Mitchell
16cace9671 GitHub Workflow changes 2023-07-14 13:24:01 +02:00
dependabot[bot]
602ece9635 Bump symfony/http-kernel from 4.4.47 to 5.4.20 in /modules/btcpay
Bumps [symfony/http-kernel](https://github.com/symfony/http-kernel) from 4.4.47 to 5.4.20.
- [Release notes](https://github.com/symfony/http-kernel/releases)
- [Changelog](https://github.com/symfony/http-kernel/blob/6.2/CHANGELOG.md)
- [Commits](https://github.com/symfony/http-kernel/compare/v4.4.47...v5.4.20)

---
updated-dependencies:
- dependency-name: symfony/http-kernel
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-14 13:24:01 +02:00
Mitchell
1444e200a7 Try and resolve local-php-security-checker issues 2023-07-14 13:24:01 +02:00
dependabot[bot]
878f82d15c Bump symfony/symfony from 4.4.47 to 4.4.50
Bumps [symfony/symfony](https://github.com/symfony/symfony) from 4.4.47 to 4.4.50.
- [Release notes](https://github.com/symfony/symfony/releases)
- [Changelog](https://github.com/symfony/symfony/blob/v4.4.50/CHANGELOG-4.4.md)
- [Commits](https://github.com/symfony/symfony/compare/v4.4.47...v4.4.50)

---
updated-dependencies:
- dependency-name: symfony/symfony
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-14 13:24:01 +02:00
111 changed files with 10863 additions and 6109 deletions

1
.github/FUNDING.yml vendored
View File

@ -1,2 +1 @@
# These are supported funding model platforms
custom: https://btcpayserver.org/donate/

View File

@ -1,38 +0,0 @@
---
name: Bug report
about: File a bug report
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Your BTCPay Environment (please complete the following information):**
- BTCPay Server Version [available in the right bottom corner of footer]
- Deployment Method: [e.g. Docker, Manual, Third-Party-hoist]
- Browser [e.g. chrome, safari]
**Logs (if applicable)**
Basic logs can be found in Server Settings > Logs. More logs https://docs.btcpayserver.org/Troubleshooting/#2-looking-through-the-logs
**Setup Parameters**
If you're reporting a deployment issue run `. btcpay-setup.sh -i` and paste your the parameters by obscuring private information.
**Additional context**
Add any other context about the problem here.

79
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,79 @@
name: 🐛 Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
### ❗️ Read this before submitting your bug report:
- **Provide as much detail as possible** - error logs, screenshots, your exact configuration. If the issue cannot be reproduced, it cannot be fixed.
- **Avoid reporting "error 500" or "white page" errors** - this is a universal error message that does not provide enough information to qualify the issue. Enable debug mode in the Performance section of PrestaShop or manually in `/config/defines.inc.php` and try again. You should get a proper error message.
- Thank you for taking the time to fill out this bug report!
- type: textarea
id: version
attributes:
label: What is your BTCPay Server version?
description: You can see the version in the footer's bottom right corner
placeholder: I'm running BTCPay v1.X.X.X
validations:
required: true
- type: textarea
id: deployment
attributes:
label: How did you deploy BTCPay Server?
description: Docker, manual, third-party host? Read more on deployment methods [here](https://docs.btcpayserver.org/Deployment/)
placeholder: I'm running BTCPay Server on a...
validations:
required: true
- type: textarea
id: module-version
attributes:
label: What is version of the PrestaShop plugin are you using?
description: You can see the version in the header of the configuration page or in the module list
placeholder: I'm running BTCPay v1.X.X.X
validations:
required: true
- type: textarea
id: what-happened
attributes:
label: What happened?
description: A clear and concise description of what the bug is.
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: reproduce
attributes:
label: How did you encounter this bug?
description: Step by step describe how did you encounter the bug?
placeholder: 1. I clicked X 2. Then I clicked Y 3. See error
validations:
required: true
- type: textarea
id: logoutput
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. PrestaShop logs can be found in Advanced Parameters > Logs.
render: shell
- type: textarea
id: browser
attributes:
label: What browser do you use (if useful)?
description: Provide your browser and it's version. If you replicated issues on multiple browsers, let us know which ones.
placeholder: For example Safari 15.00, Chrome 10.0, Tor, Edge, etc
validations:
required: false
- type: textarea
id: additonal
attributes:
label: Additional information
description: Feel free to provide additional information. Screenshots are always helpful.
- type: checkboxes
id: terms
attributes:
label: Are you sure this is a bug report?
description: By submitting this report, you agree that this is not a support or a feature request. For general questions please read our [documentation](https://docs.btcpayserver.org). You can ask questions [on our community chat](https://chat.btcpayserver.org)
options:
- label: I confirm this is a bug report
required: true

View File

@ -1,5 +1,17 @@
blank_issues_enabled: false
blank_issues_enabled: true
contact_links:
- name: Community Support Chat
- name: 💡 Request a feature
url: https://github.com/btcpayserver/prestashop-plugin/discussions/categories/ideas-feature-requests
about: Submit a feature request or vote on ideas posted by others. Features with most upvotes become roadmap candidates
- name: 🧑‍💻 Ask a technical question
url: https://github.com/btcpayserver/prestashop-plugin/discussions/new?category=technical-support
about: If you're experiencing a technical problem post it to our community support forum
- name: 📝 Official Documentation
url: https://docs.btcpayserver.org
about: Check our documentation for answers to common questions
- name: 💬 Community Support Chat
url: https://chat.btcpayserver.org/
about: Ask general questions and get community support in real-time.
about: Ask general questions and get community support in real-time
- name: 🙏 PrestaShop Support
url: https://www.prestashop-project.org/support/
about: Read up on how you can get support for your PrestaShop store

View File

@ -1,23 +0,0 @@
---
name: Feature request
about: Suggest a new feature or enhancement
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Sketch/Image/Wireframe/Mockup**
If applicable provide examples, wireframes, sketches or images to better explain your idea.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@ -1,16 +0,0 @@
<!-----------------------------------------------------------------------------
Thank you for contributing to the BTCPay plugin!
Please take the time to edit the "Answers" rows below with the necessary information.
------------------------------------------------------------------------------>
| Questions | Answers
| ------------- | -------------------------------------------------------
| Description? | Please be specific when describing the PR. <br> Every detail helps: versions, browser/server configuration, specific module/theme, etc. Feel free to add more information below this table.
| Type? | bug fix / improvement / new feature / refacto / critical
| BC breaks? | yes / no
| Deprecations? | yes / no
| Fixed ticket? | Fixes btcpayserver/prestashop-plugin#{issue number here}.
| How to test? | Please indicate how to best verify that this PR is correct.
<!-- Click the form's "Preview" button to make sure the table is functional in GitHub. Thank you! -->

View File

@ -1,9 +1,40 @@
version: 2
updates:
# Ensure root composer is up-to-date
- package-ecosystem: composer
directory: /
schedule:
interval: daily
open-pull-requests-limit: 10
cooldown:
default-days: 7
open-pull-requests-limit: 5
reviewers:
- BitcoinMitchell
labels:
- dependencies
# Ensure module composer is up-to-date
- package-ecosystem: composer
directory: /modules/btcpay
schedule:
interval: daily
cooldown:
default-days: 7
open-pull-requests-limit: 5
reviewers:
- BitcoinMitchell
labels:
- dependencies
# Ensure workflows are up-to-date
- package-ecosystem: github-actions
directory: "/.github/workflows"
schedule:
interval: daily
cooldown:
default-days: 7
open-pull-requests-limit: 5
reviewers:
- BitcoinMitchell
labels:
- dependencies

35
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,35 @@
# Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
- Fixes # (issue)
- Depends on # (issue or pr)
# Type of change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Refactor (non-breaking change which improves the codebase)
# How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [ ] Test A
- [ ] Test B
**Test Configuration**:
* BTCPay Server version:
* PrestaShop version:
* PHP version:
# Checklist:
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have checked my code and corrected any misspellings

View File

@ -1,45 +0,0 @@
name: "Validate"
on: [ "pull_request" ]
jobs:
security:
name: "Local PHP Security Checker (PHP ${{ matrix.php-versions }})"
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
matrix:
php-versions: [ '7.3', '7.4', '8.0', '8.1' ]
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-versions }}"
extensions: "mbstring, xml, ctype, iconv, intl, gd"
- name: "Get composer cache directory"
id: "composercache"
run: "echo '::set-output name=dir::$(composer config cache-files-dir)'"
- name: "Cache composer dependencies"
uses: "actions/cache@v3"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-composer-"
- name: "Validate composer"
run: "composer validate"
- name: "Install Composer dependencies"
run: "composer install --prefer-dist --no-progress --no-suggest --optimize-autoloader"
# Ensure our dependencies are fine
- name: "Cache vulnerability database"
uses: "actions/cache@v3"
with:
path: "~/.cache/local-php-security-checker"
key: "local-php-security-checker-cache"
- name: "Local PHP Security Checker"
uses: "docker://pplotka/local-php-security-checker-github-actions"
with:
path: "./modules/btcpay/composer.lock"
cache_dir: "~/.cache/local-php-security-checker"

View File

@ -4,27 +4,33 @@ on:
push:
tags: [ 'v*' ] # Push events to matching v*, i.e. v1.0, v20.15.10
permissions: {}
jobs:
linting:
name: "Release a new ZIP"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5" # v6.0.0
with:
persist-credentials: false
- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2" # https://github.com/shivammathur/setup-php
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2.36.0
with:
php-version: "7.3"
php-version: "8.0"
extensions: "mbstring, xml, ctype, iconv, intl, gd"
tools: "composer:v2"
- name: "Get composer cache directory"
id: "composercache"
run: "echo '::set-output name=dir::$(composer config cache-files-dir)'"
id: "composer-cache"
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
- name: "Cache composer dependencies"
uses: "actions/cache@v2"
uses: "actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb" # v5.0.1
with:
path: "${{ steps.composercache.outputs.dir }}"
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-composer-"
lookup-only: true
- name: "Validate composer"
run: "composer validate"
- name: "Install Composer dependencies"
@ -34,24 +40,14 @@ jobs:
- name: "Make zip"
run: "make"
# Make a release from the tag
# Make a release from the tag and upload the zip
- name: "Create Release"
id: "create_release"
uses: "actions/create-release@v1"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" # This token is provided by Actions, you do not need to create your own token
with:
tag_name: "${{ github.ref }}"
release_name: "Release ${{ github.ref }}"
# Upload the zip to the release
- name: "Upload Release Asset"
id: "upload-release-asset"
uses: "actions/upload-release-asset@v1"
uses: "softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b" # v2.5.0
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
upload_url: "${{ steps.create_release.outputs.upload_url }}" # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: "./build/btcpay.zip"
asset_name: "btcpay.zip"
asset_content_type: "application/zip"
name: "Release ${{ github.ref_name }}"
files: "./build/btcpay.zip"
fail_on_unmatched_files: true
generate_release_notes: true

26
.github/workflows/security.yml vendored Normal file
View File

@ -0,0 +1,26 @@
name: GitHub Actions Security Analysis with zizmor 🌈
on:
push:
branches: ["main"]
pull_request:
branches: ["**"]
permissions: {}
jobs:
zizmor:
name: Run zizmor 🌈
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read # only needed for private repos
actions: read # only needed for private repos
steps:
- name: Checkout repository
uses: actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5 # v6.0.0
with:
persist-credentials: false
- name: Run zizmor 🌈
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0

View File

@ -1,32 +1,43 @@
name: "Validate"
on: [ "pull_request" ]
on:
push:
paths: [ 'modules/**' ]
branches: [ '6.x' ]
tags: [ 'v*' ]
pull_request:
paths: [ 'modules/**' ]
permissions: {}
jobs:
linting:
name: "Linting (PHP ${{ matrix.php-versions }})"
runs-on: "ubuntu-latest"
strategy:
fail-fast: true
matrix:
php-versions: [ '7.3', '7.4', '8.0', '8.1' ]
php-versions: [ '8.0', '8.1' ]
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5" # v6.0.0
with:
persist-credentials: false
- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2" # https://github.com/shivammathur/setup-php
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2.36.0
with:
php-version: "${{ matrix.php-versions }}"
extensions: "mbstring, xml, ctype, iconv, intl, gd"
tools: "composer:v2"
- name: "Get composer cache directory"
id: "composercache"
run: "echo '::set-output name=dir::$(composer config cache-files-dir)'"
id: "composer-cache"
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
- name: "Cache composer dependencies"
uses: "actions/cache@v3"
uses: "actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb" # v5.0.1
with:
path: "${{ steps.composercache.outputs.dir }}"
path: "${{ steps.composer-cache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: "${{ runner.os }}-composer-"
lookup-only: true
- name: "Validate composer"
run: "composer validate"
- name: "Install Composer dependencies"

3
.gitignore vendored
View File

@ -14,11 +14,12 @@ btcpay.zip
.phpcs-cache
# Ignore developer specific docker-compose
docker-compose.yml
docker-compose.override.yml
# Ignore files in the module that are added via `make`
/modules/btcpay/LICENSE
/modules/btcpay/README.md
/modules/btcpay/docs/README.md
# We dont care about the lib/vendor folder
/modules/btcpay/lib/

1
.php-version Normal file
View File

@ -0,0 +1 @@
8.0

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017-2023 btcpayserver
Copyright (c) 2017-2025 btcpayserver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -3,9 +3,10 @@ MODULE_FOLDER := "./modules"
BUILD_FOLDER := "./build"
ZIP_NAME := "${MODULE}.zip"
ZIP_DEBUG_NAME := "${MODULE}_debug.zip"
MODULE_OUT := "${BUILD_FOLDER}/${ZIP_NAME}"
.PHONY: all build install upgrade clean lint lint-fix
.PHONY: all build install update upgrade clean lint lint-fix
all: build
@ -27,25 +28,68 @@ build: ## Build the bastard binary file
# Copy the license to the module
@cp ./LICENSE "$(MODULE_FOLDER)/$(MODULE)"
# Copy the README to the module
# Copy the README to the module root and docs
@cp ./README.md "$(MODULE_FOLDER)/$(MODULE)"
@cp ./README.md "$(MODULE_FOLDER)/$(MODULE)/docs"
# Zip the module
@cd $(MODULE_FOLDER) \
&& zip -r $(ZIP_NAME) $(MODULE) \
&& mv $(ZIP_NAME) "../$(BUILD_FOLDER)"
debug: ## Build the bastard binary file as debug file
# Installing all dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer install
# Dump autoloader
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer dump-autoload -o
# Removing the old ZIP if present
@rm -f $(MODULE_OUT)
# Make the build folder
@mkdir -p $(BUILD_FOLDER)
# Copy the license to the module
@cp ./LICENSE "$(MODULE_FOLDER)/$(MODULE)"
# Copy the README to the module
@cp ./README.md "$(MODULE_FOLDER)/$(MODULE)"
# Zip the module
@cd $(MODULE_FOLDER) \
&& zip -r $(ZIP_DEBUG_NAME) $(MODULE) \
&& mv $(ZIP_DEBUG_NAME) "../$(BUILD_FOLDER)"
bump: ## Bump all package versions
# Bump all root dependencies
@composer install
# Bump all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer install
install: ## Install everything for development
# Installing all root dependencies
composer install
@composer install
# Installing all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer install
update: ## Update all dependencies (including development)
# Upgrading all root dependencies
@composer update
# Upgrading all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \
&& composer update
upgrade: ## Upgrade all dependencies (including development)
# Upgrading all root dependencies
composer upgrade
@composer upgrade
# Upgrading all module dependencies
@cd "$(MODULE_FOLDER)/$(MODULE)" \

View File

@ -1,23 +1,48 @@
# Prestashop Plugin
# BTCPay Server - Prestashop Plugin
[![Maintained](https://img.shields.io/maintenance/yes/2023?style=flat-square)](https://github.com/btcpayserver/prestashop-plugin/pulse)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/btcpayserver/prestashop-plugin/validate.yml?branch=5.x&style=flat-square)](https://github.com/btcpayserver/prestashop-plugin/actions)
[![GitHub License](https://img.shields.io/github/license/btcpayserver/prestashop-plugin?color=brightgreen&style=flat-square)](https://github.com/btcpayserver/prestashop-plugin/blob/5.x/LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors-anon/btcpayserver/prestashop-plugin?style=flat-square)](https://github.com/btcpayserver/prestashop-plugin/graphs/contributors)
![BTCPay Server](https://raw.githubusercontent.com/btcpayserver/btcpayserver/master/BTCPayServer/wwwroot/img/btc_pay_BG_twitter.png)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/btcpayserver/prestashop-plugin?sort=semver&style=flat-square)](https://github.com/btcpayserver/prestashop-plugin/releases)
[![GitHub all releases](https://img.shields.io/github/downloads/btcpayserver/prestashop-plugin/total?style=flat-square)](https://github.com/btcpayserver/prestashop-plugin/releases)
<h3 align="center">
Accept Bitcoin payments within PrestaShop
</h3>
This is a Bitcoin payment plugin for PrestaShop using BTCPay server. [BTCPay Server](https://btcpayserver.org) is a free and open source server for merchants wanting to accept Bitcoin for their business.
<div align="center">
<p>
<a href="https://github.com/btcpayserver/prestashop-plugin/pulse"><img src="https://img.shields.io/maintenance/yes/2025?style=flat-square" alt="Maintained"/></a>
<a href="https://github.com/btcpayserver/prestashop-plugin/actions"><img src="https://img.shields.io/github/actions/workflow/status/btcpayserver/prestashop-plugin/validate.yml?style=flat-square" alt="GitHub Workflow Status"/></a>
<a href="https://github.com/btcpayserver/prestashop-plugin/blob/6.x/LICENSE"><img src="https://img.shields.io/github/license/btcpayserver/prestashop-plugin?color=brightgreen&amp;style=flat-square" alt="GitHub License"/></a>
<a href="https://github.com/btcpayserver/prestashop-plugin#contributing"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs are welcome"/></a>
<a href="https://github.com/btcpayserver/prestashop-plugin/graphs/contributors"><img src="https://img.shields.io/github/contributors-anon/btcpayserver/prestashop-plugin?style=flat-square" alt="GitHub contributors"/></a>
</p>
<p>
<a href="https://github.com/btcpayserver/prestashop-plugin/releases"><img src="https://img.shields.io/github/v/release/btcpayserver/prestashop-plugin?sort=semver&amp;style=flat-square" alt="GitHub release (latest SemVer)"/></a>
<a href="https://github.com/btcpayserver/prestashop-plugin/releases"><img src="https://img.shields.io/github/downloads/btcpayserver/prestashop-plugin/total?style=flat-square" alt="GitHub all releases"/></a>
</p>
</div>
## Requirements
<div align="center">
<sub>"This is lies, my trust in you is broken, I will make you obsolete" 💚
</a>
</div>
<br/>
<p align="center">
<a href="https://github.com/btcpayserver/prestashop-plugin/issues/new/choose">Report a bug</a>
·
<a href="https://github.com/btcpayserver/prestashop-plugin/discussions/new/choose">Request a feature</a>
·
<a href="https://docs.btcpayserver.org/FAQ/">FAQ</a>
</p>
---
## 🔧 Requirements
Please ensure that you meet the following requirements before installing this plugin.
- You are using PHP 7.3.0 or higher
- Your PrestaShop is version 1.7.8.0 or higher.
- PrestaShop 8.0 support has not yet been added/tested.
- Your BTCPay Server is version 1.3.0 or higher
- You are using PHP 8.0 or higher
- Your PrestaShop is version 8.0/9.0 or higher.
- Your BTCPay Server is version 1.7.0 or higher
- The PDO, curl, gd, intl, json, and mbstring PHP extensions are available
- You have a BTCPay Server, either [self-hosted](https://docs.btcpayserver.org/Deployment/) or [hosted by a third party](https://docs.btcpayserver.org/Deployment/ThirdPartyHosting/)
- [You've a registered account on the instance](https://docs.btcpayserver.org/RegisterAccount)
@ -25,48 +50,45 @@ Please ensure that you meet the following requirements before installing this pl
- [You've a wallet connected to your store](https://docs.btcpayserver.org/WalletSetup)
### Tested successfully
- Prestashop version 1.7.8.x up to 1.7.8.7
- BTCPay server version 1.3.4 up to 1.6.12.0
- Prestashop v8.0, v8.0.1, v8.0.4, v8.1.0, v8.1.3, v8.1.4, v8.2.1, v9.0.0
- BTCPay server v1.7.0, v1.7.3.0, v1.12.5, v1.13.0, v1.13.5, v2.1.5, v2.2.1
- BTCPay server v2 is supported as of module version v6.3.0.
## Multistore
### Multistore
As of right now the module is **not** compatible with Prestashop's multistore feature.
As of right now the module is **not** compatible with Prestashop's multistore feature. Any help to resolve this is very much welcomed. Please see the relevant [discussion](https://github.com/btcpayserver/prestashop-plugin/discussions/130).
## Documentation
## 📗 Documentation
Please check out our [official website](https://btcpayserver.org/), our [complete documentation](https://docs.btcpayserver.org/) and [FAQ](https://docs.btcpayserver.org/FAQ/) for more details.
Please check out our [official website](https://btcpayserver.org/), [complete documentation](https://docs.btcpayserver.org/) and [FAQ](https://docs.btcpayserver.org/FAQ/) for more details.
If you have trouble using BTCPay, consider joining [communities listed on official website](https://btcpayserver.org/#communityCTA) to get help from BTCPay community members. Only file [Github issue](https://github.com/btcpayserver/prestashop-plugin/issues) for technical issues you can't resolve through other channels or feature requests you've validated with other members of community.
If you have trouble using BTCPay Server, consider joining [communities listed on the official website](https://btcpayserver.org/#communityCTA) to get help from other contributors. Only create a [GitHub issue](https://github.com/btcpayserver/prestashop-plugin/issues/new/choose) for technical issues you can't resolve through other channels or feature requests you've validated with other members of the community.
Main community chat is located on [Mattermost](https://chat.btcpayserver.org/).
### Quick Start Guide
## 🚀 Quick Start Guide
To get up and running with our plugin quickly, see the [PrestaShop Guide on our documentation website](https://docs.btcpayserver.org/PrestaShop/).
## Versioning
## 🧑‍💻 Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the
[tags on this repository](https://github.com/btcpayserver/prestashop-plugin/tags).
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [releases within this repository](https://github.com/btcpayserver/prestashop-plugin/releases).
## Contributing
## 🤝 Contributing
[![Twitter Follow](https://img.shields.io/twitter/follow/btcpayserver?color=brightgreen&label=Follow%20%40BTCPayServer&style=flat-square)](https://twitter.com/btcpayserver)
[![BTCPay Server Community](https://img.shields.io/badge/chat-mattermost-brightgreen?style=flat-square)](https://chat.btcpayserver.org/btcpayserver)
BTCPay Server is built and maintained entirely by volunteer contributors around the internet. We welcome and appreciate new contributions.
BTCPay is built and maintained entirely by volunteer contributors around the internet. We welcome and appreciate new contributions.
Contributors looking to help out, before opening a pull request, please join [our community chat](https://chat.btcpayserver.org/) or [start a GitHub discussion](https://github.com/btcpayserver/btcpayserver/discussions) to get early feedback, discuss the best ways to tackle the problem, and ensure there is no work duplication.
Contributors looking to help out, before opening a pull request, please [create an issue](https://github.com/btcpayserver/prestashop-plugin/issues/new/choose)
or join [our community chat](https://chat.btcpayserver.org) to get early feedback, discuss best ways to tackle the problem and to ensure there is no work duplication.
### 🔧 Development
## PrestaShop Support
We recommend using [PrestaShop Kickstarter](https://github.com/PrestaShopCorp/docker-compose-kickstarter) (which supports [ngrok](https://ngrok.com/)) and a dockerized [BTCPay Server instance](https://github.com/btcpayserver/btcpayserver-docker/blob/master/Production/docker-compose.btc.yml) (or [an online testnet instance](https://testnet.demo.btcpayserver.org/)) for testing locally.
PrestaShop support can be found through it's official channels.
## 🏪 PrestaShop Support
* [Homepage](https://www.prestashop.com)
* [Documentation](https://doc.prestashop.com)
* [Support Forums](https://www.prestashop.com/forums)
PrestaShop support can be found through its official channels.
## License
* [Documentation](https://docs.prestashop-project.org/v.8-documentation) - contains answers to commonly asked questions and provides instructions for almost everything. Including setup, management, etc.
* [Support Forums](https://www.prestashop.com/forums) - the official Prestashop forum is a good place to find further answers and ask Prestashop related questions.
## 📝 License
BTCPay Server software, logo and designs are provided under [MIT License](LICENSE).

View File

@ -1,7 +1,74 @@
Security issues and bugs should be reported privately, via email. To report a security issue, please send an email to **security@btcpayserver.org** (not for support).
# Reporting a potential Vulnerability.
<!-- Short intro. -->
We take the security of our project seriously, and we encourage responsible disclosure of any vulnerabilities that may be found. To facilitate this process, we have established the following vulnerability reporting process.
You will receive a reply indicating the next steps in handling your report. If for some reason you do not receive a reply within 24 hours, please follow up via email to ensure the original message was received.
We appreciate your efforts to disclose your findings responsibly.
After the initial reply to your report, you will be informed of the progress towards a fix and full announcement. You may be asked to provide additional information or guidance.
##### 1. Reporting Channel
If you believe you have discovered a vulnerability in our project, please email us at `security@btcpayserver.org`. Alternatively, you may report the vulnerability to us through [huntr.dev](https://huntr.dev/repos/btcpayserver/btcpayserver/).
We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
Please allow for up to 2 business days for an acknowledgement of receipt. If you receive no response within 2 business days, please follow up via email to ensure the original message was received.
Upon review of your report, you may be asked to provide additional information or guidance.
<!--TODO: If available, add link to PGP key used to read security report emails.-->
##### 2. In-Scope
<!-- What's in scope? Any repo in our org for example. -->
We welcome reports of vulnerabilities in repositories owned by the [BTCPay Server GitHub Organization](https://github.com/btcpayserver). This includes any issues related to the confidentiality, integrity, or availability of systems or data in these systems.
##### 3. Out of Scope
<!-- What's out of scope? Thinking here about custom deployments, plugins that are not created by BTCPay (this includes kukks plugins that should be reported to him directly). -->
1. Any BTCPay Server deployment that has been customized in any way. To facilitate reproducibility, please verify that the BTCPay Server instance is based on the un-altered source-code or [Docker deployment](https://docs.btcpayserver.org/Docker/).
2. Any BTCPay Server plugin that is not authored by `btcpayserver` as stated by the author tag in-app.
##### 4. Preferred Reporting Template
<!-- Template example to guide reporter into including specific info that we'd appreciate be included in the report. -->
We encourage the use of a reporting template that includes a detailed description of the vulnerability, any evidence or proof of concept, and steps to reproduce the vulnerability.
Please find an example of an email template [at the end of this document](#7-reporting-template-example).
##### 5. Timeline for Remediation
<!-- Tentative 90 business day timeline for resolution. This is a typical industry standard, but have included wording to include the fact that we're a team of volunteers, and that we cannot guarantee it. -->
While we will work to remediate the reported vulnerability within 90 business days from the acknowledgment of the report, being a team of volunteers, we cannot guarantee this timeline to be accurate at all time.
We will provide regular updates to the reporter until the vulnerability is resolved.
##### 6. Timeline to Public Disclosure
<!-- No tentative timeline, given it can differ based on multiple criteria, but we have to take into account the fact that a public disclosure of a full year is too much. Security by obscurity is rarely beneficial, especially for the uninformed end-users. -->
We will work with the reporter to define a suitable timeline to public disclosure once the vulnerability is remediated.
<!--
##### 7. More information
For more information on our complete vulnerability response process, please see our [documentation]()
-->
##### 7. Reporting Template Example
<!-- Simple template for users to take as example for vulnerability reporting. Contains the basic minimum information that we need to assess promptly a report. -->
Feel free to use the below template to report a vulnerability.
```
Subject: Vulnerability Report - BTCPay Server
Dear BTCPay Server team,
I am writing to report a security vulnerability that I have identified in BTCPay Server. I believe this vulnerability poses a significant threat to the security of the project and its users.
Here are the details of the vulnerability:
* Vulnerability description: [Provide a clear and concise description of the vulnerability]
* Impact: [Describe the potential impact of the vulnerability, ie. any potential consequences for the project, its users, or any third parties]
* Affected version(s): [Specify which version(s) of the project are affected by the vulnerability]
* Steps to reproduce & Proof of Concept: [Provide a step-by-step guide to reproduce the vulnerability, including any screenshots and code snippets you feel would help]
* Severity: [Provide your assessment of the severity of the vulnerability, using a scale such as Warning/Low/Medium/High/Critical]
* Mitigation or Fix: [Provide your recommendation for a solution or mitigation strategy for the vulnerability]
If needed, I [agree/do not agree] to be invited into a Github private fork for the purpose of helping resolve this vulnerability. [Please include a link to your github profile]
Please let me know if you need any further information or if you would like to discuss this vulnerability in more detail.
Thank you for your attention to this matter.
Sincerely,
[Your Name/Handle]
```

10
UPGRADE-6.0.md Normal file
View File

@ -0,0 +1,10 @@
# Upgrading from 5.0 to 6.0
Prestashop modules come with an auto-upgrade feature which will be used to upgrade your currently running plugin. This documents serves as a reference for what has been changed.
## Requirements
The module requirements have been changed to:
- You are using PHP 8.0 or higher
- Your PrestaShop is version 8.0 or higher.
- Your BTCPay Server is version 1.7.0 or higher

View File

@ -20,8 +20,9 @@
"source": "https://github.com/btcpayserver/prestashop-plugin"
},
"require": {
"php": ">=7.3.0",
"php": ">=8.0",
"ext-PDO": "*",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
@ -31,91 +32,109 @@
"ext-json": "*",
"ext-mbstring": "*",
"ext-zip": "*",
"composer/installers": "^v1.9.0"
"composer/installers": "^1.12.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^v0.7.2",
"ergebnis/composer-normalize": "^v2.20.0",
"ezyang/htmlpurifier": "dev-master as v4.14.0",
"friendsofphp/php-cs-fixer": "^v3.4",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"ergebnis/composer-normalize": "^2.43.0",
"ezyang/htmlpurifier": "dev-master as 4.17.0",
"friendsofphp/php-cs-fixer": "^3.4.0",
"lcobucci/jwt": "dev-3.4.6-patch as 3.4.6",
"php-parallel-lint/php-console-highlighter": "^1.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
"prestashop/php-dev-tools": "^v4.2.1",
"prestashop/prestashop": "dev-develop",
"php-parallel-lint/php-parallel-lint": "^1.4.0",
"phpoffice/phpspreadsheet": "^1.29.1",
"prestashop/autoindex": "^2.1",
"prestashop/php-dev-tools": "^5",
"prestashop/prestashop": "^8.1.7",
"roave/security-advisories": "dev-latest",
"slevomat/coding-standard": "^v7.2.1",
"squizlabs/php_codesniffer": "^v3.7.1"
"slevomat/coding-standard": "^8.15.0",
"squizlabs/php_codesniffer": "^3.10.2"
},
"replace": {
"prestashop/blockreassurance": "^v5.0",
"prestashop/blockwishlist": "^v2.1.2",
"prestashop/classic": "^v2.0.0-beta",
"prestashop/contactform": "^v4.3.0",
"prestashop/dashactivity": "^v2",
"prestashop/dashgoals": "^v2",
"prestashop/dashproducts": "^v2",
"prestashop/dashtrends": "^v2",
"prestashop/gamification": "^v2.4.0",
"prestashop/graphnvd3": "^v2",
"prestashop/gridhtml": "^v2",
"prestashop/gsitemap": "^v4",
"prestashop/pagesnotfound": "^v2",
"prestashop/productcomments": "^v5.0.2",
"prestashop/ps_banner": "^v2",
"prestashop/ps_bestsellers": "^v1.0",
"prestashop/ps_brandlist": "^v1.0",
"prestashop/ps_cashondelivery": "^v2.0",
"prestashop/ps_categoryproducts": "^v1.0",
"prestashop/ps_categorytree": "^v2",
"prestashop/ps_checkpayment": "^v2",
"prestashop/ps_contactinfo": "^v3.2",
"prestashop/ps_crossselling": "^v2.0",
"prestashop/ps_currencyselector": "^v2",
"prestashop/ps_customeraccountlinks": "^v3",
"prestashop/ps_customersignin": "^v2",
"prestashop/ps_customtext": "^v4",
"prestashop/ps_dataprivacy": "^v2.0",
"prestashop/ps_emailalerts": "^v2.0",
"prestashop/ps_distributionapiclient": "^v1.0.1",
"prestashop/ps_emailsubscription": "^v2.7.0",
"prestashop/ps_facetedsearch": "^v3.7.1",
"prestashop/ps_faviconnotificationbo": "^v2",
"prestashop/ps_featuredproducts": "^v2",
"prestashop/ps_googleanalytics": "^v4.0",
"prestashop/ps_imageslider": "^v3",
"prestashop/ps_languageselector": "^v2",
"prestashop/ps_linklist": "^v5",
"prestashop/ps_mainmenu": "^v2",
"prestashop/ps_newproducts": "^v1.0",
"prestashop/ps_searchbar": "^v2",
"prestashop/ps_sharebuttons": "^v2",
"prestashop/ps_shoppingcart": "^v2",
"prestashop/ps_socialfollow": "^v2",
"prestashop/ps_specials": "^v1.0",
"prestashop/ps_supplierlist": "^v1.0",
"prestashop/ps_themecusto": "^v1",
"prestashop/ps_viewedproduct": "^v1.2",
"prestashop/ps_wirepayment": "^v2",
"prestashop/psgdpr": "^v1.0",
"prestashop/statsbestcategories": "^v2",
"prestashop/statsbestcustomers": "^v2",
"prestashop/statsbestmanufacturers": "^v2",
"prestashop/statsbestproducts": "^v2",
"prestashop/statsbestsuppliers": "^v2",
"prestashop/statsbestvouchers": "^v2",
"prestashop/statscarrier": "^v2",
"prestashop/statscatalog": "^v2",
"prestashop/statscheckup": "^v2",
"prestashop/statsdata": "^v2",
"prestashop/statsforecast": "^v2",
"prestashop/statsnewsletter": "^v2",
"prestashop/statspersonalinfos": "^v2",
"prestashop/statsproduct": "^v2",
"prestashop/statsregistrations": "^v2",
"prestashop/statssales": "^v2",
"prestashop/statssearch": "^v2",
"prestashop/statsstock": "^v2"
"prestashop/blockreassurance": "^5.1.4",
"prestashop/blockwishlist": "^3",
"prestashop/classic": "^2.0.0-beta",
"prestashop/contactform": "^4.3.0",
"prestashop/dashactivity": "^2",
"prestashop/dashgoals": "^2",
"prestashop/dashproducts": "^2",
"prestashop/dashtrends": "^2",
"prestashop/gamification": "^2.4.0",
"prestashop/graphnvd3": "^2",
"prestashop/gridhtml": "^2",
"prestashop/gsitemap": "^4",
"prestashop/pagesnotfound": "^2",
"prestashop/productcomments": "^7.0",
"prestashop/ps_banner": "^2",
"prestashop/ps_bestsellers": "^1.0",
"prestashop/ps_brandlist": "^1.0",
"prestashop/ps_cashondelivery": "^2.0",
"prestashop/ps_categoryproducts": "^1.0",
"prestashop/ps_categorytree": "^2",
"prestashop/ps_checkpayment": "^2",
"prestashop/ps_contactinfo": "^3.2",
"prestashop/ps_crossselling": "^2.0",
"prestashop/ps_currencyselector": "^2",
"prestashop/ps_customeraccountlinks": "^3",
"prestashop/ps_customersignin": "^2",
"prestashop/ps_customtext": "^4",
"prestashop/ps_dataprivacy": "^2.0",
"prestashop/ps_distributionapiclient": "^1.0.1",
"prestashop/ps_emailalerts": "^3.0",
"prestashop/ps_emailsubscription": "^2.7.0",
"prestashop/ps_facetedsearch": "^3.7.1",
"prestashop/ps_faviconnotificationbo": "^2",
"prestashop/ps_featuredproducts": "^2",
"prestashop/ps_googleanalytics": "^5.0",
"prestashop/ps_imageslider": "^3",
"prestashop/ps_languageselector": "^2",
"prestashop/ps_linklist": "^6",
"prestashop/ps_mainmenu": "^2",
"prestashop/ps_newproducts": "^1.0",
"prestashop/ps_searchbar": "^2",
"prestashop/ps_sharebuttons": "^2",
"prestashop/ps_shoppingcart": "^3",
"prestashop/ps_socialfollow": "^2",
"prestashop/ps_specials": "^1.0",
"prestashop/ps_supplierlist": "^1.0",
"prestashop/ps_themecusto": "^1",
"prestashop/ps_viewedproduct": "^1.2",
"prestashop/ps_wirepayment": "^2",
"prestashop/psgdpr": "^1.0",
"prestashop/statsbestcategories": "^2",
"prestashop/statsbestcustomers": "^2",
"prestashop/statsbestmanufacturers": "^2",
"prestashop/statsbestproducts": "^2",
"prestashop/statsbestsuppliers": "^2",
"prestashop/statsbestvouchers": "^2",
"prestashop/statscarrier": "^2",
"prestashop/statscatalog": "^2",
"prestashop/statscheckup": "^2",
"prestashop/statsdata": "^2",
"prestashop/statsforecast": "^2",
"prestashop/statsnewsletter": "^2",
"prestashop/statspersonalinfos": "^2",
"prestashop/statsproduct": "^2",
"prestashop/statsregistrations": "^2",
"prestashop/statssales": "^2",
"prestashop/statssearch": "^2",
"prestashop/statsstock": "^2",
"symfony/polyfill-mbstring": "*",
"symfony/polyfill-php54": "*",
"symfony/polyfill-php55": "^1.10",
"symfony/polyfill-php56": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/PrestaShop/jwt"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
@ -133,7 +152,7 @@
"ergebnis/composer-normalize": true
},
"platform": {
"php": "7.3"
"php": "8.0"
},
"preferred-install": "dist",
"prepend-autoloader": false,

3951
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -93,27 +93,9 @@ class AddressFormat extends AddressFormatCore
class AdminAccessController extends AdminAccessControllerCore
{
}
class AdminAddonsCatalogController extends AdminAddonsCatalogControllerCore
{
}
class AdminAddressesController extends AdminAddressesControllerCore
{
}
class AdminAdminPreferencesController extends AdminAdminPreferencesControllerCore
{
}
class AdminAttachmentsController extends AdminAttachmentsControllerCore
{
}
class AdminAttributeGeneratorController extends AdminAttributeGeneratorControllerCore
{
}
class AdminAttributesGroupsController extends AdminAttributesGroupsControllerCore
{
}
class AdminBackupController extends AdminBackupControllerCore
{
}
class AdminCarriersController extends AdminCarriersControllerCore
{
}
@ -126,60 +108,24 @@ class AdminCartRulesController extends AdminCartRulesControllerCore
class AdminCartsController extends AdminCartsControllerCore
{
}
class AdminCategoriesController extends AdminCategoriesControllerCore
{
}
class AdminCmsCategoriesController extends AdminCmsCategoriesControllerCore
{
}
class AdminCmsContentController extends AdminCmsContentControllerCore
{
}
class AdminCmsController extends AdminCmsControllerCore
{
}
class AdminContactsController extends AdminContactsControllerCore
{
}
class AdminController extends AdminControllerCore
{
}
class AdminCountriesController extends AdminCountriesControllerCore
{
}
class AdminCurrenciesController extends AdminCurrenciesControllerCore
{
}
class AdminCustomerPreferencesController extends AdminCustomerPreferencesControllerCore
{
}
class AdminCustomersController extends AdminCustomersControllerCore
{
}
class AdminCustomerThreadsController extends AdminCustomerThreadsControllerCore
{
}
class AdminDashboardController extends AdminDashboardControllerCore
{
}
class AdminDeliverySlipController extends AdminDeliverySlipControllerCore
{
}
class AdminEmailsController extends AdminEmailsControllerCore
{
}
class AdminEmployeesController extends AdminEmployeesControllerCore
{
}
class AdminFeaturesController extends AdminFeaturesControllerCore
{
}
class AdminGendersController extends AdminGendersControllerCore
{
}
class AdminGeolocationController extends AdminGeolocationControllerCore
{
}
class AdminGroupsController extends AdminGroupsControllerCore
{
}
@ -189,36 +135,12 @@ class AdminImagesController extends AdminImagesControllerCore
class AdminImportController extends AdminImportControllerCore
{
}
class AdminInformationController extends AdminInformationControllerCore
{
}
class AdminInvoicesController extends AdminInvoicesControllerCore
{
}
class AdminLanguagesController extends AdminLanguagesControllerCore
{
}
class AdminLegacyLayoutController extends AdminLegacyLayoutControllerCore
{
}
class AdminLocalizationController extends AdminLocalizationControllerCore
{
}
class AdminLoginController extends AdminLoginControllerCore
{
}
class AdminLogsController extends AdminLogsControllerCore
{
}
class AdminMaintenanceController extends AdminMaintenanceControllerCore
{
}
class AdminManufacturersController extends AdminManufacturersControllerCore
{
}
class AdminMetaController extends AdminMetaControllerCore
{
}
class AdminModulesController extends AdminModulesControllerCore
{
}
@ -228,51 +150,15 @@ class AdminModulesPositionsController extends AdminModulesPositionsControllerCor
class AdminNotFoundController extends AdminNotFoundControllerCore
{
}
class AdminOrderMessageController extends AdminOrderMessageControllerCore
{
}
class AdminOrderPreferencesController extends AdminOrderPreferencesControllerCore
{
}
class AdminOrdersController extends AdminOrdersControllerCore
{
}
class AdminOutstandingController extends AdminOutstandingControllerCore
{
}
class AdminPatternsController extends AdminPatternsControllerCore
{
}
class AdminPaymentController extends AdminPaymentControllerCore
{
}
class AdminPaymentPreferencesController extends AdminPaymentPreferencesControllerCore
{
}
class AdminPdfController extends AdminPdfControllerCore
{
}
class AdminPerformanceController extends AdminPerformanceControllerCore
{
}
class AdminPPreferencesController extends AdminPPreferencesControllerCore
{
}
class AdminPreferencesController extends AdminPreferencesControllerCore
{
}
class AdminProductsController extends AdminProductsControllerCore
{
}
class AdminProfilesController extends AdminProfilesControllerCore
{
}
class AdminQuickAccessesController extends AdminQuickAccessesControllerCore
{
}
class AdminReferrersController extends AdminReferrersControllerCore
{
}
class AdminRequestSqlController extends AdminRequestSqlControllerCore
{
}
@ -285,12 +171,6 @@ class AdminSearchConfController extends AdminSearchConfControllerCore
class AdminSearchController extends AdminSearchControllerCore
{
}
class AdminSearchEnginesController extends AdminSearchEnginesControllerCore
{
}
class AdminShippingController extends AdminShippingControllerCore
{
}
class AdminShopController extends AdminShopControllerCore
{
}
@ -300,9 +180,6 @@ class AdminShopGroupController extends AdminShopGroupControllerCore
class AdminShopUrlController extends AdminShopUrlControllerCore
{
}
class AdminSlipController extends AdminSlipControllerCore
{
}
class AdminSpecificPriceRuleController extends AdminSpecificPriceRuleControllerCore
{
}
@ -315,63 +192,24 @@ class AdminStatsController extends AdminStatsControllerCore
class AdminStatusesController extends AdminStatusesControllerCore
{
}
class AdminStockConfigurationController extends AdminStockConfigurationControllerCore
{
}
class AdminStockCoverController extends AdminStockCoverControllerCore
{
}
class AdminStockInstantStateController extends AdminStockInstantStateControllerCore
{
}
class AdminStockManagementController extends AdminStockManagementControllerCore
{
}
class AdminStockMvtController extends AdminStockMvtControllerCore
{
}
class AdminStoresController extends AdminStoresControllerCore
{
}
class AdminSuppliersController extends AdminSuppliersControllerCore
{
}
class AdminSupplyOrdersController extends AdminSupplyOrdersControllerCore
{
}
class AdminTabsController extends AdminTabsControllerCore
{
}
class AdminTagsController extends AdminTagsControllerCore
{
}
class AdminTaxesController extends AdminTaxesControllerCore
{
}
class AdminTaxRulesGroupController extends AdminTaxRulesGroupControllerCore
{
}
class AdminThemesCatalogController extends AdminThemesCatalogControllerCore
{
}
class AdminThemesController extends AdminThemesControllerCore
{
}
class AdminTrackingController extends AdminTrackingControllerCore
{
}
class AdminTranslationsController extends AdminTranslationsControllerCore
{
}
class AdminWarehousesController extends AdminWarehousesControllerCore
{
}
class AdminWebserviceController extends AdminWebserviceControllerCore
{
}
class AdminZonesController extends AdminZonesControllerCore
{
}
class Alias extends AliasCore
{
}
@ -381,9 +219,6 @@ class Attachment extends AttachmentCore
class AttachmentController extends AttachmentControllerCore
{
}
class Attribute extends AttributeCore
{
}
class AttributeGroup extends AttributeGroupCore
{
}
@ -744,9 +579,6 @@ class OrderDetail extends OrderDetailCore
class OrderDetailController extends OrderDetailControllerCore
{
}
class OrderDiscount extends OrderDiscountCore
{
}
class OrderFollowController extends OrderFollowControllerCore
{
}
@ -816,9 +648,6 @@ class PhpEncryption extends PhpEncryptionCore
class PhpEncryptionEngine extends PhpEncryptionEngineCore
{
}
class PhpEncryptionLegacyEngine extends PhpEncryptionLegacyEngineCore
{
}
class PrestaShopBackup extends PrestaShopBackupCore
{
}
@ -873,9 +702,6 @@ class RangePrice extends RangePriceCore
class RangeWeight extends RangeWeightCore
{
}
class Referrer extends ReferrerCore
{
}
class RequestSql extends RequestSqlCore
{
}
@ -1065,15 +891,11 @@ class WebserviceSpecificManagementImages extends WebserviceSpecificManagementIma
class WebserviceSpecificManagementSearch extends WebserviceSpecificManagementSearchCore
{
}
class Windows extends WindowsCore
{
}
class Zone extends ZoneCore
{
}
/* Class aliases */
class Autoload extends PrestaShopAutoload
{
}

76
development/bitcoin-cli.sh Executable file
View File

@ -0,0 +1,76 @@
#!/bin/bash
# Helper to connect to the running bitcoind (by default running regtest).
# Function to show usage instructions
show_usage() {
cat <<EOF
Usage: bitcoin-cli-helper COMMAND [ARGS]
Commands:
getnewaddress Generate a new address
generatetoaddress BLOCKS ADDRESS Generate new blocks and send the reward to the specified address
generate NUM_BLOCKS Generate a specified number of blocks
settxfee FEE Set the transaction fee for this network
sendtoaddress ADDRESS AMOUNT Send funds to an address
EOF
}
# Check if a valid command is provided
validate_command() {
local valid_commands=("getnewaddress" "generatetoaddress" "generate" "settxfee" "sendtoaddress")
local command=$1
for valid_cmd in "${valid_commands[@]}"; do
if [ "$valid_cmd" = "$command" ]; then
return 0
fi
done
return 1
}
# Validate the number of arguments
if [ "$#" -lt 1 ]; then
echo "Error: Missing command."
show_usage
exit 1
fi
# Check if the provided command is valid
if ! validate_command "$1"; then
echo "Error: Invalid command."
show_usage
exit 1
fi
# Execute the command with docker
if [ "$1" = "generate" ]; then
if [ "$#" -lt 2 ]; then
echo "Error: Missing number of blocks to generate."
show_usage
exit 1
fi
# Execute it right away, as we must pass `-`
docker exec prestashop_bitcoind bitcoin-cli -datadir="/data" -generate "$2"
exit 0
elif [ "$1" = "generatetoaddress" ]; then
if [ "$#" -lt 3 ]; then
echo "Error: Missing blocks to mine and/or address."
show_usage
exit 1
fi
elif [ "$1" = "settxfee" ]; then
if [ "$#" -lt 2 ]; then
echo "Error: Missing transaction fee value."
show_usage
exit 1
fi
elif [ "$1" = "sendtoaddress" ]; then
if [ "$#" -lt 3 ]; then
echo "Error: Missing address and/or amount to send."
show_usage
exit 1
fi
fi
# Execute the command with docker
docker exec prestashop_bitcoind bitcoin-cli -datadir="/data" "$@"

View File

@ -1,127 +0,0 @@
version: "3"
services:
btcpayserver:
image: btcpayserver/btcpayserver:1.6.12
expose:
- "49392"
environment:
BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver
BTCPAY_NETWORK: regtest
BTCPAY_BIND: 0.0.0.0:49392
BTCPAY_ROOTPATH: /
BTCPAY_DEBUGLOG: btcpay.log
BTCPAY_UPDATEURL: https://api.github.com/repos/btcpayserver/btcpayserver/releases/latest
BTCPAY_DOCKERDEPLOYMENT: "true"
BTCPAY_CHAINS: "btc"
BTCPAY_BTCEXPLORERURL: http://nbxplorer:32838/
volumes:
- "btcpay_datadir:/datadir"
- "nbxplorer_datadir:/root/.nbxplorer"
- "btcpay_pluginsdir:/root/.btcpayserver/Plugins"
ports:
- "8888:49392"
bitcoind:
container_name: btcpayserver_bitcoind
image: btcpayserver/bitcoin:23.0
environment:
BITCOIN_NETWORK: regtest
BITCOIN_WALLETDIR: "/walletdata"
BITCOIN_EXTRA_ARGS: |-
rpcport=43782
rpcbind=0.0.0.0:43782
rpcallowip=0.0.0.0/0
port=39388
whitelist=0.0.0.0/0
maxmempool=500
prune=50000
expose:
- "43782"
- "39388"
ports:
- "18443:43782"
volumes:
- "bitcoin_datadir:/data"
- "bitcoin_wallet_datadir:/walletdata"
nbxplorer:
image: nicolasdorier/nbxplorer:2.3.39
expose:
- "32838"
environment:
NBXPLORER_NETWORK: regtest
NBXPLORER_BIND: 0.0.0.0:32838
NBXPLORER_TRIMEVENTS: 10000
NBXPLORER_SIGNALFILESDIR: /datadir
NBXPLORER_CHAINS: "btc"
NBXPLORER_POSTGRES: User ID=postgres;Include Error Detail=true;Host=postgres;Port=5432
NBXPLORER_BTCRPCURL: http://bitcoind:43782/
NBXPLORER_BTCNODEENDPOINT: bitcoind:39388
volumes:
- "nbxplorer_datadir:/datadir"
- "bitcoin_datadir:/root/.bitcoin"
depends_on:
- postgres
postgres:
image: btcpayserver/postgres:13.7
environment:
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
mariadb:
image: bitnami/mariadb:10.7
environment:
- ALLOW_EMPTY_PASSWORD=yes
- MARIADB_SKIP_TEST_DB=yes
- MARIADB_USER=prestashop
- MARIADB_PASSWORD=bitnami
- MARIADB_DATABASE=prestashop
volumes:
- "mariadb_data:/bitnami/mariadb"
ports:
- "3305:3306"
prestashop:
image: bitnami/prestashop:1.7
ports:
- "80:8080"
- "443:8443"
environment:
- PRESTASHOP_HOST=127.0.0.1
- PRESTASHOP_DATABASE_HOST=mariadb
- PRESTASHOP_DATABASE_PORT_NUMBER=3306
- PRESTASHOP_DATABASE_USER=prestashop
- PRESTASHOP_DATABASE_PASSWORD=bitnami
- PRESTASHOP_DATABASE_NAME=prestashop
- PRESTASHOP_EMAIL=user@example.com
- PRESTASHOP_PASSWORD=bitnami1
volumes:
- "prestashop_data:/bitnami/prestashop"
depends_on:
- mariadb
- btcpayserver
links:
- mariadb
- btcpayserver
mailhog:
image: mailhog/mailhog:latest
logging:
driver: "none"
ports:
- "1025:1025"
- "8025:8025"
volumes:
btcpay_datadir:
btcpay_pluginsdir:
bitcoin_datadir:
bitcoin_wallet_datadir:
postgres_datadir:
nbxplorer_datadir:
mariadb_data:
driver: local
prestashop_data:
driver: local

14
modules/btcpay/.htaccess Normal file
View File

@ -0,0 +1,14 @@
# Apache 2.2
<IfModule !mod_authz_core.c>
<Files *.php>
order allow,deny
deny from all
</Files>
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
<Files *.php>
Require all denied
</Files>
</IfModule>

View File

@ -7,14 +7,13 @@ use BTCPay\Installer\Hooks;
use BTCPay\Installer\OrderStates;
use BTCPay\Installer\Tables;
use BTCPay\Installer\Webhook;
use BTCPay\LegacyBitcoinPaymentRepository;
use BTCPay\Repository\BitcoinPaymentRepository;
use BTCPay\Repository\TableRepository;
use BTCPay\Server\Client;
use BTCPayServer\Exception\BTCPayException;
use BTCPayServer\Exception\RequestException;
use PrestaShop\PrestaShop\Adapter\Configuration;
use PrestaShop\PrestaShop\Adapter\Presenter\Order\OrderPresenter;
use PrestaShop\PrestaShop\Adapter\SymfonyContainer;
use PrestaShop\PrestaShop\Core\Payment\PaymentOption;
if (!defined('_PS_VERSION_')) {
@ -39,16 +38,6 @@ class BTCPay extends PaymentModule
],
];
/**
* @var Client
*/
private $client;
/**
* @var BitcoinPaymentRepository
*/
private $repository;
/**
* @var Configuration
*/
@ -63,27 +52,28 @@ class BTCPay extends PaymentModule
{
$this->name = 'btcpay';
$this->tab = 'payments_gateways';
$this->version = '5.2.1';
$this->version = '6.3.1';
$this->author = 'BTCPay Server';
$this->ps_versions_compliancy = ['min' => Constants::MINIMUM_PS_VERSION, 'max' => _PS_VERSION_];
$this->controllers = ['payment', 'validation', 'webhook'];
$this->is_eu_compatible = true;
$this->bootstrap = true;
$this->module_key = 'aec3ab8084e8e626bdcbda75d2ab39ee';
$this->currencies = true;
$this->currencies_mode = 'radio';
parent::__construct();
$this->displayName = $this->trans('BTCPay Server', [], 'Modules.Btcpay.Admin');
$this->description = $this->trans('Accept crypto payments via BTCPay Server.', [], 'Modules.Btcpay.Front');
$this->displayName = $this->trans('BTCPay Server', [], 'Modules.Btcpay.Admin');
$this->description = $this->trans('Accept crypto payments via BTCPay Server.', [], 'Modules.Btcpay.Front');
$this->confirmUninstall = $this->trans('Are you sure that you want to uninstall this module? Past purchases and order states will be kept, but your configuration will be removed.', [], 'Modules.Btcpay.Front');
$this->configuration = new Configuration();
$this->versioning = new Versioning();
$this->versioning = new Versioning();
// Process any and all warnings
$this->warnings();
// Process any and all alerts/warnings
$this->displayModuleWarnings();
}
public function install(): bool
@ -128,12 +118,8 @@ class BTCPay extends PaymentModule
return false;
}
if (null === ($repository = $this->getRepository())) {
$this->addModuleErrors(['Expected a BitcoinPaymentRepository repository, but received NULL']);
return false;
}
// Create required tables
$repository = new TableRepository($this->get('doctrine.dbal.default_connection'));
if (!empty($errors = (new Tables($repository))->install())) {
$this->addModuleErrors($errors);
$this->uninstall();
@ -223,11 +209,13 @@ class BTCPay extends PaymentModule
return null;
}
// Get legacy repository
$repository = new LegacyBitcoinPaymentRepository();
// Ensure the client is ready for use
if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) {
return null;
}
// Get the order
if (null === ($bitcoinPayment = $repository->getOneByOrderID($params['id_order']))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByOrderID($params['id_order']))) {
return null;
}
@ -252,8 +240,12 @@ class BTCPay extends PaymentModule
try {
// Get the invoice and its payments
$invoice = $this->client()->invoice()->getInvoice($storeID, $invoiceId);
$paymentMethods = $this->client()->invoice()->getPaymentMethods($storeID, $invoiceId);
$invoice = $client->invoice()->getInvoice($storeID, $invoiceId);
// Filter out methods without payments
$paymentMethods = array_filter($client->invoice()->getPaymentMethods($storeID, $invoiceId), static function ($method) {
return !empty($method->getPayments());
});
// Has any payment been received
$paymentReceived = array_reduce($paymentMethods, static function ($carry, $method) {
@ -270,7 +262,7 @@ class BTCPay extends PaymentModule
return $this->display(__FILE__, 'views/templates/admin/invoice_block.tpl');
} catch (RequestException $exception) {
// Log the exception
PrestaShopLogger::addLog(\sprintf('[WARNING] Tried to load BTCPay invoice in hookDisplayAdminOrderMainBottom: %s', $exception->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $exception->getCode(), 'Order', $bitcoinPayment->getOrderId());
PrestaShopLogger::addLog(\sprintf('[WARNING] Tried to load BTCPay Server invoice in hookDisplayAdminOrderMainBottom: %s', $exception->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $exception->getCode(), 'Order', $bitcoinPayment->getOrderId());
// Show that the invoice was not found
return $this->display(__FILE__, 'views/templates/admin/invoice_missing_block.tpl');
@ -295,28 +287,35 @@ class BTCPay extends PaymentModule
return null;
}
// Get BTCPay URL or abort
if (empty($serverUrl = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST))) {
return null;
}
// Check if we actually have an order
$order = $params['order'];
if (!$order instanceof Order) {
return null;
}
// Check if we actually have an order
// If created by another module, return
if ($order->module !== $this->name) {
return false;
}
// Check if we actually have an cart
$cart = $params['cart'];
if (!$cart instanceof Cart) {
return null;
}
// Get legacy repository
$repository = new LegacyBitcoinPaymentRepository();
// Get BTCPay URL or abort
if (empty($serverUrl = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST))) {
return null;
}
// Ensure the client is ready for use
if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) {
return null;
}
// Get the order
if (null === ($bitcoinPayment = $repository->getOneByOrderID($order->id))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByOrderID($order->id))) {
return null;
}
@ -333,34 +332,20 @@ class BTCPay extends PaymentModule
$this->context->smarty->assign([
'serverURL' => $serverUrl,
'storeCurrency' => Currency::getCurrencyInstance($cart->id_currency)->getSymbol(),
'invoice' => $this->client()->invoice()->getInvoice($storeID, $invoiceId),
'paymentMethods' => $this->client()->invoice()->getPaymentMethods($storeID, $invoiceId),
'invoice' => $client->invoice()->getInvoice($storeID, $invoiceId),
'paymentMethods' => $client->invoice()->getPaymentMethods($storeID, $invoiceId),
]);
return $this->display(__FILE__, 'views/templates/hooks/order_detail.tpl');
} catch (RequestException $exception) {
// Log the exception
PrestaShopLogger::addLog(\sprintf('[WARNING] Tried to load BTCPay invoice in hookDisplayOrderDetail: %s', $exception->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $exception->getCode(), 'Order', $order->id);
PrestaShopLogger::addLog(\sprintf('[WARNING] Tried to load BTCPay Server invoice in hookDisplayOrderDetail: %s', $exception->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $exception->getCode(), 'Order', $order->id);
// If the invoice is gone just return null
return null;
}
}
public function hookDisplayPaymentEU(): array
{
// If the module is not active, abort
if (!$this->active) {
return [];
}
return [
'cta_text' => $this->name,
'logo' => Media::getMediaPath(_PS_MODULE_DIR_ . $this->name . '/views/images/bitcoin.png'),
'action' => $this->context->link->getModuleLink($this->name, 'payment', [], true),
];
}
/**
* Hooks on prestashop payment returns
*
@ -385,7 +370,7 @@ class BTCPay extends PaymentModule
}
// Get the order
if (null === ($bitcoinPayment = (new LegacyBitcoinPaymentRepository())->getOneByOrderID($order->id))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByOrderID($order->id))) {
return null;
}
@ -416,8 +401,8 @@ class BTCPay extends PaymentModule
return [];
}
// If the API key is not valid, this module is not ready to be used
if (false === $this->client()->isValid()) {
// Ensure the client is ready for use
if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) {
return [];
}
@ -426,16 +411,10 @@ class BTCPay extends PaymentModule
try {
// If the server is not fully synced, do not show the option
if (!$this->client()->server()->getInfo()->isFullySynced()) {
if (!$client->server()->getInfo()->isFullySynced()) {
return [];
}
// Prepare smarty
$this->context->smarty->assign([
'onChain' => $this->client()->onChain()->getPaymentMethods($storeID),
'offChain' => $this->client()->offChain()->getPaymentMethods($storeID),
]);
return [
(new PaymentOption())
->setModuleName($this->name)
@ -482,7 +461,7 @@ class BTCPay extends PaymentModule
}
// Get the order
if (null === ($bitcoinPayment = (new LegacyBitcoinPaymentRepository())->getOneByCartID($cart->id))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByCartID($cart->id))) {
return;
}
@ -504,47 +483,47 @@ class BTCPay extends PaymentModule
}
}
private function client(): Client
private function displayModuleWarnings(): void
{
if (null === $this->client) {
$this->client = Client::createFromConfiguration($this->configuration);
}
// Try and create the client
$client = Client::createFromConfiguration($this->configuration);
return $this->client;
}
private function getRepository(): ?BitcoinPaymentRepository
{
if (null === $this->repository) {
try {
$this->repository = $this->get('prestashop.module.btcpay.repository');
} catch (Throwable $e) {
if (null !== ($container = SymfonyContainer::getInstance())) {
$this->repository = new BitcoinPaymentRepository($container->get('doctrine.dbal.default_connection'), $container->getParameter('database_prefix'));
}
try {
// Show warning if API key is missing or if we're not yet fully synced
if (null === $client || empty($this->configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY))) {
$this->warning = $this->trans('Your BTCPay Server store has not yet been linked, payment option is unavailable.', [], 'Modules.Btcpay.Admin');
} elseif (!$client->server()->getInfo()->isFullySynced()) {
$this->warning = $this->trans('One (or more) coins are not yet synced, payment option will be unavailable until the sync has finished.', [], 'Modules.Btcpay.Admin');
}
} catch (BTCPayException $exception) {
// Log the exception
PrestaShopLogger::addLog(\sprintf('[WARNING] BTCPay Server configuration is no longer valid, resetting host and API key. Error: %s', $exception->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $exception->getCode());
// Show a warning
$this->warning = $this->trans('Your BTCPay Server configuration is no longer valid, please setup module again.', [], 'Modules.Btcpay.Admin');
// Reset configuration
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_HOST, Constants::CONFIGURATION_DEFAULT_HOST);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
// Bail
return;
} catch (\Throwable $exception) {
// Log the exception
PrestaShopLogger::addLog(\sprintf('[WARNING] Could not parse server information: %s', $exception->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $exception->getCode());
// Bail
return;
}
return $this->repository;
}
private function warnings(): void
{
$warnings = [];
// Show alert if API key is missing
if (empty($this->configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY))) {
$warnings[] = $this->trans('No API key has been set yet', [], 'Modules.Btcpay.Admin');
// API key/sync warnings are more important than a new version, if a warning is set, return now
if (!empty($this->warning)) {
return;
}
// Show alert for version upgrade
// Otherwise, add a warning on version upgrade
if (null !== ($latest = $this->versioning->latest()) && $latest->newer($this->version)) {
$warnings[] = $this->trans(\sprintf('There is a new version available for %s (%s).', $this->displayName, $latest->getTagName()), [], 'Modules.Btcpay.Admin');
}
$this->warning = \implode(' - ', $warnings);
foreach ($warnings as $warning) {
$this->adminDisplayWarning($warning);
$this->warning = $this->trans(\sprintf('There is a new version available for this plugin: %s.', $latest->getTagName()), [], 'Modules.Btcpay.Admin');
}
}
}

View File

@ -17,31 +17,34 @@
"source": "https://github.com/btcpayserver/prestashop-plugin"
},
"require": {
"php": ">=7.3.0",
"php": ">=8.0",
"ext-PDO": "*",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-gd": "*",
"ext-intl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"btcpayserver/btcpayserver-greenfield-php": "^1.3.6",
"composer/semver": "^3.3",
"guzzlehttp/guzzle": "^7.5",
"http-interop/http-factory-guzzle": "^1.2",
"knplabs/github-api": "^3.8",
"stechstudio/backoff": "^1.2"
"btcpayserver/btcpayserver-greenfield-php": "^2.8.1",
"composer/semver": "^3.4.2",
"stechstudio/backoff": "^1.4"
},
"require-dev": {
"ergebnis/composer-normalize": "^2.20",
"ergebnis/composer-normalize": "^2.43",
"roave/security-advisories": "dev-latest",
"symfony/debug-bundle": "^4.4.37",
"symfony/var-dumper": "^4.4.47"
"symfony/debug-bundle": "~5.4.40",
"symfony/var-dumper": "~5.4.43"
},
"replace": {
"symfony/polyfill-mbstring": "*",
"symfony/polyfill-php54": "*",
"symfony/polyfill-php55": "^1.10",
"symfony/polyfill-php56": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*"
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*"
},
"minimum-stability": "stable",
"autoload": {
@ -55,10 +58,11 @@
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
"ergebnis/composer-normalize": true,
"php-http/discovery": true
},
"platform": {
"php": "7.3"
"php": "8.0"
},
"preferred-install": "dist",
"prepend-autoloader": false,

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>btcpay</name>
<displayName><![CDATA[BTCPay]]></displayName>
<version><![CDATA[5.2.0]]></version>
<description><![CDATA[Accept crypto payments via BTCPay Server.]]></description>
<author><![CDATA[BTCPayServer]]></author>
<tab><![CDATA[payments_gateways]]></tab>
<confirmUninstall><![CDATA[Are you sure that you want to uninstall this module? Past purchases and order states will be kept, but your configuration will be removed.]]></confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries/>
<name>btcpay</name>
<displayName><![CDATA[BTCPay Server]]></displayName>
<version><![CDATA[6.1.0]]></version>
<description><![CDATA[Accept crypto payments via BTCPay Server.]]></description>
<author><![CDATA[BTCPay Server]]></author>
<tab><![CDATA[payments_gateways]]></tab>
<confirmUninstall><![CDATA[Are you sure that you want to uninstall this module? Past purchases and order states will be kept, but your configuration will be removed.]]></confirmUninstall>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
</module>

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -2,16 +2,24 @@ admin_btcpay_configure:
path: /btcpay/configure
methods: [GET]
defaults:
_controller: 'BTCPay\Controller\Admin\Improve\Payment\ConfigureController::editAction'
_controller: 'BTCPay\Controller\Admin\Improve\Payment\ConfigureController::viewAction'
_legacy_controller: AdminConfigureBTCPay
_legacy_link: AdminConfigureBTCPay
_disable_module_prefix: true
admin_btcpay_configure_process:
admin_btcpay_configure_server_process:
path: /btcpay/configure
methods: [GET, POST]
defaults:
_controller: 'BTCPay\Controller\Admin\Improve\Payment\ConfigureController::editProcessAction'
_controller: 'BTCPay\Controller\Admin\Improve\Payment\ConfigureController::editServerSettingsAction'
_legacy_controller: AdminConfigureBTCPay
_disable_module_prefix: true
admin_btcpay_configure_general_process:
path: /btcpay/configure/general
methods: [GET, POST]
defaults:
_controller: 'BTCPay\Controller\Admin\Improve\Payment\ConfigureController::editGeneralSettingsAction'
_legacy_controller: AdminConfigureBTCPay
_disable_module_prefix: true
@ -19,7 +27,6 @@ admin_btcpay_validate:
path: /btcpay/api-key/validate
methods: [GET, POST]
defaults:
_controller: 'BTCPay\Controller\Admin\Improve\Payment\ConfigureController::validateAction'
_controller: 'BTCPay\Controller\Admin\Improve\Payment\ConfigureController::validateAPIKeyAction'
_legacy_controller: AdminConfigureBTCPay
_disable_module_prefix: true

View File

@ -7,8 +7,8 @@ services:
class: BTCPay
# Repositories
prestashop.module.btcpay.repository:
class: BTCPay\Repository\BitcoinPaymentRepository
prestashop.module.btcpay.repository.install:
class: BTCPay\Repository\TableRepository
arguments:
- '@doctrine.dbal.default_connection'
- '%database_prefix%'
@ -19,27 +19,46 @@ services:
arguments:
- '@prestashop.module.btcpay'
- '@validator'
- '@prestashop.module.btcpay.form_handler'
- '@prestashop.module.btcpay.form_handler.server'
- '@prestashop.module.btcpay.form_handler.general'
# Form data provider
prestashop.module.btcpay.form.configure.provider:
class: BTCPay\Form\ConfigureFormDataProvider
prestashop.module.btcpay.form.server.provider:
class: BTCPay\Form\ServerFormDataProvider
prestashop.module.btcpay.form.general.provider:
class: BTCPay\Form\GeneralFormDataProvider
# Form type
prestashop.module.btcpay.form.type.configure:
class: BTCPay\Form\Type\ConfigureType
prestashop.module.btcpay.form.type.server:
class: BTCPay\Form\Type\ServerType
parent: 'form.type.translatable.aware'
public: true
tags:
- { name: form.type }
tags: [{ name: form.type }]
prestashop.module.btcpay.form.type.general:
class: BTCPay\Form\Type\GeneralType
parent: 'form.type.translatable.aware'
public: true
tags: [{ name: form.type }]
# Form handler
prestashop.module.btcpay.form_handler:
class: PrestaShop\PrestaShop\Core\Form\FormHandler
prestashop.module.btcpay.form_handler.server:
class: PrestaShop\PrestaShop\Core\Form\Handler
arguments:
$formBuilder: '@=service("form.factory").createBuilder()'
$formFactory: '@Symfony\Component\Form\FormFactoryInterface'
$hookDispatcher: '@prestashop.core.hook.dispatcher'
$formDataProvider: '@prestashop.module.btcpay.form.configure.provider'
$formTypes:
'btcpay': 'BTCPay\Form\Type\ConfigureType'
$hookName: 'AdminConfigureBTCPay'
$formDataProvider: '@prestashop.module.btcpay.form.server.provider'
$form: 'BTCPay\Form\Type\ServerType'
$hookName: 'ServerType'
$formName: 'server-form'
# Form handler
prestashop.module.btcpay.form_handler.general:
class: PrestaShop\PrestaShop\Core\Form\Handler
arguments:
$formFactory: '@Symfony\Component\Form\FormFactoryInterface'
$hookDispatcher: '@prestashop.core.hook.dispatcher'
$formDataProvider: '@prestashop.module.btcpay.form.general.provider'
$form: 'BTCPay\Form\Type\GeneralType'
$hookName: 'GeneralType'
$formName: 'general-form'

View File

@ -1,4 +1,8 @@
<?php
if (!defined('_PS_VERSION_')) {
exit;
}
class AdminConfigureBTCPayController extends ModuleAdminController
{
/**

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -2,6 +2,11 @@
use BTCPay\Constants;
use BTCPay\Server\Factory;
use PrestaShop\PrestaShop\Adapter\Configuration;
if (!defined('_PS_VERSION_')) {
exit;
}
class BTCPayPaymentModuleFrontController extends ModuleFrontController
{
@ -48,14 +53,16 @@ class BTCPayPaymentModuleFrontController extends ModuleFrontController
try {
if (null !== ($redirect = $this->factory->createPaymentRequest($this->context->customer, $this->context->cart))) {
Tools::redirectLink($redirect);
Tools::redirect($redirect);
return;
}
$this->warning[] = $this->context->getTranslator()->trans('We could not create a payment request via BTCPay Server. Please try again or contact us.', [], 'Modules.Btcpay.Front');
$this->redirectWithNotifications($this->context->link->getPageLink('cart', $this->ssl));
} catch (\Throwable $e) {
} catch (\Throwable $throwable) {
PrestaShopLogger::addLog(\sprintf('[ERROR] An error occurred during payment creation: %s', $throwable), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, $throwable->getCode());
$this->warning[] = $this->context->getTranslator()->trans('We are having issues with our BTCPay Server backend. Please try again or contact us.', [], 'Modules.Btcpay.Front');
$this->redirectWithNotifications($this->context->link->getPageLink('cart', $this->ssl));
}

View File

@ -1,10 +1,15 @@
<?php
use BTCPay\Constants;
use BTCPay\LegacyBitcoinPaymentRepository;
use BTCPay\Invoice\Processor;
use BTCPay\Repository\BitcoinPaymentRepository;
use BTCPay\Server\Client;
use PrestaShop\PrestaShop\Adapter\Configuration;
if (!defined('_PS_VERSION_')) {
exit;
}
class BTCPayValidationModuleFrontController extends ModuleFrontController
{
/**
@ -24,29 +29,11 @@ class BTCPayValidationModuleFrontController extends ModuleFrontController
*/
private $configuration;
/**
* @var Client
*/
private $client;
/**
* @var LegacyBitcoinPaymentRepository
*/
private $repository;
/**
* @var \BTCPay\Invoice\Processor
*/
private $processor;
public function __construct()
{
parent::__construct();
$this->configuration = new Configuration();
$this->client = Client::createFromConfiguration($this->configuration);
$this->repository = new LegacyBitcoinPaymentRepository();
$this->processor = new \BTCPay\Invoice\Processor($this->module, $this->configuration, $this->client);
}
/**
@ -66,7 +53,7 @@ class BTCPayValidationModuleFrontController extends ModuleFrontController
// Get the translator so we can translate our errors
if (null === ($translator = $this->getTranslator())) {
throw new \RuntimeException('Expected the translator to be available');
throw new RuntimeException('Expected the translator to be available');
}
// Check if our payment option is still valid
@ -89,7 +76,7 @@ class BTCPayValidationModuleFrontController extends ModuleFrontController
// Get the passed invoice reference, which we can then use to get the actual order
$invoiceReference = Tools::getValue('invoice_reference', 0);
if (null === ($bitcoinPayment = $this->repository->getOneByInvoiceReference($invoiceReference))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByInvoiceReference($invoiceReference))) {
$this->warning[] = $translator->trans('The passed invoice reference is not valid.', [], 'Modules.Btcpay.Front');
$this->redirectWithNotifications($this->context->link->getPageLink('cart', $this->ssl));
@ -110,8 +97,14 @@ class BTCPayValidationModuleFrontController extends ModuleFrontController
return;
}
// User was quicker than the callback, deal with the actual invoice now
$this->processor->paymentReceivedCreateAfter($bitcoinPayment);
// Ensure the client is ready for use
if (null === ($client = Client::createFromConfiguration($this->configuration)) || false === $client->isValid()) {
throw new RuntimeException('Expected the client to be available');
}
// User was quicker than the callback, so we deal with the actual invoice now
$processor = new Processor($this->module, $this->context, $this->configuration, $client);
$processor->paymentReceivedCreateAfter($bitcoinPayment);
// Grab the (now existing) order
$order = Order::getByCartId($bitcoinPayment->getCartId());

View File

@ -1,12 +1,15 @@
<?php
use BTCPay\Constants;
use BTCPay\LegacyBitcoinPaymentRepository;
use BTCPay\Server\Client;
use BTCPay\Server\WebhookHandler;
use PrestaShop\PrestaShop\Adapter\Configuration;
use Symfony\Component\HttpFoundation\Request;
if (!defined('_PS_VERSION_')) {
exit;
}
class BTCPayWebhookModuleFrontController extends \ModuleFrontController
{
/**
@ -27,7 +30,7 @@ class BTCPayWebhookModuleFrontController extends \ModuleFrontController
private $configuration;
/**
* @var Client
* @var Client|null
*/
private $client;
@ -42,7 +45,7 @@ class BTCPayWebhookModuleFrontController extends \ModuleFrontController
$this->configuration = new Configuration();
$this->client = Client::createFromConfiguration($this->configuration);
$this->handler = new WebhookHandler($this->module, $this->client, new LegacyBitcoinPaymentRepository());
$this->handler = new WebhookHandler($this->module, $this->context, $this->client);
}
/**
@ -71,10 +74,15 @@ class BTCPayWebhookModuleFrontController extends \ModuleFrontController
return;
}
// Ensure the client is ready for use, if not, just return
if (null === $this->client || false === $this->client->isValid()) {
return;
}
// Ensure our webhook is actually valid
if (false === $this->client->webhook()->isIncomingWebhookRequestValid($request->getContent(), $signature, $secret)) {
$error = 'Invalid BTCPay Server payment notification message received - signature did not match.';
\PrestaShopLogger::addLog($error, 3);
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
throw new \Exception($error);
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

File diff suppressed because it is too large Load Diff

View File

@ -4,17 +4,24 @@ namespace BTCPay;
use BTCPayServer\Client\InvoiceCheckoutOptions;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Constants
{
// Version information
public const MINIMUM_BTCPAY_VERSION = '1.3.0';
public const MINIMUM_PS_VERSION = '1.7.8';
public const MINIMUM_PHP_VERSION = '7.3.0';
public const MINIMUM_BTCPAY_VERSION = '1.7.0';
public const MINIMUM_PS_VERSION = '8.0.0';
public const MINIMUM_PHP_VERSION = '8.0.0';
// Cache configuration
public const LASTEST_VERSION_CACHE_KEY = 'BTCPAY_LATEST_VERSION';
public const LASTEST_VERSION_CACHE_EXPIRATION = 60 * 60 * 24 * 7; // 7 days
// GitHub API endpoint for releases
public const GITHUB_API_LATEST_ENDPOINT = 'https://api.github.com/repos/btcpayserver/prestashop-plugin/releases/latest';
// BTCPay Server webhook header
public const BTCPAY_HEADER_SIG = 'Btcpay-Sig';
@ -47,6 +54,9 @@ class Constants
public const CONFIGURATION_ORDER_STATE_FAILED = 'BTCPAY_OS_FAILED';
public const CONFIGURATION_ORDER_STATE_PAID = 'BTCPAY_OS_PAID';
// Do we want to protect order states from getting changed by webhook
public const CONFIGURATION_PROTECT_ORDERS = 'BTCPAY_PROTECT_ORDERS';
// Do we want to share personal details with BTCPay Server
public const CONFIGURATION_SHARE_METADATA = 'BTCPAY_SHARE_METADATA';

View File

@ -2,21 +2,33 @@
namespace BTCPay\Controller\Admin\Improve\Payment;
use BTCPay;
use BTCPay\Constants;
use BTCPay\Form\Data\Configuration;
use BTCPay\Form\Data\General;
use BTCPay\Form\Data\Server;
use BTCPay\Github\Versioning;
use BTCPay\Server\Client;
use BTCPay\Server\Data\ValidateApiKey;
use BTCPayServer\Client\ApiKey;
use Exception;
use PrestaShop\PrestaShop\Core\Domain\Configuration\ShopConfigurationInterface;
use PrestaShop\PrestaShop\Core\Form\FormHandlerInterface;
use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
use PrestaShopBundle\Security\Annotation\AdminSecurity;
use PrestaShopBundle\Security\Annotation\ModuleActivated;
use PrestaShopLogger;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Throwable;
if (!\defined('_PS_VERSION_')) {
exit;
}
/**
* @ModuleActivated(moduleName="btcpay", redirectRoute="admin_module_manage")
@ -24,7 +36,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
class ConfigureController extends FrameworkBundleAdminController
{
/**
* @var \BTCPay
* @var BTCPay
*/
private $module;
@ -36,62 +48,51 @@ class ConfigureController extends FrameworkBundleAdminController
/**
* @var FormHandlerInterface
*/
private $formHandler;
private $serverFormHandler;
/**
* @var FormHandlerInterface
*/
private $generalFormHandler;
/**
* @var Versioning
*/
private $versioning;
public function __construct(\BTCPay $module, ValidatorInterface $validator, FormHandlerInterface $formHandler)
public function __construct(BTCPay $module, ValidatorInterface $validator, FormHandlerInterface $serverFormHandler, FormHandlerInterface $generalFormHandler)
{
parent::__construct();
// Fallback in case 8.0 is used // TODO: Remove once we make 9.0 the minimum
if (\version_compare(\_PS_VERSION_, '8.1.0', '<')) {
parent::__construct();
}
$this->module = $module;
$this->validator = $validator;
$this->formHandler = $formHandler;
$this->versioning = new Versioning();
$this->module = $module;
$this->validator = $validator;
$this->serverFormHandler = $serverFormHandler;
$this->generalFormHandler = $generalFormHandler;
$this->versioning = new Versioning();
}
/**
* @AdminSecurity("is_granted('read', request.get('_legacy_controller'))", message="Access denied.")
*
* @throws \Exception
* @throws Exception
*/
public function editAction(Request $request): Response
public function viewAction(Request $request): Response
{
// Build the client
$client = Client::createFromConfiguration($this->configuration);
$client = Client::createFromConfiguration($this->getConfiguration());
// Create the authorization URL (without redirect)
$authorizeUrl = ApiKey::getAuthorizeUrl($this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST), Constants::BTCPAY_PERMISSIONS, $this->module->name, true, true, null, $this->module->name);
if (false === $client->isValid()) {
return $this->render('@Modules/btcpay/views/templates/admin/configure.html.twig', [
'form' => $this->get('prestashop.module.btcpay.form_handler')->getForm()->createView(),
'help_link' => $this->generateSidebarLink($request->attributes->get('_legacy_controller')),
'latestVersion' => $this->versioning->latest(),
'moduleVersion' => $this->module->version,
'authorizeUrl' => $authorizeUrl,
'invalidApiKey' => true,
'enableSidebar' => true,
]);
}
$authorizeUrl = ApiKey::getAuthorizeUrl($this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_HOST), Constants::BTCPAY_PERMISSIONS, $this->module->name, true, true, null, $this->module->name);
// Ensure we always have a webhook
$client->webhook()->ensureWebhook($this->configuration->get(Constants::CONFIGURATION_BTCPAY_STORE_ID));
if (null !== $client && $client->isValid()) {
$client->webhook()->ensureWebhook($this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_STORE_ID));
}
return $this->render('@Modules/btcpay/views/templates/admin/configure.html.twig', [
'form' => $this->get('prestashop.module.btcpay.form_handler')->getForm()->createView(),
'help_link' => $this->generateSidebarLink($request->attributes->get('_legacy_controller')),
'storeId' => $this->configuration->get(Constants::CONFIGURATION_BTCPAY_STORE_ID),
'webhookId' => $this->configuration->get(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID),
'latestVersion' => $this->versioning->latest(),
'moduleVersion' => $this->module->version,
'authorizeUrl' => $authorizeUrl,
'client' => $client,
'enableSidebar' => true,
]);
return $this->getResponse($request, $this->serverFormHandler->getForm(), $this->generalFormHandler->getForm(), $authorizeUrl, $client);
}
/**
@ -99,60 +100,58 @@ class ConfigureController extends FrameworkBundleAdminController
*
* @return RedirectResponse|Response
*
* @throws \Exception
* @throws Exception
*/
public function editProcessAction(Request $request): Response
public function editServerSettingsAction(Request $request): Response
{
// Get current configuration, before processing everything
$currentConfiguration = Configuration::create($this->configuration);
// Get configuration container
$shopConfiguration = $this->getConfiguration();
$form = $this->formHandler->getForm();
$form->handleRequest($request);
// Get current configuration, before processing everything
$currentConfiguration = Server::create($shopConfiguration);
$serverForm = $this->serverFormHandler->getForm();
$serverForm->handleRequest($request);
// Just show the boring configuration field on no submit/invalid form
if (!$form->isSubmitted() || !$form->isValid()) {
// Create the authorization URL (without redirect)
$authorizeUrl = ApiKey::getAuthorizeUrl($this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST), Constants::BTCPAY_PERMISSIONS, $this->module->name, true, true, null, $this->module->name);
if (!$serverForm->isSubmitted() || !$serverForm->isValid()) {
// Try and create the client
$client = Client::createFromConfiguration($this->getConfiguration());
return $this->render('@Modules/btcpay/views/templates/admin/configure.html.twig', [
'form' => $form->createView(),
'help_link' => $this->generateSidebarLink($request->attributes->get('_legacy_controller')),
'invalidApiKey' => false === Client::createFromConfiguration($this->configuration)->isValid(),
'latestVersion' => $this->versioning->latest(),
'moduleVersion' => $this->module->version,
'authorizeUrl' => $authorizeUrl,
'enableSidebar' => true,
]);
// Create the authorization URL (without redirect)
$authorizeUrl = ApiKey::getAuthorizeUrl($this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_HOST), Constants::BTCPAY_PERMISSIONS, $this->module->name, true, true, null, $this->module->name);
return $this->getResponse($request, $serverForm, $this->generalFormHandler->getForm(), $authorizeUrl, $client);
}
/** @var Configuration $configuration */
$configuration = $form->getData()['btcpay'];
/** @var Server $submittedConfiguration */
$submittedConfiguration = $serverForm->getData();
// If there are errors in the form, error out here
if (0 !== \count($saveErrors = $this->formHandler->save($form->getData()))) {
if (0 !== \count($saveErrors = $this->serverFormHandler->save($submittedConfiguration->toArray()))) {
$this->flashErrors($saveErrors);
return $this->redirectToRoute('admin_btcpay_configure');
}
// If the configuration is the same, just stop
if ($configuration->equals($currentConfiguration)) {
if ($submittedConfiguration->equals($currentConfiguration)) {
$this->addFlash('success', 'BTCPay Server Plugin: Settings have not changed.');
return $this->redirectToRoute('admin_btcpay_configure');
}
// If we are just removing the API key, do that and return
if (null === $configuration->getApiKey() && !empty($currentConfiguration->getApiKey())) {
if (null === $submittedConfiguration->getApiKey() && !empty($currentConfiguration->getApiKey())) {
// Remove the current webhook to prevent issues in the future
if (false === (new Client($this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST), $currentConfiguration->getApiKey()))->webhook()->removeCurrent()) {
if (false === (new Client($shopConfiguration->get(Constants::CONFIGURATION_BTCPAY_HOST), $currentConfiguration->getApiKey()))->webhook()->removeCurrent()) {
$this->addFlash('error', 'BTCPay Server Plugin: Could not remove webhook from the server. Please double check it is actually gone.');
}
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_SECRET, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_SECRET, null);
$this->addFlash('success', 'BTCPay Server plugin: API key has been removed');
@ -163,40 +162,96 @@ class ConfigureController extends FrameworkBundleAdminController
(new Client($currentConfiguration->getHost(), $currentConfiguration->getApiKey()))->webhook()->removeCurrent();
// If an API key is set, use that
if (null !== $configuration->getApiKey()) {
return $this->processApiKey($configuration);
if (null !== $submittedConfiguration->getApiKey()) {
return $this->processApiKey($submittedConfiguration);
}
// If nothing has been set, redirect to the host
return $this->processRedirect($request, $configuration);
return $this->processRedirect($request, $submittedConfiguration);
}
/**
* @AdminSecurity("is_granted('update', request.get('_legacy_controller'))", message="Access denied.")
*
* @return RedirectResponse|Response
*
* @throws Exception
*/
public function editGeneralSettingsAction(Request $request): Response
{
// Get current configuration, before processing everything
$currentConfiguration = General::create($this->getConfiguration());
$generalForm = $this->generalFormHandler->getForm();
$generalForm->handleRequest($request);
// Just show the boring configuration field on no submit/invalid form
if (!$generalForm->isSubmitted() || !$generalForm->isValid()) {
// Try and create the client
$client = Client::createFromConfiguration($this->getConfiguration());
// Create the authorization URL (without redirect)
$authorizeUrl = ApiKey::getAuthorizeUrl($this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_HOST), Constants::BTCPAY_PERMISSIONS, $this->module->name, true, true, null, $this->module->name);
return $this->getResponse($request, $this->serverFormHandler->getForm(), $generalForm, $authorizeUrl, $client);
}
/** @var General $general */
$general = $generalForm->getData();
// If there are errors in the form, error out here
if (0 !== \count($saveErrors = $this->generalFormHandler->save($general->toArray()))) {
$this->flashErrors($saveErrors);
return $this->redirectToRoute('admin_btcpay_configure');
}
// If the configuration is the same, just stop
if ($general->equals($currentConfiguration)) {
$this->addFlash('success', 'BTCPay Server Plugin: Settings have not changed.');
return $this->redirectToRoute('admin_btcpay_configure');
}
// Return home
$this->addFlash('success', 'BTCPay Server Plugin: Settings have been saved.');
return $this->redirectToRoute('admin_btcpay_configure');
}
/**
* @return RedirectResponse|Response
*
* @throws \Exception
* @throws Exception
*/
public function validateAction(Request $request): Response
public function validateAPIKeyAction(Request $request): Response
{
// If we received an empty post we probably hit the PrestaShop security check
if (empty($request->request->all())) {
$this->addFlash('error', 'Did not receive data from BTCPay Server. If you received an <strong>Invalid Token</strong> page, make sure to properly setup PrestaShop and BTCPay Server (publicly accessible and HTTPS enabled). Please try again once done or use the API key option.');
// Make sure to reset the API key
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
// Validate incoming request and return any errors we encouter
// Validate incoming request and return any errors we encounter
$validateRequest = new ValidateApiKey($request->request);
if (0 !== \count($errors = $this->validator->validate($validateRequest))) {
/** @var ConstraintViolationInterface $error */
foreach ($errors as $error) {
$this->addFlash('error', $error->getMessage());
}
// Make sure to reset the API key
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
// Build the client
$client = new Client($this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST), $validateRequest->getApiKey());
$client = new Client($this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_HOST), $validateRequest->getApiKey());
// Get the store ID
$storeId = $validateRequest->getStoreID();
@ -205,6 +260,10 @@ class ConfigureController extends FrameworkBundleAdminController
// Ensure we have a valid BTCPay Server version
if (null !== ($info = $client->server()->getInfo()) && \version_compare($info->getVersion(), Constants::MINIMUM_BTCPAY_VERSION, '<')) {
$this->addFlash('error', \sprintf('BTCPay server version is too low. Expected %s or higher, received %s.', Constants::MINIMUM_BTCPAY_VERSION, $info->getVersion()));
PrestaShopLogger::addLog(\sprintf('[ERROR] BTCPay server version is too low. Expected %s or higher, received %s.', Constants::MINIMUM_BTCPAY_VERSION, $info->getVersion()), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
// Make sure to reset the API key
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
@ -212,33 +271,50 @@ class ConfigureController extends FrameworkBundleAdminController
// Ensure we have a payment methods setup
if (empty($client->payment()->getPaymentMethods($storeId))) {
$this->addFlash('error', \sprintf("This plugin expects a payment method to have been setup for store '%s'.", $client->store()->getStore($storeId)->offsetGet('name')));
PrestaShopLogger::addLog(\sprintf("[ERROR] This plugin expects a payment method to have been setup for store '%s'.", $client->store()->getStore($storeId)->offsetGet('name')), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
// Make sure to reset the API key
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
// Ensure we have a webhook
$client->webhook()->ensureWebhook($storeId);
} catch (\Throwable $exception) {
$this->addFlash('error', \sprintf('BTCPay Server plugin: %s', $exception->getMessage()));
\PrestaShopLogger::addLog('[ERROR] An error occurred during setup ' . \print_r($exception, true));
} catch (Throwable $throwable) {
$this->addFlash('error', \sprintf('BTCPay Server plugin: %s', $throwable->getMessage()));
PrestaShopLogger::addLog(\sprintf('[ERROR] An error occurred during configuration validation: %s', $throwable), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, $throwable->getCode());
return $this->redirectToRoute('admin_btcpay_configure');
}
// Store the API key and store ID we received
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, $validateRequest->getApiKey());
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, $storeId);
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_API_KEY, $validateRequest->getApiKey());
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, $storeId);
$this->addFlash('success', 'BTCPay Server plugin: Your store and server have been linked!');
return $this->redirectToRoute('admin_btcpay_configure');
}
/**
* @throws \Exception
*/
private function processApiKey(Configuration $configuration): RedirectResponse
protected function getConfiguration(): ShopConfigurationInterface
{
// Fallback in case 8.0 is used // TODO: Remove once we make 9.0 the minimum
if (\version_compare(\_PS_VERSION_, '8.1.0', '<')) {
return $this->configuration;
}
return parent::getConfiguration();
}
/**
* @throws Exception
*/
private function processApiKey(Server $configuration): RedirectResponse
{
// Get configuration container
$shopConfiguration = $this->getConfiguration();
// Build the client
$client = new Client($configuration->getHost(), $configuration->getApiKey());
@ -246,51 +322,66 @@ class ConfigureController extends FrameworkBundleAdminController
// Validate created API key and return any errors we encounter
$validateKey = new ValidateApiKey(new ParameterBag($client->apiKey()->getCurrent()->getData()));
if (0 !== \count($errors = $this->validator->validate($validateKey))) {
/** @var ConstraintViolationInterface $error */
foreach ($errors as $error) {
$this->addFlash('error', $error->getMessage());
}
// Make sure to reset the API key
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
// Get the store ID
$storeId = $validateKey->getStoreID();
// Grab the store
$store = $client->store()->getStore($storeId);
// Ensure we have a valid BTCPay Server version
if (null !== ($info = $client->server()->getInfo()) && \version_compare($info->getVersion(), Constants::MINIMUM_BTCPAY_VERSION, '<')) {
$this->addFlash('error', \sprintf('BTCPay server version is too low. Expected %s or higher, received %s.', Constants::MINIMUM_BTCPAY_VERSION, $info->getVersion()));
PrestaShopLogger::addLog(\sprintf('[ERROR] BTCPay server version is too low. Expected %s or higher, received %s.', Constants::MINIMUM_BTCPAY_VERSION, $info->getVersion()), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
// Make sure to reset the API key
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
// Ensure we have a payment methods setup
if (empty($client->payment()->getPaymentMethods($storeId))) {
$this->addFlash('error', \sprintf("This plugin expects a payment method to have been setup for store '%s'.", $client->store()->getStore($storeId)->offsetGet('name')));
$this->addFlash('error', \sprintf("This plugin expects a payment method to have been setup for store '%s'.", $store->offsetGet('name')));
PrestaShopLogger::addLog(\sprintf("[ERROR] This plugin expects a payment method to have been setup for store '%s'.", $store->offsetGet('name')), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
// Make sure to reset the API key
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
// Save the new store ID
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, $storeId);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, $storeId);
// Ensure we have a webhook
$client->webhook()->ensureWebhook($storeId);
} catch (\Throwable $exception) {
$this->addFlash('error', \sprintf('BTCPay Server plugin: %s', $exception->getMessage()));
\PrestaShopLogger::addLog('[ERROR] An error occurred during setup ' . \print_r($exception, true));
} catch (Throwable $throwable) {
$this->addFlash('error', \sprintf('BTCPay Server plugin: %s', $throwable->getMessage()));
PrestaShopLogger::addLog(\sprintf('[ERROR] An error occurred during setup: %s', $throwable), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, $throwable->getCode());
// Ensure nothing is saved
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_SECRET, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID, null);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_SECRET, null);
return $this->redirectToRoute('admin_btcpay_configure');
}
// Store the API key and store ID we received
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, $validateKey->getApiKey());
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, $storeId);
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, $validateKey->getApiKey());
$shopConfiguration->set(Constants::CONFIGURATION_BTCPAY_STORE_ID, $storeId);
$this->addFlash('success', 'BTCPay Server plugin: Your store and server have been linked!');
@ -299,19 +390,19 @@ class ConfigureController extends FrameworkBundleAdminController
}
/**
* @throws \Exception
* @throws Exception
*/
private function processRedirect(Request $request, Configuration $configuration): RedirectResponse
private function processRedirect(Request $request, Server $configuration): RedirectResponse
{
// Get the store name and build the redirect URL
$storeName = $this->getContext()->shop->name;
$storeName = $this->getContext()->shop->name;
$redirectUrl = $request->getSchemeAndHttpHost() . $this->getAdminLink('btcpay', ['route' => 'admin_btcpay_validate'], true);
// Create the authorization URL (with redirect)
$authorizeUrl = ApiKey::getAuthorizeUrl($configuration->getHost(), Constants::BTCPAY_PERMISSIONS, $storeName, true, true, $redirectUrl, $storeName);
// If there is no API key, redirect no matter what
if (empty($apiKey = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY))) {
if (empty($apiKey = $this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_API_KEY))) {
return $this->redirect($authorizeUrl);
}
@ -320,17 +411,17 @@ class ConfigureController extends FrameworkBundleAdminController
$client = new Client($configuration->getHost(), $apiKey);
// If we don't have a store ID, abort right away
if (null === ($storeID = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_STORE_ID))) {
if (null === ($storeID = $this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_STORE_ID))) {
return $this->redirect($authorizeUrl);
}
// Ensure we have a webhook
$client->webhook()->ensureWebhook($storeID);
} catch (\Throwable $e) {
} catch (Throwable) {
// Reset BTCPay details
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID, null);
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_SECRET, null);
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID, null);
$this->getConfiguration()->set(Constants::CONFIGURATION_BTCPAY_WEBHOOK_SECRET, null);
// Redirect away to get proper details
return $this->redirect($authorizeUrl);
@ -339,4 +430,20 @@ class ConfigureController extends FrameworkBundleAdminController
// Return home
return $this->redirectToRoute('admin_btcpay_configure');
}
private function getResponse(Request $request, FormInterface $serverForm, FormInterface $generalForm, string $authorizeUrl, ?Client $client): Response
{
return $this->render('@Modules/btcpay/views/templates/admin/configure.html.twig', [
'server_form' => $serverForm->createView(),
'general_form' => $generalForm->createView(),
'help_link' => $this->generateSidebarLink($request->attributes->get('_legacy_controller')),
'storeId' => $this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_STORE_ID),
'webhookId' => $this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID),
'latestVersion' => $this->versioning->latest(),
'moduleVersion' => $this->module->version,
'authorizeUrl' => $authorizeUrl,
'client' => $client,
'enableSidebar' => true,
]);
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -2,6 +2,10 @@
namespace BTCPay\Entity;
if (!\defined('_PS_VERSION_')) {
exit;
}
/**
* phpcs:disable Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
*/

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -2,6 +2,10 @@
namespace BTCPay\Exception;
if (!\defined('_PS_VERSION_')) {
exit;
}
class BTCPayException extends \RuntimeException
{
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,49 @@
<?php
namespace BTCPay\Factory;
use BTCPay\Repository\CustomerThreadRepository;
if (!\defined('_PS_VERSION_')) {
exit;
}
class CustomerMessage
{
/**
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public static function create(\CustomerThread $ct, string $message): \CustomerMessage
{
// Create a customer message
$cm = new \CustomerMessage();
$cm->id_customer_thread = $ct->id;
$cm->id_employee = 0;
$cm->message = $message;
$cm->private = true;
$cm->read = true;
// Ensure it is actually created
$cm->add();
return $cm;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public static function addToOrder(\Shop $shop, \Order $order, string $message): void
{
// Find or create the customer thread
$ct = CustomerThreadRepository::fetchOrCreate($shop, $order);
// Ensure the thread is open
$ct->status = 'open';
$ct->update();
// Create the message
self::create($ct, $message);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace BTCPay\Factory;
if (!\defined('_PS_VERSION_')) {
exit;
}
class CustomerThread
{
/**
* @throws \PrestaShopException
* @throws \PrestaShopDatabaseException
*/
public static function create(\Shop $shop, \Order $order): \CustomerThread
{
// Grab the customer from the order
$customer = $order->getCustomer();
// Create a customer thread
$ct = new \CustomerThread();
$ct->id_contact = 0;
$ct->id_customer = $order->id_customer;
$ct->id_shop = (int) $shop->id;
$ct->id_order = (int) $order->id;
$ct->id_lang = \Language::getIdByIso('en');
$ct->email = $customer->email;
$ct->status = 'open';
$ct->token = \Tools::passwdGen(12);
// Ensure it is actually created
$ct->add();
return $ct;
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -4,18 +4,15 @@ namespace BTCPay\Form\Data;
use BTCPay\Constants;
use BTCPayServer\Client\InvoiceCheckoutOptions;
use PrestaShop\PrestaShop\Core\Domain\Configuration\ShopConfigurationInterface;
use Symfony\Component\Validator\Constraints as Assert;
class Configuration
{
/**
* @Assert\Url()
* @Assert\NotBlank()
*
* @var string|null
*/
private $host;
if (!\defined('_PS_VERSION_')) {
exit;
}
class General
{
/**
* @Assert\NotBlank()
* @Assert\Choice(choices=\BTCPay\Constants::TRANSACTION_SPEEDS, message="Invalid transaction speed")
@ -35,53 +32,39 @@ class Configuration
/**
* @Assert\Choice(choices={true, false})
*/
private $shareMetadata;
private $protectOrders;
/**
* @Assert\Type(type="alnum")
*
* @var string|null
* @Assert\Choice(choices={true, false})
*/
private $apiKey;
private $shareMetadata;
public function __construct(string $host, string $speed, string $orderMode, bool $shareMetadata, string $apiKey = null)
public function __construct(string $speed, string $orderMode, bool $protectOrders, bool $shareMetadata)
{
$this->host = $host;
$this->apiKey = $apiKey;
$this->speed = $speed;
$this->orderMode = $orderMode;
$this->speed = $speed;
$this->orderMode = $orderMode;
$this->protectOrders = $protectOrders;
$this->shareMetadata = $shareMetadata;
}
public static function create(\PrestaShop\PrestaShop\Adapter\Configuration $configuration): self
public static function create(ShopConfigurationInterface $configuration): self
{
return new self(
$configuration->get(Constants::CONFIGURATION_BTCPAY_HOST, Constants::CONFIGURATION_DEFAULT_HOST),
$configuration->get(Constants::CONFIGURATION_SPEED_MODE, InvoiceCheckoutOptions::SPEED_MEDIUM),
$configuration->get(Constants::CONFIGURATION_ORDER_MODE, Constants::ORDER_MODE_BEFORE),
$configuration->get(Constants::CONFIGURATION_SHARE_METADATA, false),
$configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY),
(bool) $configuration->get(Constants::CONFIGURATION_PROTECT_ORDERS, true),
(bool) $configuration->get(Constants::CONFIGURATION_SHARE_METADATA, false),
);
}
public function getHost(): ?string
public static function fromArray(array $data): self
{
return $this->host;
}
public function setHost(?string $host): void
{
$this->host = $host;
}
public function getApiKey(): ?string
{
return $this->apiKey;
}
public function setApiKey(?string $apiKey): void
{
$this->apiKey = $apiKey;
return new self(
$data['speed'],
$data['orderMode'],
$data['protectOrders'],
$data['shareMetadata'],
);
}
public function getSpeed(): string
@ -104,6 +87,16 @@ class Configuration
$this->orderMode = $order_mode;
}
public function getProtectOrders(): bool
{
return $this->protectOrders;
}
public function setProtectOrders(bool $protectOrders): void
{
$this->protectOrders = $protectOrders;
}
public function shareMetadata(): bool
{
return $this->shareMetadata;
@ -114,18 +107,17 @@ class Configuration
$this->shareMetadata = $shareMetadata;
}
public function equals(self $configuration): bool
public function equals(self $general): bool
{
return $this->toArray() === $configuration->toArray();
return $this->toArray() === $general->toArray();
}
public function toArray(): array
{
return [
'host' => $this->host,
'apiKey' => $this->apiKey,
'speed' => $this->speed,
'orderMode' => $this->orderMode,
'protectOrders' => $this->protectOrders,
'shareMetadata' => $this->shareMetadata,
];
}

View File

@ -0,0 +1,84 @@
<?php
namespace BTCPay\Form\Data;
use BTCPay\Constants;
use PrestaShop\PrestaShop\Core\Domain\Configuration\ShopConfigurationInterface;
use Symfony\Component\Validator\Constraints as Assert;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Server
{
/**
* @Assert\Url()
* @Assert\NotBlank()
*
* @var string|null
*/
private $host;
/**
* @Assert\Type(type="alnum")
*
* @var string|null
*/
private $apiKey;
public function __construct(string $host, string $apiKey = null)
{
$this->host = $host;
$this->apiKey = $apiKey;
}
public static function create(ShopConfigurationInterface $configuration): self
{
return new self(
$configuration->get(Constants::CONFIGURATION_BTCPAY_HOST, Constants::CONFIGURATION_DEFAULT_HOST),
$configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY, null),
);
}
public static function fromArray(array $data): self
{
return new self(
$data['host'],
$data['apiKey'],
);
}
public function getHost(): ?string
{
return $this->host;
}
public function setHost(?string $host): void
{
$this->host = $host;
}
public function getApiKey(): ?string
{
return $this->apiKey;
}
public function setApiKey(?string $apiKey): void
{
$this->apiKey = $apiKey;
}
public function equals(self $configuration): bool
{
return $this->toArray() === $configuration->toArray();
}
public function toArray(): array
{
return [
'host' => $this->host,
'apiKey' => $this->apiKey,
];
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -3,11 +3,15 @@
namespace BTCPay\Form;
use BTCPay\Constants;
use BTCPay\Form\Data\Configuration;
use BTCPay\Form\Data\General;
use PrestaShop\PrestaShop\Adapter\Configuration as PrestaShopConfiguration;
use PrestaShop\PrestaShop\Core\Form\FormDataProviderInterface;
class ConfigureFormDataProvider implements FormDataProviderInterface
if (!\defined('_PS_VERSION_')) {
exit;
}
class GeneralFormDataProvider implements FormDataProviderInterface
{
/**
* @var PrestaShopConfiguration
@ -19,12 +23,9 @@ class ConfigureFormDataProvider implements FormDataProviderInterface
$this->configuration = new PrestaShopConfiguration();
}
/**
* @return Configuration[]
*/
public function getData(): array
public function getData(): General
{
return ['btcpay' => Configuration::create($this->configuration)];
return General::create($this->configuration);
}
/**
@ -32,16 +33,8 @@ class ConfigureFormDataProvider implements FormDataProviderInterface
*/
public function setData(array $data): array
{
/** @var Configuration $configuration */
$configuration = $data['btcpay'];
if ($this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST) !== \rtrim(\trim(($host = $configuration->getHost())), '/\\') && !empty($host)) {
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_HOST, \rtrim(\trim($host), '/\\'));
}
if ($this->configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY) !== \rtrim(\trim(($apiKey = $configuration->getApiKey())), '/\\') && !empty($apiKey)) {
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, \rtrim(\trim($apiKey), '/\\'));
}
// Re-create configuration element with form data
$configuration = General::fromArray($data);
if ($this->configuration->get(Constants::CONFIGURATION_SPEED_MODE) !== ($speedMode = $configuration->getSpeed()) && !empty($speedMode)) {
$this->configuration->set(Constants::CONFIGURATION_SPEED_MODE, $speedMode);

View File

@ -0,0 +1,50 @@
<?php
namespace BTCPay\Form;
use BTCPay\Constants;
use BTCPay\Form\Data\Server;
use PrestaShop\PrestaShop\Adapter\Configuration as PrestaShopConfiguration;
use PrestaShop\PrestaShop\Core\Form\FormDataProviderInterface;
if (!\defined('_PS_VERSION_')) {
exit;
}
class ServerFormDataProvider implements FormDataProviderInterface
{
/**
* @var PrestaShopConfiguration
*/
private $configuration;
public function __construct()
{
$this->configuration = new PrestaShopConfiguration();
}
public function getData(): Server
{
return Server::create($this->configuration);
}
/**
* @throws \Exception
*/
public function setData(array $data): array
{
// Re-create configuration element with form data
$configuration = Server::fromArray($data);
if ($this->configuration->get(Constants::CONFIGURATION_BTCPAY_HOST) !== \rtrim(\trim(($host = $configuration->getHost())), '/\\') && !empty($host)) {
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_HOST, \rtrim(\trim($host), '/\\'));
}
if ($this->configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY) !== \rtrim(\trim(($apiKey = $configuration->getApiKey())), '/\\') && !empty($apiKey)) {
$this->configuration->set(Constants::CONFIGURATION_BTCPAY_API_KEY, \rtrim(\trim($apiKey), '/\\'));
}
// All is fine
return [];
}
}

View File

@ -1,69 +0,0 @@
<?php
namespace BTCPay\Form\Type;
use BTCPay\Constants;
use BTCPay\Form\Data\Configuration;
use BTCPayServer\Client\InvoiceCheckoutOptions;
use PrestaShopBundle\Form\Admin\Type\TranslatorAwareType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ConfigureType extends TranslatorAwareType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('host', UrlType::class, ['label' => $this->trans('BTCPay Server URL', 'Modules.Btcpay.Admin')])
->add('api_key', TextType::class, [
'label' => $this->trans('BTCPay Server API key', 'Modules.Btcpay.Admin'),
'attr' => [
'placeholder' => empty($this->getConfiguration()->get(Constants::CONFIGURATION_BTCPAY_API_KEY))
? $this->trans('Leave blank to be redirected to your BTCPay Server for authentication', 'Modules.Btcpay.Admin')
: null,
'pattern' => '[a-zA-Z0-9]+',
],
'required' => false,
'empty_data' => null,
])
->add('speed', ChoiceType::class, [
'choices' => [
$this->trans('Low', 'Modules.Btcpay.Admin') => InvoiceCheckoutOptions::SPEED_LOW,
$this->trans('Medium', 'Modules.Btcpay.Admin') => InvoiceCheckoutOptions::SPEED_MEDIUM,
$this->trans('High', 'Modules.Btcpay.Admin') => InvoiceCheckoutOptions::SPEED_HIGH,
],
'label' => $this->trans('Transaction speed', 'Modules.Btcpay.Admin'),
'empty_data' => InvoiceCheckoutOptions::SPEED_MEDIUM,
])
->add('order_mode', ChoiceType::class, [
'choices' => [
$this->trans('Order before payment', 'Modules.Btcpay.Admin') => Constants::ORDER_MODE_BEFORE,
$this->trans('Order after payment', 'Modules.Btcpay.Admin') => Constants::ORDER_MODE_AFTER,
],
'label' => $this->trans('Order creation method', 'Modules.Btcpay.Admin'),
])
->add('share_metadata', ChoiceType::class, [
'choices' => [
$this->trans('Yes', 'Modules.Btcpay.Admin') => true,
$this->trans('No', 'Modules.Btcpay.Admin') => false,
],
'label' => $this->trans('Store customer data within invoice', 'Modules.Btcpay.Admin'),
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(['data_class' => Configuration::class]);
}
public function getBlockPrefix(): string
{
return 'module_btcpay';
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace BTCPay\Form\Type;
use BTCPay\Constants;
use BTCPay\Form\Data\General;
use BTCPayServer\Client\InvoiceCheckoutOptions;
use PrestaShopBundle\Form\Admin\Type\TranslatorAwareType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
if (!\defined('_PS_VERSION_')) {
exit;
}
class GeneralType extends TranslatorAwareType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('speed', ChoiceType::class, [
'choices' => [
$this->trans('Low', 'Modules.Btcpay.Admin') => InvoiceCheckoutOptions::SPEED_LOW,
$this->trans('Medium', 'Modules.Btcpay.Admin') => InvoiceCheckoutOptions::SPEED_MEDIUM,
$this->trans('High', 'Modules.Btcpay.Admin') => InvoiceCheckoutOptions::SPEED_HIGH,
],
'label' => $this->trans('Transaction speed', 'Modules.Btcpay.Admin'),
'help' => $this->trans('Determines the transaction fee that we recommend to the customer.', 'Modules.Btcpay.Admin'),
'empty_data' => InvoiceCheckoutOptions::SPEED_MEDIUM,
])
->add('orderMode', ChoiceType::class, [
'choices' => [
$this->trans('Order before payment', 'Modules.Btcpay.Admin') => Constants::ORDER_MODE_BEFORE,
$this->trans('Order after payment', 'Modules.Btcpay.Admin') => Constants::ORDER_MODE_AFTER,
],
'label' => $this->trans('Order creation method', 'Modules.Btcpay.Admin'),
'help' => $this->trans('Will we create the order as soon as the user gets redirect to BTCPay Server or do we wait for the webhook.', 'Modules.Btcpay.Admin'),
'empty_data' => Constants::ORDER_MODE_BEFORE,
])
->add('protectOrders', ChoiceType::class, [
'choices' => [
$this->trans('Yes', 'Modules.Btcpay.Admin') => true,
$this->trans('No', 'Modules.Btcpay.Admin') => false,
],
'label' => $this->trans('Protect order status', 'Modules.Btcpay.Admin'),
'help' => $this->trans('Will protect the order status from changing to "failed" if it already has a "paid" order state. This will protect an order from being cancelled via webhook, if it was paid via a different payment gateway.', 'Modules.Btcpay.Admin'),
'empty_data' => true,
])
->add('shareMetadata', ChoiceType::class, [
'choices' => [
$this->trans('Yes', 'Modules.Btcpay.Admin') => true,
$this->trans('No', 'Modules.Btcpay.Admin') => false,
],
'label' => $this->trans('Send customer data to BTCPay Server', 'Modules.Btcpay.Admin'),
'help' => $this->trans('If you want customer email, address, etc. sent to BTCPay Server enable this option. By default for privacy and GDPR reasons this is disabled.', 'Modules.Btcpay.Admin'),
'empty_data' => false,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(['data_class' => General::class]);
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace BTCPay\Form\Type;
use BTCPay\Form\Data\Server;
use PrestaShop\PrestaShop\Adapter\Configuration;
use PrestaShopBundle\Form\Admin\Type\TranslatorAwareType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\UrlType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;
if (!\defined('_PS_VERSION_')) {
exit;
}
class ServerType extends TranslatorAwareType
{
public function __construct(TranslatorInterface $translator, array $locales)
{
parent::__construct($translator, $locales);
}
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options): void
{
/** @var Server $data */
$data = $builder->getData() ?? Server::create(new Configuration());
$builder
->add('host', UrlType::class, [
'label' => $this->trans('BTCPay Server URL', 'Modules.Btcpay.Admin'),
'help' => $this->trans('The URL/host to your BTCPay Server instance. Make sure your node is reachable from the internet.', 'Modules.Btcpay.Admin'),
'required' => true,
])
->add('apiKey', TextType::class, [
'label' => $this->trans('BTCPay Server API key', 'Modules.Btcpay.Admin'),
'attr' => [
'pattern' => '[a-zA-Z0-9]+',
'placeholder' => empty($data->getApiKey())
? $this->trans('Keep blank to be redirected for authentication', 'Modules.Btcpay.Admin')
: $this->trans('Removing the API key will disconnect your store', 'Modules.Btcpay.Admin'),
],
'required' => false,
'empty_data' => null,
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults(['data_class' => Server::class]);
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -4,6 +4,10 @@ namespace BTCPay\Github;
use Composer\Semver\Comparator;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Latest
{
/**
@ -33,11 +37,11 @@ class Latest
public function __construct(int $id, string $name, string $tagName, string $commit, string $url)
{
$this->id = $id;
$this->name = $name;
$this->id = $id;
$this->name = $name;
$this->tagName = $tagName;
$this->commit = $commit;
$this->url = $url;
$this->commit = $commit;
$this->url = $url;
}
public static function create(array $data): self
@ -50,61 +54,26 @@ class Latest
return $this->id;
}
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getTagName(): string
{
return $this->tagName;
}
public function setTagName(string $tagName): self
{
$this->tagName = $tagName;
return $this;
}
public function getCommit(): string
{
return $this->commit;
}
public function setCommit(string $commit): self
{
$this->commit = $commit;
return $this;
}
public function getUrl(): string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
public function newer(string $currentVersion): bool
{
return Comparator::greaterThan(

View File

@ -3,57 +3,78 @@
namespace BTCPay\Github;
use BTCPay\Constants;
use Github\Api\Repo;
use Github\Client;
use Symfony\Component\Cache\Adapter\AdapterInterface;
use BTCPay\Server\CurlAdapter;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\HttpFoundation\Request;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Versioning
{
private const HEADERS = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'User-Agent' => 'btcpayserver/prestashop-plugin',
];
/**
* @var AdapterInterface
* @var FilesystemAdapter
*/
private $cache;
/**
* @var Repo
* @var CurlAdapter
*/
private $client;
public function __construct()
{
$this->cache = new FilesystemAdapter();
$client = new Client();
$client->addCache($this->cache);
$this->client = new Repo($client);
$this->cache = new FilesystemAdapter();
$this->client = new CurlAdapter();
}
public function latest(): ?Latest
{
// Check if we have a recent check, cached
$cachedUpdate = $this->cache->getItem(Constants::LASTEST_VERSION_CACHE_KEY);
if ($cachedUpdate->isHit() && !empty($cachedData = $cachedUpdate->get())) {
return Latest::create($cachedData);
}
try {
// Check if we have a recent check cached
$cachedUpdate = $this->cache->getItem(Constants::LASTEST_VERSION_CACHE_KEY);
if ($cachedUpdate->isHit() && !empty($cachedData = $cachedUpdate->get())) {
return Latest::create($cachedData);
}
// Fetch the latest version
$data = $this->client->releases()->latest('btcpayserver', 'prestashop-plugin');
// Fetch the latest version
$response = $this->client->request(Request::METHOD_GET, Constants::GITHUB_API_LATEST_ENDPOINT, self::HEADERS);
// If the request failed, stop bothering
if (200 !== $response->getStatus()) {
\PrestaShopLogger::addLog(\sprintf('[WARNING] Could not check for latest version, received status: %s', $response->getBody()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $response->getStatus());
return null;
}
// Decode JSON response
$data = \json_decode($response->getBody(), true, 512, \JSON_THROW_ON_ERROR);
// If the data is empty (or the request failed), return null
if (empty($data) || false === \array_key_exists('tag_name', $data) || (\array_key_exists('message', $data) && 'Not Found' === $data['message'])) {
return null;
}
// Set updated data
$cachedUpdate->expiresAfter(Constants::LASTEST_VERSION_CACHE_EXPIRATION);
$cachedUpdate->set($data);
// Save updated data
$this->cache->save($cachedUpdate);
// Finally, return the data
return Latest::create($cachedUpdate->get());
} catch (\Throwable $exception) {
\PrestaShopLogger::addLog(\sprintf('[INFO] Could not check for latest version, caught exception: %s', $exception->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, $exception->getCode());
// If the data is empty, return null
if (empty($data)) {
return null;
}
// Set updated data
$cachedUpdate->expiresAfter(Constants::LASTEST_VERSION_CACHE_EXPIRATION);
$cachedUpdate->set($data);
// Save updated data
$this->cache->save($cachedUpdate);
// Finally, return the data
return Latest::create($cachedUpdate->get());
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -6,6 +6,10 @@ use BTCPay\Constants;
use BTCPayServer\Client\InvoiceCheckoutOptions;
use PrestaShop\PrestaShop\Adapter\Configuration;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Config
{
/**
@ -23,7 +27,7 @@ class Config
*/
public function install(): array
{
// Init clear configurations
// Ensure sane defaults
if (!$this->configuration->set(Constants::CONFIGURATION_BTCPAY_HOST, Constants::CONFIGURATION_DEFAULT_HOST)
|| !$this->configuration->set(Constants::CONFIGURATION_SPEED_MODE, InvoiceCheckoutOptions::SPEED_MEDIUM)
|| !$this->configuration->set(Constants::CONFIGURATION_ORDER_MODE, Constants::ORDER_MODE_BEFORE)

View File

@ -4,6 +4,10 @@ namespace BTCPay\Installer;
use BTCPay;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Hooks
{
/**
@ -20,8 +24,6 @@ class Hooks
{
if (!$this->module->registerHook('displayAdminOrderMainBottom')
|| !$this->module->registerHook('displayOrderDetail')
|| !$this->module->registerHook('displayPaymentEU')
|| !$this->module->registerHook('payment')
|| !$this->module->registerHook('paymentReturn')
|| !$this->module->registerHook('paymentOptions')
|| !$this->module->registerHook('actionCartSave')) {

View File

@ -7,6 +7,10 @@ use Language;
use OrderState;
use PrestaShop\PrestaShop\Adapter\Configuration;
if (!\defined('_PS_VERSION_')) {
exit;
}
class OrderStates
{
/**
@ -39,7 +43,7 @@ class OrderStates
|| !\Validate::isLoadedObject(new OrderState($this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_WAITING)))) {
if (false === $this->installAwaiting()) {
$errors[] = [
'key' => 'Could not add new order state: BTCPAY_OS_WAITING',
'key' => \sprintf('Could not add new order state: %s', Constants::CONFIGURATION_ORDER_STATE_WAITING),
'parameters' => [],
'domain' => 'Admin.Modules.Notification',
];
@ -51,7 +55,7 @@ class OrderStates
|| !\Validate::isLoadedObject(new OrderState($this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING)))) {
if (false === $this->installConfirming()) {
$errors[] = [
'key' => 'Could not add new order state: BTCPAY_OS_CONFIRMING',
'key' => \sprintf('Could not add new order state: %s', Constants::CONFIGURATION_ORDER_STATE_CONFIRMING),
'parameters' => [],
'domain' => 'Admin.Modules.Notification',
];
@ -63,7 +67,7 @@ class OrderStates
|| !\Validate::isLoadedObject(new OrderState($this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_FAILED)))) {
if (false === $this->installFailed()) {
$errors[] = [
'key' => 'Could not add new order state: BTCPAY_OS_FAILED',
'key' => \sprintf('Could not add new order state: %s', Constants::CONFIGURATION_ORDER_STATE_FAILED),
'parameters' => [],
'domain' => 'Admin.Modules.Notification',
];
@ -75,7 +79,7 @@ class OrderStates
|| !\Validate::isLoadedObject(new OrderState($this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_PAID)))) {
if (false === $this->installPaid()) {
$errors[] = [
'key' => 'Could not add new order state: BTCPAY_OS_PAID',
'key' => \sprintf('Could not add new order state: %s', Constants::CONFIGURATION_ORDER_STATE_PAID),
'parameters' => [],
'domain' => 'Admin.Modules.Notification',
];
@ -185,6 +189,7 @@ class OrderStates
$order_state->color = '#108510';
$order_state->logable = true;
$order_state->unremovable = true;
$order_state->invoice = true;
$order_state->module_name = $this->moduleName;
foreach (Language::getLanguages(true, false, true) as $languageId) {

View File

@ -2,18 +2,22 @@
namespace BTCPay\Installer;
use BTCPay\Repository\BitcoinPaymentRepository;
use BTCPay\Repository\TableRepository;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Tables
{
/**
* @var BitcoinPaymentRepository
* @var TableRepository
*/
private $repository;
private $tableRepository;
public function __construct(BitcoinPaymentRepository $repository)
public function __construct(TableRepository $repository)
{
$this->repository = $repository;
$this->tableRepository = $repository;
}
/**
@ -22,7 +26,7 @@ class Tables
*/
public function install(): array
{
return $this->repository->createTables();
return $this->tableRepository->createTables();
}
/**
@ -31,6 +35,6 @@ class Tables
*/
public function uninstall(): array
{
return $this->repository->dropTables();
return $this->tableRepository->dropTables();
}
}

View File

@ -5,6 +5,10 @@ namespace BTCPay\Installer;
use BTCPay\Server\Client;
use PrestaShop\PrestaShop\Adapter\Configuration;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Webhook
{
/**
@ -22,8 +26,16 @@ class Webhook
*/
public function uninstall(): array
{
// Remove the current webhook to prevent issues in the future
if (false === (Client::createFromConfiguration($this->configuration)->webhook()->removeCurrent())) {
// Build the client from our stored configuration
$client = Client::createFromConfiguration($this->configuration);
// If there is no client, return now
if (null === $client) {
return [];
}
// Remove the current webhook to prevent issues in the future.
if (false === ($client->webhook()->removeCurrent())) {
return [
[
'key' => 'Could not remove webhook from the server. Please double check it is actually gone.',

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -4,15 +4,26 @@ namespace BTCPay\Invoice;
use BTCPay\Constants;
use BTCPay\Entity\BitcoinPayment;
use BTCPay\Repository\OrderPaymentRepository;
use BTCPay\Server\Client;
use BTCPayServer\Result\Invoice;
use PrestaShop\PrestaShop\Adapter\Configuration;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Processor
{
/**
* @var Configuration
* @var \BTCPay
*/
private $configuration;
private $module;
/**
* @var \Context
*/
private $context;
/**
* @var Client
@ -20,15 +31,16 @@ class Processor
private $client;
/**
* @var \BTCPay
* @var Configuration
*/
private $module;
private $configuration;
public function __construct(\BTCPay $module, Configuration $configuration, Client $client)
public function __construct(\BTCPay $module, \Context $context, Configuration $configuration, Client $client)
{
$this->module = $module;
$this->context = $context;
$this->configuration = $configuration;
$this->client = $client;
$this->module = $module;
$this->client = $client;
}
/**
@ -36,7 +48,7 @@ class Processor
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public function paymentConfirmed(BitcoinPayment $bitcoinPayment)
public function invoiceSettled(BitcoinPayment $bitcoinPayment): void
{
// Get the order
$order = new \Order($bitcoinPayment->getOrderId());
@ -50,15 +62,15 @@ class Processor
// Grab the invoice from the server
$invoice = $this->client->invoice()->getInvoice($storeID, $bitcoinPayment->getInvoiceId());
// Change state if it's paid/processing
if ($invoice->isPaid() || $invoice->isProcessing()) {
// Transaction received but we have to wait some confirmation
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
// Ensure the invoice is not processing
if ($invoice->isProcessing()) {
\PrestaShopLogger::addLog(\sprintf("[ERROR] Invoice '%s' should not be processing when 'InvoiceSettled' has been received", $invoice->getId()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, null, 'Order', $order->id);
return;
}
// Change state if it's fully paid
if ($invoice->isFullyPaid()) {
// Transaction confirmed on the network
// Change state if it's settled
if ($invoice->isSettled()) {
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_PAID);
}
@ -67,16 +79,6 @@ class Processor
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_PAID);
}
// Add a message if the user paid too late
if ($invoice->isPaidLate()) {
\PrestaShopLogger::addLog('[INFO] User paid after expiration for this invoice', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
}
// Add a message if the overpaid
if ($invoice->isOverpaid()) {
\PrestaShopLogger::addLog('[INFO] User overpaid for this order', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
}
// If nothing changed, return
if ((string) $order->current_state === $orderStatus) {
\PrestaShopLogger::addLog('[INFO] The state is the same as the one received', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
@ -84,24 +86,8 @@ class Processor
return;
}
// Set the status
$bitcoinPayment->setStatus((string) $orderStatus);
// Update the object
if (false === $bitcoinPayment->update(true)) {
$error = \sprintf('[ERROR] Could not update bitcoin_payment: %s', \Db::getInstance()->getMsgError());
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, null, 'BitcoinPayment', $bitcoinPayment->getId());
throw new \RuntimeException($error);
}
// Add the order change to the order history table
$orderHistory = new \OrderHistory();
$orderHistory->id_order = $bitcoinPayment->getOrderId();
// Store the change
$orderHistory->changeIdOrderState($orderStatus, $bitcoinPayment->getOrderId(), true);
$orderHistory->add(true);
// Store the updated status
$this->updateOrderStatus($bitcoinPayment, $orderStatus);
}
/**
@ -109,7 +95,7 @@ class Processor
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public function paymentFailed(BitcoinPayment $bitcoinPayment)
public function invoiceFailed(BitcoinPayment $bitcoinPayment): void
{
// Get the order
$order = new \Order($bitcoinPayment->getOrderId());
@ -129,7 +115,7 @@ class Processor
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_FAILED);
}
// Transaction was marked completed via BTCPay Server
// Transaction was marked as invalid via BTCPay Server
if ($invoice->isMarked()) {
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_FAILED);
}
@ -142,23 +128,7 @@ class Processor
}
// Update the status
$bitcoinPayment->setStatus((string) $orderStatus);
// Update the object
if (false === $bitcoinPayment->update(true)) {
$error = \sprintf('[ERROR] Could not update bitcoin_payment: %s', \Db::getInstance()->getMsgError());
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, null, 'BitcoinPayment', $bitcoinPayment->getId());
throw new \RuntimeException($error);
}
// Add the order change to the order history table
$orderHistory = new \OrderHistory();
$orderHistory->id_order = $bitcoinPayment->getOrderId();
// Store the change
$orderHistory->changeIdOrderState($orderStatus, $bitcoinPayment->getOrderId(), true);
$orderHistory->add(true);
$this->updateOrderStatus($bitcoinPayment, $orderStatus);
}
/**
@ -166,17 +136,70 @@ class Processor
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public function paymentReceived(BitcoinPayment $bitcoinPayment)
public function paymentReceived(BitcoinPayment $bitcoinPayment): void
{
// Get the order
$order = new \Order($bitcoinPayment->getOrderId());
// Specify what status it will be
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
// Get the store ID
$storeID = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_STORE_ID);
// Grab the invoice from the server
$invoice = $this->client->invoice()->getInvoice($storeID, $bitcoinPayment->getInvoiceId());
// Set the default status to be the current status
$orderStatus = $order->current_state;
// If partially paid, we are still waiting for more
if ($invoice->isPartiallyPaid()) {
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_WAITING);
}
// Transaction received, but we have to wait some confirmation
if ($invoice->isProcessing()) {
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
}
// Transaction received, but paid late
if ($invoice->isPaidLate()) {
// Transaction received but we have to wait some confirmation
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
}
// Transaction received, but overpaid
if ($invoice->isOverpaid()) {
// Transaction received but we have to wait some confirmation
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
}
// Invoice confirmed on the network
if ($invoice->isSettled()) {
// Transaction received and already confirmed
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_PAID);
}
// If nothing changed, return
if ((string) $order->current_state === $orderStatus) {
\PrestaShopLogger::addLog('[INFO] The state is the same as the one received', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
\PrestaShopLogger::addLog(\sprintf("[INFO] The state is the same as the one received for invoice '%s'", $invoice->getId()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
return;
}
// Store the updated status
$this->updateOrderStatus($bitcoinPayment, $orderStatus);
}
/**
* @throws \JsonException
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public function paymentReceivedCreateAfter(BitcoinPayment $bitcoinPayment): void
{
// Generate an order only if there is not another one with this cart
if (null !== \Order::getByCartId($bitcoinPayment->getCartId())) {
// We already have an order, so process as normal
$this->paymentReceived($bitcoinPayment);
return;
}
@ -187,52 +210,40 @@ class Processor
// Grab the invoice from the server
$invoice = $this->client->invoice()->getInvoice($storeID, $bitcoinPayment->getInvoiceId());
// Add a message if the user paid too late
// Set an initial state
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_WAITING);
// If partially paid, we are still waiting for more
if ($invoice->isPartiallyPaid()) {
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_WAITING);
}
// Transaction received, but we have to wait some confirmation
if ($invoice->isProcessing()) {
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
}
// Transaction received, but paid late
if ($invoice->isPaidLate()) {
\PrestaShopLogger::addLog('[INFO] User paid after expiration for this invoice', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
// Transaction received but we have to wait some confirmation
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
// Add a regular log
\PrestaShopLogger::addLog(\sprintf("[INFO] User paid after expiration for this invoice '%s'", $invoice->getId()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE);
}
// Add a message if the overpaid
// Transaction received, but overpaid
if ($invoice->isOverpaid()) {
\PrestaShopLogger::addLog('[INFO] User overpaid for this order', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
// Transaction received but we have to wait some confirmation
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
}
// Update the status
$bitcoinPayment->setStatus($orderStatus);
// Update the object
if (false === $bitcoinPayment->update(true)) {
$error = \sprintf('[ERROR] Could not update bitcoin_payment: %s', \Db::getInstance()->getMsgError());
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, null, 'BitcoinPayment', $bitcoinPayment->getId());
throw new \RuntimeException($error);
// Invoice confirmed on the network
if ($invoice->isSettled()) {
// Transaction received and already confirmed
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_PAID);
}
// Add the order change to the order history table
$orderHistory = new \OrderHistory();
$orderHistory->id_order = $bitcoinPayment->getOrderId();
// Store the change
$orderHistory->changeIdOrderState($orderStatus, $bitcoinPayment->getOrderId(), true);
$orderHistory->add(true);
}
/**
* @throws \JsonException
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public function paymentReceivedCreateAfter(BitcoinPayment $bitcoinPayment)
{
// Specify what status it will be
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_CONFIRMING);
// Get the store ID
$storeID = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_STORE_ID);
// Grab the invoice from the server
$invoice = $this->client->invoice()->getInvoice($storeID, $bitcoinPayment->getInvoiceId());
// Fetch the secure key, which is used to check if the order has been made from this store
if (null === ($invoiceData = $invoice->getData()) || !\array_key_exists('metadata', $invoiceData) || !\array_key_exists('posData', $invoiceData['metadata'])) {
\PrestaShopLogger::addLog('[ERROR] Secure key was not defined', \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
@ -243,42 +254,28 @@ class Processor
// Grab the secure key
$secureKey = $invoiceData['metadata']['posData'];
// Generate an order only if there is not another one with this cart
if ($existingOrder = \Order::getByCartId($bitcoinPayment->getCartId())) {
$message = \sprintf('[INFO] Invoice %s already has an order %s', $bitcoinPayment->getInvoiceId(), $existingOrder->reference);
\PrestaShopLogger::addLog($message, \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'BitcoinPayment', $bitcoinPayment->getId());
return;
}
\PrestaShopLogger::addLog(\sprintf("[INFO] Creating actual order for invoice '%s'", $invoice->getId()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'BitcoinPayment', $bitcoinPayment->getId());
$this->module->validateOrder(
$bitcoinPayment->getCartId(),
$orderStatus,
$bitcoinPayment->getAmount(),
$this->module->displayName, // BTCPay
null, //message should be new Message
[], // extra variables for mail
null, //currency special
false, // don't touch amount
$secureKey
$this->module->displayName,
null,
[],
null,
false,
$secureKey,
$this->context->shop
);
// Get the new order ID
$order = \Order::getByCartId($bitcoinPayment->getCartId());
// Store the new order ID and set the proper status
$bitcoinPayment->setOrderId($order->id);
$bitcoinPayment->setStatus($orderStatus);
// Add a message if the user paid too late
if ($invoice->isPaidLate()) {
\PrestaShopLogger::addLog('[INFO] User paid after expiration for this invoice', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
}
// Add a message if the overpaid
if ($invoice->isOverpaid()) {
\PrestaShopLogger::addLog('[INFO] User overpaid for this order', \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'Order', $order->id);
}
// Update the object
if (false === $bitcoinPayment->update(true)) {
$error = \sprintf('[ERROR] Could not update bitcoin_payment: %s', \Db::getInstance()->getMsgError());
@ -287,4 +284,69 @@ class Processor
throw new \RuntimeException($error);
}
}
/**
* @throws \JsonException
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
public function paymentSettled(BitcoinPayment $bitcoinPayment): void
{
// Get the order
$order = new \Order($bitcoinPayment->getOrderId());
// Get the store ID
$storeID = $this->configuration->get(Constants::CONFIGURATION_BTCPAY_STORE_ID);
// Grab the payments from the server
$paymentMethods = $this->client->invoice()->getPaymentMethods($storeID, $bitcoinPayment->getInvoiceId());
// Process all payments
foreach ($paymentMethods as $paymentMethod) {
// Grab all payments per payment method
$payments = $paymentMethod->getPayments();
// Process all payments
foreach ($payments as $payment) {
// Payment is not yet settled, continue
if (Invoice::STATUS_SETTLED !== $payment->getStatus()) {
continue;
}
// Payment is known, continue
if (OrderPaymentRepository::hasPayment($order, $payment)) {
continue;
}
// Add the payment
$order->addOrderPayment(\bcmul($payment->getValue(), $paymentMethod->getRate()), null, $payment->getTransactionId());
}
}
}
/**
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
private function updateOrderStatus(BitcoinPayment $bitcoinPayment, string $orderStatus): void
{
// Set the status
$bitcoinPayment->setStatus($orderStatus);
// Update the object
if (false === $bitcoinPayment->update(true)) {
$error = \sprintf('[ERROR] Could not update bitcoin_payment: %s', \Db::getInstance()->getMsgError());
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, null, 'BitcoinPayment', $bitcoinPayment->getId());
throw new \RuntimeException($error);
}
// Add the order change to the order history table
$orderHistory = new \OrderHistory();
$orderHistory->id_order = $bitcoinPayment->getOrderId();
// Store the change and make sure to create an invoice using existing payments (in case the status is changed to 'paid with crypto')
$orderHistory->changeIdOrderState($orderStatus, $bitcoinPayment->getOrderId(), true);
$orderHistory->add();
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -1,135 +0,0 @@
<?php
namespace BTCPay;
use BTCPay\Entity\BitcoinPayment;
class LegacyBitcoinPaymentRepository
{
/**
* @var \Db
*/
private $connection;
public function __construct()
{
$this->connection = \Db::getInstance();
}
/**
* @throws \PrestaShopException
*/
public function create(int $cartId, string $status, string $invoiceId): BitcoinPayment
{
$bitcoinPayment = new BitcoinPayment();
$bitcoinPayment->setCartId($cartId);
$bitcoinPayment->setStatus($status);
$bitcoinPayment->setInvoiceId($invoiceId);
if (false === $bitcoinPayment->save(true)) {
\PrestaShopLogger::addLog('[ERROR] Could not store bitcoin_payment', \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
throw new \RuntimeException('[ERROR] Could not store bitcoin_payment');
}
\PrestaShopLogger::addLog('[INFO] Created bitcoin_payment for invoice ' . $invoiceId, \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'BitcoinPayment', $bitcoinPayment->getId());
return $bitcoinPayment;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public function getOneByInvoiceID(string $invoiceId): ?BitcoinPayment
{
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.invoice_id = "%s"', $invoiceId))
->limit(1);
$result = $this->connection->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
if (false === ($object = $result->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public function getOneByInvoiceReference(string $invoiceReference): ?BitcoinPayment
{
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.invoice_reference = "%s"', $invoiceReference))
->limit(1);
$result = $this->connection->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
if (false === ($object = $result->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public function getOneByCartID(int $cartID): ?BitcoinPayment
{
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.cart_id = "%s"', $cartID))
->limit(1);
$result = $this->connection->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
if (false === ($object = $result->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public function getOneByOrderID(int $orderID): ?BitcoinPayment
{
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.order_id = "%s"', $orderID))
->limit(1);
$result = $this->connection->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
if (false === ($object = $this->connection->query($query)->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
}

View File

@ -2,80 +2,128 @@
namespace BTCPay\Repository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use BTCPay\Entity\BitcoinPayment;
if (!\defined('_PS_VERSION_')) {
exit;
}
class BitcoinPaymentRepository
{
/**
* @var Connection
* @throws \PrestaShopException
*/
private $connection;
/**
* @var string
*/
private $prefix;
public function __construct(Connection $connection, string $prefix)
public static function create(int $cartId, string $status, string $invoiceId): BitcoinPayment
{
$this->connection = $connection;
$this->prefix = $prefix;
$bitcoinPayment = new BitcoinPayment();
$bitcoinPayment->setCartId($cartId);
$bitcoinPayment->setStatus($status);
$bitcoinPayment->setInvoiceId($invoiceId);
if (false === $bitcoinPayment->save(true)) {
\PrestaShopLogger::addLog('[ERROR] Could not store bitcoin_payment', \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
throw new \RuntimeException('[ERROR] Could not store bitcoin_payment');
}
\PrestaShopLogger::addLog('[INFO] Created bitcoin_payment for invoice ' . $invoiceId, \PrestaShopLogger::LOG_SEVERITY_LEVEL_INFORMATIVE, null, 'BitcoinPayment', $bitcoinPayment->getId());
return $bitcoinPayment;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public function createTables(): array
public static function getOneByInvoiceID(string $invoiceId): ?BitcoinPayment
{
$errors = [];
$engine = \_MYSQL_ENGINE_;
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.invoice_id = "%s"', $invoiceId))
->limit(1);
$queries = [
"CREATE TABLE IF NOT EXISTS `{$this->prefix}bitcoin_payment`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`cart_id` int(11) NOT NULL,
`order_id` int(11),
`status` varchar(255) NOT NULL,
`invoice_id` varchar(255),
`invoice_reference` varchar(255),
`amount` varchar(255),
`bitcoin_price` varchar(255),
`bitcoin_paid` varchar(255),
`bitcoin_address` varchar(255),
`bitcoin_refund_address` varchar(255),
`redirect` varchar(255),
`rate` varchar(255),
PRIMARY KEY (`id`),
UNIQUE KEY `invoice_id` (`invoice_id`)
) ENGINE=$engine DEFAULT CHARSET=utf8",
];
try {
foreach ($queries as $query) {
$this->connection->executeQuery($query);
}
} catch (Exception $e) {
$errors[] = ['key' => \json_encode($e->getMessage(), \JSON_THROW_ON_ERROR), 'parameters' => [], 'domain' => 'Admin.Modules.Notification'];
$result = \Db::getInstance()->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
return $errors;
if (false === ($object = $result->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public function dropTables(): array
public static function getOneByInvoiceReference(string $invoiceReference): ?BitcoinPayment
{
$errors = [];
$query = "DROP TABLE IF EXISTS `{$this->prefix}bitcoin_payment`";
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.invoice_reference = "%s"', $invoiceReference))
->limit(1);
try {
$this->connection->executeQuery($query);
} catch (Exception $e) {
$errors[] = ['key' => \json_encode($e->getMessage(), \JSON_THROW_ON_ERROR), 'parameters' => [], 'domain' => 'Admin.Modules.Notification'];
$result = \Db::getInstance()->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
return $errors;
if (false === ($object = $result->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public static function getOneByCartID(int $cartID): ?BitcoinPayment
{
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.cart_id = "%s"', $cartID))
->limit(1);
$result = \Db::getInstance()->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
if (false === ($object = $result->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
/**
* @throws \PrestaShopDatabaseException
* @throws \JsonException
*/
public static function getOneByOrderID(int $orderID): ?BitcoinPayment
{
$query = new \DbQuery();
$query->select('bp.*')
->from('bitcoin_payment', 'bp')
->where(\sprintf('bp.order_id = "%s"', $orderID))
->limit(1);
$result = \Db::getInstance()->query($query);
if (0 !== ($errorCode = (int) $result->errorCode())) {
throw new \PrestaShopDatabaseException(\json_encode($result->errorInfo(), \JSON_THROW_ON_ERROR), $errorCode);
}
if (false === ($object = $result->fetchObject(BitcoinPayment::class))) {
return null;
}
return $object;
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace BTCPay\Repository;
use BTCPay\Factory\CustomerThread;
if (!\defined('_PS_VERSION_')) {
exit;
}
class CustomerThreadRepository
{
/**
* @throws \PrestaShopException
* @throws \PrestaShopDatabaseException
*/
public static function fetchOrCreate(\Shop $shop, \Order $order): \CustomerThread
{
// Get the customer
$customer = $order->getCustomer();
// Check if we need to create a thread, if so, create it and return it
if (false === ($threadId = \CustomerThread::getIdCustomerThreadByEmailAndIdOrder($customer->email, $order->id))) {
return CustomerThread::create($shop, $order);
}
// Return the existing thread
return new \CustomerThread((int) $threadId);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace BTCPay\Repository;
use BTCPayServer\Result\InvoicePayment;
use PrestaShopCollection;
if (!\defined('_PS_VERSION_')) {
exit;
}
class OrderPaymentRepository
{
/**
* @throws \PrestaShopException
*/
public static function hasPayment(\Order $order, InvoicePayment $payment): bool
{
$order_payments = new PrestaShopCollection(\OrderPayment::class);
$order_payments->where('order_reference', '=', $order->reference);
$order_payments->where('transaction_id', '=', $payment->getTransactionId());
return false === empty($order_payments->getResults());
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace BTCPay\Repository;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
if (!\defined('_PS_VERSION_')) {
exit;
}
class TableRepository
{
/**
* @var Connection
*/
private $connection;
public function __construct(Connection $connection)
{
$this->connection = $connection;
$this->prefix = \_DB_PREFIX_;
}
/**
* @throws \JsonException
*/
public function createTables(): array
{
$errors = [];
$engine = \_MYSQL_ENGINE_;
$queries = [
"CREATE TABLE IF NOT EXISTS `{$this->prefix}bitcoin_payment`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`cart_id` int(11) NOT NULL,
`order_id` int(11),
`status` varchar(255) NOT NULL,
`invoice_id` varchar(255),
`invoice_reference` varchar(255),
`amount` varchar(255),
`bitcoin_price` varchar(255),
`bitcoin_paid` varchar(255),
`bitcoin_address` varchar(255),
`bitcoin_refund_address` varchar(255),
`redirect` varchar(255),
`rate` varchar(255),
PRIMARY KEY (`id`),
UNIQUE KEY `invoice_id` (`invoice_id`)
) ENGINE=$engine DEFAULT CHARSET=utf8",
];
try {
foreach ($queries as $query) {
$this->connection->executeQuery($query);
}
} catch (Exception $e) {
$errors[] = ['key' => \json_encode($e->getMessage(), \JSON_THROW_ON_ERROR), 'parameters' => [], 'domain' => 'Admin.Modules.Notification'];
}
return $errors;
}
/**
* @throws \JsonException
*/
public function dropTables(): array
{
$errors = [];
$query = "DROP TABLE IF EXISTS `{$this->prefix}bitcoin_payment`";
try {
$this->connection->executeQuery($query);
} catch (Exception $e) {
$errors[] = ['key' => \json_encode($e->getMessage(), \JSON_THROW_ON_ERROR), 'parameters' => [], 'domain' => 'Admin.Modules.Notification'];
}
return $errors;
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -3,16 +3,19 @@
namespace BTCPay\Server;
use BTCPay\Constants;
use BTCPay\LegacyBitcoinPaymentRepository;
use BTCPay\Repository\BitcoinPaymentRepository;
use BTCPayServer\Client\AbstractClient;
use BTCPayServer\Client\ApiKey as ApiKeyClient;
use BTCPayServer\Client\Invoice as InvoiceClient;
use BTCPayServer\Client\Server as ServerClient;
use BTCPayServer\Client\Store as StoreClient;
use BTCPayServer\Client\StorePaymentMethod;
use BTCPayServer\Client\StorePaymentMethodLightningNetwork;
use BTCPayServer\Client\StorePaymentMethodOnChain;
use PrestaShop\PrestaShop\Adapter\Configuration;
use PrestaShop\PrestaShop\Core\Domain\Configuration\ShopConfigurationInterface;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Client extends AbstractClient
{
@ -41,16 +44,6 @@ class Client extends AbstractClient
*/
private $payment;
/**
* @var StorePaymentMethodOnChain
*/
private $onChain;
/**
* @var StorePaymentMethodLightningNetwork
*/
private $offChain;
/**
* @var Webhook
*/
@ -61,11 +54,6 @@ class Client extends AbstractClient
*/
private $configuration;
/**
* @var LegacyBitcoinPaymentRepository
*/
private $repository;
public function __construct(string $baseUrl, string $apiKey)
{
$httpClient = new CurlAdapter();
@ -77,20 +65,27 @@ class Client extends AbstractClient
$this->server = new ServerClient($baseUrl, $apiKey, $httpClient);
$this->store = new StoreClient($baseUrl, $apiKey, $httpClient);
$this->payment = new StorePaymentMethod($baseUrl, $apiKey, $httpClient);
$this->onChain = new StorePaymentMethodOnChain($baseUrl, $apiKey, $httpClient);
$this->offChain = new StorePaymentMethodLightningNetwork($baseUrl, $apiKey, $httpClient);
$this->webhook = new Webhook($baseUrl, $apiKey, $httpClient);
$this->configuration = new Configuration();
$this->repository = new LegacyBitcoinPaymentRepository();
}
public static function createFromConfiguration(Configuration $configuration): self
public static function createFromConfiguration(ShopConfigurationInterface $configuration): ?self
{
return new self(
$configuration->get(Constants::CONFIGURATION_BTCPAY_HOST),
$configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY)
);
$host = $configuration->get(Constants::CONFIGURATION_BTCPAY_HOST, null);
$apiKey = $configuration->get(Constants::CONFIGURATION_BTCPAY_API_KEY, null);
// Cannot create a client, if we do not have valid configuration
if (empty($host) || empty($apiKey)) {
return null;
}
return new self($host, $apiKey);
}
public function getBaseUrl(): string
{
return parent::getBaseUrl();
}
public function invoice(): InvoiceClient
@ -118,16 +113,6 @@ class Client extends AbstractClient
return $this->payment;
}
public function onChain(): StorePaymentMethodOnChain
{
return $this->onChain;
}
public function offChain(): StorePaymentMethodLightningNetwork
{
return $this->offChain;
}
public function webhook(): Webhook
{
return $this->webhook;
@ -136,8 +121,12 @@ class Client extends AbstractClient
public function isValid(): bool
{
try {
// Test the server connection
$this->server()->getInfo();
} catch (\Throwable $e) {
// Test the store connection
$this->store()->getStore($this->configuration->get(Constants::CONFIGURATION_BTCPAY_STORE_ID))->getName();
} catch (\Throwable) {
return false;
}
@ -155,7 +144,7 @@ class Client extends AbstractClient
return null;
}
if (null === ($bitcoinPayment = $this->repository->getOneByCartID($cart->id))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByCartID($cart->id))) {
return null;
}

View File

@ -6,6 +6,10 @@ use BTCPayServer\Http\CurlClient;
use BTCPayServer\Http\ResponseInterface;
use STS\Backoff\Backoff;
if (!\defined('_PS_VERSION_')) {
exit;
}
class CurlAdapter extends CurlClient
{
/**

View File

@ -6,6 +6,10 @@ use BTCPay\Constants;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\Validator\Constraints as Assert;
if (!\defined('_PS_VERSION_')) {
exit;
}
class ValidateApiKey
{
/**
@ -40,7 +44,7 @@ class ValidateApiKey
}
/**
* @Assert\IsTrue(message="This plugin expects all passed permissions to be given. Remove the new API key and try again.")
* @Assert\IsTrue(message="This plugin expects all passed permissions to be given. Please remove and recreate the API key")
*/
public function hasRequiredPermissions(): bool
{
@ -55,7 +59,7 @@ class ValidateApiKey
}
/**
* @Assert\IsTrue(message="This plugin requires one store (and one store only) to be authorized. Remove the new API key and try again.")
* @Assert\IsTrue(message="This plugin requires one store (and one store only) to be authorized. Please remove and recreate the API key.")
*/
public function hasSingleStore(): bool
{

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -4,18 +4,17 @@ namespace BTCPay\Server;
use BTCPay\Constants;
use BTCPay\Exception\BTCPayException;
use BTCPay\LegacyBitcoinPaymentRepository;
use BTCPay\Repository\BitcoinPaymentRepository;
use BTCPayServer\Client\InvoiceCheckoutOptions;
use BTCPayServer\Util\PreciseNumber;
use PrestaShop\PrestaShop\Adapter\Configuration;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Factory
{
/**
* @var LegacyBitcoinPaymentRepository
*/
private $repository;
/**
* @var \Link
*/
@ -38,7 +37,6 @@ class Factory
public function __construct(\BTCPay $module, \Context $context)
{
$this->repository = new LegacyBitcoinPaymentRepository();
$this->link = new \Link();
$this->configuration = new Configuration();
$this->context = $context;
@ -59,12 +57,13 @@ class Factory
}
// Build the client from our stored configuration
try {
$client = Client::createFromConfiguration($this->configuration);
} catch (\Throwable $e) {
\PrestaShopLogger::addLog(\sprintf('[MAJOR] %s', $e->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_MAJOR, $e->getCode());
$client = Client::createFromConfiguration($this->configuration);
throw new BTCPayException($e->getMessage(), $e->getCode(), $e);
// Ensure the client is ready for use
if (null === $client || false === $client->isValid()) {
\PrestaShopLogger::addLog("[ERROR] The BTCPay payment plugin was called to process a payment but the client doesn't exist.", \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
return null;
}
// Make sure we have a webhook, before we redirect anyone anywhere
@ -120,8 +119,8 @@ class Factory
$orderStatus = (string) $this->configuration->get(Constants::CONFIGURATION_ORDER_STATE_WAITING);
// Register invoice into bitcoin_payment table, if we didn't have one before.
if (null === ($bitcoinPayment = $this->repository->getOneByCartID($cart->id))) {
$bitcoinPayment = $this->repository->create($cart->id, $orderStatus, $invoiceId);
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByCartID($cart->id))) {
$bitcoinPayment = BitcoinPaymentRepository::create($cart->id, $orderStatus, $invoiceId);
}
$bitcoinPayment->setInvoiceId($invoiceId);
@ -138,7 +137,7 @@ class Factory
// If we create the order after payment, do not make the order yet
if (Constants::ORDER_MODE_AFTER === $this->configuration->get(Constants::CONFIGURATION_ORDER_MODE)) {
// Update the object, so we can always validate it afterwards
// Update the object, so we can always validate it afterward
if (false === $bitcoinPayment->update(true)) {
$error = \sprintf('[ERROR] Could not update bitcoin_payment: %s', \Db::getInstance()->getMsgError());
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, null, 'BitcoinPayment', $bitcoinPayment->getId());
@ -158,12 +157,13 @@ class Factory
$bitcoinPayment->getCartId(),
$bitcoinPayment->getStatus(),
$bitcoinPayment->getAmount(),
$this->module->displayName, // BTCPay
null, //message should be new Message
[], // extra variables for mail
null, //currency special
false, // don't touch amount
$customer->secure_key
$this->module->displayName,
null,
[],
null,
false,
$customer->secure_key,
$this->context->shop
);
// Get the new order ID
@ -182,10 +182,10 @@ class Factory
// Redirect user to payment
return $bitcoinPayment->getRedirect();
} catch (\Throwable $e) {
\PrestaShopLogger::addLog(\sprintf('[ERROR] %s', $e->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR);
} catch (\Throwable $throwable) {
\PrestaShopLogger::addLog(\sprintf('[ERROR] %s', $throwable->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, $throwable->getCode());
throw new BTCPayException($e->getMessage(), $e->getCode(), $e);
throw new BTCPayException($throwable->getMessage(), $throwable->getCode(), $throwable);
}
}
@ -202,7 +202,7 @@ class Factory
'taxIncluded' => $taxAmount,
];
// Only include personal details if enabled, if not, return here
// Only include personal details if enabled, if not, return here (force to bool, as the default could be not bool)
if (false === (bool) $this->configuration->get(Constants::CONFIGURATION_SHARE_METADATA, false)) {
return $metadata;
}

View File

@ -8,6 +8,10 @@ use BTCPayServer\Http\ClientInterface;
use PrestaShop\PrestaShop\Adapter\Configuration;
use Symfony\Component\HttpFoundation\Response;
if (!\defined('_PS_VERSION_')) {
exit;
}
class Webhook extends \BTCPayServer\Client\Webhook
{
/**
@ -34,7 +38,7 @@ class Webhook extends \BTCPayServer\Client\Webhook
*/
public function ensureWebhook(string $storeId): void
{
// Check if we have an existing webhook, if so, just cancel now
// Check if we have an existing webhook, if so, just cancel now (empty check is required).
if (false === empty($this->getCurrent($storeId, $this->configuration->get(Constants::CONFIGURATION_BTCPAY_WEBHOOK_ID)))) {
return;
}
@ -68,7 +72,8 @@ class Webhook extends \BTCPayServer\Client\Webhook
public function getCurrent(string $storeId, ?string $webhookId): ?\BTCPayServer\Result\Webhook
{
try {
if (null === $webhookId) {
// We need to check for empty here as twig passes a null variable as "" instead of null in configure.html.twig.
if (empty($webhookId)) {
return null;
}
@ -77,9 +82,9 @@ class Webhook extends \BTCPayServer\Client\Webhook
}
return !empty($webhook->getData()) ? $webhook : null;
} catch (\Throwable $e) {
$warning = \sprintf("[WARNING] expected webhook '%s' for store '%s' to exist, but it didn't. Exception received: %s", $webhookId, $storeId, $e->getMessage());
\PrestaShopLogger::addLog($warning, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $e->getCode());
} catch (\Throwable $throwable) {
$warning = \sprintf("[WARNING] expected webhook '%s' for store '%s' to exist, but it didn't. Exception received: %s", $webhookId, $storeId, $throwable->getMessage());
\PrestaShopLogger::addLog($warning, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $throwable->getCode());
return null;
}
@ -103,8 +108,9 @@ class Webhook extends \BTCPayServer\Client\Webhook
$this->deleteWebhook($storeId, $webhookId);
return true;
} catch (\Throwable $e) {
\PrestaShopLogger::addLog(\sprintf("[WARNING] Could not remove webhook '%s' from the store '%s'. Please double check it is actually gone. Exception received: %s", $webhookId, $storeId, $e->getMessage()), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $e->getCode());
} catch (\Throwable $throwable) {
$message = \sprintf("[WARNING] Could not remove webhook '%s' from the store '%s'. Please double check it is actually gone. Exception received: %s", $webhookId, $storeId, $throwable->getMessage());
\PrestaShopLogger::addLog($message, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, $throwable->getCode());
return false;
}

View File

@ -3,27 +3,22 @@
namespace BTCPay\Server;
use BTCPay\Constants;
use BTCPay\Factory\CustomerMessage;
use BTCPay\Invoice\Processor;
use BTCPay\LegacyBitcoinPaymentRepository;
use BTCPay\Repository\BitcoinPaymentRepository;
use PrestaShop\PrestaShop\Adapter\Configuration;
use Symfony\Component\HttpFoundation\Request;
if (!\defined('_PS_VERSION_')) {
exit;
}
class WebhookHandler
{
/**
* @var \BTCPay
* @var \Context
*/
private $module;
/**
* @var Client
*/
private $client;
/**
* @var LegacyBitcoinPaymentRepository
*/
private $repository;
private $context;
/**
* @var Configuration
@ -35,13 +30,11 @@ class WebhookHandler
*/
private $processor;
public function __construct(\BTCPay $module, Client $client, LegacyBitcoinPaymentRepository $repository)
public function __construct(\BTCPay $module, \Context $context, Client $client)
{
$this->module = $module;
$this->client = $client;
$this->repository = $repository;
$this->context = $context;
$this->configuration = new Configuration();
$this->processor = new Processor($this->module, $this->configuration, $this->client);
$this->processor = new Processor($module, $context, $this->configuration, $client);
}
/**
@ -62,48 +55,55 @@ class WebhookHandler
}
// If it's a test, just accept it
if (false !== \strpos($data['invoiceId'], '__test__')) {
if (\str_contains($data['invoiceId'], '__test__')) {
\PrestaShopLogger::addLog(\sprintf('[INFO] Received test IPN: %s', \json_encode($data, \JSON_THROW_ON_ERROR)));
return;
}
// Get the data type
$dataType = (string) $data['type'];
$eventType = (string) $data['type'];
// Get order mode
$orderMode = $this->configuration->get(Constants::CONFIGURATION_ORDER_MODE);
// Payment has been received (order already exists)
if (Constants::ORDER_MODE_BEFORE === $orderMode && \in_array($dataType, ['InvoiceProcessing', 'InvoicePaidInFull', 'InvoiceReceivedPayment'], true)) {
if (Constants::ORDER_MODE_BEFORE === $orderMode && \in_array($eventType, ['InvoiceProcessing', 'InvoicePaidInFull', 'InvoiceReceivedPayment'], true)) {
$this->paymentReceived($data);
return;
}
// Payment has been received (order needs to be made)
if (Constants::ORDER_MODE_AFTER === $orderMode && \in_array($dataType, ['InvoiceProcessing', 'InvoicePaidInFull', 'InvoiceReceivedPayment'], true)) {
if (Constants::ORDER_MODE_AFTER === $orderMode && \in_array($eventType, ['InvoiceProcessing', 'InvoicePaidInFull', 'InvoiceReceivedPayment'], true)) {
$this->paymentReceivedDelayedOrder($data);
return;
}
// Payment has failed
if (\in_array($dataType, ['InvoiceInvalid', 'InvoiceExpired'], true)) {
$this->paymentFailed($data);
return;
}
// Payment has been confirmed
if ('InvoiceSettled' === $dataType) {
$this->paymentConfirmed($data);
if ('InvoicePaymentSettled' === $eventType) {
$this->paymentSettled($data);
return;
}
// We don't really care about these events
if (\in_array($dataType, ['InvoiceCreated', 'InvoicePaymentSettled'], true)) {
// Invoice has failed or expired
if (\in_array($eventType, ['InvoiceInvalid', 'InvoiceExpired'], true)) {
$this->invoiceFailed($data);
return;
}
// Invoice has been confirmed
if ('InvoiceSettled' === $eventType) {
$this->invoiceSettled($data);
return;
}
// Invoice was crated, but either order already exists or will be created on first payment, skip
if ('InvoiceCreated' === $eventType) {
return;
}
@ -122,7 +122,7 @@ class WebhookHandler
$invoiceId = (string) $data['invoiceId'];
\PrestaShopLogger::addLog(\sprintf('[INFO] Payment received for invoice %s', $invoiceId));
if (null === ($bitcoinPayment = $this->repository->getOneByInvoiceID($invoiceId))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByInvoiceID($invoiceId))) {
$error = \sprintf('[WARNING] Could not load order with invoice ID %s', $invoiceId);
\PrestaShopLogger::addLog(\sprintf('[INFO] Received IPN: %s', \json_encode($data, \JSON_THROW_ON_ERROR)));
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING);
@ -144,7 +144,7 @@ class WebhookHandler
$invoiceId = (string) $data['invoiceId'];
\PrestaShopLogger::addLog(\sprintf('[INFO] Payment received for invoice %s', $invoiceId));
if (null === ($bitcoinPayment = $this->repository->getOneByInvoiceID($invoiceId))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByInvoiceID($invoiceId))) {
$error = \sprintf('[WARNING] Could not load order with invoice ID %s', $invoiceId);
\PrestaShopLogger::addLog(\sprintf('[INFO] Received IPN: %s', \json_encode($data, \JSON_THROW_ON_ERROR)));
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING);
@ -157,17 +157,40 @@ class WebhookHandler
$this->processor->paymentReceivedCreateAfter($bitcoinPayment);
}
/**
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
* @throws \JsonException
*/
private function paymentSettled(array $data): void
{
$invoiceId = (string) $data['invoiceId'];
\PrestaShopLogger::addLog(\sprintf('[INFO] One of the payments has settled for invoice %s', $invoiceId));
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByInvoiceID($invoiceId))) {
$error = \sprintf('[WARNING] Could not load order with invoice ID %s', $invoiceId);
\PrestaShopLogger::addLog(\sprintf('[INFO] Received IPN: %s', \json_encode($data, \JSON_THROW_ON_ERROR)));
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING);
// Don't bother retrying
return;
}
// Deal with the actual invoice now
$this->processor->paymentSettled($bitcoinPayment);
}
/**
* @throws \JsonException
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
*/
private function paymentFailed(array $data): void
private function invoiceFailed(array $data): void
{
$invoiceId = (string) $data['invoiceId'];
\PrestaShopLogger::addLog(\sprintf('[INFO] Payment failed for invoice %s', $invoiceId));
\PrestaShopLogger::addLog(\sprintf("[INFO] Invoice '%s' failed, either because it wasn't paid, it expired or it was marked as invalid", $invoiceId));
if (null === ($bitcoinPayment = $this->repository->getOneByInvoiceID($invoiceId))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByInvoiceID($invoiceId))) {
$error = \sprintf('[WARNING] Could not load order with invoice ID %s', $invoiceId);
\PrestaShopLogger::addLog(\sprintf('[INFO] Received IPN: %s', \json_encode($data, \JSON_THROW_ON_ERROR)));
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING);
@ -181,7 +204,30 @@ class WebhookHandler
return;
}
$this->processor->paymentFailed($bitcoinPayment);
// Check if protection is disabled, if so, just process the failure
if (false === $this->configuration->get(Constants::CONFIGURATION_PROTECT_ORDERS, true)) {
$this->processor->invoiceFailed($bitcoinPayment);
}
// Otherwise, will need to check the order so fetch it
$order = new \Order($bitcoinPayment->getOrderId());
// Check if the order has been paid, if so, add a note and abort
if (\Validate::isLoadedObject($orderState = $order->getCurrentOrderState()) && $orderState->paid) {
// Ensure we log this IPN
\PrestaShopLogger::addLog(\sprintf('[INFO] Received IPN: %s', \json_encode($data, \JSON_THROW_ON_ERROR)));
\PrestaShopLogger::addLog(\sprintf("[WARN] Webhook ('%s') received from BTCPay Server, but the order was already marked as paid.", $data['type']), \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING, null, 'Order', $order->id);
// Build a simple note and add it to the order
$note = \sprintf("BTCPay Server: Webhook ('%s') received, but the order was already marked as paid.", $data['type']);
CustomerMessage::addToOrder($this->context->shop, $order, $note);
// Don't bother with the rest
return;
}
// The order has not been set to paid, process the failure
$this->processor->invoiceFailed($bitcoinPayment);
}
/**
@ -189,12 +235,12 @@ class WebhookHandler
* @throws \PrestaShopException
* @throws \PrestaShopDatabaseException
*/
private function paymentConfirmed(array $data): void
private function invoiceSettled(array $data): void
{
$invoiceId = (string) $data['invoiceId'];
\PrestaShopLogger::addLog(\sprintf('[INFO] Payment confirmed for invoice %s', $invoiceId));
\PrestaShopLogger::addLog(\sprintf("[INFO] Invoice '%s' has been settled and thus fully paid", $invoiceId));
if (null === ($bitcoinPayment = $this->repository->getOneByInvoiceID($invoiceId))) {
if (null === ($bitcoinPayment = BitcoinPaymentRepository::getOneByInvoiceID($invoiceId))) {
$error = \sprintf('[WARNING] Could not load order with invoice ID %s', $invoiceId);
\PrestaShopLogger::addLog(\sprintf('[INFO] Received IPN: %s', \json_encode($data, \JSON_THROW_ON_ERROR)));
\PrestaShopLogger::addLog($error, \PrestaShopLogger::LOG_SEVERITY_LEVEL_WARNING);
@ -208,6 +254,6 @@ class WebhookHandler
return;
}
$this->processor->paymentConfirmed($bitcoinPayment);
$this->processor->invoiceSettled($bitcoinPayment);
}
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -7,9 +7,9 @@ if (!defined('_PS_VERSION_')) {
}
/**
* @param BTCpay $module
* @param BTCpay|ModuleInterface|mixed $module
*/
function upgrade_module_2_0_0(ModuleInterface $module): bool
function upgrade_module_2_0_0(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');

View File

@ -8,11 +8,11 @@ if (!defined('_PS_VERSION_')) {
}
/**
* @param BTCpay $module
* @param BTCpay|ModuleInterface|mixed $module
*
* @throws JsonException
*/
function upgrade_module_3_0_0(ModuleInterface $module): bool
function upgrade_module_3_0_0(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');

View File

@ -7,9 +7,9 @@ if (!defined('_PS_VERSION_')) {
}
/**
* @param BTCpay $module
* @param BTCpay|ModuleInterface|mixed $module
*/
function upgrade_module_4_0_0(ModuleInterface $module): bool
function upgrade_module_4_0_0(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');

View File

@ -9,13 +9,13 @@ if (!defined('_PS_VERSION_')) {
}
/**
* @param BTCpay $module
* @param BTCpay|ModuleInterface|mixed $module
*
* @throws JsonException
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
function upgrade_module_5_0_0(ModuleInterface $module): bool
function upgrade_module_5_0_0(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');

View File

@ -7,9 +7,9 @@ if (!defined('_PS_VERSION_')) {
}
/**
* @param BTCpay $module
* @param BTCpay|ModuleInterface|mixed $module
*/
function upgrade_module_5_1_0(ModuleInterface $module): bool
function upgrade_module_5_1_0(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');

View File

@ -0,0 +1,24 @@
<?php
use PrestaShop\PrestaShop\Core\Module\ModuleInterface;
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param BTCpay|ModuleInterface|mixed $module
*/
function upgrade_module_6_0_0(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');
}
return updateHooks($module);
}
function updateHooks(BTCPay $module): bool
{
return $module->unregisterHook('payment');
}

View File

@ -0,0 +1,19 @@
<?php
use PrestaShop\PrestaShop\Core\Module\ModuleInterface;
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param BTCpay|ModuleInterface|mixed $module
*/
function upgrade_module_6_0_2(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');
}
return $module->unregisterHook('displayPaymentEU');
}

View File

@ -0,0 +1,39 @@
<?php
use BTCPay\Constants;
use PrestaShop\PrestaShop\Core\Module\ModuleInterface;
if (!defined('_PS_VERSION_')) {
exit;
}
/**
* @param BTCpay|ModuleInterface|mixed $module
*
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
function upgrade_module_6_1_0(mixed $module): bool
{
if (!$module instanceof BTCPay) {
throw new LogicException('Received invalid module');
}
// Set a sane default for the new protection mode (which is true)
Configuration::set(Constants::CONFIGURATION_PROTECT_ORDERS, true);
// Update "paid with crypto" order statuses to allow the invoice to be downloaded
$orderState = new OrderState(Configuration::get(Constants::CONFIGURATION_ORDER_STATE_PAID));
// Ensure we actually have a valid order state
if (!\Validate::isLoadedObject($orderState)) {
throw new \LogicException(\sprintf("Expected order state '%s' to exist", Constants::CONFIGURATION_ORDER_STATE_FAILED));
}
// Allow the invoice to be downloaded and save the order state
$orderState->invoice = true;
$orderState->save();
// And we are done
return true;
}

View File

@ -0,0 +1,11 @@
<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

Some files were not shown because too many files have changed in this diff Show More