Skip to content

Commit

Permalink
Merge pull request #4 from vdhicts/feature/laravel-11
Browse files Browse the repository at this point in the history
Add support for Laravel 11
  • Loading branch information
dvdheiden authored Mar 17, 2024
2 parents 09ca99e + 31b29f8 commit 4251de9
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 45 deletions.
58 changes: 33 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
name: WeFact API Client
name: Tests

on: [push]

jobs:
wefact-api-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress

- name: Execute tests (Unit and Feature tests) via PHPUnit
run: |
vendor/bin/phpunit
- name: Execute static analysis
run: |
vendor/bin/phpstan
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']

name: PHP ${{ matrix.php-versions }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress

- name: Execute tests (Unit and Feature tests) via PHPUnit
run: |
vendor/bin/phpunit
- name: Execute static analysis
run: |
vendor/bin/phpstan
- name: Execute lint check
run: |
vendor/bin/pint --test
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). Please note this changelog affects this package and not the
WeFact API. See the changelog of the [WeFact API](https://www.wefact.nl/api/changelog/) for detailed information.

## [4.0.0]

### Added

- Add support for Laravel 11.
- Add pint for code style.

### Removed

- Drop support for PHP versions lower than 8.1

## [3.0.0]

### Changed
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Easy WeFact API client

## Requirements

This package requires at least PHP 7.4.
This package requires at least PHP 8.1.

## Installation

Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@
}
],
"require": {
"php": "^7.4|^8.0",
"php": "^8.1",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.0",
"illuminate/http": "^8.0|^9.0|^10.0",
"illuminate/support": "^8.0|^9.0|^10.0"
"illuminate/http": "^8.0|^9.0|^10.0|^11.0",
"illuminate/support": "^8.0|^9.0|^10.0|^11.0"
},
"require-dev": {
"laravel/pint": "^1.14",
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^9.0"
"phpunit/phpunit": "^9.0|^10.0"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"preset": "laravel",
"rules": {
"array_indentation": false,
"phpdoc_align": false
}
}
5 changes: 4 additions & 1 deletion src/Contracts/RequestContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
interface RequestContract
{
public function getController(): string;

public function getAction(): string;

public function getParams(): array;

public function getRequestData(): array;
}
}
15 changes: 14 additions & 1 deletion src/Enums/WeFactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@
class WeFactController
{
public const ATTACHMENT = 'attachment';

public const CREDITOR = 'creditor';

public const DEBTOR = 'debtor';

public const EXTRA_CLIENT_CONTACT = 'extraclientcontact';

public const GROUP = 'group';

public const INVOICE = 'invoice';

public const INVOICE_LINE = 'invoiceline';

public const PRICE_QUOTE = 'pricequote';

public const PRICE_QUOTE_LINE = 'pricequoteline';

public const PRODUCT = 'product';

public const PURCHASE_INVOICE = 'creditinvoice';

public const PURCHASE_INVOICE_LINE = 'creditinvoiceline';

public const SETTINGS = 'settings';

public const SUBSCRIPTION = 'subscription';
}
}
38 changes: 37 additions & 1 deletion src/Enums/WeFactCurrency.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,76 @@
class WeFactCurrency
{
public const ANG = 'ANG';

public const AED = 'AED';

public const AUD = 'AUD';

public const AWG = 'AWG';

public const BGN = 'BGN';

public const BRL = 'BRL';

public const CAD = 'CAD';

public const CHF = 'CHF';

public const CNY = 'CNY';

public const CZK = 'CZK';

public const DKK = 'DKK';

public const EUR = 'EUR';

public const GBP = 'GBP';

public const HKD = 'HKD';

public const HRK = 'HRK';

public const HUF = 'HUF';

public const ILS = 'ILS';

public const INR = 'INR';

public const ISK = 'ISK';

public const JPY = 'JPY';

public const MAD = 'MAD';

public const MXN = 'MXN';

public const MYR = 'MYR';

public const NOK = 'NOK';

public const NZD = 'NZD';

public const PHP = 'PHP';

public const PLN = 'PLN';

public const QAR = 'QAR';

public const RON = 'RON';

public const RUB = 'RUB';

public const SEK = 'SEK';

public const SGD = 'SGD';

public const THB = 'THB';

public const TRY = 'TRY';

public const TWD = 'TWD';

public const USD = 'USD';

public const ZAR = 'ZAR';
}
}
7 changes: 6 additions & 1 deletion src/Enums/WeFactInvoiceStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
class WeFactInvoiceStatus
{
public const CONCEPT = 0;

public const SENT = 2;

public const PARTIALLY_PAYED = 3;

public const PAYED = 4;

public const CREDIT_INVOICE = 8;

public const EXPIRED = 9;
}
}
11 changes: 10 additions & 1 deletion src/Enums/WeFactPaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@
class WeFactPaymentMethod
{
public const ACCOUNTING = 'accounting';

public const CASH = 'cash';

public const CARD = 'card';

public const DIRECT_DEBIT = 'auth';

public const IDEAL = 'ideal';

public const OTHER = 'other';

public const PAYPAL = 'paypal';

public const QR_CODE = 'qrcode';

public const VARIOUS = 'various';

public const WIRE = 'wire';
}
}
9 changes: 8 additions & 1 deletion src/Enums/WeFactPeriodic.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
class WeFactPeriodic
{
public const NO_PERIOD = '';

public const DAY = 'd';

public const WEEK = 'w';

public const MONTH = 'm';

public const QUATER = 'k';

public const HALF_YEAR = 'h';

public const YEAR = 'j';

public const TWO_YEARs = 't';
}
}
6 changes: 5 additions & 1 deletion src/Enums/WeFactPriceQuoteStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
class WeFactPriceQuoteStatus
{
public const CONCEPT = 0;

public const SENT = 2;

public const ACCEPTED = 3;

public const BILLED = 4;

public const DECLINED = 8;
}
}
4 changes: 3 additions & 1 deletion src/Enums/WeFactPurchaseInvoiceStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
class WeFactPurchaseInvoiceStatus
{
public const NOT_PAYED = 1;

public const PAYED = 3;

public const CREDIT_INVOICE = 8;
}
}
4 changes: 3 additions & 1 deletion src/Enums/WeFactSendMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
class WeFactSendMethod
{
public const EMAIL = 0;

public const POST = 1;

public const BOTH = 3;
}
}
3 changes: 2 additions & 1 deletion src/Enums/WeFactSubscriptionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
class WeFactSubscriptionStatus
{
public const ACTIVE = 'active';

public const TERMINATED = 'terminated';
}
}
9 changes: 6 additions & 3 deletions src/WeFact.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
class WeFact extends Factory
{
private const API_URL = 'https://api.mijnwefact.nl/v2/';

private const TIMEOUT = 180;
private const VERSION = '2.0.0';
private const USER_AGENT = 'vdhicts-wefact-api-client/' . self::VERSION;

private const VERSION = '4.0.0';

private const USER_AGENT = 'vdhicts-wefact-api-client/'.self::VERSION;

private string $apiKey;

Expand Down Expand Up @@ -40,4 +43,4 @@ protected function newPendingRequest(): PendingRequest
->timeout(self::TIMEOUT)
->withUserAgent(self::USER_AGENT);
}
}
}
4 changes: 3 additions & 1 deletion src/WeFactRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
class WeFactRequest implements RequestContract
{
private string $controller;

private string $action;

private array $params;

public function __construct(string $controller, string $action, array $params = [])
Expand Down Expand Up @@ -42,4 +44,4 @@ public function getRequestData(): array
$this->params
);
}
}
}
2 changes: 1 addition & 1 deletion tests/Unit/WeFactRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public function testRequest(): void
$this->assertSame($action, $request->getAction());
$this->assertCount(1, $request->getParams());
}
}
}

0 comments on commit 4251de9

Please sign in to comment.