예제 #1
0
        public virtual orderDto.PaymentIn ToOrderPaymentInDto(PaymentIn payment)
        {
            var retVal = new orderDto.PaymentIn();

            retVal.InjectFrom <NullableAndEnumValueInjecter>(payment);
            retVal.Sum           = (double)payment.Sum.Amount;
            retVal.Currency      = payment.Currency.Code;
            retVal.PaymentStatus = payment.Status;

            if (payment.BillingAddress != null)
            {
                retVal.BillingAddress = payment.BillingAddress.ToOrderAddressDto();
            }

            if (payment.DynamicProperties != null)
            {
                retVal.DynamicProperties = payment.DynamicProperties.Select(ToOrderDynamicPropertyDto).ToList();
            }

            //if (payment.GatewayCode != null)
            //{
            //    var a = retVal.GatewayCode;
            //}

            return(retVal);
        }
예제 #2
0
        public virtual PaymentIn ToOrderInPayment(orderDto.PaymentIn paymentIn, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(paymentIn.Currency)) ?? new Currency(language, paymentIn.Currency);
            var retVal   = new PaymentIn(currency);

            retVal.InjectFrom(paymentIn);

            if (paymentIn.BillingAddress != null)
            {
                retVal.BillingAddress = paymentIn.BillingAddress.ToAddress();
            }

            if (paymentIn.DynamicProperties != null)
            {
                retVal.DynamicProperties = paymentIn.DynamicProperties.Select(ToDynamicProperty).ToList();
            }

            retVal.Sum = new Money(paymentIn.Sum ?? 0, currency);

            if (paymentIn.PaymentMethod != null)
            {
                retVal.GatewayCode = paymentIn.PaymentMethod.Code;
            }
            return(retVal);
        }
예제 #3
0
        public static PaymentIn ToOrderInPayment(this orderDto.PaymentIn paymentIn, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(paymentIn.Currency)) ?? new Currency(language, paymentIn.Currency);
            var retVal   = new PaymentIn(currency)
            {
                CancelledDate = paymentIn.CancelledDate,
                CancelReason  = paymentIn.CancelReason,
                Comment       = paymentIn.Comment,
                CustomerId    = paymentIn.CustomerId,
                CustomerName  = paymentIn.CustomerName,
                GatewayCode   = paymentIn.GatewayCode,
                Id            = paymentIn.Id,
                IncomingDate  = paymentIn.IncomingDate,
                IsApproved    = paymentIn.IsApproved,
                IsCancelled   = paymentIn.IsCancelled,
                CreatedBy     = paymentIn.CreatedBy,
                CreatedDate   = paymentIn.CreatedDate,
                ModifiedDate  = paymentIn.ModifiedDate,
                ModifiedBy    = paymentIn.ModifiedBy,
                Number        = paymentIn.Number
            };

            retVal.IsCancelled       = paymentIn.IsCancelled;
            retVal.Number            = paymentIn.Number;
            retVal.OperationType     = paymentIn.OperationType;
            retVal.OrganizationId    = paymentIn.OrganizationId;
            retVal.OrganizationName  = paymentIn.OrganizationName;
            retVal.OuterId           = paymentIn.OuterId;
            retVal.ParentOperationId = paymentIn.ParentOperationId;
            retVal.Purpose           = paymentIn.Purpose;
            retVal.Status            = paymentIn.Status;
            retVal.CapturedDate      = paymentIn.CapturedDate;
            retVal.AuthorizedDate    = paymentIn.AuthorizedDate;
            retVal.VoidedDate        = paymentIn.VoidedDate;
            retVal.OrderId           = paymentIn.OrderId;


            if (paymentIn.BillingAddress != null)
            {
                retVal.BillingAddress = paymentIn.BillingAddress.ToAddress();
            }

            if (paymentIn.DynamicProperties != null)
            {
                retVal.DynamicProperties = paymentIn.DynamicProperties.Select(ToDynamicProperty).ToList();
            }

            retVal.Sum = new Money(paymentIn.Sum ?? 0, currency);

            if (paymentIn.PaymentMethod != null)
            {
                retVal.GatewayCode       = paymentIn.PaymentMethod.Code;
                retVal.PaymentMethodType = paymentIn.PaymentMethod.PaymentMethodType;
            }
            return(retVal);
        }
예제 #4
0
        public static orderDto.PaymentIn ToOrderPaymentInDto(this PaymentIn payment)
        {
            var retVal = new orderDto.PaymentIn
            {
                CancelledDate = payment.CancelledDate,
                CancelReason  = payment.CancelReason,
                Comment       = payment.Comment,
                CustomerId    = payment.CustomerId,
                CustomerName  = payment.CustomerName,
                GatewayCode   = payment.GatewayCode,
                Id            = payment.Id,
                IncomingDate  = payment.IncomingDate,
                IsApproved    = payment.IsApproved,
                IsCancelled   = payment.IsCancelled,
                CreatedBy     = payment.CreatedBy,
                CreatedDate   = payment.CreatedDate,
                ModifiedDate  = payment.ModifiedDate,
                ModifiedBy    = payment.ModifiedBy,
                Number        = payment.Number
            };

            retVal.IsCancelled       = payment.IsCancelled;
            retVal.Number            = payment.Number;
            retVal.OperationType     = payment.OperationType;
            retVal.OrganizationId    = payment.OrganizationId;
            retVal.OrganizationName  = payment.OrganizationName;
            retVal.OuterId           = payment.OuterId;
            retVal.ParentOperationId = payment.ParentOperationId;
            retVal.Purpose           = payment.Purpose;
            retVal.Status            = payment.Status;

            retVal.Sum           = (double)payment.Sum.Amount;
            retVal.Currency      = payment.Currency.Code;
            retVal.PaymentStatus = payment.Status;

            if (payment.BillingAddress != null)
            {
                retVal.BillingAddress = payment.BillingAddress.ToOrderAddressDto();
            }

            if (payment.DynamicProperties != null)
            {
                retVal.DynamicProperties = payment.DynamicProperties.Select(ToOrderDynamicPropertyDto).ToList();
            }

            //if (payment.GatewayCode != null)
            //{
            //    var a = retVal.GatewayCode;
            //}

            return(retVal);
        }
예제 #5
0
        public virtual PaymentIn ToOrderInPayment(orderDto.PaymentIn paymentIn, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(paymentIn.Currency)) ?? new Currency(language, paymentIn.Currency);
            var retVal   = ServiceLocator.Current.GetInstance <OrderFactory>().CreatePaymentIn(currency);

            retVal.InjectFrom(paymentIn);

            if (paymentIn.DynamicProperties != null)
            {
                retVal.DynamicProperties = paymentIn.DynamicProperties.Select(ToDynamicProperty).ToList();
            }

            retVal.Sum = new Money(paymentIn.Sum ?? 0, currency);

            if (paymentIn.PaymentMethod != null)
            {
                retVal.GatewayCode = paymentIn.PaymentMethod.Code;
            }
            return(retVal);
        }
예제 #6
0
 public static PaymentIn ToOrderInPayment(this orderDto.PaymentIn paymentInDto, IEnumerable <Currency> availCurrencies, Language language)
 {
     return(OrderConverterInstance.ToOrderInPayment(paymentInDto, availCurrencies, language));
 }