コード例 #1
0
        private static IEnumerable <MiscellaneousCharge> GetMiscellaneousCharges(Hashtable properties, string propertyNamespace, string propertyName)
        {
            IEnumerable <MiscellaneousCharge> miscellaneousCharges = null;

            PaymentProperty[] miscellaneousChargesPropertyArray;
            if (PaymentProperty.GetPropertyValue(properties, propertyNamespace, propertyName, out miscellaneousChargesPropertyArray))
            {
                if (miscellaneousChargesPropertyArray.Length > 0)
                {
                    miscellaneousCharges = new List <MiscellaneousCharge>();
                    foreach (var miscellaneousChargesProperty in miscellaneousChargesPropertyArray)
                    {
                        PaymentProperty[] miscellaneousChargePropertyArray = miscellaneousChargesProperty.PropertyList;
                        if (miscellaneousChargePropertyArray != null)
                        {
                            Hashtable miscellaneousChargeProperties = PaymentProperty.ConvertToHashtable(miscellaneousChargePropertyArray);
                            var       miscellaneousCharge           = new MiscellaneousCharge();
                            miscellaneousCharge.ChargeType   = PaymentUtilities.GetPropertyStringValue(miscellaneousChargeProperties, GenericNamespace.MiscellaneousCharge, MiscellaneousChargeProperties.ChargeType);
                            miscellaneousCharge.ChargeAmount = PaymentUtilities.GetPropertyDecimalValue(miscellaneousChargeProperties, GenericNamespace.MiscellaneousCharge, MiscellaneousChargeProperties.ChargeAmount);
                            (miscellaneousCharges as List <MiscellaneousCharge>).Add(miscellaneousCharge);
                        }
                    }
                }
            }

            return(miscellaneousCharges);
        }
コード例 #2
0
        private static IEnumerable <TaxDetail> GetTaxDetails(Hashtable properties, string propertyNamespace, string propertyName)
        {
            IEnumerable <TaxDetail> taxDetails = null;

            PaymentProperty[] taxDetailsPropertyArray;
            if (PaymentProperty.GetPropertyValue(properties, propertyNamespace, propertyName, out taxDetailsPropertyArray))
            {
                if (taxDetailsPropertyArray.Length > 0)
                {
                    taxDetails = new List <TaxDetail>();
                    foreach (var taxDetailsProperty in taxDetailsPropertyArray)
                    {
                        PaymentProperty[] taxDetailPropertyArray = taxDetailsProperty.PropertyList;
                        if (taxDetailPropertyArray != null)
                        {
                            Hashtable taxDetailProperties = PaymentProperty.ConvertToHashtable(taxDetailPropertyArray);
                            var       taxDetail           = new TaxDetail();
                            taxDetail.TaxTypeIdentifier = PaymentUtilities.GetPropertyStringValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxTypeIdentifier);
                            taxDetail.TaxRate           = PaymentUtilities.GetPropertyDecimalValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxRate);
                            taxDetail.TaxDescription    = PaymentUtilities.GetPropertyStringValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxDescription);
                            taxDetail.TaxAmount         = PaymentUtilities.GetPropertyDecimalValue(taxDetailProperties, GenericNamespace.TaxDetail, TaxDetailProperties.TaxAmount);
                            (taxDetails as List <TaxDetail>).Add(taxDetail);
                        }
                    }
                }
            }

            return(taxDetails);
        }
