Beispiel #1
0
        public static PaymentDTO Entity2PaymentDto(this vw_SALE_OrderLinePayments entity)
        {
            var type = Utils.ParseEnum <BillingEnums.ePaymentTypes>(entity.PaymentTypeId.ToString());

            return(new PaymentDTO
            {
                OrderId = entity.OrderId
                , OrderNumber = entity.OrderNumber
                , ItemName = entity.ItemName
                , LineId = entity.OrderLineId
                , PaymentId = entity.PaymentId
                , Number = entity.PaymentNumber
                , Amount = entity.Amount
                , Fee = entity.Fee
                , Status = Utils.ParseEnum <BillingEnums.ePaymentStatuses>(entity.StatusId.ToString())
                , Currency = entity.Entity2BaseCurrencyDto()
                , Type = type
                , TypeName = Utils.GetEnumDescription(type)
                , ScheduledDate = entity.ScheduledDate
                , CompletedDate = entity.PaymentDate
                , IsRefundable = entity.IsPaymentRefundAllowed()
                , TotalRefunded = entity.TotalRefunded
                , AffiliateCommission = entity.AffiliateCommission
            });
        }
Beispiel #2
0
        public static PaymentViewDTO Entity2PaymentViewDto(this vw_SALE_OrderLinePayments entity)
        {
            var type = Utils.ParseEnum <BillingEnums.ePaymentTypes>(entity.PaymentTypeId.ToString());

            var token = new PaymentViewDTO
            {
                OrderId               = entity.OrderId
                , OrderNumber         = entity.OrderNumber
                , ItemName            = entity.ItemName
                , LineId              = entity.OrderLineId
                , PaymentId           = entity.PaymentId
                , Number              = entity.PaymentNumber
                , Amount              = entity.Amount
                , Fee                 = entity.Fee
                , Status              = Utils.ParseEnum <BillingEnums.ePaymentStatuses>(entity.StatusId.ToString())
                , Currency            = entity.Entity2BaseCurrencyDto()
                , Type                = type
                , TypeName            = Utils.GetEnumDescription(type)
                , ScheduledDate       = entity.ScheduledDate
                , CompletedDate       = entity.PaymentDate
                , OrderDate           = entity.OrderDate
                , IsRefundable        = entity.IsPaymentRefundAllowed()
                , TotalRefunded       = entity.TotalRefunded
                , TrxId               = entity.ExternalTransactionID
                , AffiliateCommission = entity.AffiliateCommission
                , Buyer               = new BaseUserInfoDTO
                {
                    UserId     = entity.BuyerUserId
                    , Email    = entity.BuyerEmail
                    , FullName = entity.Entity2BuyerFullName()
                }
                , Seller = new BaseUserInfoDTO
                {
                    UserId     = entity.SellerUserId
                    , Email    = entity.SellerEmail
                    , FullName = entity.Entity2SellerFullName()
                }
                , StoreOwner = entity.StoreOwnerUserId != null ? new BaseUserInfoDTO {
                    UserId = (int)entity.StoreOwnerUserId, FullName = entity.Entity2StoreOwnerFullName()
                } : new BaseUserInfoDTO {
                    FullName = string.Empty, UserId = -1
                }
            };

            token.Commission = token.Amount.ToLfeCommission(token.Fee ?? 0, token.TotalRefunded);
            token.Payout     = token.Amount.ToPayout(token.Fee ?? 0, (decimal)token.Commission, token.TotalRefunded);
            return(token);
        }