private async void cmdUnlink_Clicked(object sender, EventArgs e)
        {
            if (viewCardList.SelectedItem == null)
            {
                await App.Current.MainPage.DisplayAlert("Error", "No card selected", "OK");

                return;
            }

            try
            {
                gridProgress.IsVisible = true;
                await Task.Run(async() =>
                {
                    Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        await client.CardCancelcardPostAsync(((Card)viewCardList.SelectedItem).CardSerialNumberId);
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            ((Card)viewCardList.SelectedItem).CardState = CardState.Cancelled;
                        });
                    }
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
 private async Task RegisterCard(string accountNumberId, string cardSerialNumber)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             await client.CardRegistercardPostAsync(cardSerialNumber);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
 private async Task CallTransactByQRCodeWebService(string fromAccountNumber, string toAccountNumber, long?amount, string trackingId)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             QRCodeTransferTransaction tx = new QRCodeTransferTransaction()
             {
                 Amount      = amount.Value,
                 AccountFrom = fromAccountNumber,
                 AccountTo   = toAccountNumber,
                 TrackingId  = trackingId,
             };
             await client.TransactionQrcodetransferPostAsync(tx.ToJsonString());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
 private async Task <bool> CallTransactGetStateWebService(string trackingId)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             return(await client.TransactionGettransactionstateGetAsync(trackingId));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
Exemple #5
0
 private async Task CallTopUpWebService(string toAccountNumber, long?amount, string cvv, TLV emvData)
 {
     Device.BeginInvokeOnMainThread(() =>
     {
         gridProgress.IsVisible = true;
     });
     try
     {
         Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
         using (SessionSingleton.HttpClient)
         {
             CCTopUpTransaction tx = new CCTopUpTransaction()
             {
                 Amount   = amount.Value,
                 CVV      = cvv,
                 EMV_Data = TLVasJSON.ToJSON(emvData),
             };
             await client.TransactionTopupPostAsync(tx.ToJsonString());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             gridProgress.IsVisible = false;
         });
     }
 }
Exemple #6
0
        private static async Task LoadAccountEx()
        {
            Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
            using (SessionSingleton.HttpClient)
            {
                Proxies.Account accountJson = await client.AccountGetAsync();

                Account account = Account.FromJsonString(accountJson.ToJson());
                SessionSingleton.Account = account;
            }
        }
Exemple #7
0
 public static Proxies.DCEMVDemoServerClient GenDCEMVServerApiClient()
 {
     if (HttpClient != null)
     {
         HttpClient.Dispose();
     }
     HttpClient = new HttpClient();
     HttpClient.SetBearerToken(AccessToken);
     Proxies.DCEMVDemoServerClient xserverApi = new Proxies.DCEMVDemoServerClient(ApiServerURL, HttpClient);
     return(xserverApi);
 }
        private async Task <Account> CallGetTransactionsWebService()
        {
            try
            {
                Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                using (SessionSingleton.HttpClient)
                {
                    Proxies.Account ret = await client.TransactionsGetAsync();

                    return(Account.FromJsonString(ret.ToJson()));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private async void cmdOk_Clicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                await Task.Run(async() =>
                {
                    Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        account.CustomerType = MapPickerValue();
                        switch (account.CustomerType)
                        {
                        case CustomerType.Individual:
                            await client.AccountUpdateindividualaccountdetailsPostAsync(account.ToJsonString());

                            SessionSingleton.Account.AccountState = 0;
                            SessionSingleton.Account.CustomerType = account.CustomerType;
                            SessionSingleton.Account.FirstName    = account.FirstName;
                            SessionSingleton.Account.LastName     = account.LastName;
                            break;

                        case CustomerType.Business:
                            await client.AccountUpdatebusinessaccountdetailsPostAsync(account.ToJsonString());

                            SessionSingleton.Account.AccountState     = 0;
                            SessionSingleton.Account.CustomerType     = account.CustomerType;
                            SessionSingleton.Account.BusinessName     = account.BusinessName;
                            SessionSingleton.Account.CompanyRegNumber = account.CompanyRegNumber;
                            SessionSingleton.Account.TaxNumber        = account.TaxNumber;
                            break;
                        }
                    }
                    ClosePage();
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
        private async void cmdEditCardOk_Clicked(object sender, EventArgs e)
        {
            try
            {
                gridProgress.IsVisible = true;
                Card cardDto = new Card()
                {
                    CardSerialNumberId = card.CardSerialNumberId,
                    FreindlyName       = card.FreindlyName,
                    DailySpendLimit    = Convert.ToInt64(card.DailySpendLimit),
                    MonthlySpendLimit  = Convert.ToInt64(card.MonthlySpendLimit)
                };
                await Task.Run(async() =>
                {
                    Proxies.DCEMVDemoServerClient client = SessionSingleton.GenDCEMVServerApiClient();
                    using (SessionSingleton.HttpClient)
                    {
                        await client.CardUpdatecarddetailsPostAsync(cardDto.ToJsonString());

                        Card cardRepo              = SessionSingleton.Account.Cards.ToList().Find(x => x.CardSerialNumberId == card.CardSerialNumberId);
                        cardRepo.FreindlyName      = card.FreindlyName;
                        cardRepo.DailySpendLimit   = Convert.ToInt64(card.DailySpendLimit);
                        cardRepo.MonthlySpendLimit = Convert.ToInt64(card.MonthlySpendLimit);
                    }
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        viewCardList.ItemsSource = null;
                        viewCardList.ItemsSource = SessionSingleton.Account.Cards;
                        UpdateView(CardAdminViewState.CardList);
                    });
                });
            }
            catch (Exception ex)
            {
                await App.Current.MainPage.DisplayAlert("Error", ex.Message, "OK");
            }
            finally
            {
                gridProgress.IsVisible = false;
            }
        }
Exemple #11
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;
                });
            }
        }