refactor: update tax category structure in invoice mappers and tests #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate Invoice with Fatoora | |
on: [push, pull_request] | |
jobs: | |
validate_invoice: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛠️ Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
extensions: mbstring, xml, ctype, json, curl, openssl | |
- name: Install Composer dependencies | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: Generator Invoice | |
run: | | |
cd examples | |
php GeneratorStandard_Invoice.php | |
php SigningInvoices.php | |
- name: ☕ Install OpenJDK 11.0.26 | |
run: | | |
sudo apt update | |
sudo apt install -y openjdk-11-jdk | |
java -version | |
- name: 📥 Download SDK | |
run: | | |
curl -o sdk.zip "https://latency.sa/zatca-einvoicing-sdk-Java-238-R3.3.9.zip" | |
ls -lah sdk.zip | |
- name: 📦 Extract SDK | |
run: | | |
unzip sdk.zip -d sdk | |
- name: ✅ Validate Invoice using Fatoora | |
run: | | |
cd sdk/zatca-einvoicing-sdk-Java-238-R3.3.9/ | |
SDK_CONFIG="${PWD}/Configuration/config.json" | |
export FATOORA_HOME="${PWD}" | |
export PATH=$PATH:$FATOORA_HOME/Apps/ | |
export FATOORA_HOME=${PWD}/Apps | |
export SDK_CONFIG=$SDK_CONFIG | |
cd Configuration | |
parentDir="$(dirname "$PWD")" | |
xsdPath=$(jq -r '.xsdPath' defaults.json) | |
xsdPathFileName="$(basename $xsdPath)" | |
enSchematron=$(jq -r '.enSchematron' defaults.json) | |
enSchematronFileName="$(basename $enSchematron)" | |
zatcaSchematron=$(jq -r '.zatcaSchematron' defaults.json) | |
zatcaSchematronFileName="$(basename $zatcaSchematron)" | |
certPath=$(jq -r '.certPath' defaults.json) | |
certPathFileName="$(basename $certPath)" | |
pkPath=$(jq -r '.privateKeyPath' defaults.json) | |
pkPathFileName="$(basename $pkPath)" | |
pihPath=$(jq -r '.pihPath' defaults.json) | |
pihPathFileName="$(basename $pihPath)" | |
usagePath=$(jq -r '.usagePathFile' defaults.json) | |
usagePathFileName="$(basename $usagePath)" | |
jq -n '{"xsdPath":$one, "enSchematron":$two, "zatcaSchematron":$thr,"certPath":$fou, "privateKeyPath":$fiv ,"pihPath":$six ,"inputPath":$sev,"usagePathFile":$eight}' \ | |
--arg one "${parentDir}/Data/Schemas/xsds/UBL2.1/xsd/maindoc/$xsdPathFileName" \ | |
--arg two "${parentDir}/Data/Rules/schematrons/$enSchematronFileName" \ | |
--arg thr "${parentDir}/Data/Rules/schematrons/$zatcaSchematronFileName" \ | |
--arg fou "${parentDir}/Data/Certificates/$certPathFileName" \ | |
--arg fiv "${parentDir}/Data/Certificates/$pkPathFileName" \ | |
--arg six "${parentDir}/Data/PIH/$pihPathFileName" \ | |
--arg sev "${parentDir}/Data/Input" \ | |
--arg eight "${parentDir}/Configuration/$usagePathFileName" >config.json | |
cd ../Apps | |
chmod +x fatoora | |
# ✅ Validate Invoice using Fatoora | |
fatoora -validate -invoice ../../../examples/output/GeneratorSimplified_Invoice_Signed.xml | |
fatoora -validate -invoice ../../../examples/output/GeneratorStandard_Invoice_Signed.xml | |