public GetPaymentResponse GetPaymentByPaymentId(GetPaymentRequest req) { var res = new GetPaymentResponse(); try { long id = long.Parse(req.PaymentId); using (var container = new TransactionModelContainer()) { var payment = container.Payments .Include("PaymentItems") .FirstOrDefault(x => x.Id == id); if (payment == null) { throw new Exception("Payment is not found"); } res.SetPaymentResponse(payment); res.Succeed(); } } catch (Exception ex) { res.Fail(ex); CreateLog(ex); } return(res); }
public virtual Task <Payment> GetPaymentAsync(GetPaymentParam param) { if (param == null) { throw new ArgumentNullException(nameof(param)); } if (param.CustomerId == Guid.Empty) { throw new ArgumentException(GetMessageOfEmpty(nameof(param.CustomerId)), nameof(param)); } if (string.IsNullOrWhiteSpace(param.Scope)) { throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.Scope)), nameof(param)); } if (param.CultureInfo == null) { throw new ArgumentException(GetMessageOfNull(nameof(param.CultureInfo)), nameof(param)); } if (string.IsNullOrWhiteSpace(param.CartName)) { throw new ArgumentException(GetMessageOfNullWhiteSpace(nameof(param.CartName)), nameof(param)); } var getPaymentRequest = new GetPaymentRequest { CustomerId = param.CustomerId, CartName = param.CartName, ScopeId = param.Scope, CultureName = param.CultureInfo.Name, Id = param.PaymentId }; return(OvertureClient.SendAsync(getPaymentRequest)); }
/// <inheritdoc /> public async Task <GetPaymentResponse> GetPayment(GetPaymentRequest request) { var payment = await _paymentRepository.GetPaymentByPaymentId(request.PaymentId); return(new GetPaymentResponse(payment.CardHolderName, payment.LastFourDigitsOfCard, payment.Amount, payment.CurrencyCode)); }
public GetPaymentResponse GetPayment(string paymentId, GetPaymentRequest request) { var transaction = DataAccess.GetTransaction(paymentId); Console.WriteLine(paymentId); if (transaction == null) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid id")); } long tick = 1000000000000; DateTime date = new DateTime(tick); return(new GetPaymentResponse { //EmailAddress = transaction.Account.EmailAddress, EmailAddress = "*****@*****.**", ErrorMessage = null, PaymentDetail = new PaymentDetail { AccountNumber = "1234-1234-1234-1234", //BillingAddress = transaction.Account.PaymentInstrument.BillingAddress, BillingAddress = null, //Cvv = transaction.Account.PaymentInstrument.Cvv, Cvv = 0, //ExpirationDate = transaction.Account.PaymentInstrument.ExpirationDate, ExpirationDate = date, //Type = transaction.Account.PaymentInstrument.Type, //Type = null, }, //ShippingAddress = transaction.Account.ShippingAddress, ShippingAddress = null, State = transaction.State, }); }
public Task <GetPaymentResponse> GetPayment( [FromBody] GetPaymentRequest request) { return(_paymentsService.GetPayment(request)); }
public GetPaymentResponse GetPaymentByPaymentId(GetPaymentRequest req) { var res = new GetPaymentResponse(); try { long id = long.Parse(req.PaymentId); using (var container = new TransactionModelContainer()) { var payment = container.Payments .Include("PaymentItems") .FirstOrDefault(x => x.Id == id); if (payment == null) throw new Exception("Payment is not found"); res.SetPaymentResponse(payment); res.Succeed(); } } catch (Exception ex) { res.Fail(ex); CreateLog(ex); } return res; }