Esempio n. 1
0
 private static ProcessPaymentModel BuildPaymentModel(ProcessPaymentAPIModel paymentModel)
 {
     logger.Info("Building payment process model");
     return(new ProcessPaymentModel
     {
         MerchantId = paymentModel.MerchantId,
         Amount = paymentModel.Amount,
         CardNumber = EncryDecryMechanism.EncryptData(paymentModel.CardNumber, secretKey),
         CVV = paymentModel.CVV,
         Currency = paymentModel.Currency,
         ExpiryDate = paymentModel.ExpiryDate
     });
 }
Esempio n. 2
0
 private static Transaction BuildTransactionModel(ProcessPaymentModel processModel, ResponseModel response)
 {
     logger.Info("Build transaction models");
     return(new Transaction
     {
         TransactionId = response.TransactionID,
         MerchantId = processModel.MerchantId,
         CardNumber = EncryDecryMechanism.EncryptData(processModel.CardNumber, secretKey),
         CardExpiryDate = processModel.ExpiryDate,
         CardCurrency = processModel.Currency,
         Amount = processModel.Amount,
         TransactionDateTime = DateTime.Now,
         TransactionStatus = response.ResponseStatus
     });
 }
Esempio n. 3
0
        public async Task <List <TransactionAPIModel> > GetTransactions(Guid merchantId)
        {
            List <Transaction> transactions = new List <Transaction>();

            using (CheckOutPaymentGatewayEntities db = new CheckOutPaymentGatewayEntities())
            {
                transactions = await db.Transactions.Where(x => x.MerchantId == merchantId).ToListAsync();
            }

            return(transactions.Select(x => new TransactionAPIModel
            {
                Amount = x.Amount,
                CardExpiryDate = x.CardExpiryDate,
                MaskedCardNumber = PrepareMask(EncryDecryMechanism.DecryptData(x.CardNumber, secretKey)),
                CardCurrency = x.CardCurrency,
                TransactionStatus = x.TransactionStatus,
                TransactionDateTime = x.TransactionDateTime
            }).ToList());
        }