Codeunit 6149 Get Response Runner

E-Document Core, Microsoft.eServices.EDocument.Integration.Send

src/Apps/W1/EDocument/App/src/Integration/Send/GetResponseRunner.Codeunit.al82 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------// Copyright (c) Microsoft Corporation. All rights reserved.// Licensed under the MIT License. See License.txt in the project root for license information.// ------------------------------------------------------------------------------------------------namespace Microsoft.eServices.EDocument.Integration.Send;using Microsoft.eServices.EDocument;using Microsoft.eServices.EDocument.Integration;using Microsoft.eServices.EDocument.Integration.Interfaces;codeunit 6149 "Get Response Runner"{    Access = Internal;    InherentEntitlements = X;    InherentPermissions = X;    trigger OnRun()    begin        if GlobalEDocumentService."Service Integration V2" <> Enum::"Service Integration"::"No Integration" then begin            IDocumentSender := GlobalEDocumentService."Service Integration V2";            if IDocumentSender is IDocumentResponseHandler then                Result := (IDocumentSender as IDocumentResponseHandler).GetResponse(this.GlobalEDocument, this.GlobalEDocumentService, GlobalSendContext);            exit;        end;#if not CLEAN26#pragma warning disable AL0432        IEDocIntegration := this.GlobalEDocumentService."Service Integration";        Result := IEDocIntegration.GetResponse(this.GlobalEDocument, this.HttpRequestMessage, this.HttpResponseMessage);#pragma warning restore AL0432        LegacyHttpMessagesFilled := true;#endif    end;    procedure SetDocumentAndService(var EDocument: Record "E-Document"; var EDocumentService: Record "E-Document Service")    begin        this.GlobalEDocument.Copy(EDocument);        this.GlobalEDocumentService.Copy(EDocumentService);    end;    procedure SetContext(SendContext: Codeunit SendContext)    begin        this.GlobalSendContext := SendContext;    end;    procedure GetResponseResult(): Boolean    begin        exit(Result);    end;#if not CLEAN26    // Handles that http is set in case of failures    procedure GetContext(var SendContext: Codeunit SendContext);    begin        if not LegacyHttpMessagesFilled then            exit;        // Need to set this        this.GlobalSendContext.Http().SetHttpRequestMessage(this.HttpRequestMessage);        this.GlobalSendContext.Http().SetHttpResponseMessage(this.HttpResponseMessage);        SendContext := this.GlobalSendContext;    end;#endif    var        GlobalEDocument: Record "E-Document";        GlobalEDocumentService: Record "E-Document Service";        GlobalSendContext: Codeunit SendContext;#if not CLEAN26        HttpRequestMessage: HttpRequestMessage;        HttpResponseMessage: HttpResponseMessage;#pragma warning disable AL0432        IEDocIntegration: Interface "E-Document Integration";#pragma warning restore AL0432#endif        IDocumentSender: Interface IDocumentSender;        Result: Boolean;#if not CLEAN26        LegacyHttpMessagesFilled: Boolean;#endif}