public static PaymentMethod ToStorePaymentMethod(this storeDto.PaymentMethod paymentMethodDto, Currency currency)
        {
            var retVal = new PaymentMethod(currency)
            {
                Code                   = paymentMethodDto.Code,
                Description            = paymentMethodDto.Currency,
                IsAvailableForPartial  = paymentMethodDto.IsAvailableForPartial ?? false,
                LogoUrl                = paymentMethodDto.LogoUrl,
                Name                   = paymentMethodDto.Name,
                PaymentMethodGroupType = paymentMethodDto.PaymentMethodGroupType,
                PaymentMethodType      = paymentMethodDto.PaymentMethodType,
                TaxType                = paymentMethodDto.TaxType,

                Priority = paymentMethodDto.Priority ?? 0
            };

            if (paymentMethodDto.Settings != null)
            {
                retVal.Settings = paymentMethodDto.Settings.Where(x => !x.ValueType.EqualsInvariant("SecureString")).Select(x => x.JsonConvert <AutoRestClients.PlatformModuleApi.Models.Setting>().ToSettingEntry()).ToList();
            }

            retVal.Currency       = currency;
            retVal.Price          = new Money(paymentMethodDto.Price ?? 0, currency);
            retVal.DiscountAmount = new Money(paymentMethodDto.DiscountAmount ?? 0, currency);
            retVal.TaxPercentRate = (decimal?)paymentMethodDto.TaxPercentRate ?? 0m;

            if (paymentMethodDto.TaxDetails != null)
            {
                retVal.TaxDetails = paymentMethodDto.TaxDetails.Select(td => ToTaxDetail(td, currency)).ToList();
            }

            return(retVal);
        }
예제 #2
0
        public virtual PaymentMethod ToPaymentMethod(storeDto.PaymentMethod paymentMethodDto, CustomerOrder order)
        {
            var retVal = new PaymentMethod(order.Currency);

            retVal.Code                   = paymentMethodDto.Code;
            retVal.Description            = paymentMethodDto.Currency;
            retVal.IsAvailableForPartial  = paymentMethodDto.IsAvailableForPartial ?? false;
            retVal.LogoUrl                = paymentMethodDto.LogoUrl;
            retVal.Name                   = paymentMethodDto.Name;
            retVal.PaymentMethodGroupType = paymentMethodDto.PaymentMethodGroupType;
            retVal.PaymentMethodType      = paymentMethodDto.PaymentMethodType;
            retVal.TaxType                = paymentMethodDto.TaxType;

            retVal.Priority = paymentMethodDto.Priority ?? 0;

            if (paymentMethodDto.Settings != null)
            {
                retVal.Settings = paymentMethodDto.Settings.Where(x => !x.ValueType.EqualsInvariant("SecureString")).Select(x => x.JsonConvert <platformDto.Setting>().ToSettingEntry()).ToList();
            }

            retVal.Currency       = order.Currency;
            retVal.Price          = new Money(paymentMethodDto.Price ?? 0, order.Currency);
            retVal.DiscountAmount = new Money(paymentMethodDto.DiscountAmount ?? 0, order.Currency);
            retVal.TaxPercentRate = (decimal?)paymentMethodDto.TaxPercentRate ?? 0m;

            if (paymentMethodDto.TaxDetails != null)
            {
                retVal.TaxDetails = paymentMethodDto.TaxDetails.Select(td => ToTaxDetail(td, order.Currency)).ToList();
            }

            return(retVal);
        }
예제 #3
0
        public virtual PaymentMethod ToPaymentMethod(storeDto.PaymentMethod paymentMethodDto, CustomerOrder order)
        {
            var retVal = new PaymentMethod(order.Currency);

            retVal.InjectFrom <NullableAndEnumValueInjecter>(paymentMethodDto);
            retVal.Priority = paymentMethodDto.Priority ?? 0;

            if (paymentMethodDto.Settings != null)
            {
                retVal.Settings = paymentMethodDto.Settings.Select(x => x.JsonConvert <platformDto.Setting>().ToSettingEntry()).ToList();
            }

            retVal.Currency       = order.Currency;
            retVal.Price          = new Money(paymentMethodDto.Price ?? 0, order.Currency);
            retVal.DiscountAmount = new Money(paymentMethodDto.DiscountAmount ?? 0, order.Currency);
            retVal.TaxPercentRate = (decimal?)paymentMethodDto.TaxPercentRate ?? 0m;

            if (paymentMethodDto.TaxDetails != null)
            {
                retVal.TaxDetails = paymentMethodDto.TaxDetails.Select(td => ToTaxDetail(td, order.Currency)).ToList();
            }

            return(retVal);
        }
예제 #4
0
 public static PaymentMethod ToPaymentMethod(this storeDto.PaymentMethod dto, CustomerOrder order)
 {
     return(OrderConverterInstance.ToPaymentMethod(dto, order));
 }