Esempio n. 1
0
        public override (string, DeviceStatus) OpenReversalReceipt(
            ReversalReason reason,
            string receiptNumber,
            System.DateTime receiptDateTime,
            string fiscalMemorySerialNumber,
            string uniqueSaleNumber,
            string operatorId,
            string operatorPassword)
        {
            // Protocol: {OpCode}<SEP>{OpPwd}<SEP>{TillNmb}<SEP>{Storno}<SEP>{DocNum}<SEP>{DateTime}<SEP>
            //           {FM Number}<SEP>{Invoice}<SEP>{ToInvoice}<SEP>{Reason}<SEP>{NSale}<SEP>
            var headerData = string.Join("\t",
                                         String.IsNullOrEmpty(operatorId) ?
                                         Options.ValueOrDefault("Operator.ID", "1")
                    :
                                         operatorId,
                                         String.IsNullOrEmpty(operatorId) ?
                                         Options.ValueOrDefault("Operator.Password", "0000").WithMaxLength(Info.OperatorPasswordMaxLength)
                    :
                                         operatorPassword,
                                         "1",
                                         GetReversalReasonText(reason),
                                         receiptNumber,
                                         receiptDateTime.ToString("dd-MM-yy HH:mm:ss", CultureInfo.InvariantCulture),
                                         fiscalMemorySerialNumber,
                                         "",
                                         "",
                                         "",
                                         uniqueSaleNumber,
                                         "");

            return(Request(DatecsXCommandOpenStornoDocument, headerData.ToString()));
        }
Esempio n. 2
0
        public override (string, DeviceStatus) OpenReversalReceipt(
            ReversalReason reason,
            string receiptNumber,
            System.DateTime receiptDateTime,
            string fiscalMemorySerialNumber,
            string uniqueSaleNumber,
            string operatorId,
            string operatorPassword)
        {
            // Protocol: <OpNum>,<UNP>,<RevDocNo>[,<F1>[<F2><RevInvoiceNo>,<dd-mm-yy hh:mm:ss>,origDevDMNo]]
            var headerData = new StringBuilder()
                             .Append(
                String.IsNullOrEmpty(operatorId) ?
                Options.ValueOrDefault("Operator.ID", "1")
                        :
                operatorId
                )
                             .Append(',')
                             .Append(uniqueSaleNumber)
                             .Append(',')
                             .Append(receiptNumber)
                             .Append(',')
                             .Append(GetReversalReasonText(reason))
                             .Append(GetReversalReasonText(reason))
                             .Append('0')
                             .Append(',')
                             .Append(receiptDateTime.ToString("dd-MM-yy HH:mm:ss", CultureInfo.InvariantCulture))
                             .Append(',')
                             .Append(fiscalMemorySerialNumber);

            return(Request(CommandOpenFiscalReceipt, headerData.ToString()));
        }
        private void OnReversalCommand()
        {
            IsShowErrorMessage = false;
            try
            {
                TicketInfo = BaseAPI.reverseTicket(TicketInfo, ReversalReason.IsNull() ? string.Empty : ReversalReason);
                UpdateTicketInfoView();
                IsDisplayTicketInfo = true;
            }
            catch (Exception e)
            {
                Log.Fatal("В процессе сторнирования билета {0}, произошло исключение:\n{1}", TicketBarcode, e);

                ErrorMessage       = "Произошло исключение: {0}".F(e.Message);
                IsShowErrorMessage = true;
                return;
            }

            if (TicketInfo.RequestError)
            {
                Log.Error("В процессе сторнирования билета {0}, произошла ошибка: {1}", TicketBarcode,
                          TicketInfo.ErrorMessage);
            }
            else
            {
                ErrorMessage       = "Успешно!";
                IsShowErrorMessage = true;
                Log.Debug("Билет {0} успешно сторнирован!", TicketBarcode);
            }
        }
Esempio n. 4
0
        public override (string, DeviceStatus) OpenReversalReceipt(
            ReversalReason reason,
            string receiptNumber,
            System.DateTime receiptDateTime,
            string fiscalMemorySerialNumber,
            string uniqueSaleNumber,
            string operatorId,
            string operatorPassword)
        {
            // Protocol: <OperName>,<UNP>[,Type[ ,<FMIN>,<Reason>,<num>[,<time>[,<inv>]]]]
            var header = string.Join(",",
                                     new string[] {
                String.IsNullOrEmpty(operatorId) ?
                Options.ValueOrDefault("Operator.Name", "Operator")
                        :
                operatorId,
                uniqueSaleNumber,
                "S",
                fiscalMemorySerialNumber,
                GetReversalReasonText(reason),
                receiptNumber,
                receiptDateTime.ToString("yyyy-MM-ddTHH:mm:ss", CultureInfo.InvariantCulture)
            });

            return(Request(CommandOpenFiscalReceipt, header));
        }
        public override (string, DeviceStatus) OpenReversalReceipt(
            ReversalReason reason,
            string receiptNumber,
            System.DateTime receiptDateTime,
            string fiscalMemorySerialNumber,
            string uniqueSaleNumber,
            string operatorId,
            string operatorPassword)
        {
            // Protocol:<OpNum>,<Password>,<TillNum>[,<Invoice><InvNum>][,<UNP>],< StType >< DocNo >[,< StUNP >,< StDT >,< StFMIN >][#<StornoReason>]
            var header = string.Join(",",
                                     new string[] {
                String.IsNullOrEmpty(operatorId) ?
                Options.ValueOrDefault("Operator.ID", "1")
                        :
                operatorId,
                String.IsNullOrEmpty(operatorId) ?
                Options.ValueOrDefault("Operator.Password", "0000").WithMaxLength(Info.OperatorPasswordMaxLength)
                        :
                operatorPassword,
                "1",
                GetReversalReasonText(reason) + receiptNumber,
                uniqueSaleNumber,
                receiptDateTime.ToString("ddMMyyHHmmss", CultureInfo.InvariantCulture),
                fiscalMemorySerialNumber
            });

            return(Request(CommandDatecsOpenReversalReceipt, header));
        }
