Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 10 additions & 98 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,113 +31,25 @@ jobs:
with:
access_token: ${{ github.token }}

# A copy of InvoiceShelf's own workflow used to run here: `pint` from a
# vendor directory the module never installs, `php artisan test` and a
# `make dist` of InvoiceShelf.zip, none of which a module has. It is now the
# style check alone; release.yaml builds the module's zip.
php_syntax_errors:
name: 1️⃣ PHP Code Style errors
runs-on: ubuntu-latest
needs:
- kill_previous
steps:
- name: Set up PHP
- name: Set up PHP with Pint
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.4
tools: pint:1.29.0
coverage: none

- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
uses: ramsey/composer-install@v2

- name: Check source code for syntax errors
run: ./vendor/bin/pint --test

tests:
name: 2️⃣ PHP ${{ matrix.php-version }} Tests
needs:
- php_syntax_errors
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 8.2
- 8.3
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
coverage: xdebug
tools: pecl, composer

- name: Install Composer dependencies
uses: ramsey/composer-install@v2

- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install
run: npm install

- name: Compile Front-end
run: npm run build

- name: Apply tests ${{ matrix.php-version }}
run: php artisan test

createReleaseFile:
name: 3️⃣ Build / Upload - Release File
if: github.ref_type == 'tag'
needs:
- tests
runs-on: ubuntu-latest
env:
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: ${{ env.extensions }}
coverage: none

- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: --no-dev

- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install
run: npm install

- name: Compile Front-end
run: npm run build

- name: Build Dist
run: |
make clean dist

- name: Upload package
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ github.token }}
file: InvoiceShelf.zip
asset_name: InvoiceShelf.zip
tag: ${{ github.ref }}
overwrite: true
- name: Check code style
run: pint --test
17 changes: 12 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ jobs:
runs-on: [ubuntu-latest]

steps:
- name: Checkout InvoiceShelf
# The module is for InvoiceShelf 2.x and bundles host code from it, so it is
# built against the 2.x branch, not the default branch (3.x).
- name: Checkout InvoiceShelf 2.x
uses: actions/checkout@v4
with:
repository: InvoiceShelf/InvoiceShelf
ref: 2.x

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.4
extensions: bcmath, curl, dom, gd, imagick, json, libxml, mbstring, pcntl, pdo, pdo_mysql, zip
coverage: none

Expand All @@ -30,13 +33,17 @@ jobs:
with:
composer-options: --no-dev

- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24

- name: Install and build InvoiceShelf node dependencies
run: npm install && npm run build
# The module build resolves pinia, axios and host components from here.
- name: Install InvoiceShelf node dependencies
run: pnpm install --frozen-lockfile

- name: Checkout Payments module
uses: actions/checkout@v4
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.1.1](https://github.com/InvoiceShelf/module-payments/compare/v1.1.0...v1.1.1) (2026-09-24)


### Bug Fixes

* work on InvoiceShelf 2.3.0 and later: the store uses Pinia 3's `defineStore(id, options)` form and the host's HTTP client instead of the removed `window.axios`
* the module's stylesheet no longer breaks the app's layout on InvoiceShelf 2.3.0 and later (missing sidebar and header controls): it now sits in the app's Tailwind 4 `utilities` cascade layer instead of outside any layer
* build releases against InvoiceShelf's `2.x` branch with its toolchain (PHP 8.4, Node 24, pnpm)


### Documentation

* say the module is for InvoiceShelf 2.x only, add a compatibility table and the cache step after installing

## [1.1.0](https://github.com/rihards-simanovics/InvoiceShelf-payment-module/compare/v1.0.0...v1.1.0) (2024-09-30)


Expand Down
2 changes: 1 addition & 1 deletion Config/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
'name' => 'Payments'
'name' => 'Payments',
];
16 changes: 9 additions & 7 deletions Helpers/VersionHelper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Version Helper
*
Expand All @@ -8,11 +9,13 @@
* PHP version 8.1
*
* @category Helpers
* @package Modules\Payments\Helpers
*
* @author Rihards Simanovics <rihards.s@griffin-web.studio>
* @copyright 2024 Rihards Simanovics
* @license GNU GPLv3
*
* @version GIT: <git_id>
*
* @link https://invoiceshelf.com
*/

