UK ENS
This commit is contained in:
@@ -1509,42 +1509,48 @@ Public Class cHMRC
|
||||
|
||||
|
||||
Shared Function getTOKEN(APPLICATION, Optional forceNewToken = False) As cHMRCToken
|
||||
|
||||
Dim TOKEN = New cHMRCToken(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA, APPLICATION)
|
||||
Dim appl = ""
|
||||
Dim HMRC_APPLICATION = "AVISO"
|
||||
Select Case APPLICATION
|
||||
Case "HELLOWORLD" '"EORI_CHECK"
|
||||
'appl = "write:import-control-system+read:import-control-system"
|
||||
appl = "applicationRestricted"
|
||||
HMRC_APPLICATION = "AVISO"
|
||||
Case "GVMS"
|
||||
appl = "write:goods-movement-system+read:pull-notifications"
|
||||
HMRC_APPLICATION = "AVISO"
|
||||
Case "VAT_CHECK" '"EORI_CHECK"
|
||||
appl = "read:vat write:vat"
|
||||
HMRC_APPLICATION = "AVISO"
|
||||
Case "ENS" '"EORI_CHECK"
|
||||
'appl = "write:import-control-system+read:import-control-system"
|
||||
appl = "write:import-control-system"
|
||||
HMRC_APPLICATION = "AVISO_ENS"
|
||||
Case "ENS_HELLOWORLD" '"EORI_CHECK"
|
||||
'appl = "write:import-control-system+read:import-control-system"
|
||||
appl = "hello"
|
||||
HMRC_APPLICATION = "AVISO_ENS"
|
||||
End Select
|
||||
Try
|
||||
Dim appl = ""
|
||||
Dim HMRC_APPLICATION = "AVISO"
|
||||
Select Case APPLICATION
|
||||
Case "HELLOWORLD" '"EORI_CHECK"
|
||||
'appl = "write:import-control-system+read:import-control-system"
|
||||
appl = "applicationRestricted"
|
||||
HMRC_APPLICATION = "AVISO"
|
||||
Case "GVMS"
|
||||
appl = "write:goods-movement-system+read:pull-notifications"
|
||||
HMRC_APPLICATION = "AVISO"
|
||||
Case "VAT_CHECK" '"EORI_CHECK"
|
||||
appl = "read:vat write:vat"
|
||||
HMRC_APPLICATION = "AVISO"
|
||||
Case "ENS" '"EORI_CHECK"
|
||||
'appl = "write:import-control-system+read:import-control-system"
|
||||
appl = "write:import-control-system"
|
||||
HMRC_APPLICATION = "AVISO_ENS"
|
||||
Case "ENS_HELLOWORLD" '"EORI_CHECK"
|
||||
'appl = "write:import-control-system+read:import-control-system"
|
||||
appl = "hello"
|
||||
HMRC_APPLICATION = "AVISO_ENS"
|
||||
End Select
|
||||
|
||||
|
||||
|
||||
If forceNewToken OrElse TOKEN.hasEntry = False OrElse TOKEN.token_BEARER_TOKEN Is Nothing OrElse TOKEN.token_BEARER_TOKEN = "" Then
|
||||
Dim AccessToken = ""
|
||||
grantAccess(AccessToken, appl, HMRC_APPLICATION)
|
||||
TOKEN.token_Application = APPLICATION
|
||||
TOKEN.token_BEARER_TOKEN = AccessToken
|
||||
TOKEN.token_refresh_datetime = Now
|
||||
TOKEN.SAVE()
|
||||
Else
|
||||
HMRC_RefreshToken(TOKEN, HMRC_APPLICATION)
|
||||
End If
|
||||
If forceNewToken OrElse TOKEN.hasEntry = False OrElse TOKEN.token_BEARER_TOKEN Is Nothing OrElse TOKEN.token_BEARER_TOKEN = "" Then
|
||||
Dim AccessToken = ""
|
||||
grantAccess(AccessToken, appl, HMRC_APPLICATION)
|
||||
TOKEN.token_Application = APPLICATION
|
||||
TOKEN.token_BEARER_TOKEN = AccessToken
|
||||
TOKEN.token_refresh_datetime = Now
|
||||
TOKEN.SAVE()
|
||||
Else
|
||||
HMRC_RefreshToken(TOKEN, HMRC_APPLICATION)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Return TOKEN
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user