OBJECT XMLport 50138 Vitacard Request Token Req { OBJECT-PROPERTIES { Date=10.06.22; Time=[ 8:11:19]; Modified=Yes; Version List=#18#ZPW; } PROPERTIES { CaptionML=[CSY=Vitacard § dost token Req; ENU=Vitacard Request Token Req]; OnPostXMLport=VAR ThirdPartySWSession@70000 : Record 70106; ThirdPartySWSession2@70006 : Record 70106; ThirdPartySWIdentity@70001 : Record 70031; ThirdPartySWType@70003 : Record 70030; VitacardSetup@70005 : Record 50060; VitacardManagement@70004 : Codeunit 50139; SessionTicket@70002 : GUID; BEGIN VitacardSetup.GET; ThirdPartySWType.SETCURRENTKEY(Type); ThirdPartySWType.SETRANGE(Type,ThirdPartySWType.Type::Vitacard); ThirdPartySWType.FINDFIRST; ThirdPartySWIdentity.SETCURRENTKEY("SW Identifier","SW Type","Valid From","Valid To"); ThirdPartySWIdentity.SETRANGE("SW Type",ThirdPartySWType.Code); ThirdPartySWIdentity.SETRANGE("SW Identifier",SWIdentifier); ThirdPartySWIdentity.SETFILTER("Valid From",'%1|<=%2',0DT,CREATEDATETIME(TODAY,235959T)); ThirdPartySWIdentity.SETFILTER("Valid To",'%1|>=%2',0DT,CREATEDATETIME(TODAY,000000T)); IF NOT ThirdPartySWIdentity.FINDFIRST THEN ERROR(ThirdPartySWIdentityErr,SWIdentifier); // Zjist¡me zda pro id prihlaseni uz neni nejake platn‚ prihlaseni (mobil… m…§e pýidat v¡ce, ty ukonŸit nesm¡me) IF typZarizeni <> 'MOB' THEN BEGIN ThirdPartySWSession.SETCURRENTKEY("SW Type Code","Identity No.","Ticket ID"); ThirdPartySWSession.SETRANGE("SW Type Code",ThirdPartySWType.Code); ThirdPartySWSession.SETRANGE("Identity No.",ThirdPartySWIdentity."Entry No."); ThirdPartySWSession.SETFILTER("Ticket Expiry Date",'%1|<=%2',0DT,CURRENTDATETIME); ThirdPartySWSession.SETFILTER("Ticket Expiry Date",'%1|>=%2',0DT,CURRENTDATETIME); ThirdPartySWSession.SETRANGE("Ticket ID",idPrihlaseni); IF NOT ThirdPartySWSession.ISEMPTY THEN ThirdPartySWSession.MODIFYALL("Ticket Expiry Date",CURRENTDATETIME); END ELSE BEGIN // Pokud se sna§¡ pýidat stejn‚ mobiln¡ zaýizen¡, starç¡ ukonŸ¡me ThirdPartySWSession.SETCURRENTKEY("SW Type Code","Ticket Type","Identity No.","Client Device ID"); ThirdPartySWSession.SETRANGE("SW Type Code",ThirdPartySWType.Code); ThirdPartySWSession.SETRANGE("Ticket Type",ThirdPartySWSession."Ticket Type"::"Long-term"); ThirdPartySWSession.SETRANGE("Identity No.",ThirdPartySWIdentity."Entry No."); ThirdPartySWSession.SETFILTER("Ticket Expiry Date",'%1|<=%2',0DT,CURRENTDATETIME); ThirdPartySWSession.SETFILTER("Ticket Expiry Date",'%1|>=%2',0DT,CURRENTDATETIME); ThirdPartySWSession.SETRANGE("Client Device ID",idInstalace); IF NOT ThirdPartySWSession.ISEMPTY THEN ThirdPartySWSession.MODIFYALL("Ticket Expiry Date",CURRENTDATETIME); END; // Zaregistrujeme pýihl çen¡ ThirdPartySWSession."Entry No." := 0; ThirdPartySWSession."SW Type Code" := ThirdPartySWIdentity."SW Type"; ThirdPartySWSession."Identity No." := ThirdPartySWIdentity."Entry No."; CASE typZarizeni OF 'WEB': BEGIN ThirdPartySWSession."Ticket Type" := ThirdPartySWSession."Ticket Type"::Standard; ThirdPartySWSession."Ticket Expiry Date" := CREATEDATETIME(CALCDATE(VitacardSetup."Ticket Expiry Period",TODAY),TIME); END; 'MOB': BEGIN ThirdPartySWSession."Ticket Type" := ThirdPartySWSession."Ticket Type"::"Long-term"; ThirdPartySWSession."Ticket Expiry Date" := CREATEDATETIME(CALCDATE(VitacardSetup."Long Ticket Expiry Period",TODAY),TIME); END; ELSE BEGIN ThirdPartySWSession."Ticket Type" := ThirdPartySWSession."Ticket Type"::Standard; ThirdPartySWSession."Ticket Expiry Date" := CREATEDATETIME(CALCDATE(VitacardSetup."Ticket Expiry Period",TODAY),TIME); END; END; ThirdPartySWSession."Session Ticket" := DELCHR(DELCHR(FORMAT(CREATEGUID),'=','{'),'=','}'); ThirdPartySWSession."Client Type" := typZarizeni; ThirdPartySWSession."Client Browser Type" := platforma; ThirdPartySWSession."Client Version" := verzeAplikace; ThirdPartySWSession."Ticket ID" := idPrihlaseni; ThirdPartySWSession."Client Device ID" := idInstalace; ThirdPartySWSession.INSERT(TRUE); ThirdPartySWSession2.SETCURRENTKEY("Entry No.","Client Device ID"); ThirdPartySWSession2.SETFILTER("Entry No.",'<>%1',ThirdPartySWSession."Entry No."); ThirdPartySWSession2.SETRANGE("Client Device ID",idInstalace); IF ThirdPartySWSession2.FINDLAST THEN BEGIN ThirdPartySWSession.Name := ThirdPartySWSession2.Name; IF ThirdPartySWSession.Name = '' THEN ThirdPartySWSession.Name := NameNotSpecifiedTxt; ThirdPartySWSession.MODIFY(TRUE); END; EVALUATE(SessionTicket,ThirdPartySWSession."Session Ticket"); CreateResponseData(SessionTicket,ThirdPartySWSession."Ticket Expiry Date"); // Zalogujeme tuto akci VitacardManagement.LoggingActions(XMLPORT::"Vitacard Request Token Req",ThirdPartySWIdentity.Login,''); END; } ELEMENTS { { [{AD479EED-5F78-4092-912D-8AB0B5EC9678}]; ;Parameters ;Element ;Text } { [{2AEAB378-6739-4010-B833-CAD0732CF987}];1 ;uzivatel ;Element ;Text ; Import::OnAfterAssignVariable=BEGIN SWIdentifier := uzivatel; END; } { [{B9C47C4A-BA9C-4D0B-8F20-FB2F6AEC625E}];1 ;idPrihlaseni ;Element ;Text } { [{5BE161B8-A268-4F1F-A3DE-09C6E614C8F0}];1 ;TokenDInfo ;Element ;Text ; MinOccurs=Zero } { [{8D8F5A11-87EE-4698-A3B0-97B21F9A292F}];2 ;auditInfo ;Element ;Text ; MinOccurs=Zero } { [{6A57A673-0FBB-4C12-98B9-F2F12BAEE0E5}];3 ;verzeOS ;Element ;Text ; MinOccurs=Zero } { [{BCFCC365-1D94-4CFD-95DC-9214D1DB019D}];3 ;verzeAplikace ;Element ;Text ; MinOccurs=Zero } { [{43E4DEA4-8D75-45BE-8684-D72E1CE31E57}];3 ;verzeBrowseru ;Element ;Text ; MinOccurs=Zero } { [{7FFAF47C-AADF-4C3E-9B83-C265FAC0198D}];3 ;gps ;Element ;Text ; MinOccurs=Zero } { [{E314CDF6-05F8-4B6A-8DE5-CD029E27D98A}];3 ;karta ;Element ;Text ; MinOccurs=Zero } { [{CB8C420E-77CD-4973-9D0D-B8EACCC18490}];3 ;rozliseni ;Element ;Text ; MinOccurs=Zero } { [{3D7AA899-1FBD-4D66-9819-198035885B10}];3 ;typZarizeni ;Element ;Text ; MinOccurs=Zero } { [{87944C20-5C08-48EF-976D-396F32E389B0}];3 ;platforma ;Element ;Text ; MinOccurs=Zero } { [{18235452-DCEB-42E4-9FE8-B138443FAB93}];2 ;idInstalace ;Element ;Text ; MinOccurs=Zero } } EVENTS { } REQUESTPAGE { PROPERTIES { } CONTROLS { } } CODE { VAR GlobalParameter@70002 : Codeunit 62007; SWIdentifier@70003 : Text; ResponseErr@70005 : TextConst 'CSY=Pýi pokusu o zpracov n¡ odpovØdi, doçlo k n sleduj¡c¡ chybØ: %1.;ENU=When trying to process a response, the following error occurred:%1.'; ThirdPartySWIdentityErr@70001 : TextConst 'CSY=Neexistuje platn  identita pro u§ivatele %1.;ENU=There is no valid identity for user %1.'; ThirdPartySWSessionErr@70000 : TextConst 'CSY=Nen¡ § dn‚ platn‚ pýihl çen¡ s Id pr¡hl çen¡ %1.;ENU=There are no valid entries with Login Id% 1.'; NameNotSpecifiedTxt@70004 : TextConst 'CSY=N zev neuveden;ENU=Name not specified'; LOCAL PROCEDURE CreateResponseData@70000(SessionTicket@70004 : GUID;ExpirationDateTime@70006 : DateTime); VAR TempBlob@70001 : TEMPORARY Record 99008535; VitacardRequestTokenRes@70002 : XMLport 50139; DataXml@70000 : DotNet "'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Xml.XmlDocument"; OutStream@70003 : OutStream; ResponseErr@70005 : TextConst 'CSY=Pýi pokusu o zpracov n¡ odpovØdi, doçlo k n sleduj¡c¡ chybØ: %1.;ENU=When trying to process a response, the following error occurred:%1.'; BEGIN // Create response message DataXml := DataXml.XmlDocument; // Create response BLOB CLEAR(TempBlob); CLEARLASTERROR; TempBlob.Blob.CREATEOUTSTREAM(OutStream); VitacardRequestTokenRes.SETDESTINATION(OutStream); VitacardRequestTokenRes.SetSessionTicket(SessionTicket,ExpirationDateTime); IF NOT VitacardRequestTokenRes.EXPORT THEN BEGIN GlobalParameter.SetVitaCardErrorText(STRSUBSTNO(ResponseErr,GETLASTERRORTEXT)); END ELSE GlobalParameter.SetVitaCardResponseBlob(TempBlob); END; BEGIN { #DOCU ZPW653.38847:JAKRIB:27.06.19:NEWOBJECT JAKRIB:31.08.21: #DOCU } END. } }