Beispiel #1
0
        public PaymentResponse CreatePayment(TemporaryTransaction temporaryTransaction)
        {
            using (var contex = new CheckoutDBContext(_connectionString))
            {
                contex.TemporaryTransaction.Attach(temporaryTransaction);
                contex.Entry(temporaryTransaction).State = EntityState.Added;
                contex.SaveChanges();
            }

            PaymentResponse paymentResponse = temporaryTransaction.ToPaymentResponse();

            paymentResponse.CheckoutUrl = Tools.GetCheckoutUrl(_configuration, temporaryTransaction.TransctionCode);

            return(paymentResponse);
        }
Beispiel #2
0
 public static PaymentResponse ToPaymentResponse(this TemporaryTransaction value)
 {
     return(new PaymentResponse()
     {
         Amount = value.Amount,
         CustomerId = value.CustomerId,
         Description = value.Description,
         Locale = value.Locale,
         MandateId = value.MandateId,
         Metadata = value.Metadata,
         RedirectUrl = value.RedirectUrl,
         WebhookUrl = value.WebhookUrl,
         PaymentSequenceType = value.SequenceType ?? PaymentSequenceType.FirstPayment,
         TransctionCode = value.TransctionCode,
         PaymentStatus = value.PaymentStatus,
         CreateDateTime = value.InsertDate
     });
 }