Esempio n. 6
0
 public virtual string GetReversalReasonText(ReversalReason reversalReason)
 {
     return(reversalReason switch
     {
         ReversalReason.OperatorError => "0",
         ReversalReason.Refund => "1",
         ReversalReason.TaxBaseReduction => "2",
         _ => "0",
     });
 public override string GetReversalReasonText(ReversalReason reversalReason)
 {
     return(reversalReason switch
     {
         ReversalReason.OperatorError => "O",
         ReversalReason.Refund => "R",
         ReversalReason.TaxBaseReduction => "T",
         _ => "O",
     });
Esempio n. 8
0
        public override string GetReversalReasonText(ReversalReason reversalReason)
        {
            switch (reversalReason)
            {
            case ReversalReason.Refund:
                return("S");

            case ReversalReason.TaxBaseReduction:
                return("V");

            case ReversalReason.OperatorError:
            default:
                return("R");
            }
        }
Esempio n. 9
0
        public virtual string GetReversalReasonText(ReversalReason reversalReason)
        {
            switch (reversalReason)
            {
            case ReversalReason.OperatorError:
                return("0");

            case ReversalReason.Refund:
                return("1");

            case ReversalReason.TaxBaseReduction:
                return("2");

            default:
                return("0");
            }
        }
        private void DidFinishWithReversal(PtzPaymentResponse response, ReversalReason reason, bool reversalApproved)
        {
            try
            {
                var responseString = "TRANSACTION COMPLETE\r\n\r\n" + JsonConvert.SerializeObject(response, Formatting.Indented);
                responseString += $"\r\n Reversal reason {reason}";
                responseString += $"\r\n Reversal approved: {reversalApproved}";
                responseString += $"\r\n TerminalResult: {response?.TerminalResult.ToString()}";

                CommonUtility.LogInfo(responseString);
                CurrentTransactionId = response.TransactionIdentifier;
                IsActiveTransaction  = false;
            }
            catch (Exception x)
            {
                CommonUtility.LogInfo($"{x.ToString()}\r\n");
            }
        }
Esempio n. 11
0
        public virtual (string, DeviceStatus) OpenReversalReceipt(
            ReversalReason reason,
            string receiptNumber,
            System.DateTime receiptDateTime,
            string fiscalMemorySerialNumber,
            string uniqueSaleNumber,
            string operatorId,
            string operatorPassword)
        {
            var reversalReceiptData = new StringBuilder()
                                      .Append("20")
                                      .Append(GetReversalReasonText(reason))
                                      .Append("0000")
                                      .Append(receiptNumber)
                                      .Append(receiptDateTime.ToString("ddMMyyyyHHmmss", CultureInfo.InvariantCulture))
                                      .Append(fiscalMemorySerialNumber)
                                      .Append(uniqueSaleNumber);

            return(Request(reversalReceiptData.ToString()));
        }
Esempio n. 12
0
        public override (string, DeviceStatus) OpenReversalReceipt(
            ReversalReason reason,
            string receiptNumber,
            System.DateTime receiptDateTime,
            string fiscalMemorySerialNumber,
            string uniqueSaleNumber)
        {
            // Protocol: <OpCode>,<OpPwd>,<NSale>,<TillNmb>,<DocType>,<DocNumber>,<DocDateTime>,< FMNumber >[,< Invoice >,< InvNumber >,< Reason >]
            var header = string.Join(",",
                                     new string[] {
                Options.ValueOrDefault("Operator.ID", "1"),
                Options.ValueOrDefault("Operator.Password", "1").WithMaxLength(Info.OperatorPasswordMaxLength),
                uniqueSaleNumber,
                "1",
                GetReversalReasonText(reason),
                receiptNumber,
                receiptDateTime.ToString("ddMMyyHHmmss", CultureInfo.InvariantCulture),
                fiscalMemorySerialNumber
            });

            return(Request(CommandDatecsOpenReversalReceipt, header));
        }