/// <summary> /// Make a subscriber purchase using Stripe /// </summary> /// <param name="input">Stripe input info</param> public Dtos.PaymentGatewayDtos.PaymentResponseDto MakeStripePurchase(Dtos.PaymentGatewayDtos.PaymentStripeDto input) { //Create Paypal payment gateway object var paymentGateway = new Dtos.PaymentGatewayDtos.PaymentGateway<Dtos.PaymentGatewayDtos.PaymentStripeDto, Dtos.PaymentGatewayDtos.StripePayment>(input); var paymentResponse = paymentGateway.MakePayment<Dtos.PaymentGatewayDtos.StripePayment>(); if (paymentResponse.MessageCode == "sale") { //Create PurchaseTransaction _subscriberPurchaseRepository.InsertAndGetId(new SubscriberPurchase() { Amount = input.Amount, InvoiceNumber = paymentResponse.Message, SubscriberRefId = input.SubscribersId.Value, PaymentGatewayType = "Stripe", TransactionType = paymentResponse.AuthCode, Response = paymentResponse.ResponseCode, Request = paymentResponse.TransactionId }); //Add Credits for Subscriber var subscriberCredits = AddSubscriberCredits(new CreateSubscribersCreditsInput() { Credits = input.Credits, SubscribersId = input.SubscribersId.Value }); } return paymentResponse; }
/// <summary> /// Make a subscriber purchase using Authorize.NET /// </summary> /// <param name="input">Authorize.NET input info</param> public Dtos.PaymentGatewayDtos.PaymentResponseDto MakeAuthorizationNetPurchase(Dtos.PaymentGatewayDtos.PaymentAuthorizeNetDto input) { //Create Authorize.NET payment gateway object var paymentGateway = new Dtos.PaymentGatewayDtos.PaymentGateway<Dtos.PaymentGatewayDtos.PaymentAuthorizeNetDto, Dtos.PaymentGatewayDtos.AuthorizeNetPayment>(input); //Make Payment Transaction var paymentResults = paymentGateway.MakePayment<Dtos.PaymentGatewayDtos.AuthorizeNetPayment>(); //Create PurchaseTransaction _subscriberPurchaseRepository.InsertAndGetId(new SubscriberPurchase() { Amount = input.Amount, InvoiceNumber = paymentResults.Message, SubscriberRefId = input.SubscribersId.Value, PaymentGatewayType = "AuthorizeNet", TransactionType = paymentResults.AuthCode, Response = paymentResults.ResponseCode, Request = paymentResults.TransactionId }); //Add Credits for Subscriber var subscriberCredits = AddSubscriberCredits(new CreateSubscribersCreditsInput() { Credits =input.Credits , SubscribersId = input.SubscribersId.Value}); return paymentResults; }