public RedirectResult Create(PaymentDetails payementDetails)
        {
            Api.Data.Entities.Card card = RetrieveCard(payementDetails);


            //cardRepository.SaveCard(card);
            //cardRepository.Commit();

            Api.Data.Entities.Customer customer = new Api.Data.Entities.Customer
            {
                cardId = card.Id,
                Name   = payementDetails.Lastname + ", " + payementDetails.Firstname
            };



            //customerRepository.SaveCustomer(customer);
            //customerRepository.Commit();

            PaymentData payment = new PaymentData()
            {
                Order    = orderRepository.GetById(int.Parse(payementDetails.TransactionId)),
                Customer = customer
            };

            //paymentRepository.SavePayment(payment);
            //paymentRepository.Commit();

            PaymentApiModel pam = new PaymentApiModel(card, payment, customer);

            var requestResult = CreatePaymentRequest(pam);



            //ajouter une loguique de réussite ou de rejet du payment
            //manipuler le paymentDetails pour voir si ca marche
            bool result = Validate(payementDetails);
            var  rnd    = new Random();
            int  val    = rnd.Next(6);



            //Si le payment réussi, alors on renvoi vers l'écran de réussite
            if (result && val <= 3)
            {
                return(Redirect(successUrl));
            }
            else
            {
                return(Redirect(failureUrl));
            }
        }
        private Api.Data.Entities.Card RetrieveCard(PaymentDetails payementDetails)
        {
            string month   = payementDetails.ExpirationDate.Month.ToString();
            string year    = payementDetails.ExpirationDate.Year.ToString();
            string expDate = month + "/" + year;

            if (cardRepository.GetByCredentials(payementDetails.Lastname, payementDetails.SecurityNumber.ToString(), payementDetails.CardNumber.ToString()) == null)
            {
                Api.Data.Entities.Card card = new Api.Data.Entities.Card
                {
                    cardholderName = payementDetails.Lastname,
                    cardNumber     = payementDetails.CardNumber.ToString(),
                    cvv            = payementDetails.SecurityNumber.ToString(),
                    expiryDate     = expDate
                };
                return(card);
            }
            else
            {
                return(cardRepository.GetByCredentials(payementDetails.Lastname, payementDetails.SecurityNumber.ToString(), payementDetails.CardNumber.ToString()));
            }
        }