예제 #1
0
        public string RecordLine()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(recordType); // (2) - static length
            sb.Append(SduBatchId.PadLeft(20, '0'));
            sb.Append(SduTranId);  //(20) - static length
            sb.Append(ReceiptNumber.PadLeft(7, '0'));
            sb.Append(StrRetransmittalIndicator.PadRight(1));
            sb.Append(PayorID.PadRight(13));
            sb.Append(PayorSSN.PadRight(9));
            sb.Append(PaidBy.PadRight(15));
            sb.Append(PayorLastName.PadRight(25));
            sb.Append(PayorFirstName.PadRight(20));
            sb.Append(PayorMiddleName.PadRight(20));
            sb.Append(PayorSuffix.PadRight(3));
            sb.Append(StrAmount.PadLeft(15, '0'));
            sb.Append(StrOfcAmount.PadLeft(15, '0'));
            sb.Append(PaymentMode.PadRight(2));
            sb.Append(PaymentSource.PadRight(4));
            sb.Append(ReceiptReceivedDate.PadRight(8));
            sb.Append(ReceiptEffectiveDate.PadRight(8));
            sb.Append(CheckNumber.PadRight(18));
            sb.Append(ComplianceExemptionReason.PadRight(1));
            sb.Append(TargetedPaymentIndicator.PadRight(1, '0'));
            sb.Append(Fips.PadRight(7));
            sb.Append(CourtCaseNumber.PadRight(25));
            sb.Append(CourtJudgementNumber.PadLeft(3, '0'));
            sb.Append(CourtGuidelineNumber.PadLeft(3, '0'));
            sb.Append(ReasonCode.PadRight(3));
            sb.Append(filler.PadRight(32));

            return(sb.ToString());
        }
예제 #2
0
        /// <summary>
        /// Hjälpmetod för att representera ett kvitto som en textsträng.
        /// </summary>
        /// <returns>Strängrepresentationen av ett kvitto.</returns>
        public override string ToString()
        {
            string receiptAsString;

            receiptAsString  = ProductCode.ToString(CultureInfo.CurrentCulture) + ';';
            receiptAsString += Quantity.ToString(CultureInfo.CurrentCulture) + ';';
            receiptAsString += DateOfSale + ';';
            receiptAsString += ReceiptNumber.ToString(CultureInfo.CurrentCulture) + ';';
            receiptAsString += Price.ToString(CultureInfo.CurrentCulture);

            return(receiptAsString);
        }
        public override string ToString()
        {
            var info = new StringBuilder();

            info.Append(base.ToString());
            info.Append("Amount: ").AppendLine(Amount.ToString());
            info.Append("Receipt number: ").AppendLine(ReceiptNumber.ToString());
            info.Append("RRN: ").AppendLine(ReturnReferenceNumber);
            info.Append("Authorization code: ").AppendLine(AuthorizationCode);

            return(info.ToString());
        }
예제 #4
0
 private Receipt(ReceiptNumber number,
                 RegisterIdentifier registerIdentifier,
                 TaxData taxData,
                 CertificateSerialNumber certificateSerialNumber,
                 byte[] key,
                 LocalDateTime created = null)
 {
     Number                  = number ?? throw new ArgumentException("The receipt number has to be specified.");
     RegisterIdentifier      = registerIdentifier ?? throw new ArgumentException("The register identifier has to be specified.");
     TaxData                 = taxData ?? throw new ArgumentException("The tax data have to be specified.");
     CertificateSerialNumber = certificateSerialNumber ?? throw new ArgumentException("The certificate serial number has to be specified.");
     Created                 = created ?? LocalDateTime.Now;
     Suite = "R1-AT1";
     Key   = key;
 }
예제 #5
0
 public Receipt(
     ReceiptNumber number,
     RegisterIdentifier registerIdentifier,
     TaxData taxData,
     EncryptedTurnover encryptedTurnover,
     CertificateSerialNumber certificateSerialNumber,
     ChainValue chainValue,
     byte[] key,
     LocalDateTime created = null)
     : this(number, registerIdentifier, taxData, certificateSerialNumber, key, created)
 {
     EncryptedTurnover = encryptedTurnover;
     Turnover          = DecryptTurnover();
     ChainValue        = chainValue;
 }
