This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl><resources><resource id="Magento_Backend::admin">
<resource id="Magento_Customer::customer">
<resource id="Esun_CustomerVat::applications" title="VAT Number Applications" sortOrder="80">
<resource id="Esun_CustomerVat::review" title="Review VAT Applications" sortOrder="10"/>
</resource>
</resource>
</resource></resources></acl>
</config>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Esun_CustomerVat::applications" title="VAT Number Applications"
module="Esun_CustomerVat" sortOrder="80" parent="Magento_Customer::customer"
action="esun_customer_vat/application/index" resource="Esun_CustomerVat::applications"/>
</menu>
</config>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="esun_customer_vat" frontName="esun_customer_vat">
<module name="Esun_CustomerVat" before="Magento_Backend"/>
</route>
</router>
</config>
@@ -0,0 +1,51 @@
<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="esun_customer_vat" resource="default" engine="innodb" comment="eSUN Customer VAT Applications">
<column xsi:type="int" name="entity_id" unsigned="true" nullable="false" identity="true" comment="Entity ID"/>
<column xsi:type="int" name="customer_id" unsigned="true" nullable="false" comment="Customer ID"/>
<column xsi:type="varchar" name="company_name" nullable="false" length="255" comment="Company Name"/>
<column xsi:type="varchar" name="country_id" nullable="false" length="2" comment="VAT Country"/>
<column xsi:type="varchar" name="vat_number" nullable="false" length="64" comment="VAT Number"/>
<column xsi:type="varchar" name="normalized_vat_number" nullable="false" length="64" comment="Normalized VAT Number"/>
<column xsi:type="varchar" name="status" nullable="false" length="16" default="pending" comment="Review Status"/>
<column xsi:type="text" name="review_note" nullable="true" comment="Review Note"/>
<column xsi:type="int" name="reviewed_by" unsigned="true" nullable="true" comment="Admin User ID"/>
<column xsi:type="timestamp" name="reviewed_at" on_update="false" nullable="true" comment="Reviewed At"/>
<column xsi:type="timestamp" name="created_at" on_update="false" nullable="false" default="CURRENT_TIMESTAMP" comment="Created At"/>
<column xsi:type="timestamp" name="updated_at" on_update="true" nullable="false" default="CURRENT_TIMESTAMP" comment="Updated At"/>
<constraint xsi:type="primary" referenceId="PRIMARY"><column name="entity_id"/></constraint>
<constraint xsi:type="foreign" referenceId="ESUN_CUSTOMER_VAT_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID"
table="esun_customer_vat" column="customer_id" referenceTable="customer_entity"
referenceColumn="entity_id" onDelete="CASCADE"/>
<constraint xsi:type="unique" referenceId="ESUN_CUSTOMER_VAT_CUSTOMER_COUNTRY_NUMBER">
<column name="customer_id"/><column name="country_id"/><column name="normalized_vat_number"/>
</constraint>
<index referenceId="ESUN_CUSTOMER_VAT_CUSTOMER_STATUS_COUNTRY" indexType="btree">
<column name="customer_id"/><column name="status"/><column name="country_id"/>
</index>
<index referenceId="ESUN_CUSTOMER_VAT_STATUS_CREATED" indexType="btree">
<column name="status"/><column name="created_at"/>
</index>
</table>
<table name="quote" resource="checkout">
<column xsi:type="int" name="esun_vat_id" unsigned="true" nullable="true" comment="Matched VAT Application ID"/>
<column xsi:type="varchar" name="esun_vat_number" nullable="true" length="64" comment="VAT Number Snapshot"/>
<column xsi:type="varchar" name="esun_vat_country_id" nullable="true" length="2" comment="VAT Country Snapshot"/>
<column xsi:type="varchar" name="esun_vat_company_name" nullable="true" length="255" comment="VAT Company Snapshot"/>
<column xsi:type="smallint" name="esun_vat_exempt" unsigned="true" nullable="false" default="0" comment="VAT Exempt"/>
<column xsi:type="decimal" name="esun_nominal_tax_rate" scale="4" precision="12" nullable="false" default="0" comment="Nominal Tax Rate"/>
<column xsi:type="varchar" name="esun_tax_mode" nullable="false" length="32" default="" comment="Tax Mode"/>
</table>
<table name="sales_order" resource="sales">
<column xsi:type="int" name="esun_vat_id" unsigned="true" nullable="true" comment="Matched VAT Application ID"/>
<column xsi:type="varchar" name="esun_vat_number" nullable="true" length="64" comment="VAT Number Snapshot"/>
<column xsi:type="varchar" name="esun_vat_country_id" nullable="true" length="2" comment="VAT Country Snapshot"/>
<column xsi:type="varchar" name="esun_vat_company_name" nullable="true" length="255" comment="VAT Company Snapshot"/>
<column xsi:type="smallint" name="esun_vat_exempt" unsigned="true" nullable="false" default="0" comment="VAT Exempt"/>
<column xsi:type="decimal" name="esun_nominal_tax_rate" scale="4" precision="12" nullable="false" default="0" comment="Nominal Tax Rate"/>
<column xsi:type="varchar" name="esun_tax_mode" nullable="false" length="32" default="" comment="Tax Mode"/>
</table>
</schema>
@@ -0,0 +1,49 @@
{
"esun_customer_vat": {
"column": {
"entity_id": true,
"customer_id": true,
"company_name": true,
"country_id": true,
"vat_number": true,
"normalized_vat_number": true,
"status": true,
"review_note": true,
"reviewed_by": true,
"reviewed_at": true,
"created_at": true,
"updated_at": true
},
"index": {
"ESUN_CUSTOMER_VAT_CUSTOMER_ID_STATUS_COUNTRY_ID": true,
"ESUN_CUSTOMER_VAT_STATUS_CREATED_AT": true
},
"constraint": {
"PRIMARY": true,
"ESUN_CUSTOMER_VAT_CUSTOMER_ID_CUSTOMER_ENTITY_ENTITY_ID": true,
"ESUN_CUSTOMER_VAT_CUSTOMER_ID_COUNTRY_ID_NORMALIZED_VAT_NUMBER": true
}
},
"quote": {
"column": {
"esun_vat_id": true,
"esun_vat_number": true,
"esun_vat_country_id": true,
"esun_vat_company_name": true,
"esun_vat_exempt": true,
"esun_nominal_tax_rate": true,
"esun_tax_mode": true
}
},
"sales_order": {
"column": {
"esun_vat_id": true,
"esun_vat_number": true,
"esun_vat_country_id": true,
"esun_vat_company_name": true,
"esun_vat_exempt": true,
"esun_nominal_tax_rate": true,
"esun_tax_mode": true
}
}
}
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
<arguments><argument name="collections" xsi:type="array">
<item name="esun_customer_vat_listing_data_source" xsi:type="string">EsunCustomerVatGridCollection</item>
</argument></arguments>
</type>
<virtualType name="EsunCustomerVatGridCollection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
<arguments>
<argument name="mainTable" xsi:type="string">esun_customer_vat</argument>
<argument name="resourceModel" xsi:type="string">Esun\CustomerVat\Model\ResourceModel\VatApplication</argument>
</arguments>
</virtualType>
</config>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="sales_quote_collect_totals_before">
<observer name="esun_customer_vat_update_quote_context"
instance="Esun\CustomerVat\Observer\UpdateQuoteVatContext"/>
</event>
<event name="sales_model_service_quote_submit_before">
<observer name="esun_customer_vat_copy_context_to_order"
instance="Esun\CustomerVat\Observer\CopyVatContextToOrder"/>
</event>
</config>
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Checkout\CustomerData\Cart">
<plugin name="esun_customer_vat_cart_prompt"
type="Esun\CustomerVat\Plugin\CustomerData\CartVatPromptPlugin" sortOrder="50"/>
</type>
</config>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="esun_customer_vat" frontName="esun_customer_vat">
<module name="Esun_CustomerVat"/>
</route>
</router>
</config>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Esun_CustomerVat">
<sequence>
<module name="Esun_Customer"/>
<module name="Esun_Cart"/>
<module name="Magento_Tax"/>
<module name="Magento_Sales"/>
</sequence>
</module>
</config>