Пример #1
0
        /// <summary>
        /// Builds the rebate record of the specified type for the specified record.
        /// </summary>
        /// <param name="record">
        /// The record for which to build a rebate record.
        /// </param>
        /// <returns>
        /// The rebate record for the specified record.
        /// </returns>
        internal static string Build(RebateRecord record)
        {
            StringBuilder result = new StringBuilder();

            // Record type.
            result.Append(RecordType);

            // Transaction sequence number.
            result.Append(record.TransactionSequenceNumber);

            // Bank account number.
            result.Append(RebateConstants.AlphaOmittedCharacter, BankAccountNumberFieldLength);

            // Transaction amount.
            result.Append(record.TransactionAmount.ToString("F2").PadLeft(TransactionAmountFieldLength, RebateConstants.NumericOmittedCharacter));

            // Transaction date.
            result.Append(record.TransactionDate.ToString("yyyyMMdd"));

            // Rebate amount.
            result.Append(record.RebateAmount.ToString("F2").PadLeft(RebateAmountFieldLength, RebateConstants.NumericOmittedCharacter));

            // Merchant category code.
            result.Append(MerchantCategoryCode);

            // Transaction description.
            result.Append(record.TransactionDescription.PadRight(TransactionDescriptionFieldLength));

            // Reversal indicator.
            result.Append(NoReversalIndicator);

            // Merchant ID.
            result.Append(record.MerchantId.PadRight(MerchantIdFieldLength));

            // Issuer ICA.
            result.Append(record.IssuerIca);

            // Program code.
            result.Append(ProgramCode);

            // Bank product code.
            result.Append(BankProductCode.PadRight(BankProductCodeFieldLength));

            // Bank customer number.
            result.Append(record.BankCustomerNumber.PadRight(BankCustomerNumberFieldLength));

            // Filler.
            result.Append(RebateConstants.AlphaOmittedCharacter, FillerFieldLength);

            return(result.ToString());
        }
        /// <summary>
        /// Builds the filtering record of the specified type for the specified record.
        /// </summary>
        /// <param name="record">
        /// The record for which to build a filtering record.
        /// </param>
        /// <param name="date">
        /// The date to add to the filtering record.
        /// </param>
        /// <param name="mappingTypeCode">
        /// The mapping type code to embed within the filtering record.
        /// </param>
        /// <param name="setId">
        /// The set ID to specify for the record.
        /// </param>
        /// <param name="mappingId">
        /// The mapping ID for the filtering record.
        /// </param>
        /// <returns>
        /// The filtering record for the specified record.
        /// </returns>
        internal static string Build(FilteringRecord record,
                                     string date,
                                     string mappingTypeCode,
                                     string setId,
                                     int mappingId)
        {
            StringBuilder result = new StringBuilder();

            // Record type.
            result.Append(RecordType);

            // Record date.
            result.Append(date);

            // Member ICA.
            result.Append(FilteringConstants.MemberIca);

            // Bank customer number.
            result.Append(record.BankCustomerNumber.PadRight(BankCustomerNumberFieldLength));

            // Bank account number.
            result.Append(FilteringConstants.AlphaOmittedCharacter, BankAccountNumberFieldLength);

            // Bank product code.
            result.Append(BankProductCode.PadRight(BankProductCodeFieldLength));

            // Mapping action code.
            result.Append(MappingActionCode);

            // Mapping type code.
            result.Append(mappingTypeCode);

            // Mapping ID.
            result.Append(mappingId.ToString().PadRight(MappingIdFieldLength));

            // Status.
            result.Append(Status);

            // Expiration date.
            result.Append(FilteringConstants.DateTimeOmittedCharacter, ExpirationDateFieldLength);

            // Enrollment date.
            result.Append(record.EffectiveDate.ToString("yyyyMMdd"));

            // Merchant set ID (User defined 1).
            result.Append(setId.PadRight(UserDefinedFieldLength));

            // Transaction threshold (User defined 2).
            result.Append(record.Threshold.ToString("F2").PadRight(UserDefinedFieldLength));

            // User defined 3.
            result.Append(FilteringConstants.AlphaOmittedCharacter, UserDefinedFieldLength);

            // User defined 4.
            result.Append(FilteringConstants.AlphaOmittedCharacter, UserDefinedFieldLength);

            // User defined 5.
            result.Append(FilteringConstants.AlphaOmittedCharacter, UserDefinedFieldLength);

            // Points total sign.
            result.Append(FilteringConstants.AlphaOmittedCharacter);

            // Point total.
            result.Append(FilteringConstants.NumericOmittedCharacter, PointTotalFieldLength);

            // Filler.
            result.Append(FilteringConstants.AlphaOmittedCharacter, FillerFieldLength);

            return(result.ToString());
        }