예제 #6
0
 public Receipt(
     ReceiptNumber number,
     RegisterIdentifier registerIdentifier,
     TaxData taxData,
     CurrencyValue turnover,
     CertificateSerialNumber certificateSerialNumber,
     JwsRepresentation previousJwsRepresentation,
     byte[] key,
     LocalDateTime created = null)
     : this(number, registerIdentifier, taxData, certificateSerialNumber, key, created)
 {
     PreviousJwsRepresentation = previousJwsRepresentation;
     ChainValue        = ComputeChainValue();
     Turnover          = turnover ?? throw new ArgumentException("The turnover has to be specified.");
     EncryptedTurnover = EncryptTurnover();
 }
예제 #7
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is Payment other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((TipMoney == null && other.TipMoney == null) || (TipMoney?.Equals(other.TipMoney) == true)) &&
                   ((TotalMoney == null && other.TotalMoney == null) || (TotalMoney?.Equals(other.TotalMoney) == true)) &&
                   ((AppFeeMoney == null && other.AppFeeMoney == null) || (AppFeeMoney?.Equals(other.AppFeeMoney) == true)) &&
                   ((ProcessingFee == null && other.ProcessingFee == null) || (ProcessingFee?.Equals(other.ProcessingFee) == true)) &&
                   ((RefundedMoney == null && other.RefundedMoney == null) || (RefundedMoney?.Equals(other.RefundedMoney) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((DelayDuration == null && other.DelayDuration == null) || (DelayDuration?.Equals(other.DelayDuration) == true)) &&
                   ((DelayAction == null && other.DelayAction == null) || (DelayAction?.Equals(other.DelayAction) == true)) &&
                   ((DelayedUntil == null && other.DelayedUntil == null) || (DelayedUntil?.Equals(other.DelayedUntil) == true)) &&
                   ((SourceType == null && other.SourceType == null) || (SourceType?.Equals(other.SourceType) == true)) &&
                   ((CardDetails == null && other.CardDetails == null) || (CardDetails?.Equals(other.CardDetails) == true)) &&
                   ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) &&
                   ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) &&
                   ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) &&
                   ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) &&
                   ((RefundIds == null && other.RefundIds == null) || (RefundIds?.Equals(other.RefundIds) == true)) &&
                   ((RiskEvaluation == null && other.RiskEvaluation == null) || (RiskEvaluation?.Equals(other.RiskEvaluation) == true)) &&
                   ((BuyerEmailAddress == null && other.BuyerEmailAddress == null) || (BuyerEmailAddress?.Equals(other.BuyerEmailAddress) == true)) &&
                   ((BillingAddress == null && other.BillingAddress == null) || (BillingAddress?.Equals(other.BillingAddress) == true)) &&
                   ((ShippingAddress == null && other.ShippingAddress == null) || (ShippingAddress?.Equals(other.ShippingAddress) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((StatementDescriptionIdentifier == null && other.StatementDescriptionIdentifier == null) || (StatementDescriptionIdentifier?.Equals(other.StatementDescriptionIdentifier) == true)) &&
                   ((ReceiptNumber == null && other.ReceiptNumber == null) || (ReceiptNumber?.Equals(other.ReceiptNumber) == true)) &&
                   ((ReceiptUrl == null && other.ReceiptUrl == null) || (ReceiptUrl?.Equals(other.ReceiptUrl) == true)));
        }
