lavaloon-eg / ksa_compliance

KSA Compliance App for KSA E-invoice
https://www.lavaloon.com/
GNU Affero General Public License v3.0
38 stars 34 forks source link

Can I integrate two companies with same Vat Registration Number and different seller name ? #105

Closed saud-2 closed 2 months ago

saud-2 commented 3 months ago

OK. This setup is going to run into a problem once you onboard the second company. Currently, the private key and certificate used to sign invoices are stored under sites/ in the format {vat_registration_number}.privkey and {vat_registration_number}.pem respectively. The private key is generated during onboarding (the onboard button) and the certificate is written when you retrieve the production CSID. So, the second company to onboard will overwrite the files for the first if they share the same VAT. Invoices generated for both companies will now use the signing information of the second company. ZATCA should reject the invoices for the first company because of an invalid signature. The reason this might work on frappe cloud (the scenario is not supported so is currently untested), is that it runs docker containers, and my understanding is that each site is going to get its own container. Assuming the containers don't share a volume mounted under sites/, each is going to get its own copy of the private key and certificate files. I stress that this is untested and may not work either.

@omarashrafsarhan Please open a work item to track enabling this scenario (different companies with same VAT) or different branches on the same company.

_Originally posted by @mhaggag in https://github.com/lavaloon-eg/ksa_compliance/issues/102#issuecomment-2313101315_

omarashrafsarhan commented 2 months ago

The primary identifier on Fatoora is the VAT registration number. You have the flexibility to onboard multiple servers under the same VAT registration number, or onboard multiple VAT registration numbers for a single server. However, while it is technically possible to onboard the same VAT registration number on the same server more than once, it is not a recommended practice.

I will now proceed to close this issue.

mhaggag commented 1 month ago

We've fixed this in 0.33.0 and now you can have multiple companies with the same VAT without the files interfering with each other. The generated files now use the ID of the ZATCA Business Settings