Ejemplo n.º 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
            });
        }
Ejemplo n.º 2
0
        public static CustomTrxDTO Entity2CustomTrxDto(this vw_SALE_OrderLinePayments entity)
        {
            var type = Utils.ParseEnum <BillingEnums.ePaymentTypes>(entity.PaymentTypeId.ToString());

            return(new CustomTrxDTO
            {
                LineId = entity.OrderLineId
                , PaymentId = entity.PaymentId
                , Amount = entity.Amount
                , Status = Utils.ParseEnum <BillingEnums.ePaymentStatuses>(entity.StatusId.ToString())
                , Currency = entity.Entity2BaseCurrencyDto()
                , Type = type
                , ScheduledDate = entity.ScheduledDate
            });
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public static ScheduledPaymentSummaryToken PaymentEntity2ScheduledPaymentSummaryToken(this vw_SALE_OrderLinePayments entity)
 {
     try
     {
         var pm = Utils.ParseEnum <BillingEnums.ePaymentMethods>(entity.PaymentMethodId);
         return(new ScheduledPaymentSummaryToken
         {
             LineId = entity.OrderLineId
             , PaymentId = entity.PaymentId
             , OrderNumber = entity.OrderNumber
             , OrderId = entity.OrderId
             , ItemName = entity.ItemName
             , Amount = entity.Amount
             , Number = entity.PaymentNumber
             , Status = Utils.ParseEnum <BillingEnums.ePaymentStatuses>(entity.StatusId.ToString())
             , Currency = entity.Entity2BaseCurrencyDto()
             , ScheduledDate = entity.ScheduledDate
             , PaymentMethod = pm
             , PaymentMethodName = Utils.GetEnumDescription(pm)
             , PaypalProfileID = entity.PaypalProfileID
             , PaymentInstrumentName = entity.DisplayName
             , AutoBill = !String.IsNullOrEmpty(entity.PaypalProfileID)
             , Buyer = new BaseUserInfoDTO
             {
                 UserId = entity.BuyerUserId
                 , FullName = entity.Entity2BuyerFullName()
                 , Email = entity.BuyerEmail
             }
             , Seller = new BaseUserInfoDTO
             {
                 UserId = entity.SellerUserId
                 , FullName = entity.Entity2SellerFullName()
                 , Email = entity.SellerEmail
             }
             , WebStore = entity.WebStoreId != null ? new BaseWebStoreDTO
             {
                 StoreId = (int)entity.WebStoreId
                 , TrackingID = entity.TrackingID
                 , Name = entity.StoreName
             } : new BaseWebStoreDTO()
         });
     }
     catch (Exception)
     {
         return(new ScheduledPaymentSummaryToken());
     }
 }