예제 #8
0
        public void FillReceipts()
        {
            if (ReceiptNumber.ToString().Trim() != "0" && (ReceiptNumber % 1) == 0)
            {
                try
                {
                    ReceiptModel        rm   = new ReceiptModel();
                    List <ReceiptModel> list = new List <ReceiptModel>()
                    {
                        rm.GetMeByNumber(ReceiptNumber, Customer.Id)
                    };
                    if (list[0] == null || list.Count == 0)
                    {
                        throw new Exception("No receipt for " + Customer.Name + " with number " + ReceiptNumber);
                    }
                    Receipts = new BindableCollection <ReceiptModel>(list);
                }
                catch (Exception e)
                {
                    Receipts = new BindableCollection <ReceiptModel>();
                }
            }
            else
            {
                switch (ReceiptSeason.Id.ToString())
                {
                case "0":
                    if (ReceiptSeason.Year == "None")
                    {
                        Receipts = Customer.GetMyReceipts(0);
                    }
                    else
                    {
                        Receipts = Customer.GetMyReceipts();
                    }
                    break;

                default:
                    Receipts = Customer.GetMyReceipts(ReceiptSeason.Id);
                    break;
                }
            }
        }
예제 #9
0
        public override string ToString()
        {
            var info = new StringBuilder();

            info.Append(base.ToString());
            info.Append("Approved amount: ").AppendLine(ApprovedAmount.ToString());
            info.Append("Approved Amount Currency: ").AppendLine(ApprovedAmountCurrency);
            info.Append("Batch number: ").AppendLine(BatchNumber.ToString());
            info.Append("Receipt number: ").AppendLine(ReceiptNumber.ToString());
            info.Append("RRN: ").AppendLine(ReturnReferenceNumber);
            info.Append("Authorization code: ").AppendLine(AuthorizationCode);
            info.Append("Card number: ").AppendLine(CardNumber);
            info.Append("Card holder name: ").AppendLine(CardHolderName);
            info.Append("Card company: ").AppendLine(CardCompany);
            info.Append("EMV Application Label: ").AppendLine(EmvApplicationLabel);
            info.Append("EMV Application ID: ").AppendLine(EmvApplicationId);
            info.Append("Transaction Flag: ").AppendLine(TransactionFlag.ToString());
            info.Append("Is Pin Used: ").AppendLine(IsPinUsed.ToString());

            return(info.ToString());
        }
예제 #10
0
 public Receipt(
     ReceiptNumber number,
     RegisterIdentifier registerIdentifier,
     TaxData taxData,
     CurrencyValue turnover,
     CertificateSerialNumber certificateSerialNumber,
     JwsRepresentation previousJwsRepresentation,
     byte[] key,
     LocalDateTime created = null)
 {
     Number                    = number ?? throw new ArgumentException("The receipt number has to be specified.");
     RegisterIdentifier        = registerIdentifier ?? throw new ArgumentException("The register identifier has to be specified.");
     TaxData                   = taxData ?? throw new ArgumentException("The tax data have to be specified.");
     Turnover                  = turnover ?? throw new ArgumentException("The turnover has to be specified.");
     CertificateSerialNumber   = certificateSerialNumber ?? throw new ArgumentException("The certificate serial number has to be specified.");
     PreviousJwsRepresentation = previousJwsRepresentation;
     Created                   = created ?? LocalDateTime.Now;
     Suite             = "R1-AT1";
     Key               = key;
     ChainValue        = ComputeChainValue();
     EncryptedTurnover = EncryptTurnover();
 }