コード例 #3
0
        /// <summary>
        /// Logs the operation result.
        /// </summary>
        /// <param name="methodName">Name of the method.</param>
        /// <param name="connectorName">Name of the connector.</param>
        /// <param name="platform">The platform.</param>
        /// <param name="request">The request.</param>
        /// <param name="response">The response.</param>
        internal static void LogOperationResult(string methodName, string connectorName, string platform, Request request, Response response)
        {
            /*
             * IMPORTANT!!!
             * THIS IS SAMPLE CODE ONLY!
             * THE CODE MIGHT LOG TOO MUCH INFORMATION WHICH IS INAPPROPRIATE FOR PRODUCT ENVIRONMENT.
             */
            if (request != null && request.Properties != null && response != null && response.Properties != null)
            {
                var requestProperties  = PaymentProperty.ConvertToHashtable(request.Properties);
                var responseProperties = PaymentProperty.ConvertToHashtable(response.Properties);

                StringBuilder result            = new StringBuilder();
                string        requestCardToken  = PaymentUtilities.GetPropertyStringValue(requestProperties, GenericNamespace.PaymentCard, PaymentCardProperties.CardToken);
                string        responseCardToken = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.PaymentCard, PaymentCardProperties.CardToken);
                if (string.IsNullOrWhiteSpace(requestCardToken) && !string.IsNullOrWhiteSpace(responseCardToken))
                {
                    string last4Digit = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.PaymentCard, PaymentCardProperties.Last4Digits);
                    result.Append(string.Format("Card {0}, Tokenization Success. ", last4Digit));
                }

                string authResult = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.AuthorizationResponse, AuthorizationResponseProperties.AuthorizationResult);
                if (!string.IsNullOrWhiteSpace(authResult))
                {
                    string  last4Digit     = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.AuthorizationResponse, AuthorizationResponseProperties.Last4Digits);
                    decimal?approvedAmount = PaymentUtilities.GetPropertyDecimalValue(responseProperties, GenericNamespace.AuthorizationResponse, AuthorizationResponseProperties.ApprovedAmount);
                    string  currency       = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.AuthorizationResponse, AuthorizationResponseProperties.CurrencyCode);
                    result.Append(string.Format("Card {0}, Authorization {1}, Approved amount {2} {3}. ", last4Digit, authResult, approvedAmount, currency));
                }

                string captureResult = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.CaptureResponse, CaptureResponseProperties.CaptureResult);
                if (!string.IsNullOrWhiteSpace(captureResult))
                {
                    string  last4Digit      = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.CaptureResponse, CaptureResponseProperties.Last4Digits);
                    decimal?requestedAmount = PaymentUtilities.GetPropertyDecimalValue(requestProperties, GenericNamespace.TransactionData, TransactionDataProperties.Amount);
                    string  currency        = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.CaptureResponse, CaptureResponseProperties.CurrencyCode);
                    result.Append(string.Format("Card {0}, Capture {1}, Requested amount {2} {3}. ", last4Digit, captureResult, requestedAmount, currency));
                }

                string voidResult = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.VoidResponse, VoidResponseProperties.VoidResult);
                if (!string.IsNullOrWhiteSpace(voidResult))
                {
                    string  last4Digit      = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.VoidResponse, VoidResponseProperties.Last4Digits);
                    decimal?requestedAmount = PaymentUtilities.GetPropertyDecimalValue(requestProperties, GenericNamespace.TransactionData, TransactionDataProperties.Amount);
                    string  currency        = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.VoidResponse, VoidResponseProperties.CurrencyCode);
                    result.Append(string.Format("Card {0}, Void {1}, Requested amount {2} {3}. ", last4Digit, voidResult, requestedAmount, currency));
                }

                string refundResult = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.RefundResponse, RefundResponseProperties.RefundResult);
                if (!string.IsNullOrWhiteSpace(refundResult))
                {
                    string  last4Digit     = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.RefundResponse, RefundResponseProperties.Last4Digits);
                    decimal?approvedAmount = PaymentUtilities.GetPropertyDecimalValue(responseProperties, GenericNamespace.RefundResponse, RefundResponseProperties.ApprovedAmount);
                    string  currency       = PaymentUtilities.GetPropertyStringValue(responseProperties, GenericNamespace.RefundResponse, RefundResponseProperties.CurrencyCode);
                    result.Append(string.Format("Card {0}, Refund {1}, Approved amount {2} {3}. ", last4Digit, refundResult, approvedAmount, currency));
                }

                string step = "result: ";
                if (result.Length > 0)
                {
                    step += result.ToString();
                }
                else
                {
                    step += "No result. ";
                }

                RetailLogger.Log.PaymentConnectorLogOperation(methodName, step, connectorName, platform);
            }
        }
