/// <summary> /// Add Order Payment Details /// </summary> /// <param name="orderPaymentDetail"></param> /// <returns></returns> public bool AddOrderPaymentDetails(OrderPaymentDetail orderPaymentDetail) { try { _context.OrderPaymentDetails.Add(orderPaymentDetail); _context.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public void Handle(PayPalExpressCheckoutPaymentInitiated @event) { using (var context = _contextFactory.Invoke()) { var detail = new OrderPaymentDetail { PaymentId = @event.SourceId, Amount = @event.Amount, Meter = @event.Meter, Tax = @event.Tax, Tip = @event.Tip, OrderId = @event.OrderId, PayPalToken = @event.Token, Provider = PaymentProvider.PayPal, Type = PaymentType.PayPal }; context.Save(detail); } }
public static SendReceipt GetSendReceiptCommand(OrderDetail order, AccountDetail account, int?orderId, string vehicleNumber, DriverInfos driverInfos, double?fare, double?toll, double?extra, double?surcharge, double?bookingFees, double?tip, double?tax, OrderPaymentDetail orderPayment = null, double?amountSavedByPromotion = null, PromotionUsageDetail promotionUsed = null, CreditCardDetails creditCard = null, SendReceipt.CmtRideLinqReceiptFields cmtRideLinqFields = null) { var command = new SendReceipt { Id = Guid.NewGuid(), OrderId = order.Id, EmailAddress = account.Email, IBSOrderId = orderId ?? 0, PickupDate = order.PickupDate, UtcDropOffDate = order.DropOffDate, VehicleNumber = vehicleNumber, DriverInfos = driverInfos, Fare = fare.GetValueOrDefault(), Extra = extra.GetValueOrDefault(), Tip = tip.GetValueOrDefault(), Tax = tax.GetValueOrDefault(), Toll = toll.GetValueOrDefault(), Surcharge = surcharge.GetValueOrDefault(), BookingFees = bookingFees.GetValueOrDefault(), PickupAddress = order.PickupAddress, DropOffAddress = order.DropOffAddress, ClientLanguageCode = order.ClientLanguageCode, CmtRideLinqFields = cmtRideLinqFields }; if (promotionUsed != null) { command.AmountSavedByPromotion = amountSavedByPromotion.GetValueOrDefault(); command.PromoCode = promotionUsed.Code; command.PromoDiscountType = promotionUsed.DiscountType; command.PromoDiscountValue = promotionUsed.DiscountValue; } if (orderPayment != null) { command.PaymentInfo = new SendReceipt.Payment( orderPayment.Amount, orderPayment.TransactionId, orderPayment.AuthorizationCode, orderPayment.Type == PaymentType.CreditCard ? "Credit Card" : orderPayment.Type.ToString()); if ((orderPayment.CardToken.HasValue()) && (creditCard != null)) { command.PaymentInfo.Last4Digits = creditCard.Last4Digits; command.PaymentInfo.Company = creditCard.CreditCardCompany; command.PaymentInfo.NameOnCard = creditCard.NameOnCard; command.PaymentInfo.ExpirationMonth = creditCard.ExpirationMonth; command.PaymentInfo.ExpirationYear = creditCard.ExpirationYear; } } return(command); }