Compare commits
No commits in common. "6.x" and "v6.2.1" have entirely different histories.
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@ -5,8 +5,6 @@ updates:
|
||||
directory: /
|
||||
schedule:
|
||||
interval: daily
|
||||
cooldown:
|
||||
default-days: 7
|
||||
open-pull-requests-limit: 5
|
||||
reviewers:
|
||||
- BitcoinMitchell
|
||||
@ -18,8 +16,6 @@ updates:
|
||||
directory: /modules/btcpay
|
||||
schedule:
|
||||
interval: daily
|
||||
cooldown:
|
||||
default-days: 7
|
||||
open-pull-requests-limit: 5
|
||||
reviewers:
|
||||
- BitcoinMitchell
|
||||
@ -31,8 +27,6 @@ updates:
|
||||
directory: "/.github/workflows"
|
||||
schedule:
|
||||
interval: daily
|
||||
cooldown:
|
||||
default-days: 7
|
||||
open-pull-requests-limit: 5
|
||||
reviewers:
|
||||
- BitcoinMitchell
|
||||
|
||||
49
.github/workflows/dependencies.yml
vendored
Normal file
49
.github/workflows/dependencies.yml
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
name: "Dependencies"
|
||||
|
||||
on: [ "pull_request" ]
|
||||
|
||||
jobs:
|
||||
security:
|
||||
name: "Local PHP Security Checker (PHP ${{ matrix.php-versions }})"
|
||||
runs-on: "ubuntu-latest"
|
||||
strategy:
|
||||
matrix:
|
||||
php-versions: [ '8.0', '8.1' ]
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@v4"
|
||||
- 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"
|
||||
tools: "composer:v2"
|
||||
- name: "Get composer cache directory"
|
||||
id: "composer-cache"
|
||||
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
|
||||
- name: "Cache composer dependencies"
|
||||
uses: "actions/cache@v4"
|
||||
with:
|
||||
path: "${{ steps.composer-cache.outputs.dir }}"
|
||||
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}"
|
||||
restore-keys: "${{ runner.os }}-composer-"
|
||||
- name: "Validate composer"
|
||||
run: "composer validate"
|
||||
- name: "Install all dependencies"
|
||||
run: "make install"
|
||||
- uses: "actions/cache@v4"
|
||||
with:
|
||||
path: "~/.cache/local-php-security-checker"
|
||||
key: "local-php-security-checker-cache"
|
||||
|
||||
# Ensure our dependencies are fine
|
||||
- name: "Local PHP Security Checker"
|
||||
uses: "docker://pplotka/local-php-security-checker-github-actions:v1.0.0"
|
||||
with:
|
||||
cache_dir: "~/.cache/local-php-security-checker"
|
||||
path: "./composer.lock"
|
||||
- name: "Local PHP Security Checker - Module"
|
||||
uses: "docker://pplotka/local-php-security-checker-github-actions:v1.0.0"
|
||||
with:
|
||||
cache_dir: "~/.cache/local-php-security-checker"
|
||||
path: "./modules/btcpay/composer.lock"
|
||||
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
@ -4,19 +4,15 @@ 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@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5" # v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
uses: "actions/checkout@v4"
|
||||
- name: "Setup PHP, with composer and extensions"
|
||||
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2.36.0
|
||||
uses: "shivammathur/setup-php@v2" # https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: "8.0"
|
||||
extensions: "mbstring, xml, ctype, iconv, intl, gd"
|
||||
@ -25,12 +21,11 @@ jobs:
|
||||
id: "composer-cache"
|
||||
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
|
||||
- name: "Cache composer dependencies"
|
||||
uses: "actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb" # v5.0.1
|
||||
uses: "actions/cache@v4"
|
||||
with:
|
||||
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"
|
||||
@ -43,7 +38,7 @@ jobs:
|
||||
# Make a release from the tag and upload the zip
|
||||
- name: "Create Release"
|
||||
id: "create_release"
|
||||
uses: "softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b" # v2.5.0
|
||||
uses: "softprops/action-gh-release@v2"
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
with:
|
||||
|
||||
26
.github/workflows/security.yml
vendored
26
.github/workflows/security.yml
vendored
@ -1,26 +0,0 @@
|
||||
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
|
||||
19
.github/workflows/validate.yml
vendored
19
.github/workflows/validate.yml
vendored
@ -1,14 +1,6 @@
|
||||
name: "Validate"
|
||||
|
||||
on:
|
||||
push:
|
||||
paths: [ 'modules/**' ]
|
||||
branches: [ '6.x' ]
|
||||
tags: [ 'v*' ]
|
||||
pull_request:
|
||||
paths: [ 'modules/**' ]
|
||||
|
||||
permissions: {}
|
||||
on: [ "pull_request" ]
|
||||
|
||||
jobs:
|
||||
linting:
|
||||
@ -19,11 +11,9 @@ jobs:
|
||||
php-versions: [ '8.0', '8.1' ]
|
||||
steps:
|
||||
- name: "Checkout"
|
||||
uses: "actions/checkout@c2d88d3ecc89a9ef08eebf45d9637801dcee7eb5" # v6.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
uses: "actions/checkout@v4"
|
||||
- name: "Setup PHP, with composer and extensions"
|
||||
uses: "shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1" # v2.36.0
|
||||
uses: "shivammathur/setup-php@v2" # https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: "${{ matrix.php-versions }}"
|
||||
extensions: "mbstring, xml, ctype, iconv, intl, gd"
|
||||
@ -32,12 +22,11 @@ jobs:
|
||||
id: "composer-cache"
|
||||
run: 'echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
|
||||
- name: "Cache composer dependencies"
|
||||
uses: "actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb" # v5.0.1
|
||||
uses: "actions/cache@v4"
|
||||
with:
|
||||
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"
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2025 btcpayserver
|
||||
Copyright (c) 2017-2024 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
|
||||
|
||||
14
README.md
14
README.md
@ -8,7 +8,7 @@
|
||||
|
||||
<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/pulse"><img src="https://img.shields.io/maintenance/yes/2024?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&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>
|
||||
@ -41,7 +41,7 @@
|
||||
Please ensure that you meet the following requirements before installing this plugin.
|
||||
|
||||
- You are using PHP 8.0 or higher
|
||||
- Your PrestaShop is version 8.0/9.0 or higher.
|
||||
- Your PrestaShop is version 8.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/)
|
||||
@ -50,9 +50,9 @@ 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 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.
|
||||
- Prestashop v8.0, v8.0.1, v8.0.4, v8.1.0, v8.1.3 and v8.1.4
|
||||
- BTCPay server v1.7.0, v1.7.3.0, v1.12.5, v1.13.0 and v1.13.5
|
||||
- BTCPay server v2 should be supported as of module version v6.2.0.
|
||||
|
||||
### Multistore
|
||||
|
||||
@ -78,10 +78,6 @@ BTCPay Server is built and maintained entirely by volunteer contributors around
|
||||
|
||||
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.
|
||||
|
||||
### 🔧 Development
|
||||
|
||||
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
|
||||
|
||||
PrestaShop support can be found through its official channels.
|
||||
|
||||
774
composer.lock
generated
774
composer.lock
generated
File diff suppressed because it is too large
Load Diff
153
docker-compose.yml
Normal file
153
docker-compose.yml
Normal file
@ -0,0 +1,153 @@
|
||||
version: '3'
|
||||
services:
|
||||
btcpayserver:
|
||||
container_name: prestashop_btcpayserver
|
||||
environment:
|
||||
BTCPAY_POSTGRES: >-
|
||||
User ID=postgres;Host=postgres;Port=5432;Application
|
||||
Name=btcpayserver;Database=btcpayserverregtest
|
||||
BTCPAY_EXPLORERPOSTGRES: >-
|
||||
User ID=postgres;Host=postgres;Port=5432;Application
|
||||
Name=btcpayserver;MaxPoolSize=80;Database=nbxplorerregtest
|
||||
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/'
|
||||
expose:
|
||||
- '49392'
|
||||
image: 'btcpayserver/btcpayserver:1.13.0'
|
||||
links:
|
||||
- postgres
|
||||
ports:
|
||||
- '49392:49392'
|
||||
volumes:
|
||||
- 'btcpay_datadir:/datadir'
|
||||
- 'nbxplorer_datadir:/root/.nbxplorer'
|
||||
- 'btcpay_pluginsdir:/root/.btcpayserver/Plugins'
|
||||
|
||||
bitcoind:
|
||||
container_name: prestashop_bitcoind
|
||||
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
|
||||
mempoolfullrbf=1
|
||||
expose:
|
||||
- '43782'
|
||||
- '39388'
|
||||
image: 'btcpayserver/bitcoin:26.0'
|
||||
ports:
|
||||
- '18443:43782'
|
||||
volumes:
|
||||
- 'bitcoin_datadir:/data'
|
||||
- 'bitcoin_wallet_datadir:/walletdata'
|
||||
|
||||
nbxplorer:
|
||||
container_name: prestashop_nbxplorer
|
||||
environment:
|
||||
NBXPLORER_NETWORK: regtest
|
||||
NBXPLORER_BIND: '0.0.0.0:32838'
|
||||
NBXPLORER_TRIMEVENTS: 10000
|
||||
NBXPLORER_SIGNALFILESDIR: /datadir
|
||||
NBXPLORER_POSTGRES: >-
|
||||
User ID=postgres;Host=postgres;Port=5432;Application
|
||||
Name=nbxplorer;MaxPoolSize=20;Database=nbxplorerregtest
|
||||
NBXPLORER_AUTOMIGRATE: 1
|
||||
NBXPLORER_NOMIGRATEEVTS: 1
|
||||
NBXPLORER_DELETEAFTERMIGRATION: 1
|
||||
NBXPLORER_CHAINS: btc
|
||||
NBXPLORER_BTCRPCURL: 'http://bitcoind:43782/'
|
||||
NBXPLORER_BTCNODEENDPOINT: 'bitcoind:39388'
|
||||
expose:
|
||||
- '32838'
|
||||
image: 'nicolasdorier/nbxplorer:2.5.2'
|
||||
links:
|
||||
- postgres
|
||||
volumes:
|
||||
- 'nbxplorer_datadir:/datadir'
|
||||
- 'bitcoin_datadir:/root/.bitcoin'
|
||||
|
||||
postgres:
|
||||
command:
|
||||
- '-c'
|
||||
- random_page_cost=1.0
|
||||
- '-c'
|
||||
- shared_preload_libraries=pg_stat_statements
|
||||
container_name: prestashop_postgres
|
||||
environment:
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
image: 'btcpayserver/postgres:13.13'
|
||||
shm_size: 256mb
|
||||
volumes:
|
||||
- 'postgres_datadir:/var/lib/postgresql/data'
|
||||
|
||||
mariadb:
|
||||
container_name: prestashop_mariadb
|
||||
environment:
|
||||
- ALLOW_EMPTY_PASSWORD=yes
|
||||
- MARIADB_SKIP_TEST_DB=yes
|
||||
- MARIADB_USER=prestashop
|
||||
- MARIADB_PASSWORD=bitnami
|
||||
- MARIADB_DATABASE=prestashop
|
||||
image: 'bitnami/mariadb:11.0'
|
||||
ports:
|
||||
- '3305:3306'
|
||||
volumes:
|
||||
- 'mariadb_data:/bitnami/mariadb'
|
||||
|
||||
prestashop:
|
||||
container_name: prestashop_prestashop
|
||||
depends_on:
|
||||
- mariadb
|
||||
- btcpayserver
|
||||
environment:
|
||||
- PRESTASHOP_HOST=prestashop:8080
|
||||
- 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
|
||||
expose:
|
||||
- '8080'
|
||||
- '8443'
|
||||
image: 'bitnami/prestashop:8.0.4'
|
||||
links:
|
||||
- mariadb
|
||||
- btcpayserver
|
||||
ports:
|
||||
- '8080:8080'
|
||||
- '8443:8443'
|
||||
volumes:
|
||||
- 'prestashop_data:/bitnami/prestashop'
|
||||
|
||||
mailpit:
|
||||
container_name: prestashop_mailpit
|
||||
image: 'axllent/mailpit:latest'
|
||||
logging:
|
||||
driver: none
|
||||
ports:
|
||||
- '1025:1025'
|
||||
- '8025:8025'
|
||||
|
||||
volumes:
|
||||
bitcoin_datadir: ~
|
||||
bitcoin_wallet_datadir: ~
|
||||
btcpay_datadir: ~
|
||||
btcpay_pluginsdir: ~
|
||||
mariadb_data: { driver: local }
|
||||
nbxplorer_datadir: ~
|
||||
postgres_datadir: ~
|
||||
prestashop_data: { driver: local }
|
||||
@ -52,7 +52,7 @@ class BTCPay extends PaymentModule
|
||||
{
|
||||
$this->name = 'btcpay';
|
||||
$this->tab = 'payments_gateways';
|
||||
$this->version = '6.3.1';
|
||||
$this->version = '6.2.1';
|
||||
$this->author = 'BTCPay Server';
|
||||
$this->ps_versions_compliancy = ['min' => Constants::MINIMUM_PS_VERSION, 'max' => _PS_VERSION_];
|
||||
$this->controllers = ['payment', 'validation', 'webhook'];
|
||||
@ -240,12 +240,8 @@ class BTCPay extends PaymentModule
|
||||
|
||||
try {
|
||||
// Get the invoice and its payments
|
||||
$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());
|
||||
});
|
||||
$invoice = $client->invoice()->getInvoice($storeID, $invoiceId);
|
||||
$paymentMethods = $client->invoice()->getPaymentMethods($storeID, $invoiceId);
|
||||
|
||||
// Has any payment been received
|
||||
$paymentReceived = array_reduce($paymentMethods, static function ($carry, $method) {
|
||||
@ -415,6 +411,12 @@ class BTCPay extends PaymentModule
|
||||
return [];
|
||||
}
|
||||
|
||||
// Prepare smarty
|
||||
$this->context->smarty->assign([
|
||||
'onChain' => $client->onChain()->getPaymentMethods($storeID),
|
||||
'offChain' => $client->offChain()->getPaymentMethods($storeID),
|
||||
]);
|
||||
|
||||
return [
|
||||
(new PaymentOption())
|
||||
->setModuleName($this->name)
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
"ext-intl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"btcpayserver/btcpayserver-greenfield-php": "^2.8.1",
|
||||
"btcpayserver/btcpayserver-greenfield-php": "^2.6.0",
|
||||
"composer/semver": "^3.4.2",
|
||||
"stechstudio/backoff": "^1.4"
|
||||
},
|
||||
|
||||
677
modules/btcpay/composer.lock
generated
677
modules/btcpay/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -53,16 +53,14 @@ class BTCPayPaymentModuleFrontController extends ModuleFrontController
|
||||
|
||||
try {
|
||||
if (null !== ($redirect = $this->factory->createPaymentRequest($this->context->customer, $this->context->cart))) {
|
||||
Tools::redirect($redirect);
|
||||
Tools::redirectLink($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 $throwable) {
|
||||
PrestaShopLogger::addLog(\sprintf('[ERROR] An error occurred during payment creation: %s', $throwable), PrestaShopLogger::LOG_SEVERITY_LEVEL_ERROR, $throwable->getCode());
|
||||
|
||||
} catch (\Throwable) {
|
||||
$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));
|
||||
}
|
||||
|
||||
@ -62,10 +62,7 @@ class ConfigureController extends FrameworkBundleAdminController
|
||||
|
||||
public function __construct(BTCPay $module, ValidatorInterface $validator, FormHandlerInterface $serverFormHandler, FormHandlerInterface $generalFormHandler)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
parent::__construct();
|
||||
|
||||
$this->module = $module;
|
||||
$this->validator = $validator;
|
||||
@ -299,7 +296,7 @@ class ConfigureController extends FrameworkBundleAdminController
|
||||
|
||||
protected function getConfiguration(): ShopConfigurationInterface
|
||||
{
|
||||
// Fallback in case 8.0 is used // TODO: Remove once we make 9.0 the minimum
|
||||
// Fallback in case 8.0 is used // TODO: Remove once we make 8.1.0 the minimum
|
||||
if (\version_compare(\_PS_VERSION_, '8.1.0', '<')) {
|
||||
return $this->configuration;
|
||||
}
|
||||
|
||||
@ -10,6 +10,8 @@ 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;
|
||||
|
||||
@ -44,6 +46,16 @@ class Client extends AbstractClient
|
||||
*/
|
||||
private $payment;
|
||||
|
||||
/**
|
||||
* @var StorePaymentMethodOnChain
|
||||
*/
|
||||
private $onChain;
|
||||
|
||||
/**
|
||||
* @var StorePaymentMethodLightningNetwork
|
||||
*/
|
||||
private $offChain;
|
||||
|
||||
/**
|
||||
* @var Webhook
|
||||
*/
|
||||
@ -65,6 +77,8 @@ 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();
|
||||
@ -113,6 +127,16 @@ 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;
|
||||
|
||||
@ -135,6 +135,7 @@
|
||||
<div class="card-deck">
|
||||
<div class="card">
|
||||
<h3 class="card-header">
|
||||
<i class="material-icons">store</i>
|
||||
{{ 'Store Information'|trans({}, 'Admin.Actions') }}
|
||||
</h3>
|
||||
|
||||
@ -163,6 +164,7 @@
|
||||
|
||||
<div class="card">
|
||||
<h3 class="card-header">
|
||||
<i class="material-icons">info_outline</i>
|
||||
{{ 'Server Information'|trans({}, 'Admin.Actions') }}
|
||||
</h3>
|
||||
|
||||
@ -174,7 +176,7 @@
|
||||
{% set webhook = client.webhook().getCurrent(storeId, webhookId) %}
|
||||
<dt><span class="text-muted mb-0"><strong>{{ 'Webhook'|trans({}, 'Modules.Btcpay.Admin') }}</strong></span></dt>
|
||||
{% if webhook is not null and webhook.enabled is defined and webhook.enabled %}
|
||||
<dd><span class="text-success px-1">✓</span></dd>
|
||||
<dd><span class="text-success px-1"><i class="material-icons">checkmark</i></span></dd>
|
||||
{% elseif webhook is not null and webhook.enabled is defined and not webhook.enabled %}
|
||||
<dd><span class="text-warning px-1">Webhook has been disabled, re-enable it again your store</span></dd>
|
||||
{% else %}
|
||||
@ -192,9 +194,12 @@
|
||||
|
||||
<dt><span class="text-muted mb-0"><strong>{{ 'Supported payment methods'|trans({}, 'Modules.Btcpay.Front') }}</strong></span></dt>
|
||||
<dd>
|
||||
<ul>
|
||||
{% for paymentMethod in client.payment().getPaymentMethods(storeId) %}
|
||||
<li>{{ paymentMethod.cryptoCode }} {% if 'LNURL' in paymentMethod.paymentMethod %}LNURL ⚡{% elseif 'LN' in paymentMethod.paymentMethod or 'Lightning' in paymentMethod.paymentMethod %}Lightning ⚡{% else %}(On-Chain){% endif %}</li>
|
||||
<ul class="list-unstyled px-1">
|
||||
{% for paymentMethod in client.offChain().getPaymentMethods(storeId) %}
|
||||
<li>{{ paymentMethod.cryptoCode }} Lightning ⚡</li>
|
||||
{% endfor %}
|
||||
{% for paymentMethod in client.onChain().getPaymentMethods(storeId) %}
|
||||
<li>{{ paymentMethod.cryptoCode }} On-Chain</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</dd>
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||
{foreach $paymentMethods as $paymentMethod}
|
||||
{if not empty($paymentMethod->getPayments())}
|
||||
{assign currencyCode "_"|explode:($paymentMethod.paymentMethod|default:$paymentMethod.currency)|current}
|
||||
{assign currencyCode "_"|explode:$paymentMethod.paymentMethod|current}
|
||||
<a class="nav-item nav-link{if $paymentMethod@first} active{/if}" id="nav-{$currencyCode|strtolower|escape:'htmlall':'UTF-8'}-tab" data-toggle="tab" href="#nav-{$currencyCode|strtolower|escape:'htmlall':'UTF-8'}" role="tab" aria-controls="nav-{$currencyCode|strtolower|escape:'htmlall':'UTF-8'}" aria-selected="true">
|
||||
<strong>{$currencyCode|escape:'htmlall':'UTF-8'}</strong>
|
||||
</a>
|
||||
@ -60,48 +60,48 @@
|
||||
<div class="tab-content" id="nav-tabContent">
|
||||
{foreach $paymentMethods as $paymentMethod}
|
||||
{if not empty($paymentMethod->getPayments())}
|
||||
{assign currencyCode "_"|explode:($paymentMethod.paymentMethod|default:$paymentMethod.currency)|current}
|
||||
<div class="tab-pane fade{if $paymentMethod@first} show active{/if}" id="nav-{$currencyCode|strtolower|escape:'htmlall':'UTF-8'}" role="tabpanel" aria-labelledby="nav-{$currencyCode|strtolower|escape:'htmlall':'UTF-8'}-tab">
|
||||
<table id="{$currencyCode|escape:'htmlall':'UTF-8'}-details" class="table table-bordered my-2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-head-rate">{l s='Rate' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-cart-amount">{l s='Invoice amount' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-paid-amount">{l s='Total amount paid in %s' sprintf=[$currencyCode|escape:'htmlall':'UTF-8'] d='Modules.Btcpay.Global'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$storeCurrency|escape:'htmlall':'UTF-8'} {$paymentMethod.rate|escape:'htmlall':'UTF-8'}</td>
|
||||
<td>{$paymentMethod.amount|escape:'htmlall':'UTF-8'} {$paymentMethod.paymentMethod|escape:'htmlall':'UTF-8'}</td>
|
||||
<td>{$paymentMethod.paymentMethodPaid|escape:'htmlall':'UTF-8'} {$paymentMethod.paymentMethod|escape:'htmlall':'UTF-8'}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="{$currencyCode|escape:'htmlall':'UTF-8'}-payments" class="table table-bordered my-2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-head-date">{l s='Date' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-amount">{l s='Amount' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-destination">{l s='Transaction' d='Modules.Btcpay.Global'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $paymentMethod->getPayments() as $payment}
|
||||
<tr>
|
||||
<td>{$payment->getReceivedTimestamp()|date_format:"%Y-%m-%d %T"}</td>
|
||||
<td>{$payment.value|escape:'htmlall':'UTF-8'} {$currencyCode|escape:'htmlall':'UTF-8'}</td>
|
||||
{if $currencyCode == 'BTC'}
|
||||
<td><a href="https://mempool.space/tx/{$payment->getTransactionId()|escape:'htmlall':'UTF-8'}" target="_blank" rel="noopener noreferrer nofollow">{$payment->getTransactionId()|escape:'htmlall':'UTF-8'}</a></td>
|
||||
{else}
|
||||
<td><a href="https://blockchair.com/search?q={$payment->getTransactionId()|escape:'htmlall':'UTF-8'}" target="_blank" rel="noopener noreferrer nofollow">{$payment->getTransactionId()|escape:'htmlall':'UTF-8'}</a></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{assign currencyCode "_"|explode:$paymentMethod.paymentMethod|current}
|
||||
<div class="tab-pane fade{if $paymentMethod@first} show active{/if}" id="nav-{$currencyCode|strtolower|escape:'htmlall':'UTF-8'}" role="tabpanel" aria-labelledby="nav-{$currencyCode|strtolower|escape:'htmlall':'UTF-8'}-tab">
|
||||
<table id="{$currencyCode|escape:'htmlall':'UTF-8'}-details" class="table table-bordered my-2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-head-rate">{l s='Rate' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-cart-amount">{l s='Invoice amount' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-paid-amount">{l s='Total amount paid in %s' sprintf=[$currencyCode|escape:'htmlall':'UTF-8'] d='Modules.Btcpay.Global'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$storeCurrency|escape:'htmlall':'UTF-8'} {$paymentMethod.rate|escape:'htmlall':'UTF-8'}</td>
|
||||
<td>{$paymentMethod.amount|escape:'htmlall':'UTF-8'} {$paymentMethod.paymentMethod|escape:'htmlall':'UTF-8'}</td>
|
||||
<td>{$paymentMethod.paymentMethodPaid|escape:'htmlall':'UTF-8'} {$paymentMethod.paymentMethod|escape:'htmlall':'UTF-8'}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table id="{$currencyCode|escape:'htmlall':'UTF-8'}-payments" class="table table-bordered my-2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="table-head-date">{l s='Date' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-amount">{l s='Amount' d='Modules.Btcpay.Global'}</th>
|
||||
<th class="table-head-destination">{l s='Transaction' d='Modules.Btcpay.Global'}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $paymentMethod->getPayments() as $payment}
|
||||
<tr>
|
||||
<td>{$payment->getReceivedTimestamp()|date_format:"%Y-%m-%d %T"}</td>
|
||||
<td>{$payment.value|escape:'htmlall':'UTF-8'} {$currencyCode|escape:'htmlall':'UTF-8'}</td>
|
||||
{if $currencyCode == 'BTC'}
|
||||
<td><a href="https://mempool.space/tx/{$payment->getTransactionId()|escape:'htmlall':'UTF-8'}" target="_blank" rel="noopener noreferrer nofollow">{$payment->getTransactionId()|escape:'htmlall':'UTF-8'}</a></td>
|
||||
{else}
|
||||
<td><a href="https://blockchair.com/search?q={$payment->getTransactionId()|escape:'htmlall':'UTF-8'}" target="_blank" rel="noopener noreferrer nofollow">{$payment->getTransactionId()|escape:'htmlall':'UTF-8'}</a></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@ -1,3 +1,13 @@
|
||||
<section class="mb-2">
|
||||
<p class="mb-1">{l s='Please pay the exact amount (including transaction fees when paying on-chain).' d='Modules.Btcpay.Front'}</p>
|
||||
<hr class="mb-1"/>
|
||||
<p class="mb-1"><strong>{l s='Supported payment methods' d='Modules.Btcpay.Front'}</strong>:</p>
|
||||
<dl>
|
||||
{foreach $offChain as $paymentMethod}
|
||||
<dt>{$paymentMethod.cryptoCode|escape:'htmlall':'UTF-8'} Lightning ⚡</dt>
|
||||
{/foreach}
|
||||
{foreach $onChain as $paymentMethod}
|
||||
<dt>{$paymentMethod.cryptoCode|escape:'htmlall':'UTF-8'} (On-Chain)</dt>
|
||||
{/foreach}
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user