Closed HazemFCIH closed 2 years ago
please refer to this issue, actually it is not an issue, it is a fix regarding your problem https://github.com/bassemAgmi/EInvoicingSigner/issues/12#issue-1140665447
@socertis So what you mean is to bulid a new run time version with this fix and use it?
@HazemFCIH it means that you need to integrate the code into the function that serializes JSON, which can be found on this line https://github.com/bassemAgmi/EInvoicingSigner/blob/7d3acb6105f8ca72e62b7e2fa5eca21cb483cc4c/EInvoicingSigner/Signer.cs#L197
I have done it and it worked perfectly on my code, you can take a look https://github.com/Optomatica/EInvoicingSigner/blob/7ed606e3cf018fc6ca7fe9e5b012275a890fe536/EInvoicingSigner/Signer.cs#L209
and of course, you need to build the code and produce a new exe
after you apply the changes.
anyway, it has been integrated into the code, earlier today. this is the merged pull request https://github.com/bassemAgmi/EInvoicingSigner/pull/13
@socertis still not working and it gives the same error can you take a look at this json strcture and tell me if i am doing something wrong.
{"issuer":{"type":"B","id":"113317713","name":"Issuer Company","address":{"branchID":"0","country":"EG","governate":"القاهرة","regionCity":"مصر الجديدة","street":"street name","buildingNumber":"1"}},"receiver":{"type":"B","id":"113317712","name":"Reciver Company","address":{"country":"EG","governate":"Heliopolis","regionCity":"Cairo","street":"Street name","buildingNumber":"1"}},"documentType":"i","documentTypeVersion":"1.0","dateTimeIssued":"2022-05-19T10:35:26Z","taxpayerActivityCode":"1111","internalID":"IS-2022-S0192","invoiceLines":[{"description":"Meeting room","itemType":"EGS","itemCode":"EG-113317713-205","unitType":"HUR","unitValue":{"currencySold":"EGP","amountEGP":66.88},"quantity":5,"salesTotal":334.4,"total":381.22,"valueDifference":0,"totalTaxableFees":0,"taxableItems":[{"taxType":"T1","amount":46.82,"rate":14,"subType":"V009"}],"netTotal":334.4,"itemsDiscount":0,"internalCode":"205"}],"totalSalesAmount":334.4,"totalDiscountAmount":0,"netAmount":334.4,"taxTotals":[{"taxType":"T1","amount":46.82}],"extraDiscountAmount":0,"totalItemsDiscountAmount":0,"totalAmount":381.22}
Thank you in advance.
@socertis
@HazemFCIH I have tried this json and it produced a signature. I think that you mean error 403 from the preportal...
Am I understood it right, or there is something else?
@socertis yes but the error is 4043
@HazemFCIH do you use E-signature or E-Seal?
i Solved it !! i Have been stuck in this error for 2 months please send your number so we can discuss how you can solve it too
@HazemFCIH
@bassemAgmi @abouelkheir-ai please publish the solution, so the issue will be closed afterwards and for the people to know about it.....
1- استخدم ختم الكتروني و ليش توقيع الكتروني 2-ويندوز 10 و ما اعلي 3-استخدم serialization code الموجود علي موقع الضرائب
لو لسه في حد عنده مشكله يا ريت يقول
@abouelkheir-ai ممكن تفاصيل اكتر؟ اعرف ازاي انا بستخدم ختم ولا توقيع الكتروني؟ انا بستخدم ال token دي و دي نفس ال token اللي المحاسب بيختم بيها الفواتير علي ال portal انا بستخدم windows 10. قصدك ايه بال serialization code ؟ هل قصدك ده
@HazemFCIH do you use E-signature or E-Seal?
@socertis Can you tell me what is the difference? I am using this token
In the token, the certificate name is Egypt Trust Sealing CA. I am not sure if this information answers your question.
الاتنين نفس الشكل حضرتك ممكن تكلم egytrust او ممكن تقولي حضرتك بتدفع اشتراك كام و انا اقولك دا ختم ولا توقيع وفي طريقه تانيه تعرف دا ختم ولا توقيع لما لو توقيع حيبان اسم الموقع في البورتال شخص انما لو ختم حيبان ان اسمع الموقع كيان اسم شركه او مصنع.... التوقيع يشتغل في رفع علي البورتال عادي لكن ميشتغلش علي نظام erp
function string Serialize(documentStructure)
if documentStructure is simple value type
return """ + documentStructure.value + """
end if
var serializedString = ""
foreach element in the structure:
if element is not array type
serializeString.Append (""" + element.name.uppercase + """)
serializeString.Append ( Serialize(element.value) )
end if
if element is of array type
serializeString.Append (""" + element.name.uppercase + """)
foreach array element in element:
// use below line for JSON because subelements of array in JSON do not have own names
serializeString.Append (""" + element.name.uppercase + """)
serializeString.Append ( Serialize(arrayelement.value) )
end foreach
end if
end foreach
return serializedString
end function
Dear @abouelkheir-ai, We have the same error. Your code is not in C#. Which part of the code in Signer.cs needs to be revised in order to get the runtime version correctly running and avoid the 4043 error. Thanks a lot.
حضرتك ممكن تكلم egytrust او ممكن تقولي حضرتك بتدفع اشتراك كام و انا اقولك دا ختم ولا توقيع وفي طريقه تانيه تعرف دا ختم ولا توقيع لما لو توقيع حيبان اسم الموقع في البورتال شخص انما لو ختم حيبان ان اسمع الموقع كيان اسم شركه او مصنع.... التوقيع يشتغل في رفع علي البورتال عادي لكن ميشتغلش علي نظام e @abouelkheir-ai دافعين 2500 اشتراك سنتين + 500 token واسم الشركة اللي علي ال profile
@hedeya1980 check CanonicalizeITIDA code and cms.options and please show me your json
@HazemFCIH
دا ختم كده حضرتك يبقي مشكلتك في طريقه رفع ال json
1- بتعمل Canonicalize لل json من غير document
لو في امكانيه للتوصال معاك اسهل من كده يا ريت علشان اقدر اساعدك @hedeya1980 @HazemFCIH
@abouelkheir-ai Thanks for your fast response. Could you pls provide me with links to CanonicalizeITIDA code and cms.options? This is my mobile number 01227399522. Also, this is my email address: hedeya1980@gmail.com
there is no link for that you should do your CanonicalizeITIDA code
@abouelkheir-ai Thanks a lot for your help. After communicating with you through WhatsApp, and based on your advice to remove null values from the json file, I replaced all null values with "" and the problem has been solved. Thanks a lot. Really appreciated.
@abouelkheir-ai رقمي: 01018907806 ال email: hazem.fcih12@gmail.com
Dear @hedeya1980 Code Serialize By C#.
public string Serialize(JObject request)
{
return SerializeToken(request);
}
private static string SerializeToken(JToken request)
{
var serialized = "";
if (request.Parent is null)
SerializeToken(request.First);
else
{
switch (request.Type)
{
case JTokenType.Property:
{
var name = ((JProperty) request).Name.ToUpper();
serialized += "\"" + name + "\"";
foreach (var property in request)
{
switch (property.Type)
{
case JTokenType.Array:
foreach (var item in property.Children())
{
serialized += "\"" + ((JProperty) request).Name.ToUpper() + "\"";
serialized += SerializeToken(item);
}
break;
case JTokenType.String:
serialized += JsonConvert.ToString(property.Value<string>());
break;
case JTokenType.Object:
serialized += SerializeToken(property);
break;
case JTokenType.Boolean:
case JTokenType.Integer:
case JTokenType.Float:
case JTokenType.Date:
serialized += "\"" + property.Value<string>() + "\"";
break;
}
}
break;
}
// Added to fix "References"
case JTokenType.String:
serialized += JsonConvert.ToString(request.Value<string>());
break;
}
}
switch (request.Type)
{
case JTokenType.Object:
{
foreach (var property in request.Children())
if (property.Type == JTokenType.Object || property.Type == JTokenType.Property)
serialized += SerializeToken(property);
break;
}
}
return serialized;
}
Thanks to @abouelkheir-ai it's working. The problem was that I was manually adding the Signature to the JSON structure before sending the request, but after reading it with code, it worked. also thank you for helping @socertis .
Thanks a lot @MohamedUltimate
I receive a 4043 error when submitting an invoice via the preprod portal. I am using PHP Laravel to structure and submit the invoice. When I send it using version 0.9, the invoice is successfully submitted. So I am 100% sure that the JSON structure is valid, but when I flow the steps and generate the signature from the runtime version and submit the document to the preprod portal, I receive this error.