public static PaymentIn ToWebModel(this VirtoCommerceOrderModuleWebModelPaymentIn paymentIn, IEnumerable<Currency> availCurrencies, Language language)
        {
            var webModel = new PaymentIn();

            var currency = availCurrencies.FirstOrDefault(x => x.Equals(paymentIn.Currency)) ?? new Currency(language, paymentIn.Currency);

            webModel.InjectFrom(paymentIn);

            if (paymentIn.ChildrenOperations != null)
            {
                webModel.ChildrenOperations = paymentIn.ChildrenOperations.Select(co => co.ToWebModel(availCurrencies, language)).ToList();
            }

            webModel.Currency = currency;

            if (paymentIn.DynamicProperties != null)
            {
                webModel.DynamicProperties = paymentIn.DynamicProperties.Select(dp => dp.ToWebModel()).ToList();
            }

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

            return webModel;
        }
        public static PaymentIn ToWebModel(this VirtoCommerceOrderModuleWebModelPaymentIn paymentIn)
        {
            var webModel = new PaymentIn();

            var currency = new Currency(EnumUtility.SafeParse(paymentIn.Currency, CurrencyCodes.USD));

            webModel.InjectFrom(paymentIn);

            if (paymentIn.ChildrenOperations != null)
            {
                webModel.ChildrenOperations = paymentIn.ChildrenOperations.Select(co => co.ToWebModel()).ToList();
            }

            webModel.Currency = currency;

            if (paymentIn.DynamicProperties != null)
            {
                webModel.DynamicProperties = paymentIn.DynamicProperties.Select(dp => dp.ToWebModel()).ToList();
            }

            webModel.Sum = new Money(paymentIn.Sum ?? 0, currency.Code);
            webModel.Tax = new Money(paymentIn.Tax ?? 0, currency.Code);

            return webModel;
        }
Example #3
0
        public virtual Transaction ToLiquidTransaction(StorefrontModel.PaymentIn payment)
        {
            var result = new Transaction();

            result.Amount         = payment.Sum.Amount * 100;
            result.CreatedAt      = payment.CreatedDate ?? default(DateTime);
            result.Gateway        = payment.GatewayCode;
            result.Id             = payment.Id;
            result.Kind           = payment.OperationType;
            result.Name           = payment.Number;
            result.Receipt        = payment.OuterId;
            result.Status         = payment.Status;
            result.StatusLabel    = payment.Status;
            result.PaymentDetails = payment.Purpose;
            return(result);
        }
Example #4
0
        public virtual Transaction ToLiquidTransaction(StorefrontModel.PaymentIn payment)
        {
            var factory = ServiceLocator.Current.GetInstance <ShopifyModelFactory>();
            var result  = factory.CreateTransaction();

            result.Amount         = payment.Sum.Amount * 100;
            result.CreatedAt      = payment.CreatedDate ?? default(DateTime);
            result.Gateway        = payment.GatewayCode;
            result.Id             = payment.Id;
            result.Kind           = payment.OperationType;
            result.Name           = payment.Number;
            result.Receipt        = payment.OuterId;
            result.Status         = payment.Status;
            result.StatusLabel    = payment.Status;
            result.PaymentDetails = payment.Purpose;
            return(result);
        }
Example #5
0
        public static Transaction ToShopifyModel(this StorefrontModel.PaymentIn payment)
        {
            var converter = ServiceLocator.Current.GetInstance <ShopifyModelConverter>();

            return(converter.ToLiquidTransaction(payment));
        }
Example #6
0
        public static Transaction ToShopifyModel(this StorefrontModel.PaymentIn payment)
        {
            var converter = new ShopifyModelConverter();

            return(converter.ToLiquidTransaction(payment));
        }