Esempio n. 1
0
        public async Task <SendRevenueResult> SendRevenueAsync(RevenueRecord record, EetMode mode = EetMode.Operational)
        {
            Logger?.Info($"Sending revenue record for bill '{record.BillNumber}' to EET servers in {mode} mode.", new { RecordIdentifier = record.Identifier });

            var xmlMessage = new SendRevenueMessage(record, mode).GetXmlMessage();

            Logger?.Debug("DTOs for XML mapping were created.", xmlMessage);

            var sendRevenueResult = await EetSoapClient.SendRevenueAsync(xmlMessage);

            Logger?.Debug("Result received and successfully deserialized from XML DTOs.", sendRevenueResult);

            var result = new SendRevenueResult(sendRevenueResult);

            if (result.IsError)
            {
                Logger?.Info($"Got error response from EET servers for bill '{record.BillNumber}'.", result);
            }
            else
            {
                Logger?.Info($"Got success response from EET servers for bill '{record.BillNumber}'. FIK: '{result.Success.FiscalCode}'.", result);
            }

            return(result);
        }
Esempio n. 2
0
        public async Task <SendRevenueResult> SendRevenueAsync(RevenueRecord record, EetMode mode = EetMode.Operational)
        {
            Logger?.Info($"Sending bill {record.BillNumber} to EET servers in {mode} mode.");

            var xmlMessage        = new SendRevenueMessage(record, mode).GetXmlMessage();
            var sendRevenueResult = await EetSoapClient.SendRevenueAsync(xmlMessage).ConfigureAwait(continueOnCapturedContext: false);

            var result = new SendRevenueResult(sendRevenueResult);

            if (result.IsError)
            {
                Logger?.Info($"Got error response from EET servers for bill {record.BillNumber}.");
            }
            else
            {
                Logger?.Info($"Got success response from EET servers for bill {record.BillNumber}.");
            }

            return(result);
        }