278 lines
11 KiB
VB.net
278 lines
11 KiB
VB.net
|
||
|
||
Public Class GlobalVATRefundApplication_HR
|
||
|
||
Public Property Applicant As Applicant_
|
||
Public Property Representative As Representative_
|
||
Public Property RefundPeriod As RefundPeriod_
|
||
Public Property BankAccount As BankAccount_
|
||
Public Property RefundRequest As RefundRequest_
|
||
Public Property BusinessDescription As BusinessDescription_
|
||
|
||
Public Function ToXml() As Chilkat.Xml
|
||
|
||
Dim xml As New Chilkat.Xml
|
||
|
||
' =========================================================
|
||
' 🔥 CRITICAL FIX: Encoding exakt wie Portal erwartet
|
||
' =========================================================
|
||
xml.Encoding = "UTF-8"
|
||
xml.EmitBom = False
|
||
|
||
' =========================================================
|
||
' ROOT (NICHT ÄNDERN – entspricht funktionierendem XML)
|
||
' =========================================================
|
||
xml.Tag = "p:GlobalVATRefundApplication"
|
||
|
||
xml.AddAttribute("xsi:type", "p:GlobalVATRefundApplication")
|
||
xml.AddAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
|
||
xml.AddAttribute("xmlns:p", "http://VATRefund/")
|
||
|
||
' ---------------------------
|
||
' Applicant
|
||
' ---------------------------
|
||
xml.UpdateChildContent("applicant|nameType", Applicant.NameType)
|
||
xml.UpdateChildContent("applicant|nameFree", Applicant.NameFree)
|
||
xml.UpdateChildContent("applicant|addressFree", Applicant.AddressFree)
|
||
xml.UpdateChildContent("applicant|telephone", Applicant.Telephone)
|
||
|
||
xml.UpdateChildContent("applicant|country|countryISOCode", Applicant.CountryISOCode)
|
||
xml.UpdateChildContent("applicant|country|memberStatePreferences|countryMSCode", Applicant.CountryISOCode)
|
||
|
||
xml.UpdateChildContent("applicant|identification|VATId", Applicant.VATId)
|
||
xml.UpdateChildContent("applicant|identification|identificationCountry|countryISOCode", Applicant.CountryISOCode)
|
||
xml.UpdateChildContent("applicant|identification|identificationCountry|memberStatePreferences|countryMSCode", Applicant.CountryISOCode)
|
||
|
||
xml.UpdateChildContent("applicant|email", Applicant.Email)
|
||
|
||
' ---------------------------
|
||
' Representative
|
||
' ---------------------------
|
||
xml.UpdateChildContent("representative|nameFree", Representative.Name)
|
||
xml.UpdateChildContent("representative|addressFree", Representative.Address)
|
||
xml.UpdateChildContent("representative|telephone", Representative.Telephone)
|
||
|
||
xml.UpdateChildContent("representative|country|countryISOCode", Representative.CountryISOCode)
|
||
|
||
xml.UpdateChildContent("representative|identification|identificationType", Representative.IdentificationType)
|
||
xml.UpdateChildContent("representative|identification|identificationNumber", Representative.IdentificationNumber)
|
||
xml.UpdateChildContent("representative|identification|identificationCountry|countryISOCode", Representative.CountryISOCode)
|
||
|
||
xml.UpdateChildContent("representative|email", Representative.Email)
|
||
|
||
' ---------------------------
|
||
' RefundPeriod
|
||
' ---------------------------
|
||
xml.UpdateChildContent("refundPeriod|fromDate", RefundPeriod.FromDate)
|
||
xml.UpdateChildContent("refundPeriod|toDate", RefundPeriod.ToDate)
|
||
|
||
' ---------------------------
|
||
' BusinessDescription
|
||
' ---------------------------
|
||
xml.UpdateChildContent("businessDescription|businessActivity|code", BusinessDescription.code.ToString())
|
||
xml.UpdateChildContent("businessDescription|businessActivity|names|name", BusinessDescription.name)
|
||
|
||
' ---------------------------
|
||
' BankAccount
|
||
' ---------------------------
|
||
xml.UpdateChildContent("defaultBankAccount|IBAN", BankAccount.IBAN)
|
||
xml.UpdateChildContent("defaultBankAccount|BIC", BankAccount.BIC)
|
||
xml.UpdateChildContent("defaultBankAccount|ownerName", BankAccount.OwnerName)
|
||
xml.UpdateChildContent("defaultBankAccount|details|ownerType", BankAccount.OwnerType)
|
||
xml.UpdateChildContent("defaultBankAccount|details|currency|currencyISO", BankAccount.CurrencyISO)
|
||
|
||
' ---------------------------
|
||
' Version
|
||
' ---------------------------
|
||
xml.UpdateChildContent("version",
|
||
DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"))
|
||
|
||
' ---------------------------
|
||
' RefundRequest
|
||
' ---------------------------
|
||
xml.UpdateChildContent("refundRequest|refundMemberState|countryISOCode",
|
||
RefundRequest.RefundMemberState)
|
||
|
||
For i As Integer = 0 To RefundRequest.PurchaseInformation.Count - 1
|
||
|
||
Dim p = RefundRequest.PurchaseInformation(i)
|
||
Dim path = $"refundRequest|purchaseInformation[{i}]"
|
||
|
||
xml.UpdateChildContent(path & "|sequence", p.Sequence.ToString())
|
||
xml.UpdateChildContent(path & "|simplifiedInvoice", p.SimplifiedInvoice.ToString().ToLower())
|
||
xml.UpdateChildContent(path & "|referenceNumber", p.ReferenceNumber)
|
||
xml.UpdateChildContent(path & "|issuingDate", p.IssuingDate)
|
||
|
||
xml.UpdateChildContent(path & "|transactionDescription|taxableAmount|amount",
|
||
p.TransactionDescription.TaxableAmount.Amount.ToString(Globalization.CultureInfo.InvariantCulture))
|
||
|
||
xml.UpdateChildContent(path & "|transactionDescription|taxableAmount|currency|currencyISO",
|
||
p.TransactionDescription.TaxableAmount.CurrencyISO)
|
||
|
||
xml.UpdateChildContent(path & "|transactionDescription|VATAmount|amount",
|
||
p.TransactionDescription.VATAmount.Amount.ToString(Globalization.CultureInfo.InvariantCulture))
|
||
|
||
xml.UpdateChildContent(path & "|transactionDescription|VATAmount|currency|currencyISO",
|
||
p.TransactionDescription.VATAmount.CurrencyISO)
|
||
|
||
xml.UpdateChildContent(path & "|deduction|deductibleAmount|amount",
|
||
p.Deduction.DeductibleAmount.Amount.ToString(Globalization.CultureInfo.InvariantCulture))
|
||
|
||
xml.UpdateChildContent(path & "|deduction|deductibleAmount|currency|currencyISO",
|
||
p.Deduction.DeductibleAmount.CurrencyISO)
|
||
|
||
xml.UpdateChildContent(path & "|goodsDescription|code", p.GoodsDescription.Code)
|
||
|
||
If p.GoodsDescription.Subcode <> "" Then xml.UpdateChildContent(path & "|goodsDescription|subcode", p.GoodsDescription.Subcode)
|
||
|
||
xml.UpdateChildContent(path & "|EUSupplier|nameFree", p.EUSupplier.NameFree)
|
||
xml.UpdateChildContent(path & "|EUSupplier|addressFree", p.EUSupplier.AddressFree)
|
||
xml.UpdateChildContent(path & "|EUSupplier|country|countryISOCode", p.EUSupplier.CountryISOCode)
|
||
|
||
xml.UpdateChildContent(path & "|EUSupplier|identification|VATId", p.EUSupplier.VATId)
|
||
xml.UpdateChildContent(path & "|EUSupplier|identification|identificationCountry|countryISOCode", p.EUSupplier.CountryISOCode)
|
||
|
||
xml.UpdateChildContent(path & "|state", "N")
|
||
|
||
Next
|
||
|
||
' ---------------------------
|
||
' DocumentCopy
|
||
' ---------------------------
|
||
For i As Integer = 0 To RefundRequest.DocumentCopy.Count - 1
|
||
|
||
Dim d = RefundRequest.DocumentCopy(i)
|
||
Dim path = $"refundRequest|documentCopy[{i}]"
|
||
|
||
If d.FileName <> "" Then xml.UpdateChildContent(path & "|filename", d.FileName)
|
||
If d.FileType <> "" Then xml.UpdateChildContent(path & "|fileType", d.FileType.ToUpper()) ' optional safer
|
||
If d.Description <> "" Then xml.UpdateChildContent(path & "|description", d.Description)
|
||
|
||
' =========================================
|
||
' BASE64 FILE CONTENT (WICHTIG)
|
||
' =========================================
|
||
If d.Base64Content <> "" Then xml.UpdateChildContent(path & "|file", d.Base64Content)
|
||
'xml.UpdateChildContent(path & "|file|file", d.Base64Content)
|
||
|
||
Next
|
||
|
||
xml.UpdateChildContent("refundRequest|state", "N")
|
||
xml.UpdateChildContent("submittedLocale", "de")
|
||
|
||
Return xml
|
||
|
||
End Function
|
||
|
||
End Class
|
||
|
||
Public Class Applicant_
|
||
Public Property NameType As String
|
||
Public Property NameFree As String
|
||
Public Property AddressFree As String
|
||
Public Property Telephone As String
|
||
Public Property CountryISOCode As String
|
||
Public Property VATId As String
|
||
Public Property Email As String
|
||
End Class
|
||
|
||
Public Class Representative_
|
||
Public Property Name As String
|
||
Public Property Address As String
|
||
Public Property Telephone As String
|
||
Public Property CountryISOCode As String
|
||
Public Property IdentificationType As String
|
||
Public Property IdentificationNumber As String
|
||
Public Property Email As String
|
||
End Class
|
||
|
||
Public Class RefundPeriod_
|
||
Public Property FromDate As String
|
||
Public Property ToDate As String
|
||
End Class
|
||
|
||
Public Class BankAccount_
|
||
Public Property IBAN As String
|
||
Public Property BIC As String
|
||
Public Property OwnerName As String
|
||
Public Property OwnerType As String
|
||
Public Property CurrencyISO As String
|
||
End Class
|
||
|
||
Public Class Purchase_
|
||
|
||
Public Property Sequence As Integer
|
||
Public Property SimplifiedInvoice As Boolean
|
||
Public Property ReferenceNumber As String
|
||
Public Property IssuingDate As String
|
||
Public Property TransactionDescription As TransactionDescription_
|
||
Public Property Deduction As Deduction_
|
||
Public Property GoodsDescription As GoodsDescription_
|
||
Public Property EUSupplier As EUSupplier_
|
||
Public Property State As String = "N"
|
||
|
||
End Class
|
||
|
||
Public Class DocumentCopy_
|
||
|
||
Public Property FileType As String
|
||
Public Property FileName As String
|
||
Public Property Description As String
|
||
Public Property Base64Content As String
|
||
|
||
End Class
|
||
|
||
Public Class RefundRequest_
|
||
|
||
Public Property RefundMemberState As String
|
||
Public Property PurchaseInformation As New List(Of Purchase_)
|
||
Public Property DocumentCopy As New List(Of DocumentCopy_)
|
||
Public Property State As String = "N"
|
||
|
||
End Class
|
||
|
||
Public Class TransactionDescription_
|
||
|
||
Public Property TaxableAmount As MoneyAmount_
|
||
Public Property VATAmount As MoneyAmount_
|
||
|
||
End Class
|
||
|
||
Public Class Deduction_
|
||
|
||
Public Property DeductibleAmount As MoneyAmount_
|
||
|
||
End Class
|
||
|
||
Public Class MoneyAmount_
|
||
|
||
Public Property Amount As Decimal
|
||
Public Property CurrencyISO As String = "EUR"
|
||
|
||
End Class
|
||
|
||
Public Class GoodsDescription_
|
||
|
||
Public Property Code As String
|
||
|
||
Public Property Subcode As String
|
||
|
||
End Class
|
||
|
||
Public Class EUSupplier_
|
||
|
||
Public Property NameFree As String
|
||
Public Property AddressFree As String
|
||
Public Property CountryISOCode As String
|
||
Public Property VATId As String
|
||
|
||
End Class
|
||
|
||
Public Class BusinessDescription_
|
||
Public Property code As Integer
|
||
Public Property name As String
|
||
End Class
|
||
|
||
|
||
|
||
|