コード例 #4
0
        /// <summary>
        /// Gets the level3 data.
        /// </summary>
        /// <param name="properties">The properties.</param>
        /// <returns>Collection of <see cref="Level3Data"/>.</returns>
        /// <exception cref="ArgumentNullException">properties</exception>
        internal static IEnumerable <Level3Data> GetLevel3Data(Hashtable properties)
        {
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            IEnumerable <Level3Data> level3Data = null;

            PaymentProperty[] level3DataPropertyArray;
            if (PaymentProperty.GetPropertyValue(properties, GenericNamespace.PurchaseLevelData, PurchaseLevelDataProperties.L3Data, out level3DataPropertyArray))
            {
                if (level3DataPropertyArray.Length > 0)
                {
                    level3Data = new List <Level3Data>();
                }

                foreach (var level3DataProperty in level3DataPropertyArray)
                {
                    var       level3DataItems           = new Level3Data();
                    Hashtable level3DataItemsProperties = PaymentProperty.ConvertToHashtable(level3DataProperty.PropertyList);

                    level3DataItems.SequenceNumber        = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.SequenceNumber);
                    level3DataItems.CommodityCode         = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.CommodityCode);
                    level3DataItems.ProductCode           = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.ProductCode);
                    level3DataItems.ProductName           = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.ProductName);
                    level3DataItems.ProductSKU            = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.ProductSKU);
                    level3DataItems.Descriptor            = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.Descriptor);
                    level3DataItems.UnitOfMeasure         = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.UnitOfMeasure);
                    level3DataItems.UnitPrice             = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.UnitPrice);
                    level3DataItems.Discount              = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.Discount);
                    level3DataItems.DiscountRate          = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.DiscountRate);
                    level3DataItems.Quantity              = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.Quantity);
                    level3DataItems.MiscCharge            = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.MiscCharge);
                    level3DataItems.NetTotal              = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.NetTotal);
                    level3DataItems.TaxAmount             = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.TaxAmount);
                    level3DataItems.TaxRate               = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.TaxRate);
                    level3DataItems.TotalAmount           = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.TotalAmount);
                    level3DataItems.CostCenter            = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.CostCenter);
                    level3DataItems.FreightAmount         = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.FreightAmount);
                    level3DataItems.HandlingAmount        = PaymentUtilities.GetPropertyDecimalValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.HandlingAmount);
                    level3DataItems.CarrierTrackingNumber = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.CarrierTrackingNumber);
                    level3DataItems.MerchantTaxID         = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.MerchantTaxID);
                    level3DataItems.MerchantCatalogNumber = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.MerchantCatalogNumber);
                    level3DataItems.TaxCategoryApplied    = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.TaxCategoryApplied);
                    level3DataItems.PickupAddress         = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupAddress);
                    level3DataItems.PickupCity            = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupCity);
                    level3DataItems.PickupState           = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupState);
                    level3DataItems.PickupCounty          = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupCounty);
                    level3DataItems.PickupZip             = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupZip);
                    level3DataItems.PickupCountry         = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupCountry);
                    level3DataItems.PickupDateTime        = PaymentUtilities.GetPropertyDateTimeValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupDateTime);
                    level3DataItems.PickupRecordNumber    = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.PickupRecordNumber);
                    level3DataItems.CarrierShipmentNumber = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.CarrierShipmentNumber);
                    level3DataItems.UNSPSCCode            = PaymentUtilities.GetPropertyStringValue(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.UNSPSCCode);

                    level3DataItems.TaxDetails           = PaymentUtilities.GetTaxDetails(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.TaxDetails);
                    level3DataItems.MiscellaneousCharges = PaymentUtilities.GetMiscellaneousCharges(level3DataItemsProperties, GenericNamespace.L3Data, L3DataProperties.MiscellaneousCharges);

                    (level3Data as List <Level3Data>).Add(level3DataItems);
                }
            }

            return(level3Data);
        }
