internal DataCenterService(Authentication authentication, IServiceInvoker serviceInvoker, GroupService groupService, AccountService accountService, BillingService billingService) : base(authentication, serviceInvoker) { this.groupService = groupService; this.accountService = accountService; this.billingService = billingService; }
public void WhenABillIsRequested_ThenABillShouldBeReturned() { // Arrange var id = 1; var bill = new Bill { CallCharges = new CallCharges { Calls = new List<Call> { new Call { Called = string.Empty, Cost = 0.00, Duration = string.Empty } } }, Package = new Package { Subscriptions = new List<Subscription> { new Subscription { Type = string.Empty, Cost = 0.00, Name = string.Empty } } }, SkyStore = new SkyStore { BuyAndKeeps = new List<BuyAndKeep> { new BuyAndKeep { Cost = 0.00, Title = string.Empty } } }, Statement = new Statement { Due = DateTime.Now, Generated = DateTime.Now, Period = new Period { From = DateTime.Now, To = DateTime.Now } }, Total = 0.00 }; var validator = Substitute.For<IValidator<BillValidator>>(); validator.Validate(bill).Returns(new ValidationResult { }); var _billingRepository = Substitute.For<IBillingRepository>(); _billingRepository.Get(id) .Returns(bill); var _billingService = new BillingService(_billingRepository, validator); // Act var actual = _billingService.Get(id); //Assert Assert.NotNull(actual); }
public void GetBill_calls_BillingApi_correctly() { // arrange var mockBillingApi = new Mock<IBillingApi>(MockBehavior.Strict); mockBillingApi.Setup(x => x.GetBill()).Returns(new Bill()); var billingService = new BillingService(mockBillingApi.Object); // act billingService.GetBill(); // assert mockBillingApi.Verify(x => x.GetBill(), Times.Once); }
private static void Billing(IPercentageDiscount percentageDiscount) { var billingService = new BillingService(percentageDiscount, new BillDiscount()); billingService.AddItem(new OtherItem { Name = "Laptop", Price = 50000 }); billingService.AddItem(new OtherItem { Name = "Mobile", Price = 20000 }); billingService.AddItem(new GroceryItem { Name = "Rice", Price = 1000 }); Console.WriteLine(billingService.PrintBill()); }
public async Task BillingService_Us_ShouldBeAddInvoiceWithoutPeriodicityProperty_WhenClientIsPrepaid() { var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var billingMappers = new List <IBillingMapper> { new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations), }; var slackServiceMock = new Mock <ISlackService>(); slackServiceMock.Setup(x => x.SendNotification(It.IsAny <string>())).Returns(Task.CompletedTask); var queuingServiceMock = new Mock <IQueuingService>(); var billingValidations = new List <IBillingValidation> { new BillingForUsValidation(Mock.Of <ILogger <BillingForUsValidation> >()) }; var billingService = new BillingService(queuingServiceMock.Object, Mock.Of <IDateTimeProvider>(), Mock.Of <ILogger <BillingService> >(), slackServiceMock.Object, billingMappers, billingValidations, Mock.Of <ISapServiceSettingsFactory>()); var billingRequestList = new List <BillingRequest> { new BillingRequest { Id = 1, BillingSystemId = 2, FiscalID = "123", Periodicity = null, PlanFee = 15 } }; await billingService.CreateBillingRequest(billingRequestList); queuingServiceMock.Verify(x => x.AddToTaskQueue( It.Is <SapTask>(y => y.BillingRequest.DocumentLines.FirstOrDefault().FreeText == "$ 15")), Times.Once); }
public void GivenIOrderTwoStartersTwoMains() { List <Item> items = new List <Item>() { new Item("Vegetable Gyoza", ItemType.Starter), new Item("Veg Spring Rolls", ItemType.Starter), new Item("Tofu Pad Thai", ItemType.Mains), new Item("Vegetable Katsu Curry", ItemType.Mains), }; IBillingService billingService = new BillingService(); var order = billingService.AddOrder(items); _orderContext.order = order; _orderContext.billingService = billingService; }
private void orderDeleteButton_Click(object sender, RoutedEventArgs e) { BillingOperation order = (BillingOperation)billingDataGrid.SelectedItem; if (order != null) { BillingService billingService = new BillingService(); if (MessageBox.Show("Are you want to Delete ?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { billingService.DeleteOrder(order.OrderId); } LoadData(); } }
public AdvanceBookingBilling(Entity.Booking booking) { InitializeComponent(); getCategoryId(); bookingIdBlock.Text = booking.BookingNo; bookingDateBlock.Text = Convert.ToString(booking.BookingDate); tableNoBlock.Text = booking.TableNo; customerNameBlock.Text = booking.CustomerName; contactBlock.Text = booking.Phone; advanceBlock.Text = Convert.ToString(booking.Advance); if (this.IsLoaded == false) { BillingService bs = new BillingService(); bs.TruncateOrder(); } }
public async Task BillingService_ShouldBeReturnInvoice_WhenTheRequestIsValid() { var invoiceId = 1; var billingSystemId = 2; var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var billingMappers = new List <IBillingMapper> { new BillingForArMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations), new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations) }; var sapTaskHandlerMock = new Mock <ISapTaskHandler>(); sapTaskHandlerMock.Setup(x => x.TryGetInvoiceByInvoiceIdAndOrigin(It.IsAny <int>(), It.IsAny <string>())) .ReturnsAsync(new SapSaleOrderInvoiceResponse { BillingSystemId = billingSystemId, CardCode = "CD001", DocEntry = 1 }); var sapServiceSettingsFactoryMock = new Mock <ISapServiceSettingsFactory>(); sapServiceSettingsFactoryMock.Setup(x => x.CreateHandler("US")).Returns(sapTaskHandlerMock.Object); var billingService = new BillingService(Mock.Of <IQueuingService>(), Mock.Of <IDateTimeProvider>(), Mock.Of <ILogger <BillingService> >(), Mock.Of <ISlackService>(), billingMappers, null, sapServiceSettingsFactoryMock.Object); var response = await billingService.GetInvoiceByDopplerInvoiceIdAndOrigin(billingSystemId, invoiceId, "doppler"); Assert.NotNull(response); Assert.Equal(billingSystemId, response.BillingSystemId); Assert.Equal("CD001", response.CardCode); Assert.Equal(1, response.DocEntry); sapTaskHandlerMock.Verify(x => x.TryGetInvoiceByInvoiceIdAndOrigin(invoiceId, "doppler"), Times.Once); }
private void printButton_Click(object sender, RoutedEventArgs e) { PrintDialog printDlg = new PrintDialog(); FlowDocument doc = CreateFlowDocument(); doc.Name = "FlowDoc"; IDocumentPaginatorSource idpSource = doc; printDlg.PrintDocument(idpSource.DocumentPaginator, "Billing"); BillingOperation Bo = new BillingOperation(billingNo.Text, customerName.Text, Convert.ToDateTime(billingDate.Text), tableNo.Text, contact.Text, Convert.ToDouble(subTotal.Text), Convert.ToDouble(serviceTax.Text), Convert.ToDouble(vat.Text), Convert.ToDouble(discount.Text), Total); BillingService bs = new BillingService(); bs.AddBilling(Bo); bs.TruncateOrder(); this.Close(); }
public async Task BillingService_ShouldBeAddOneTaskInQueue_WhenBillingRequestListHasOneInvalidCountryCodeElement() { var sapConfigMock = new Mock <IOptions <SapConfig> >(); var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var dateTimeProviderMock = new Mock <IDateTimeProvider>(); dateTimeProviderMock.Setup(x => x.UtcNow) .Returns(new DateTime(2019, 09, 25)); var billingMappers = new List <IBillingMapper> { new BillingForArMapper(Mock.Of <ISapBillingItemsService>(), dateTimeProviderMock.Object, timeZoneConfigurations), new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), dateTimeProviderMock.Object, timeZoneConfigurations) }; var slackServiceMock = new Mock <ISlackService>(); slackServiceMock.Setup(x => x.SendNotification(It.IsAny <string>())).Returns(Task.CompletedTask); var queuingServiceMock = new Mock <IQueuingService>(); var billingService = new BillingService(queuingServiceMock.Object, dateTimeProviderMock.Object, Mock.Of <ILogger <BillingService> >(), slackServiceMock.Object, billingMappers, null); var billingRequestList = new List <BillingRequest> { new BillingRequest { BillingSystemId = 16, FiscalID = "123" } }; await billingService.CreateBillingRequest(billingRequestList); queuingServiceMock.Verify(x => x.AddToTaskQueue(It.IsAny <SapTask>()), Times.Never); slackServiceMock.Verify(x => x.SendNotification(It.IsAny <string>()), Times.Once); }
protected void btnProcessResult_Click(object sender, EventArgs e) { try { string fileName = Server.MapPath("~/Temp/") + fupResultFile.FileName; fupResultFile.SaveAs(fileName); int count = BillingService.ProcessBillingUnpaidInvoice(fileName); ScriptManager.RegisterStartupScript(this, this.GetType(), "_alert", String.Format("alert('{0} accepted invoice(s) are successfully processed');", count), true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "_alert", "alert('" + ex.Message + "');", true); } }
public string GetPriceString(CocoStoreID id, bool useISOCurrencySymbol = false) { var itemData = StoreConfigData.GetItemData(id); if (itemData == null) { return(string.Empty); } if (!useISOCurrencySymbol) { return(BillingService.GetLocalizedPriceString(itemData.Key)); } var symbol = BillingService.GetISOCurrencySymbol(itemData.Key); return(string.Format("{0} {1}", symbol, BillingService.GetPriceInLocalCurrency(itemData.Key))); }
public async Task BillingService_ShouldBeNotAddOneTaskInQueue_WhenUpdateBillingRequestHasOneInvalidElement() { var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var dateTimeProviderMock = new Mock <IDateTimeProvider>(); dateTimeProviderMock.Setup(x => x.UtcNow) .Returns(new DateTime(2019, 09, 25)); var billingMappers = new List <IBillingMapper> { new BillingForArMapper(Mock.Of <ISapBillingItemsService>(), dateTimeProviderMock.Object, timeZoneConfigurations), new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), dateTimeProviderMock.Object, timeZoneConfigurations) }; var slackServiceMock = new Mock <ISlackService>(); slackServiceMock.Setup(x => x.SendNotification(It.IsAny <string>())).Returns(Task.CompletedTask); var queuingServiceMock = new Mock <IQueuingService>(); var billingService = new BillingService(queuingServiceMock.Object, dateTimeProviderMock.Object, Mock.Of <ILogger <BillingService> >(), slackServiceMock.Object, billingMappers, null, Mock.Of <ISapServiceSettingsFactory>()); var updateBillingRequestList = new UpdatePaymentStatusRequest { BillingSystemId = 9, InvoiceId = 0 }; await billingService.UpdatePaymentStatus(updateBillingRequestList); queuingServiceMock.Verify(x => x.AddToTaskQueue(It.IsAny <SapTask>()), Times.Never); slackServiceMock.Verify(x => x.SendNotification(It.IsAny <string>()), Times.Once); }
protected void btnProcess_Click(object sender, EventArgs e) { try { string[] invoices = gvwMaster.Rows.Cast <GridViewRow>().Where(row => (row.Cells[row.Cells.Count - 1].Controls[1] as CheckBox).Checked).Select(row => row.Cells[0].Text).ToArray(); string fileName = BillingService.GenerateBillingUnpaidInvoice( Convert.ToInt32(ddlBranch.SelectedValue), invoices, Server.MapPath("~/billing/")); litResult.Text = String.Format("Billing result file <b><a target='_new' href='{0}'>{1}</a></b>", this.ResolveClientUrl("~/billing/" + fileName), fileName); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "_alert", "alert('" + ex.Message + "');", true); } }
public async Task BillingService_ShouldBeAddThreeTasksInQueue_WhenListHasOneValidElementWithFridayDay() { var sapConfigMock = new Mock <IOptions <SapConfig> >(); var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var dateTimeProviderMock = new Mock <IDateTimeProvider>(); dateTimeProviderMock.Setup(x => x.UtcNow) .Returns(new DateTime(2020, 12, 04)); var billingMappers = new List <IBillingMapper> { new BillingForArMapper(Mock.Of <ISapBillingItemsService>(), dateTimeProviderMock.Object, timeZoneConfigurations), new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), dateTimeProviderMock.Object, timeZoneConfigurations) }; var queuingServiceMock = new Mock <IQueuingService>(); var billingService = new BillingService(queuingServiceMock.Object, dateTimeProviderMock.Object, Mock.Of <ILogger <BillingService> >(), Mock.Of <ISlackService>(), billingMappers, null); var currencyList = new List <CurrencyRateDto> { new CurrencyRateDto { SaleValue = 3, CurrencyCode = "ARS", CurrencyName = "Pesos Argentinos", Date = DateTime.UtcNow } }; await billingService.SendCurrencyToSap(currencyList); queuingServiceMock.Verify(x => x.AddToTaskQueue(It.IsAny <SapTask>()), Times.Exactly(3)); }
public OrdersController(CategoryRepository categoryRepository, UserRepository userRepository, SubcategoryRepository subcategoryRepository, OrdersRepository ordersRepository, AssetRepository assetRepository, TaskRepository taskRepository, ReviewRepository reviewRepository, UserService userService, UserResponseHistoryRepository userResponseHistoryRepository, ViewCounterService viewCounterService, BillingService billingService, GigbucketDbContext dbContext) { _categoryRepository = categoryRepository; _userRepository = userRepository; _subcategoryRepository = subcategoryRepository; _ordersRepository = ordersRepository; _assetRepository = assetRepository; _taskRepository = taskRepository; _reviewRepository = reviewRepository; _userService = userService; _userResponseHistoryRepository = userResponseHistoryRepository; _viewCounterService = viewCounterService; _billingService = billingService; _dbContext = dbContext; }
public async Task BillingService_ShouldBeReturnNull_WhenInvoiceNotExistInSap() { var invoiceId = 1; var billingSystemId = 2; var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var billingMappers = new List <IBillingMapper> { new BillingForArMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations), new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations) }; var sapTaskHandlerMock = new Mock <ISapTaskHandler>(); sapTaskHandlerMock.Setup(x => x.TryGetInvoiceByInvoiceIdAndOrigin(invoiceId, "doppler")) .ReturnsAsync((SapSaleOrderInvoiceResponse)null); var sapServiceSettingsFactoryMock = new Mock <ISapServiceSettingsFactory>(); sapServiceSettingsFactoryMock.Setup(x => x.CreateHandler("US")).Returns(sapTaskHandlerMock.Object); var billingService = new BillingService(Mock.Of <IQueuingService>(), Mock.Of <IDateTimeProvider>(), Mock.Of <ILogger <BillingService> >(), Mock.Of <ISlackService>(), billingMappers, null, sapServiceSettingsFactoryMock.Object); var response = await billingService.GetInvoiceByDopplerInvoiceIdAndOrigin(billingSystemId, invoiceId, "doppler"); Assert.Null(response); sapTaskHandlerMock.Verify(x => x.TryGetInvoiceByInvoiceIdAndOrigin(invoiceId, "doppler"), Times.Once); }
public DependencyInjector() { _container = new UnityContainer(); ILogService _ILogService = LogServiceProviderManager.getDefaultProvider(); IBdConsulta1Repository _IBdConsulta1Repository = new BdConsulta1RepositoryStoredProcedures(_ILogService); IBillingRepository _IBillingRepository = new BillingRepositoryStoredProcedures(_ILogService); IBdSolicitudServicioRepository _IBdSolicitudServicioRepository = new BdSolicitudServicioRepositoryStoredProcedures(_ILogService); IIFSRepository _IIFSRepository = new IFSDocumentosRepositoryFile(_ILogService); IIFSRepository _IFSRepositoryToSync1 = new IFSFCNCRepositoryFile(_ILogService); IN4Repository _IN4Repository = new N4RepositoryStoredProcedure(_ILogService); IBdConsulta1Service _IBdConsulta1Service = new BdConsulta1Service(_IBdConsulta1Repository, _ILogService); IN4Service _IN4Service = new N4Service(_IN4Repository, _ILogService); IBillingService _IBillingService = new BillingService(_IBillingRepository, _ILogService); IMappingService _IMappingService = new MappingService(_ILogService); IBdSolicitudServicioService _IBdSolicitudServicioService = new BdSolicitudServicioService(_IBdSolicitudServicioRepository, _ILogService); IIFSService _IIFSService = new IFSService(_IIFSRepository, new List <IIFSRepository>() { _IFSRepositoryToSync1 }, _ILogService); IJob _IProcess = new IFSDocsN4Process(_IBdConsulta1Service, _IBdSolicitudServicioService, _IN4Service, _IBillingService, _IIFSService, _IMappingService, _ILogService); _container.RegisterInstance <IBdConsulta1Repository>(_IBdConsulta1Repository); _container.RegisterInstance <IBillingRepository>(_IBillingRepository); _container.RegisterInstance <IN4Repository>(_IN4Repository); _container.RegisterInstance <ILogService>(_ILogService); _container.RegisterInstance <IMappingService>(_IMappingService); _container.RegisterInstance <IN4Service>(_IN4Service); _container.RegisterInstance <IBillingService>(_IBillingService); _container.RegisterInstance <IBdConsulta1Service>(_IBdConsulta1Service); _container.RegisterInstance <IIFSService>(_IIFSService); _container.RegisterInstance <IJob>(_IProcess); }
public BitGoClient(BitGoNetwork network, string token = null) { _network = network; _baseUrl = new Uri(network == BitGoNetwork.Main ? MainBaseUrl : TestBaseUrl); if (!string.IsNullOrEmpty(token)) { _token = ConvertToSecureString(token); } _sjcl = new SjclManaged(); Keychains = new KeychainService(this); Wallets = new WalletService(this); WalletAddresses = new WalletAddressService(this); User = new UserService(this); Labels = new LabelService(this); Market = new MarketService(this); Transactions = new TransactionService(this); Instant = new InstantService(this); Billing = new BillingService(this); Webhooks = new WebhookService(this); PendingApprovals = new PendingApprovalService(this); }
public Billing() { InitializeComponent(); getCategoryId(); billingDate.SelectedDate = DateTime.Now.Date; String query = "Select COUNT(BILLINGNO) from Billing"; SqlDataReader reader = DataAccess.GetData(query); reader.Read(); BillingOperation bl = new BillingOperation(reader.GetInt32(0)); billingNo.Text = bl.BillingNo; if (this.IsLoaded == false) { BillingService bs = new BillingService(); bs.TruncateOrder(); } priceTextBox.IsEnabled = false; menuComboBox.IsEnabled = false; NextButton1.IsEnabled = false; quantityTextBox.IsEnabled = false; AddButton.IsEnabled = false; }
public BillingServiceTest() { this.client = ModelFakers.ClientFaker.Generate(1)[0]; this.clientService = new Mock <IClientService>(); var billRepository = new Mock <IBillRepository>(); billRepository.Setup(x => x.Create(It.IsAny <Bill>())).Returns((Bill a) => a); this.clientService .Setup(x => x.GetClient(this.client.Id)) .Returns(this.client); this.clientService .Setup(x => x.GetNationalCost(It.IsAny <Client>(), It.IsAny <Months>(), It.IsAny <int>())) .Returns(10); this.clientService .Setup(x => x.GetInternationalCost(It.IsAny <Client>(), It.IsAny <Months>(), It.IsAny <int>())) .Returns(10); this.clientService .Setup(x => x.GetLocalCost(It.IsAny <Client>(), It.IsAny <Months>(), It.IsAny <int>())) .Returns(10); this.billService = new BillingService(this.clientService.Object, billRepository.Object); }
public async Task BillingService_ShouldBeAddOneTaskInQueue_WhenUpdateCreditNotePaymentStatusRequestHasValidElement() { var billingValidations = new List <IBillingValidation> { new BillingForArValidation(Mock.Of <ILogger <BillingForArValidation> >()), new BillingForUsValidation(Mock.Of <ILogger <BillingForUsValidation> >()) }; var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var billingMappers = new List <IBillingMapper> { new BillingForArMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations), new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations) }; var queuingServiceMock = new Mock <IQueuingService>(); var billingService = new BillingService(queuingServiceMock.Object, Mock.Of <IDateTimeProvider>(), Mock.Of <ILogger <BillingService> >(), Mock.Of <ISlackService>(), billingMappers, billingValidations, Mock.Of <ISapServiceSettingsFactory>()); var updateCreditNotePaymentStatusRequest = new UpdateCreditNotePaymentStatusRequest { BillingSystemId = 2, Type = 2, CreditNoteId = 1 }; await billingService.UpdateCreditNotePaymentStatus(updateCreditNotePaymentStatusRequest); queuingServiceMock.Verify(x => x.AddToTaskQueue(It.IsAny <SapTask>()), Times.Once); }
public async Task BillingService_ShouldBeNotAddOneTaskInQueue_WhenCreateCreditNotesHasOneElementWithInvalidClientId() { var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var billingMappers = new List <IBillingMapper> { new BillingForArMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations), new BillingForUsMapper(Mock.Of <ISapBillingItemsService>(), Mock.Of <IDateTimeProvider>(), timeZoneConfigurations) }; var slackServiceMock = new Mock <ISlackService>(); slackServiceMock.Setup(x => x.SendNotification(It.IsAny <string>())).Returns(Task.CompletedTask); var queuingServiceMock = new Mock <IQueuingService>(); var billingService = new BillingService(queuingServiceMock.Object, Mock.Of <IDateTimeProvider>(), Mock.Of <ILogger <BillingService> >(), slackServiceMock.Object, billingMappers, null, Mock.Of <ISapServiceSettingsFactory>()); var creditNote = new CreditNoteRequest { Amount = 100, BillingSystemId = 2, ClientId = 0, InvoiceId = 1, Type = 1 }; await billingService.CreateCreditNote(creditNote); queuingServiceMock.Verify(x => x.AddToTaskQueue(It.IsAny <SapTask>()), Times.Never); slackServiceMock.Verify(x => x.SendNotification(It.IsAny <string>()), Times.Once); }
public async Task BillingService_ShouldBeAddOneTaskInQueue_WhenBillingRequestListHasOneValidElement() { var itemCode = "1.0.1"; var items = new List <BillingItemPlanDescriptionModel> { new BillingItemPlanDescriptionModel { ItemCode = "1.0.1", description = "Test" } }; var billingValidations = new List <IBillingValidation> { new BillingForArValidation(Mock.Of <ILogger <BillingForArValidation> >()), new BillingForUsValidation(Mock.Of <ILogger <BillingForUsValidation> >()) }; var sapConfigMock = new Mock <IOptions <SapConfig> >(); var timeZoneConfigurations = new TimeZoneConfigurations { InvoicesTimeZone = TimeZoneHelper.GetTimeZoneByOperativeSystem("Argentina Standard Time") }; var sapBillingItemsServiceMock = new Mock <ISapBillingItemsService>(); sapBillingItemsServiceMock.Setup(x => x.GetItemCode(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <bool>())).Returns(itemCode); sapBillingItemsServiceMock.Setup(x => x.GetItems(It.IsAny <int>())).Returns(items); var dateTimeProviderMock = new Mock <IDateTimeProvider>(); dateTimeProviderMock.Setup(x => x.UtcNow) .Returns(new DateTime(2019, 09, 25)); var billingMappers = new List <IBillingMapper> { new BillingForArMapper(sapBillingItemsServiceMock.Object, dateTimeProviderMock.Object, timeZoneConfigurations), new BillingForUsMapper(sapBillingItemsServiceMock.Object, dateTimeProviderMock.Object, timeZoneConfigurations) }; var queuingServiceMock = new Mock <IQueuingService>(); var billingService = new BillingService(queuingServiceMock.Object, dateTimeProviderMock.Object, Mock.Of <ILogger <BillingService> >(), Mock.Of <ISlackService>(), billingMappers, billingValidations); var billingRequestList = new List <BillingRequest> { new BillingRequest { BillingSystemId = 9, Id = 1, FiscalID = "123" } }; await billingService.CreateBillingRequest(billingRequestList); queuingServiceMock.Verify(x => x.AddToTaskQueue(It.IsAny <SapTask>()), Times.Once); }
public TaskRepository(GigbucketDbContext dbContext, BillingService billingService) { _dbContext = dbContext; _billingService = billingService; }
protected override void OnCreate(Bundle bundle) { System.Threading.Tasks.TaskScheduler.UnobservedTaskException += new EventHandler <System.Threading.Tasks.UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Change this to true if you expect signed responses // This would occur when installing a signed APK on your device and have already uploaded the signed APK to Google Play // see: http://developer.android.com/guide/google/play/billing/billing_testing.html Security.ExpectSignature = false; m_service = new BillingService(this, this, m_sig); var connTask = m_service.Connect(); //Load inventory on start-up connTask.ContinueWith(t => { if (t.Result) { //Existing purchases m_service.SendRequest <GetPurchasesResponse>(new GetPurchases(Consts.ITEM_TYPE_INAPP, m_requestId++)); //All SKUs that have or could be purchased m_service.SendRequest <GetSkuDetailsResponse>(new GetSkuDetails(Consts.ITEM_TYPE_INAPP, m_requestId++, new List <string>() { "play.billing.v3.item_2" })); } }); //BUY (use android.test.purchased for a static response) var pButton = FindViewById <Button>(Resource.Id.PurchaseButton); pButton.Click += delegate { SendBuyRequest("play.billing.v3.item_2"); }; //CANCEL var cButton = FindViewById <Button>(Resource.Id.CancelButton); cButton.Click += delegate { SendBuyRequest("android.test.canceled"); }; //ITEM UNAVAILABLE var uButton = FindViewById <Button>(Resource.Id.UnavailableButton); uButton.Click += delegate { SendBuyRequest("android.test.item_unavailable"); }; //GET SKU DETAILS var skuButton = FindViewById <Button>(Resource.Id.SkuButton); skuButton.Click += delegate { m_service.SendRequest <GetSkuDetailsResponse>(new GetSkuDetails(Consts.ITEM_TYPE_INAPP, m_requestId++, new List <string>() { "play.billing.v3.item_2" })).ContinueWith(t => { this.RunOnUiThread(() => { if (t.Result.Success) { Toast.MakeText(this, "GetSkuDetail: " + (t.Result.Details.Count > 0 ? t.Result.Details.First().ToString() : "Not Found"), ToastLength.Long).Show(); } else { Toast.MakeText(this, "GetSkuDetail failure. Error: " + t.Result.Message, ToastLength.Long).Show(); } }); }); }; //CONSUME var consumeButton = FindViewById <Button>(Resource.Id.ConsumeButton); consumeButton.Click += delegate { var p = m_service.CurrentInventory.Purchases.Where(x => x.Sku == "play.billing.v3.item_2").FirstOrDefault(); if (p == null) { Toast.MakeText(this, "There are no purchases to consume.", ToastLength.Long).Show(); return; } System.Diagnostics.Debug.WriteLine("Attemping to consume: " + p.Sku); m_service.SendRequest <Response>(new ConsumePurchase(p, m_requestId++)).ContinueWith(t => { this.RunOnUiThread(() => { if (t.Result.Success) { //p.Token? m_service.CurrentInventory.ErasePurchase(p.Sku); Toast.MakeText(this, "Consume complete. Item: " + p.Sku, ToastLength.Long).Show(); } else { Toast.MakeText(this, "Consume failure. Error: " + t.Result.Message, ToastLength.Long).Show(); } }); }); }; //GET PURCHASES var invButton = FindViewById <Button>(Resource.Id.InventoryButton); invButton.Click += delegate { m_service.SendRequest <GetPurchasesResponse>(new GetPurchases(Consts.ITEM_TYPE_INAPP, m_requestId++)).ContinueWith(t => { this.RunOnUiThread(() => { if (t.Result.Success) { var sb = new StringBuilder(); sb.Append("Purchases: "); t.Result.PurchasedItems.Select(x => x.Sku).ToList().ForEach(x => sb.AppendFormat("{0},", x)); sb.Remove(sb.Length - 1, 1); Toast.MakeText(this, sb.ToString(), ToastLength.Long).Show(); } else { Toast.MakeText(this, "Purchases request failure. Error: " + t.Result.Message, ToastLength.Long).Show(); } }); }); }; }
private int pageSize = 10; //每頁10筆資料 public BillController() { _billingSvc = new BillingService(); }
protected override void OnCreate(Bundle bundle) { System.Threading.Tasks.TaskScheduler.UnobservedTaskException += new EventHandler<System.Threading.Tasks.UnobservedTaskExceptionEventArgs>(TaskScheduler_UnobservedTaskException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Change this to true if you expect signed responses // This would occur when installing a signed APK on your device and have already uploaded the signed APK to Google Play // see: http://developer.android.com/guide/google/play/billing/billing_testing.html Security.ExpectSignature = false; m_service = new BillingService(this, this, m_sig); var connTask = m_service.Connect(); //Load inventory on start-up connTask.ContinueWith(t => { if (t.Result) { //Existing purchases m_service.SendRequest<GetPurchasesResponse>(new GetPurchases(Consts.ITEM_TYPE_INAPP, m_requestId++)); //All SKUs that have or could be purchased m_service.SendRequest<GetSkuDetailsResponse>(new GetSkuDetails(Consts.ITEM_TYPE_INAPP, m_requestId++, new List<string>() { "play.billing.v3.item_2" })); } }); //BUY (use android.test.purchased for a static response) var pButton = FindViewById<Button>(Resource.Id.PurchaseButton); pButton.Click += delegate { SendBuyRequest("play.billing.v3.item_2"); }; //CANCEL var cButton = FindViewById<Button>(Resource.Id.CancelButton); cButton.Click += delegate { SendBuyRequest("android.test.canceled"); }; //ITEM UNAVAILABLE var uButton = FindViewById<Button>(Resource.Id.UnavailableButton); uButton.Click += delegate { SendBuyRequest("android.test.item_unavailable"); }; //GET SKU DETAILS var skuButton = FindViewById<Button>(Resource.Id.SkuButton); skuButton.Click += delegate { m_service.SendRequest<GetSkuDetailsResponse>(new GetSkuDetails(Consts.ITEM_TYPE_INAPP, m_requestId++, new List<string>() { "play.billing.v3.item_2" })).ContinueWith(t => { this.RunOnUiThread(() => { if (t.Result.Success) Toast.MakeText(this, "GetSkuDetail: " + (t.Result.Details.Count > 0 ? t.Result.Details.First().ToString() : "Not Found"), ToastLength.Long).Show(); else Toast.MakeText(this, "GetSkuDetail failure. Error: " + t.Result.Message, ToastLength.Long).Show(); }); }); }; //CONSUME var consumeButton = FindViewById<Button>(Resource.Id.ConsumeButton); consumeButton.Click += delegate { var p = m_service.CurrentInventory.Purchases.Where(x => x.Sku == "play.billing.v3.item_2").FirstOrDefault(); if (p == null) { Toast.MakeText(this, "There are no purchases to consume.", ToastLength.Long).Show(); return; } System.Diagnostics.Debug.WriteLine("Attemping to consume: " + p.Sku); m_service.SendRequest<Response>(new ConsumePurchase(p, m_requestId++)).ContinueWith(t => { this.RunOnUiThread(() => { if (t.Result.Success) { //p.Token? m_service.CurrentInventory.ErasePurchase(p.Sku); Toast.MakeText(this, "Consume complete. Item: " + p.Sku, ToastLength.Long).Show(); } else Toast.MakeText(this, "Consume failure. Error: " + t.Result.Message, ToastLength.Long).Show(); }); }); }; //GET PURCHASES var invButton = FindViewById<Button>(Resource.Id.InventoryButton); invButton.Click += delegate { m_service.SendRequest<GetPurchasesResponse>(new GetPurchases(Consts.ITEM_TYPE_INAPP, m_requestId++)).ContinueWith(t => { this.RunOnUiThread(() => { if (t.Result.Success) { var sb = new StringBuilder(); sb.Append("Purchases: "); t.Result.PurchasedItems.Select(x => x.Sku).ToList().ForEach(x => sb.AppendFormat("{0},", x)); sb.Remove(sb.Length - 1, 1); Toast.MakeText(this, sb.ToString(), ToastLength.Long).Show(); } else Toast.MakeText(this, "Purchases request failure. Error: " + t.Result.Message, ToastLength.Long).Show(); }); }); }; }
public BillingController() { unitOfWork = new UnitOfWork(); billingService = new BillingService(unitOfWork); jobService = new JobService(unitOfWork); }
private static void SendInvoice(OrderInfo orderInfo) { BillingService billingService = new BillingService(); billingService.SendInvoice(orderInfo); }
public SupplierBillingManager(int connectorId) { service = base.CreateService(typeof(BillingService), connectorId) as BillingService; orderService = base.CreateService(typeof(OrderService), connectorId) as OrderService; }
/// <summary> /// The save button_ click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void SaveButtonClick(object sender, EventArgs e) { var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label; this.billingEntityController = new BillingEntityController(); this.billingServiceEntityController = new BillingServiceEntityController(); if (this.sumOfServicesTextBox.Text == string.Empty) { this.sumOfServicesTextBox.Text = 0.ToString(); this.totalSumTextBox.Text = this.priceValueTextBox.Text; } this.billing = new Billing { BookingId = Convert.ToInt32(this.bookingIdTextBox.Text), PriceForRoom = Convert.ToDouble(this.priceValueTextBox.Text), PriceForServices = Convert.ToDouble(this.sumOfServicesTextBox.Text), TotalPrice = Convert.ToDouble(this.totalSumTextBox.Text), Paid = this.paidCheckBox.Checked }; try { this.billing = this.billingEntityController.CreateOrUpdateEntity(this.billing); var localBooking = this.bookingEntityController.GetEntity(this.billing.BookingId); localBooking.Status = Status.Billed; this.bookingEntityController.CreateOrUpdateEntity(localBooking); } catch (SqlException ex) { if (errorlabel != null) { errorlabel.Text = "Couldn't create the current booking"; } } catch (ArgumentNullException ex) { if (errorlabel != null) { errorlabel.Text = "Couldn't create the current booking"; } } catch (Exception ex) { if (errorlabel != null) { errorlabel.Text = ex.Message; } } this.myBillingServices = this.Session["billingServiceWithServiceDescription"] as List <BillingServiceWithServiceDescription>; if (this.myBillingServices != null && this.myBillingServices.Count > 0) { foreach (var item in this.myBillingServices) { if (item.Quantity > 0) { this.billingService = new BillingService { BillingId = this.billing.Id, ServiceId = item.Id, Quantity = item.Quantity, Price = item.PricePerUnit }; try { this.billingServiceEntityController.CreateOrUpdateEntity(this.billingService); } catch (SqlException ex) { if (errorlabel != null) { errorlabel.Text = "Couldn't create the current billing service"; } } catch (ArgumentNullException ex) { if (errorlabel != null) { errorlabel.Text = "Couldn't create the current billing service"; } } catch (Exception ex) { if (errorlabel != null) { errorlabel.Text = ex.Message; } } } } } this.Response.Redirect("BillingListWebForm.aspx", true); }
/// <summary> /// The bt ok click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> protected void BtOkClick(object sender, EventArgs e) { var errorlabel = this.Master?.FindControl("form1").FindControl("divErrorMessage") as Label; var selectedRowKeys = this.BookingListGridview.GetSelectedFieldValues( this.BookingListGridview.KeyFieldName, "Id"); if ((selectedRowKeys == null) || (selectedRowKeys.Count == 0)) { return; } else { try { foreach (object[] row in selectedRowKeys) { var id = Convert.ToInt32(row[0]); this.pricingListEntityController = new PricingListController(); this.customerEntityController = new CustomerController(); var booking = this.bookingEntityController.GetEntity(id); this.bookingIdTextBox.Text = id.ToString(); this.customerSurnameTextBox.Text = this.customerEntityController.GetEntity(booking.CustomerId).Surname; this.priceValueTextBox.Text = booking.AgreedPrice.ToString(CultureInfo.InvariantCulture); this.customerNameTextBox.Text = this.customerEntityController.GetEntity(booking.CustomerId).Name; this.fromTextBox.Text = booking.From.ToShortDateString().ToString(CultureInfo.InvariantCulture); this.toTextBox.Text = booking.To.ToShortDateString().ToString(CultureInfo.InvariantCulture); this.roomTextBox.Text = booking.Room.Code; this.billing = new Billing { PriceForRoom = booking.AgreedPrice }; var servicesList = this.serviceController.RefreshEntities(); var billingServices = new List <BillingService>(); foreach (var item in servicesList) { if (item.HotelId == booking.Room.HotelId) { try { this.price = this.pricingListEntityController.ServicePricing(booking.From, item.Id); } catch (ArgumentNullException ex) { this.price = 0; } catch (NullReferenceException ex) { this.price = 0; } { var myBillingService = new BillingService { Service = item, Price = this.price, Quantity = 0 }; billingServices.Add(myBillingService); } } } this.myBillingServices = billingServices.Select( item => new BillingServiceWithServiceDescription { Id = item.Service.Id, Description = item.Service.Description, Quantity = item.Quantity, PricePerUnit = item.Price, TotalPrice = 0 }).ToList(); this.Session["billingServiceWithServiceDescription"] = this.myBillingServices; this.BillingListGridView.DataSource = this.myBillingServices; this.BillingListGridView.DataBind(); this.BillingListGridView.Visible = true; this.saveButton.Enabled = true; this.totalSumTextBox.Visible = true; this.totalSumTextBox.ReadOnly = true; this.totalSumTextBox.Text = this.priceValueTextBox.Text; this.paidCheckBox.Visible = true; this.sumOfServicesTextBox.Visible = true; this.sumOfServicesTextBox.ReadOnly = true; this.paidLabel.Visible = true; this.totalSumLabel.Visible = true; this.sumOfServicesLabel.Visible = true; } } catch (SqlException ex) { if (errorlabel != null) { errorlabel.Text = "Something went wrong with the database.Please check the connection string."; } } catch (ArgumentNullException ex) { if (errorlabel != null) { errorlabel.Text = "Couldn't create the current Billing"; } } catch (Exception ex) { errorlabel.Text = ex.Message; } } }
public IActionResult NewPatient(RegistrationNewViewModel model, BillingService billing) { model.Billables = billing.GetBillableServices(_Constants.INITIAL_REG_FEE); return(View(model)); }
public BillingController() { var unitOfWork = new EFUnitOfWork(); _billingService = new BillingService(unitOfWork); }