Exemplo n.º 1
0
		protected virtual void OnViewBalanceClicked (object sender, System.EventArgs e)
		{
			if (Validate())
			{
				string merchantId = merchantIdEntry.Text.Trim();
				string pwd = pwdEntry.Text.Trim();
				
				balanceTextView.Buffer.Clear();
				try
				{
					LiqPayClient client = new LiqPayClient(merchantId, string.Empty, pwd);
					Dictionary<string, double> balance = client.ViewBalance();
					StringBuilder sb = new StringBuilder();
					foreach (KeyValuePair<string, double> balancePair in balance)
					{
						sb.AppendLine(string.Format("{0}: {1}", balancePair.Key, balancePair.Value));
					}
					balanceTextView.Buffer.Text = sb.ToString();
					// Save settings
					UserSettings.SharedSettings.MerchantId = merchantId;
					UserSettings.SharedSettings.OtherPassword = pwd;
					SaveSettings();
				}
				catch (Exception ex)
				{
					DialogHelper.DisplayError((Gtk.Window)this.Toplevel, "Failed to check balance. Error: " + ex.Message);
				}
			}
		}
		protected virtual void OnViewTransactionClicked (object sender, System.EventArgs e)
		{
			if (Validate())
			{
				transactionIDEntry.Text = string.Empty;
				orderIdEntry.Text = string.Empty;
				fromEntry.Text = string.Empty;
				toEntry.Text = string.Empty;
				amountEntry.Text = string.Empty;
				currencyEntry.Text = string.Empty;
				descriptionEntry.Text = string.Empty;
				refererEntry.Text = string.Empty;
				
				string transactionId = searchTransactionIdEntry.Text.Trim();
				string orderId = searchOrderIdEntry.Text.Trim();
				string merchantId = merchantIdEntry.Text.Trim();
				string pwd = pwdEntry.Text.Trim();
				try
				{
					
					LiqPayClient client = new LiqPayClient(merchantId, string.Empty, pwd);
					Transaction transaction = string.IsNullOrEmpty(transactionId) ? client.ViewTransactionByOrderId(orderId) : client.ViewTransactionByTransactionId(transactionId);
					transactionIDEntry.Text = transaction.Id;
					orderIdEntry.Text = transaction.OrderId;
					fromEntry.Text = transaction.From;
					toEntry.Text = transaction.To;
					amountEntry.Text = transaction.Amount.ToString();
					currencyEntry.Text = transaction.Currency;
					descriptionEntry.Text = transaction.Description;
					
					// Save settings
					UserSettings.SharedSettings.MerchantId = merchantId;
					UserSettings.SharedSettings.OtherPassword = pwd;
					SaveSettings();
				}
				catch (Exception ex)
				{
					DialogHelper.DisplayError((Gtk.Window)this.Toplevel, "View transaction failed. Error: " + ex.Message);
				}
			}
		}
Exemplo n.º 3
0
		protected virtual void OnPhoneCreditClicked (object sender, System.EventArgs e)
		{
			if (Validate())
			{
				string merchantId = merchantIdEntry.Text.Trim();
				string pwd = pwdEntry.Text.Trim();
				try
				{
					LiqPayClient client = new LiqPayClient(merchantId, string.Empty, pwd);
					client.PhoneCredit(phoneEntry.Text, 
					                   double.Parse(amountEntry.Text), 
					                   currencyComboBox.ActiveText, 
					                   orderIdEntry.Text);
					
					UserSettings.SharedSettings.MerchantId = merchantId;
					UserSettings.SharedSettings.SendMoneyPassword = pwd;
					SaveSettings();
				}
				catch (Exception ex)
				{
					DialogHelper.DisplayError((Gtk.Window)this.Toplevel, "Phone credit operation failed. Error: " + ex.Message);
				}
			}
		}
Exemplo n.º 4
0
		protected virtual void OnSendMoneyClicked (object sender, System.EventArgs e)
		{
			transactionIdLabel.Text = string.Empty;
			if (Validate())
			{
				string merchantId = merchantIdEntry.Text.Trim();
				string pwd = pwdEntry.Text.Trim();
				try
				{
					LiqPayClient client = new LiqPayClient(merchantId, pwd, string.Empty);
					string transactionId = client.SendMoney(toEntry.Text,
					                                        double.Parse(amountEntry.Text),
					                                        currencyComboBox.ActiveText,
					                                        kindComboBox.ActiveText.ToLower(),
					                                        descriptionEntry.Text,
					                                        orderIdEntry.Text
					                                        );
					transactionIdLabel.Text = transactionId;
					
					// Save settings
					UserSettings.SharedSettings.MerchantId = merchantId;
					UserSettings.SharedSettings.SendMoneyPassword = pwd;
					SaveSettings();
				}
				catch (Exception ex)
				{
					DialogHelper.DisplayError((Gtk.Window)this.Toplevel, "Send money failed. Error: " + ex.Message);
				}
			}
		}