Adds VAT handling for Twingle Shop products #4

Closed
marc.koch wants to merge 0 commits from implement_taxes into ProPeaceBranch
Owner

This PR introduces VAT handling for Twingle Shop products, aligning with CiviCRM's financial accounting practices. It ensures that product prices are correctly stored as net amounts and that VAT is calculated and recorded separately based on configured financial types.

Key changes include:

  • VAT Field & Price Conversion:
    • A vat_rate field is added to Twingle products to store the associated VAT percentage.
    • Product data processing now converts gross prices received from Twingle into net prices for storage in CiviCRM. The included VAT is automatically split off based on the sales tax rate of the line item's financial type, ensuring accurate financial recording.
  • Line Item and Financial Item Creation:
    • The process for creating line items and their corresponding financial items has been enhanced to correctly account for VAT, even for contributions with a 'Pending' status.
  • Outdated Product Detection:
    • A system status check is introduced to identify existing Twingle products whose price fields still contain gross prices (created before VAT handling was implemented). This prompts users to update these products to reflect net prices and VAT rates.
  • Schema Management Modernization:
    • The extension's schema management has been migrated to CiviCRM's Entity Framework v2, replacing legacy XML definitions with entityType.php files and utilizing the CiviMix\Schema library for robust installation and upgrades.
  • User Interface Enhancements:
    • Improved visual feedback for disabled buttons and clearer success messages in the Twingle Shop administration interface.
  • Documentation:
    • Comprehensive documentation is added, detailing the setup and configuration of VAT for Twingle Shop integration.
This PR introduces VAT handling for Twingle Shop products, aligning with CiviCRM's financial accounting practices. It ensures that product prices are correctly stored as net amounts and that VAT is calculated and recorded separately based on configured financial types. **Key changes include:** * **VAT Field & Price Conversion:** * A `vat_rate` field is added to Twingle products to store the associated VAT percentage. * Product data processing now converts gross prices received from Twingle into net prices for storage in CiviCRM. The included VAT is automatically split off based on the sales tax rate of the line item's financial type, ensuring accurate financial recording. * **Line Item and Financial Item Creation:** * The process for creating line items and their corresponding financial items has been enhanced to correctly account for VAT, even for contributions with a 'Pending' status. * **Outdated Product Detection:** * A system status check is introduced to identify existing Twingle products whose price fields still contain gross prices (created before VAT handling was implemented). This prompts users to update these products to reflect net prices and VAT rates. * **Schema Management Modernization:** * The extension's schema management has been migrated to CiviCRM's Entity Framework v2, replacing legacy XML definitions with `entityType.php` files and utilizing the `CiviMix\Schema` library for robust installation and upgrades. * **User Interface Enhancements:** * Improved visual feedback for disabled buttons and clearer success messages in the Twingle Shop administration interface. * **Documentation:** * Comprehensive documentation is added, detailing the setup and configuration of VAT for Twingle Shop integration.
Upgrade v23.02.01 => v25.10.2

Yes, update to Entity Framework v2

What kind of class-scanner should we use? [Standard scanner (scan-classes@1)]
Introducing VAT handling for products synced from Twingle and for orders processed through the Twingle Shop integration.

Key changes include:
*   **VAT Rate Storage**: A `vat_rate` field is added to `TwingleProduct` to store the VAT rate for each product.
*   **Net Price Calculation**: Prices received from Twingle (which include VAT) are now converted to net prices when stored in CiviCRM's `TwingleProduct` and corresponding `PriceField`s.
*   **Line Item Tax Splitting**: When processing orders, the extension correctly splits the included tax from Twingle's gross amounts for each line item, using the sales tax rate of the associated financial type. This ensures accurate recording of net revenue and tax amounts.
*   **Financial Item Creation**: Financial items for line items are now manually created after contribution creation (when `skipLineItem` is used) to ensure proper financial reconciliation.
*   **System Check**: A new system status check warns administrators about existing Twingle products created before VAT support that need to be updated.
*   **Documentation**: Comprehensive documentation has been added to guide users on configuring VAT for Twingle Shop products in CiviCRM.
* Ensure disabled Twingle Shop buttons are visually distinct by applying specific styles. This addresses cases where the CiviCRM theme might not provide default styling for disabled elements.
* Give product action buttons some spaceing.
Update translations
Some checks failed
PHP_CodeSniffer / PHP_CodeSniffer (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-stable (pull_request) Has been cancelled
7d737361d2
marc.koch force-pushed implement_taxes from 7d737361d2
Some checks failed
PHP_CodeSniffer / PHP_CodeSniffer (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-stable (pull_request) Has been cancelled
to 9d824da66f
Some checks failed
PHP_CodeSniffer / PHP_CodeSniffer (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-stable (pull_request) Has been cancelled
2026-10-24 12:42:35 +02:00
Compare
marc.koch force-pushed implement_taxes from 9d824da66f
Some checks failed
PHP_CodeSniffer / PHP_CodeSniffer (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-stable (pull_request) Has been cancelled
to 9a57316f7f
Some checks failed
PHP_CodeSniffer / PHP_CodeSniffer (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-stable (pull_request) Has been cancelled
2026-10-24 12:46:42 +02:00
Compare
marc.koch closed this pull request 2026-10-24 12:48:46 +02:00
Some checks failed
PHP_CodeSniffer / PHP_CodeSniffer (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPStan / PHPStan with PHP 8.4 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.1 prefer-stable (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-lowest (pull_request) Has been cancelled
PHPUnit / PHPUnit with PHP 8.4 prefer-stable (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ProPeace/de.systopia.twingle!4
No description provided.