예제 #11
0
        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            // Message type (= Payment request), Length: 4, Fieldtype: AN
            result.Append(StringValueAttribute.GetStringValue(MessageType));
            // Terminal number, Length: 8, Fieldtype: N
            result.Append(TerminalId.ToString(CultureInfo.InvariantCulture).PadLeft(8, '0'));
            // Message version number, Length: 1, Fieldtype: N
            // 0 = No addittional information, 1 = additional information
            result.Append(HasAdditionalInformation ? "1" : "0");
            // Amount, Length: 11, Fieldtype: N
            result.Append(Amount.ToString("#.##", CultureInfo.CurrentCulture).Replace(
                              CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator, "").PadLeft(11, '0'));
            // Product info, Length: 20, Fieldtype: AN (Future use)
            result.Append(new String(' ', 20));
            // Receipt number, Length: 6, Fieldtype: N
            result.Append(ReceiptNumber.ToString(CultureInfo.InvariantCulture).PadLeft(6, '0'));
            // Transaction type, Length: 2, Fieldtype: N
            // 00 = Purchase
            result.Append(StringValueAttribute.GetStringValue(TransactionType));
            // Length of additional information, Length: 3, Fieldtype: N
            result.Append(AdditionalInformation.Length.ToString(CultureInfo.InvariantCulture).PadLeft(3, '0'));
            // Indicator additional information, Length: 2, Fieldtype: N
            // 01 = Currency, 02 = Product information (only for petrol)
            // 03 = Product information (Special terminal)
            result.Append(StringValueAttribute.GetStringValue(AdditionalInformationType));
            // Additional information, Length: variable, Fieldtype: AN
            result.Append(AdditionalInformation);
            // End of text
            result.Append((Char)TwoStepProtocol.EndOfText);
            // LRC Checksum
            result.Append(TerminalRequest.CalculateLongitudinalRedundancyCheck(result.ToString()));
            // Start of text
            result.Insert(0, (Char)TwoStepProtocol.StartOfText);
            return(result.ToString());
        }
예제 #12
0
 public override void Save()
 {
     StorageProvider.Save(CreatePrintImage(), ReceiptNumber.ToString());
 }
예제 #13
0
        public override int GetHashCode()
        {
            int hashCode = 1131972147;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (UpdatedAt != null)
            {
                hashCode += UpdatedAt.GetHashCode();
            }

            if (AmountMoney != null)
            {
                hashCode += AmountMoney.GetHashCode();
            }

            if (TipMoney != null)
            {
                hashCode += TipMoney.GetHashCode();
            }

            if (TotalMoney != null)
            {
                hashCode += TotalMoney.GetHashCode();
            }

            if (AppFeeMoney != null)
            {
                hashCode += AppFeeMoney.GetHashCode();
            }

            if (ProcessingFee != null)
            {
                hashCode += ProcessingFee.GetHashCode();
            }

            if (RefundedMoney != null)
            {
                hashCode += RefundedMoney.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (DelayDuration != null)
            {
                hashCode += DelayDuration.GetHashCode();
            }

            if (DelayAction != null)
            {
                hashCode += DelayAction.GetHashCode();
            }

            if (DelayedUntil != null)
            {
                hashCode += DelayedUntil.GetHashCode();
            }

            if (SourceType != null)
            {
                hashCode += SourceType.GetHashCode();
            }

            if (CardDetails != null)
            {
                hashCode += CardDetails.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (OrderId != null)
            {
                hashCode += OrderId.GetHashCode();
            }

            if (ReferenceId != null)
            {
                hashCode += ReferenceId.GetHashCode();
            }

            if (CustomerId != null)
            {
                hashCode += CustomerId.GetHashCode();
            }

            if (EmployeeId != null)
            {
                hashCode += EmployeeId.GetHashCode();
            }

            if (RefundIds != null)
            {
                hashCode += RefundIds.GetHashCode();
            }

            if (RiskEvaluation != null)
            {
                hashCode += RiskEvaluation.GetHashCode();
            }

            if (BuyerEmailAddress != null)
            {
                hashCode += BuyerEmailAddress.GetHashCode();
            }

            if (BillingAddress != null)
            {
                hashCode += BillingAddress.GetHashCode();
            }

            if (ShippingAddress != null)
            {
                hashCode += ShippingAddress.GetHashCode();
            }

            if (Note != null)
            {
                hashCode += Note.GetHashCode();
            }

            if (StatementDescriptionIdentifier != null)
            {
                hashCode += StatementDescriptionIdentifier.GetHashCode();
            }

            if (ReceiptNumber != null)
            {
                hashCode += ReceiptNumber.GetHashCode();
            }

            if (ReceiptUrl != null)
            {
                hashCode += ReceiptUrl.GetHashCode();
            }

            return(hashCode);
        }