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

This file was deleted.

38 changes: 1 addition & 37 deletions Modules/Clients/Models/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
use Modules\Core\Models\User;
use Modules\Core\Traits\BelongsToCompany;
use Modules\Expenses\Models\Expense;
use Modules\Invoices\Enums\PeppolValidationStatus;
use Modules\Invoices\Models\CustomerPeppolValidationHistory;
use Modules\Invoices\Models\Invoice;
use Modules\Payments\Models\Payment;
use Modules\Projects\Models\Project;
Expand All @@ -39,12 +37,8 @@
* @property string|null $coc_number
* @property string|null $vat_number
* @property string|null $peppol_id
* @property string|null $peppol_scheme
* @property string|null $peppol_format
* @property bool $enable_e_invoicing
* @property PeppolValidationStatus|null $peppol_validation_status
* @property string|null $peppol_validation_message
* @property Carbon|null $peppol_validated_at
* @property Carbon $registered_at
* @property mixed $created_at
* @property mixed $updated_at
Expand Down Expand Up @@ -74,8 +68,6 @@ class Relation extends Model
'relation_type' => RelationType::class,
'relation_status' => RelationStatus::class,
'enable_e_invoicing' => 'boolean',
'peppol_validation_status' => PeppolValidationStatus::class,
'peppol_validated_at' => 'datetime',
];

protected $guarded = [];
Expand Down Expand Up @@ -169,26 +161,11 @@ public function tasks(): HasMany
return $this->hasMany(Task::class, 'customer_id');
}

/**
* Define a one-to-many relationship to User models.
*
* @return HasMany The has-many relationship for User models.
*/
public function users(): HasMany
{
return $this->hasMany(User::class);
}

/**
* Get the Peppol validation history records for this relation.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany Collection of CustomerPeppolValidationHistory models related by `customer_id`.
*/
public function peppolValidationHistory(): HasMany
{
return $this->hasMany(CustomerPeppolValidationHistory::class, 'customer_id');
}

/*
|--------------------------------------------------------------------------
| Accessors
Expand All @@ -203,19 +180,6 @@ public function getCustomerEmailAttribute()
{
return mb_trim($this->primary_ontact?->first_name . ' ' . $this->primary_contact?->last_name);
}*/

/**
* Determines whether the relation's Peppol ID has been validated and e-invoicing is enabled.
*
* @return bool `true` if e-invoicing is enabled, the Peppol validation status is `PeppolValidationStatus::VALID`, and `peppol_id` is not null; `false` otherwise.
*/
public function hasPeppolIdValidated(): bool
{
return $this->enable_e_invoicing
&& $this->peppol_validation_status === PeppolValidationStatus::VALID
&& $this->peppol_id !== null;
}

/*
|--------------------------------------------------------------------------
| Scopes
Expand All @@ -237,4 +201,4 @@ protected static function newFactory(): Factory
| Subqueries
|--------------------------------------------------------------------------
*/
}
}
77 changes: 2 additions & 75 deletions Modules/Invoices/Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,81 +153,8 @@
'enable_webhooks' => env('PEPPOL_ENABLE_WEBHOOKS', false),
'enable_participant_search' => env('PEPPOL_ENABLE_PARTICIPANT_SEARCH', true),
'enable_health_checks' => env('PEPPOL_ENABLE_HEALTH_CHECKS', true),
'auto_retry_failed' => env('PEPPOL_AUTO_RETRY', true),
'max_retries' => env('PEPPOL_MAX_RETRIES', 5),
],

/*
|--------------------------------------------------------------------------
| Country to Scheme Mapping
|--------------------------------------------------------------------------
|
| Mapping of country codes to default Peppol endpoint schemes.
| Used for auto-suggesting the appropriate scheme when onboarding customers.
|
*/
'country_scheme_mapping' => [
'BE' => 'BE:CBE',
'DE' => 'DE:VAT',
'FR' => 'FR:SIRENE',
'IT' => 'IT:VAT',
'ES' => 'ES:VAT',
'NL' => 'NL:KVK',
'NO' => 'NO:ORGNR',
'DK' => 'DK:CVR',
'SE' => 'SE:ORGNR',
'FI' => 'FI:OVT',
'AT' => 'AT:VAT',
'CH' => 'CH:UIDB',
'GB' => 'GB:COH',
],

/*
|--------------------------------------------------------------------------
| Retry Policy
|--------------------------------------------------------------------------
|
| Configuration for automatic retries of failed transmissions.
| Uses exponential backoff strategy.
|
*/
'retry' => [
'max_attempts' => env('PEPPOL_MAX_RETRY_ATTEMPTS', 5),
'backoff_delays' => [60, 300, 1800, 7200, 21600], // 1min, 5min, 30min, 2h, 6h
'retry_transient_errors' => true,
'retry_unknown_errors' => true,
'retry_permanent_errors' => false,
],

/*
|--------------------------------------------------------------------------
| Storage Configuration
|--------------------------------------------------------------------------
|
| Configuration for storing Peppol artifacts (XML, PDF).
|
*/
'storage' => [
'disk' => env('PEPPOL_STORAGE_DISK', 'local'),
'path_template' => 'peppol/{integration_id}/{year}/{month}/{transmission_id}',
'retention_days' => env('PEPPOL_RETENTION_DAYS', 2555), // 7 years default
],

/*
|--------------------------------------------------------------------------
| Monitoring & Alerting
|--------------------------------------------------------------------------
|
| Thresholds and settings for monitoring Peppol operations.
|
*/
'monitoring' => [
'alert_on_dead_transmission' => true,
'dead_transmission_threshold' => 10, // Alert if > 10 dead in 1 hour
'alert_on_auth_failure' => true,
'status_check_interval' => 15, // minutes
'reconciliation_interval' => 60, // minutes
'old_transmission_threshold' => 168, // hours (7 days)
'auto_retry_failed' => env('PEPPOL_AUTO_RETRY', false),
'max_retries' => env('PEPPOL_MAX_RETRIES', 3),
],
],
];
40 changes: 0 additions & 40 deletions Modules/Invoices/Console/Commands/PollPeppolStatusCommand.php

This file was deleted.

This file was deleted.

53 changes: 0 additions & 53 deletions Modules/Invoices/Console/Commands/TestPeppolIntegrationCommand.php

This file was deleted.

This file was deleted.

Loading