GENERALBYTESCOM / batm_public

BATM Public Repository
www.generalbytes.com
Other
98 stars 241 forks source link

How to get terminal serial number inside IWallet.sendCoins() #453

Closed alexisdevtailor closed 3 years ago

alexisdevtailor commented 3 years ago

Hello,

I would like to ask how to get the terminal serial number from within IWallet.sendCoins(). Our current setting is that we have one IWallet to be used by all atm terminals. My original approach was implementing the ITransactionListener interface and persisting the serial number in a private field of the Extension class. But this will not work since the ITransactionListener callbacks will be called by multiple atm terminals, thereby causing a potential race condition where the persisted serial number is not the correct one when IWallet.sendCoins() attempts to use it.

What is the most reliable way to get this information from inside IWallet.sendCoins()?

Thanks in advance.

generalbytes commented 3 years ago

Hi, there is no real solution to your problem. Terminal serial number is not available to wallet because mapping is not one-to-one. There might be for example only one sendCoins call for multiple transactions made on multiple machines when output queues are enabled and same destination address is used. Why do you need serial number inside sendCoins?

alexisdevtailor commented 3 years ago

Hello,

Thank you for the reply. We would like to get the serial number in sendCoins() because we would like to know which atm terminal did the purchase. We need this information for auditing purposes. Thanks.

alexisdevtailor commented 3 years ago

Maybe there is another way to save the terminal serial number together with the transaction in our database. In ITransactionListener.onTransactionUpdated(), what does ITransactionDetails.getRemoteTransactionId() return? Is this the same transactionId that IWallet.sendCoins() returned?

generalbytes commented 3 years ago

ITransactionDetails.getDetail() contains String that IWallet.sendCoins() returned.

alexisdevtailor commented 3 years ago

Cool. Thank you for the reply.