コード例 #5
0
        /// <summary>
        /// Gets the level2 data.
        /// </summary>
        /// <param name="properties">The properties.</param>
        /// <returns>Collection of <see cref="Level2Data"/>.</returns>
        /// <exception cref="ArgumentNullException">properties</exception>
        internal static Level2Data GetLevel2Data(Hashtable properties)
        {
            if (properties == null)
            {
                throw new ArgumentNullException(nameof(properties));
            }

            Level2Data level2Data = null;

            PaymentProperty[] level2DataPropertyArray;
            if (PaymentProperty.GetPropertyValue(properties, GenericNamespace.PurchaseLevelData, PurchaseLevelDataProperties.L2Data, out level2DataPropertyArray))
            {
                Hashtable level2DataProperties = PaymentProperty.ConvertToHashtable(level2DataPropertyArray);

                level2Data = new Level2Data();
                level2Data.OrderDateTime              = PaymentUtilities.GetPropertyDateTimeValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.OrderDateTime);
                level2Data.OrderNumber                = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.OrderNumber);
                level2Data.InvoiceDateTime            = PaymentUtilities.GetPropertyDateTimeValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.InvoiceDateTime);
                level2Data.InvoiceNumber              = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.InvoiceNumber);
                level2Data.OrderDescription           = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.OrderDescription);
                level2Data.SummaryCommodityCode       = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.SummaryCommodityCode);
                level2Data.MerchantContact            = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantContact);
                level2Data.MerchantTaxId              = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantTaxId);
                level2Data.MerchantType               = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantType);
                level2Data.PurchaserId                = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.PurchaserId);
                level2Data.PurchaserTaxId             = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.PurchaserTaxId);
                level2Data.ShipToCity                 = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipToCity);
                level2Data.ShipToCounty               = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipToCounty);
                level2Data.ShipToState_ProvinceCode   = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipToState_ProvinceCode);
                level2Data.ShipToPostalCode           = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipToPostalCode);
                level2Data.ShipToCountryCode          = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipToCountryCode);
                level2Data.ShipFromCity               = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipFromCity);
                level2Data.ShipFromCounty             = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipFromCounty);
                level2Data.ShipFromState_ProvinceCode = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipFromState_ProvinceCode);
                level2Data.ShipFromPostalCode         = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipFromPostalCode);
                level2Data.ShipFromCountryCode        = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.ShipFromCountryCode);
                level2Data.DiscountAmount             = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.DiscountAmount);
                level2Data.MiscCharge                 = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MiscCharge);
                level2Data.DutyAmount                 = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.DutyAmount);
                level2Data.FreightAmount              = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.FreightAmount);
                level2Data.IsTaxable              = PaymentUtilities.GetPropertyBooleanValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.IsTaxable);
                level2Data.TotalTaxAmount         = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TotalTaxAmount);
                level2Data.TotalTaxRate           = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TotalTaxRate);
                level2Data.MerchantName           = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantName);
                level2Data.MerchantStreet         = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantStreet);
                level2Data.MerchantCity           = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantCity);
                level2Data.MerchantState          = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantState);
                level2Data.MerchantCounty         = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantCounty);
                level2Data.MerchantCountryCode    = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantCountryCode);
                level2Data.MerchantZip            = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MerchantZip);
                level2Data.TaxRate                = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TaxRate);
                level2Data.TaxAmount              = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TaxAmount);
                level2Data.TaxDescription         = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TaxDescription);
                level2Data.TaxTypeIdentifier      = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TaxTypeIdentifier);
                level2Data.RequesterName          = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.RequesterName);
                level2Data.TotalAmount            = PaymentUtilities.GetPropertyDecimalValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TotalAmount);
                level2Data.PurchaseCardType       = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.PurchaseCardType);
                level2Data.AmexLegacyDescription1 = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.AmexLegacyDescription1);
                level2Data.AmexLegacyDescription2 = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.AmexLegacyDescription2);
                level2Data.AmexLegacyDescription3 = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.AmexLegacyDescription3);
                level2Data.AmexLegacyDescription4 = PaymentUtilities.GetPropertyStringValue(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.AmexLegacyDescription4);

                level2Data.TaxDetails           = PaymentUtilities.GetTaxDetails(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.TaxDetails);
                level2Data.MiscellaneousCharges = PaymentUtilities.GetMiscellaneousCharges(level2DataProperties, GenericNamespace.L2Data, L2DataProperties.MiscellaneousCharges);
            }

            return(level2Data);
        }
コード例 #6
0
        /// <summary>
        /// Reads the base properties.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="errors">The errors.</param>
        /// <exception cref="SampleException">
        /// Request is null.
        /// or
        /// Locale is null or whitespaces.
        /// or
        /// Request properties is null or empty.
        /// </exception>
        protected void ReadBaseProperties(Request request, List <PaymentError> errors)
        {
            if (request == null)
            {
                throw new SampleException(ErrorCode.InvalidRequest, "Request is null.");
            }

            if (string.IsNullOrWhiteSpace(request.Locale))
            {
                throw new SampleException(ErrorCode.InvalidRequest, "Locale is null or whitespaces.");
            }
            else
            {
                this.Locale = request.Locale;
            }

            if (request.Properties == null || request.Properties.Length == 0)
            {
                throw new SampleException(ErrorCode.InvalidRequest, "Request properties is null or empty.");
            }

            Hashtable properties = PaymentProperty.ConvertToHashtable(request.Properties);

            this.AssemblyName = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                MerchantAccountProperties.AssemblyName,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.ServiceAccountId = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                MerchantAccountProperties.ServiceAccountId,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.MerchantId = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                MerchantAccountProperties.MerchantId,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.ProviderId = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                SampleMerchantAccountProperty.ProviderId,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.Environment = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                SampleMerchantAccountProperty.Environment);
            this.TestString = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                SampleMerchantAccountProperty.TestString,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.TestDecimal = PaymentUtilities.GetPropertyDecimalValue(
                properties,
                GenericNamespace.MerchantAccount,
                SampleMerchantAccountProperty.TestDecimal,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.TestDate = PaymentUtilities.GetPropertyDateTimeValue(
                properties,
                GenericNamespace.MerchantAccount,
                SampleMerchantAccountProperty.TestDate,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.SupportedCurrencies = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                MerchantAccountProperties.SupportedCurrencies,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.SupportedTenderTypes = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.MerchantAccount,
                MerchantAccountProperties.SupportedTenderTypes,
                errors,
                ErrorCode.InvalidMerchantProperty);
            this.IndustryType = PaymentUtilities.GetPropertyStringValue(
                properties,
                GenericNamespace.TransactionData,
                TransactionDataProperties.IndustryType);
            this.IsTestMode = PaymentUtilities.GetPropertyBooleanValue(
                properties,
                GenericNamespace.TransactionData,
                TransactionDataProperties.IsTestMode);
        }