Expand All @@ -33,9 +36,8 @@ class VersionHelper
* This method checks the application version against a specified version using a comparison operator.
* It temporarily aliases the Setting class to access the version information.
*
* @param string $operator The comparison operator (e.g., '<', '>=').
* @param string $version The version to compare against.
*
* @param string $operator The comparison operator (e.g., '<', '>=').
* @param string $version The version to compare against.
* @return bool True if the comparison is valid, false otherwise.
*/
public static function checkAppVersion($operator, $version)
Expand All @@ -49,12 +51,12 @@ public static function checkAppVersion($operator, $version)
/**
* Alias old namespace classes to new ones if necessary.
*
* @param string $oldClass The old class name with namespace.
* @param string $newClass The new class name with namespace.
* @param string $oldClass The old class name with namespace.
* @param string $newClass The new class name with namespace.
*/
public static function aliasClass($newClass, $oldClass)
{
if (!class_exists($oldClass) && class_exists($newClass)) {
if (! class_exists($oldClass) && class_exists($newClass)) {
class_alias($newClass, $oldClass);
}
}
Expand Down
6 changes: 3 additions & 3 deletions Http/Controllers/ActivePaymentProvidersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use App\Models\Company;
use App\Models\PaymentMethod;
use Illuminate\Http\Request;
use Modules\Payments\Http\Resources\ActivePaymentProviderResource;
use Illuminate\Http\Response;
use Modules\Payments\Helpers\VersionHelper;
use Modules\Payments\Http\Resources\ActivePaymentProviderResource;

if (VersionHelper::checkAppVersion('<', '2.0.0')) {
VersionHelper::aliasClass('InvoiceShelf\Http\Controllers\Controller', 'App\Http\Controllers\Controller');
Expand All @@ -20,8 +21,7 @@ class ActivePaymentProvidersController extends Controller
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @return Response
*/
public function __invoke(Request $request, Company $company)
{
Expand Down
2 changes: 1 addition & 1 deletion Http/Controllers/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
use App\Models\Company;
use App\Models\Invoice;
use Illuminate\Http\Request;
use Modules\Payments\Services\PaymentProcessor;
use Modules\Payments\Helpers\VersionHelper;
use Modules\Payments\Services\PaymentProcessor;

if (VersionHelper::checkAppVersion('<', '2.0.0')) {
VersionHelper::aliasClass('InvoiceShelf\Http\Controllers\Controller', 'App\Http\Controllers\Controller');
Expand Down
4 changes: 2 additions & 2 deletions Http/Controllers/PaymentDriversController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Payments\Helpers\VersionHelper;

if (VersionHelper::checkAppVersion('<', '2.0.0')) {
Expand All @@ -15,8 +16,7 @@ class PaymentDriversController extends Controller
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @return Response
*/
public function __invoke(Request $request)
{
Expand Down
4 changes: 2 additions & 2 deletions Http/Controllers/PaymentPdfController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\Payment;
use App\Models\Transaction;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Payments\Helpers\VersionHelper;

if (VersionHelper::checkAppVersion('<', '2.0.0')) {
Expand All @@ -19,8 +20,7 @@ class PaymentPdfController extends Controller
/**
* Handle the incoming request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @return Response
*/
public function __invoke(Transaction $transaction, Request $request)
{
Expand Down
17 changes: 9 additions & 8 deletions Http/Controllers/PaymentProvidersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
use App\Http\Controllers\Controller;
use App\Models\PaymentMethod;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Payments\Helpers\VersionHelper;
use Modules\Payments\Http\Requests\PaymentMethodRequest;
use Modules\Payments\Http\Resources\PaymentProviderResource;
use Modules\Payments\Traits\AuthorizationTrait;
use Modules\Payments\Helpers\VersionHelper;

if (VersionHelper::checkAppVersion('<', '2.0.0')) {
VersionHelper::aliasClass('InvoiceShelf\Http\Controllers\Controller', 'App\Http\Controllers\Controller');
Expand All @@ -22,7 +23,7 @@ class PaymentProvidersController extends Controller
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
* @return Response
*/
public function index(Request $request)
{
Expand All @@ -42,8 +43,8 @@ public function index(Request $request)
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param Request $request
* @return Response
*/
public function store(PaymentMethodRequest $request)
{
Expand All @@ -65,7 +66,7 @@ public function store(PaymentMethodRequest $request)
* Display the specified resource.
*
* @param \InvoiceShelf\Models\PaymentMethod $paymentMethod
* @return \Illuminate\Http\Response
* @return Response
*/
public function show(PaymentMethod $paymentProvider)
{
Expand All @@ -77,9 +78,9 @@ public function show(PaymentMethod $paymentProvider)
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param Request $request
* @param \InvoiceShelf\Models\PaymentMethod $paymentMethod
* @return \Illuminate\Http\Response
* @return Response
*/
public function update(PaymentMethodRequest $request, PaymentMethod $paymentProvider)
{
Expand All @@ -101,7 +102,7 @@ public function update(PaymentMethodRequest $request, PaymentMethod $paymentProv
* Remove the specified resource from storage.
*
* @param \InvoiceShelf\Models\PaymentMethod $paymentMethod
* @return \Illuminate\Http\Response
* @return Response
*/
public function destroy(PaymentMethod $paymentProvider)
{
Expand Down
10 changes: 5 additions & 5 deletions Http/Requests/PaymentMethodRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ public function rules()
->where('company_id', $this->header('company')),
],
'driver' => [
'required'
'required',
],
'active' => [
'required',
'boolean'
'boolean',
],
'use_test_env' => [
'required',
'boolean'
'boolean',
],
'settings' => [
'required'
'required',
],
'settings.*' => [
'required'
'required',
],
];

Expand Down
Loading
Loading