Esempio n. 1
0
        private async Task CallPosTransactWebService(string fromAccountNumber, string toAccountNumber, string cardSerialNumberFrom, string cardSerialNumberTo, long?amount, TransactionType transactionType, TLV emvData)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                gridProgress.IsVisible = true;
            });
            try
            {
                Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    POSTransaction posTx = new POSTransaction();
                    posTx.InvItems = ConvertLineItems(basketItems.ToList());

                    CardTransferTransaction tx = new CardTransferTransaction()
                    {
                        Amount          = amount.Value,
                        AccountFrom     = fromAccountNumber,
                        AccountTo       = toAccountNumber,
                        CardSerialFrom  = cardSerialNumberFrom,
                        CardSerialTo    = cardSerialNumberTo,
                        CardFromEMVData = TLVasJSON.ToJSON(emvData),
                    };
                    await client.StoreSalebycardPostAsync(tx.ToJsonString(), posTx.ToJsonString());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    gridProgress.IsVisible = false;
                });
            }
        }