Adding an item order an an existing ticket from a 3rd Party Software

Hallo,
I want to add and order to an existing Ticket via an external application. I get as far as seeing the new order in the left screen. However, when the SambaPOS 5 terminal is used to add a new item it crashes.

Im accessing ans where nessessary updating the following tables:

AccountTransactions
AccountTransactionValues
Orders
Tickets
TicketEntities
MenuItems

Have I forgotten anything?

Regards,
Stuart
Here is the extract of the log:

Application: SambaPOS
Version: 5.2.24
Region: en
DB: SQ
Machine: LENOVO-STUART
User: stuart
Date: 03.04.2020
Time: 14:54

User Explanation:

stuart said “”

[Exception Info 1]

Top-level Exception
Type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
Stack Trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Inner Exception 1
Type: System.InvalidOperationException
Message: Sequence contains no matching element
Source: System.Core
Stack Trace: at System.Linq.Enumerable.Single[TSource](IEnumerable 1 source, Func 2 predicate)
at Samba.Services.Implementations.CacheService.GetAccountTransactionTypeById(Int32 id) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\CacheService.cs:line 385
at Samba.Services.Implementations.TicketModule.TicketServiceBase.<>c__DisplayClass26_0.b__2(IGrouping 2 order) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\TicketModule\TicketServiceBase.cs:line 228 at System.Linq.Enumerable.WhereSelectEnumerableIterator 2.MoveNext()
at Samba.Services.Implementations.TicketModule.TicketServiceBase.RefreshAccountTransactions(Ticket ticket) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\TicketModule\TicketServiceBase.cs:line 226
at Samba.Services.Common.OrderUpdater.Update(ITicketServiceBase ticketService, ICacheService cacheService, Ticket ticket, Order order, String menuItemName, Nullable 1 quantity, Nullable 1 price, Nullable 1 increaseInventory, Nullable 1 decreaseInventory, Nullable 1 locked, Nullable 1 calculatePrice, String taxTemplate, String accountTransactionType, String warehouseName, String portionName, String priceTag, Nullable 1 disablePortionSelection, String groupTagName, String groupTagFormat, AppState appState) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Common\OrderUpdater.cs:line 45 at Samba.Services.ActionProcessors.TicketModule.UpdateOrder.Process(ActionData actionData, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\ActionProcessors\TicketModule\UpdateOrder.cs:line 30 at Samba.Services.Common.RuleActionTypeRegistry.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Common\RuleActionTypeRegistry.cs:line 39 at Samba.Services.Implementations.AutomationModule.AutomationService.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\AutomationService.cs:line 42 at Samba.Services.Implementations.AutomationModule.ActionDataBuilder.<>c__DisplayClass13_0.<InvokeWith>b__0() in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\ActionDataBuilder.cs:line 76 at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout) at System.Windows.Threading.Dispatcher.Invoke(Action callback) at Samba.Services.Implementations.AutomationModule.ActionDataBuilder.InvokeWith(AppState appState, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\ActionDataBuilder.cs:line 84 at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWithoutLogging(Object ruleData) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 125 at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWith(Object dataParameter) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 62 at Samba.Services.Implementations.AutomationModule.NotificationService.NotifyEvent(String eventName, Object dataParameter, AppState appState) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\NotificationService.cs:line 26 at Samba.Services.Implementations.TicketModule.TicketServiceBase.AddOrder(Ticket ticket, MenuItem menuItem, Nullable 1 quantity, Boolean enforceQuantity, String portionName, String orderState, String orderTagJson, AppState appState, Nullable 1 price) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\TicketModule\TicketServiceBase.cs:line 204 at Samba.Presentation.Services.Implementations.TicketModule.TicketService.AddOrder(Ticket ticket, Int32 menuItemId, Nullable 1 quantity, Boolean enforceQuantity, String portionName, String orderState, String orderTagJson)
at Samba.Presentation.ClientLibrary.Modules.PosModule.TicketOrdersViewModel.AddOrder(Int32 menuItemId, Nullable 1 quantity, Boolean enforceQuantity, String portionName) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\PosModule\TicketOrdersViewModel.cs:line 209 at Samba.Presentation.ClientLibrary.Modules.PosModule.TicketOrdersViewModel.AddOrder(ScreenMenuItemData data) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\PosModule\TicketOrdersViewModel.cs:line 216 at Samba.Presentation.ClientLibrary.Modules.PosModule.PosViewModel.OnMenuItemSelected(EventParameters 1 obj) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\PosModule\PosViewModel.cs:line 541
at Microsoft.Practices.Prism.Events.EventSubscription 1.InvokeAction(Action 1 action, TPayload argument)
at Microsoft.Practices.Prism.Events.EventSubscription 1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments) at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments) at Microsoft.Practices.Prism.Events.CompositePresentationEvent 1.Publish(TPayload payload)
at Samba.Presentation.Services.Common.ExtensionMethods.Publish[TEventsubject](TEventsubject eventArgs, String eventTopic, Action expectedAction)

[Assembly Info]

mscorlib, Version=4.0.0.0
System, Version=4.0.0.0
Samba.Services, Version=1.0.0.0
Samba.Domain, Version=1.0.0.0
Samba.Infrastructure.Data, Version=1.0.0.0
System.ComponentModel.Composition, Version=4.0.0.0
Samba.Presentation.Services, Version=1.0.0.0
System.Core, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
DevExpress.Xpf.LayoutControl.v16.2, Version=16.2.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v16.2, Version=16.2.13.0
DevExpress.Xpf.Grid.v16.2.Core, Version=16.2.13.0
System.Xaml, Version=4.0.0.0
Samba.Infrastructure, Version=1.0.0.0
Microsoft.Practices.Prism, Version=4.0.0.0
System.Runtime.Serialization, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
DevExpress.Xpf.Core.v16.2, Version=16.2.13.0
System.Windows.Forms, Version=4.0.0.0
System.Drawing, Version=4.0.0.0
Samba.Persistance, Version=1.0.0.0
Stateless, Version=1.0.0.0
PropertyTools, Version=2012.4.14.1
Samba.Localization, Version=1.0.0.0
ReachFramework, Version=4.0.0.0
EntityFramework, Version=6.0.0.0
FluentValidation, Version=3.4.0.0
NCalc, Version=1.3.8.0
Microsoft.CSharp, Version=4.0.0.0
Omu.ValueInjecter, Version=2.3.0.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
DevExpress.Data.v16.2, Version=16.2.13.0
WindowsInput, Version=1.0.4.0

You should not be doing that. You should use graphql to load a virtual terminal to build your tickets

Thanks for that Jessa,
Do you have any documentation About the graphql API.

Our current interface (barSTOCK Drink Exchange) however uses direct Access to the database and a script to update live Prices.

Thanks,
Stuart

If it’s for a stock type price changes why do you need to mess with account and ticket tables? Surely it’s just price changes?
Graph api has basic self documentation listing functions and variables and there are several topics on forum to get going.
It’s a big topic to tutorial everything so you need to use tutorial for basic starter then develop using the more basic documentation within it itself.

https://forum.sambapos.com/t/integrators-graphql-api-guide/14047?u=jtrtech

Hallo Jesse,
Just to update you. I have solved the issue via the ‘unconventional’ way. It works a treat.
I will however long-term deploy the API methodology,
Thanks for your pointers.
Regards,
Stuart

1 Like