0% found this document useful (0 votes)
155 views4 pages

E-Invoice Technical Document Details: Java Classes 1-Response

The document describes Java classes and OAF code used to integrate an e-invoicing solution with Zatca. It includes classes for parsing responses, converting XML to base64, generating hashes, and extracting QR codes. Database objects like packages, tables, views, sequences and triggers are used to generate XML invoices, store transaction data, and process responses. Application profiles and functions were added to identify the Zatca instance and whitelist the URL for invoice clearance requests.

Uploaded by

mfarzadk123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views4 pages

E-Invoice Technical Document Details: Java Classes 1-Response

The document describes Java classes and OAF code used to integrate an e-invoicing solution with Zatca. It includes classes for parsing responses, converting XML to base64, generating hashes, and extracting QR codes. Database objects like packages, tables, views, sequences and triggers are used to generate XML invoices, store transaction data, and process responses. Application profiles and functions were added to identify the Zatca instance and whitelist the URL for invoice clearance requests.

Uploaded by

mfarzadk123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

E-Invoice Technical Document Details

Java Classes
1- Response
a. Use to Read Response from Zatca
b. ParseResponse Function used to read the response from Zatca and save that information in the
table.

2- ParseJson
a. Use to Parse each response from Zatca
b. Parse Function Use to get the Value from Response of Specific Json Column Type.
c. ParseJsonArray Function Use to get Array of Values from Response of Specific Array of Type.
d. ParseJsonObject Function Use to get the JsonObject from Response.

3- ConvertBase64
a. Use to Convert XML File into Base64 Format.
b. getXMLString Function Extract XML from Table and Convert into Base64 and Update Base64
Column in Table.
c. getInvoiceHash Function read CLOB Data and Return Base64Hash String.
d. getString Function Convert CLOB data into String.
e. Format Function Take String from getString Function and Serialize and Format in UTF-8.
f. parseXmlFile Function use to Parse XML in Proper Format
g. Convert Formatted String into Byte Array.
h. Convert Byte Array into Base64 String Using DatatypeConverter.printBase64Binary

4- GenerateInvoiceHash (Database Java Class)


a. Convert Hash XML into Base64 Hash.
b. getInvoiceHash Function Take CLOB Parameter and return its hash value in String.
c. getString Function Convert CLOB data into String.
d. Format Function Take String from getString Function and Serialize and Format in UTF-8.
e. parseXmlFile Function use to Parse XML in Proper Format
f. hashStringToBytes Function Convert Formatted XML String into HEX Value.
g. Convert Formatted String into Byte Array.
h. Convert Byte Array into Base64 String Using DatatypeConverter.printBase64Binary
i. Create Function in Database for this Java Class (GenerateInvoiceHash)

5- GetQRCode (Database Java Class).


a. Extract QR Code Tag from Zatca XML Response.
b. getInvoiceQR Function Extract QR Code from CLOB XML Document.
c. getString Function Convert CLOB data into String.
d. Format Function Take String from getString Function and Serialize and Format in UTF-8.
e. parseXmlFile Function use to Parse XML in Proper Format
f. XPATH Class is used to Extract QR Code Tag from XML.
g. Create Function in Database for this Java Class (GenerateQrCode)
OAF Code and Classes.
1- All Zatca Classes and Pages Located at
$JAVA_TOP/aec/oracle/apps/pos/Zatca
1- Pages
ZatcaPG (Main Page for Zatca Invoice Screen)
CommentsRN (Region for Last Zatca Response)

AllErrorsRN (Region for All Error Details for that Transction).

2- Controllers

ZatcaPGCO (Used to send that to Zatca and get response).

3- Application AM

EINVAMImpl (Function Generate_Xml_Data Call Database Package to Generate XML).

2- We use some external Classes for signature, Hashing and Json Located at
$JAVA_TOP/org
Database Package
1- AEC_ZATCA_B2B_PKG
a. Crt_Inv_UBL_XML_Body Use to Generate Record for Invoice.
i. Generate Invoice Hash XML (HASH_XML_BODY_GENERATION).
ii. CRT_INV_UBL_XML_BODY (Generate XML Invoice).
iii. genrate_uuid (Generate UUID for XML).
iv. GET_XML_INFORMATION (Use to Get Previous Invoice Hash and Invoice Number
Reference in case of Credit Note).
v. Crt_Signature_Hash_Update (Use to Update Signature Hash in the Table and Original
XML).
Database Tables
1- AEC_ZATCA_B2B_UBL_SETUP
Use to Have All Information for Connection Certificate and its different Components.
2- AEC_ZATCA_B2B_UBL_XML_TEMP
Use to Have XML Template Structure to Be Joined and Updated when creating original XML and
Hash XML.
3- AEC_ZATCA_B2B_UBL_LK_VALUES
Use to Have Queries for Each Attribute Values in XML.
4- AEC_ZATCA_B2B_REQUESTS.
Use to Have Invoice Information, XML, Hash and Response from Zatca for each transactions.
Database Views
1- ZATCA_INVOICE_INFO_AEC
View Used in the Page to Show all invoice Results Processed or Errors.

Database Sequence
1- AEC_ZATCA_B2B_SEQ

Used to Generate Request Id for Each Sending Request.

Database Trigger
1- AEC_ZATCA_B2B_REQUESTS_TRG

Trigger on AEC_ZATCA_B2B_REQUESTS Table once Processed Flag is “Y” Means Zatca Response Cleared

then Run Create Accounting for that Invoice.

New Application Profiles:


To Identify Which Link to be Used for Zatca.

1- AEC Zatca Instance Name


Set PROD at Site Level

Set DEV at Application Developer Responsibility

2- ZATCA Clearance URL


Set “https://mobileapp.aecl.com/ExternalRequest/api/Zacat/PRODInvoicesClearanceSingle” at Site Level.

Set “https://mobileapp.aecl.com/ExternalRequest/api/Zacat/InvoicesClearanceSingle” at Application Developer


Responsibility.

New Application Function.


1- AEC_ZATCA_AEC
URL https:\\mobileapp.aecl.com should be whitelist at Prod1 Instance.

a. White List the mobileapp Server:


Make sure FND_ZATCA_URL profile value set to correct URL.
Backup $FND_TOP/secure/allowed_redirects.conf
Add the below line under “Server level profiles (site or server level)” section in
$FND_TOP/secure/allowed_redirects.conf
profile FND_ZATCA_URL # URL for Zatca
Synchronize conf from Run to Patch FS.
Restart Apache and oacore services.

b. Create the new profile:

c. Set the profile to map it to Mobileapp.aecl.com server:

d. Update the /etc/hosts file as following:

You might also like