예제 #1
0
        public static PaymentMethod ToCartPaymentMethod(this cartDto.PaymentMethod paymentMethodDto, ShoppingCart cart)
        {
            var retVal = new PaymentMethod(cart.Currency)
            {
                Code    = paymentMethodDto.Code,
                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 <platformDto.ObjectSettingEntry>().ToSettingEntry()).ToList();
            }

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

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

            return(retVal);
        }
예제 #2
0
        public virtual PaymentMethod ToPaymentMethod(cartDto.PaymentMethod paymentMethodDto)
        {
            var retVal = ServiceLocator.Current.GetInstance <CartFactory>().CreatePaymentMethod();

            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();
            }

            return(retVal);
        }
예제 #3
0
        public virtual PaymentMethod ToPaymentMethod(cartDto.PaymentMethod paymentMethodDto, ShoppingCart cart)
        {
            var retVal = new PaymentMethod(cart.Currency);

            retVal.InjectFrom <NullableAndEnumValueInjecter>(paymentMethodDto);
            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       = cart.Currency;
            retVal.Price          = new Money(paymentMethodDto.Price ?? 0, cart.Currency);
            retVal.DiscountAmount = new Money(paymentMethodDto.DiscountAmount ?? 0, cart.Currency);
            retVal.TaxPercentRate = (decimal?)paymentMethodDto.TaxPercentRate ?? 0m;

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

            return(retVal);
        }
예제 #4
0
 public static PaymentMethod ToPaymentMethod(this cartDto.PaymentMethod paymentMethodDto)
 {
     return(CartConverterInstance.ToPaymentMethod(paymentMethodDto));
 }
예제 #5
0
 public static PaymentMethod ToPaymentMethod(this cartDto.PaymentMethod paymentMethodDto, ShoppingCart cart)
 {
     return(CartConverterInstance.ToPaymentMethod(paymentMethodDto, cart));
 }