Пример #1
0
        public async Task <ConfirmationResultResponse> BoxResult(TradeKey tradeKey, string apiJwtToken, IFidectusConfiguration fidectusConfiguration)
        {
            var tradeDataObject = await GetTradeAsync(tradeKey.TradeReference, tradeKey.TradeLeg, apiJwtToken);

            if (tradeDataObject is null)
            {
                return(new ConfirmationResultResponse());
            }

            var requestTokenResponse = await CreateAuthenticationTokenAsync(apiJwtToken, fidectusConfiguration);

            var companyId         = fidectusConfiguration.CompanyId();
            var boxResultResponse = await fidectusService.GetBoxResult(companyId, tradeDataObject.ConfirmationDocumentId(), requestTokenResponse, fidectusConfiguration);

            return(new ConfirmationResultResponse
            {
                Id = boxResultResponse.Id,
                DocumentId = boxResultResponse.BoxResult?.DocumentId,
                DocumentVersion = boxResultResponse.BoxResult?.DocumentVersion,
                DocumentType = boxResultResponse.BoxResult?.DocumentType,
                State = boxResultResponse.BoxResult?.State,
                Timestamp = boxResultResponse.BoxResult?.Timestamp,
                CounterpartyDocumentId = boxResultResponse.BoxResult?.Counterparty?.DocumentId,
                CounterpartyDocumentVersion = boxResultResponse.BoxResult?.Counterparty?.DocumentVersion
            });
        }
Пример #2
0
 private async Task <ConfirmationResponse> DeleteConfirmationAsync(TradeDataObject tradeDataObject, TradeConfirmation tradeConfirmation, string apiJwtToken, IFidectusConfiguration fidectusConfiguration)
 {
     try
     {
         return(await fidectusService.DeleteConfirmation(fidectusConfiguration.CompanyId(tradeConfirmation.SenderId),
                                                         tradeDataObject.ConfirmationDocumentId(), await CreateAuthenticationTokenAsync(apiJwtToken, fidectusConfiguration), fidectusConfiguration));
     }
     catch (Exception ex)
     {
         logger.LogError(ex, "{Message}", ex.Message);
         throw;
     }
 }
Пример #3
0
 private async Task <ConfirmationResponse> SendConfirmationAsync(string method, TradeConfirmation tradeConfirmation, string apiJwtToken, IFidectusConfiguration fidectusConfiguration)
 {
     try
     {
         return(await fidectusService.SendConfirmation(method, fidectusConfiguration.CompanyId(tradeConfirmation.SenderId),
                                                       new ConfirmationRequest { TradeConfirmation = tradeConfirmation },
                                                       await CreateAuthenticationTokenAsync(apiJwtToken, fidectusConfiguration), fidectusConfiguration));
     }
     catch (Exception ex)
     {
         logger.LogError(ex, "{Message}", ex.Message);
         throw;
     }
 }