Ejemplo n.º 1
0
 private static Receipt CreateRefundReceipt(ProductReceiptEntity entity)
 {
     return(new RefundReceipt
     {
         Id = entity.id,
         Time = entity.externalTransactionTime,
         ExternalTransactionId = entity.externalTransactionId,
         ExternalTransactionTime = entity.externalTransactionTime,
     });
 }
Ejemplo n.º 2
0
        public static Receipt Map(this ProductReceiptEntity entity)
        {
            switch ((ReceiptType)entity.type)
            {
            case ReceiptType.CreditCard:
                return(CreateCreditCardReceipt(entity));

            default:
                return(CreateRefundReceipt(entity));
            }
        }
Ejemplo n.º 3
0
 private static Receipt CreateCreditCardReceipt(ProductReceiptEntity entity)
 {
     return(new CreditCardReceipt
     {
         Id = entity.id,
         Time = entity.externalTransactionTime,
         ExternalTransactionId = entity.externalTransactionId,
         ExternalTransactionTime = entity.externalTransactionTime,
         CreditCard = new CreditCardSummary
         {
             Pan = entity.creditCardPan,
             Type = (CreditCardType)entity.creditCardType,
         }
     });
 }
Ejemplo n.º 4
0
        public static ProductReceiptEntity Map(this Receipt receipt, Guid orderId)
        {
            var type   = GetReceiptType(receipt);
            var entity = new ProductReceiptEntity
            {
                id      = receipt.Id,
                orderId = orderId,
                time    = receipt.Time,
                externalTransactionId   = receipt.ExternalTransactionId,
                externalTransactionTime = receipt.ExternalTransactionTime,
                type = (int)type,
            };

            switch (type)
            {
            case ReceiptType.CreditCard:
                ((CreditCardReceipt)receipt).MapTo(entity);
                break;
            }

            return(entity);
        }
Ejemplo n.º 5
0
 private static void MapTo(this CreditCardReceipt receipt, ProductReceiptEntity entity)
 {
     entity.creditCardPan  = receipt.CreditCard.Pan;
     entity.creditCardType = (int?)receipt.CreditCard.Type;
 }