/// <summary> /// Execute Action has switch case to execute appropriate action based on Payment type /// </summary> /// <param name="type">Enum value of the selected payment type</param> public void ExecuteAction(PaymentForOrder type) { switch (type) { case PaymentForOrder.PhysicalProduct: GeneratePackingSlip(1); break; case PaymentForOrder.Book: GenerateDuplicatePackingSlip(1); break; case PaymentForOrder.Membership: ActivateMembership(1); break; case PaymentForOrder.Upgrade: UpgradeMembership(1); break; case PaymentForOrder.MembershipUpgrade: NotifyOwnerForMembershipOrUpgrade(PaymentForOrder.MembershipUpgrade); break; case PaymentForOrder.LearningtoSki: AddFirstAidVideotoPackingSlip(PaymentForOrder.LearningtoSki); break; case PaymentForOrder.PhysicalProductBook: GenerateCommisionPaymentForAgent(PaymentForOrder.PhysicalProductBook); break; } }
public void ExecuteAction() { string paymentType = "Book"; PaymentForOrder foo = (PaymentForOrder)Enum.Parse(typeof(PaymentForOrder), paymentType); sut.ExecuteAction(foo); mock.Verify(x => x.PackingSlipRepository.GetAllAsync(), Times.Never); }
public async Task <IActionResult> Post([FromBody] string type) { try { PaymentForOrder paymentOrder = (PaymentForOrder)Enum.Parse(typeof(PaymentForOrder), type); _businessRuleEngineService.ExecuteAction(paymentOrder); return(Ok()); } catch (Exception ex) { return(CustomResponse(ex, null, "Could not execute the Rule. Please try again later or contact the administrator")); } }
/// <summary> /// AddFirstAidVideotoPackingSlip method has logic to add firstadidvideo to packing Slip /// </summary> /// <param name="type"></param> public void AddFirstAidVideotoPackingSlip(PaymentForOrder type) { // Method intentionally left empty. PackingSlip pckslip = new PackingSlip() { PackingSlipId = System.Guid.NewGuid(), OrderId = 1, AddressDetails = "Test Address", ShippedItemDetails = new PaymentItem() { ItemId = 2, ItemName = "First Aid", Price = 0 } }; PackingSlipResponseContext taskReponseContext = new PackingSlipResponseContext { PackingSlipDetails = pckslip }; }
/// <summary> /// Method to Generate the Commision for Agent /// </summary> /// <param name="type"></param> public void GenerateCommisionPaymentForAgent(PaymentForOrder type) { // Method intentionally left empty. }
/// <summary> /// NotifyOwnerForMembershipOrUpgrade method has logic to notify Owner and upgrade membership /// </summary> /// <param name="type"></param> public void NotifyOwnerForMembershipOrUpgrade(PaymentForOrder type) { // Method intentionally left empty. }