private void TipAdjustButton_Click(object sender, EventArgs e)
{
InputForm inputForm = new InputForm(this);
inputForm.Label = "Enter Tip Amount";
inputForm.Title = "Adjust Tip Amount";
inputForm.FormClosed += (object s, FormClosedEventArgs ce) =>
{
if (inputForm.Status == DialogResult.OK)
{
string tipValue = inputForm.Value;
try
{
int tipAmount = int.Parse(tipValue);
TipAdjustAuthRequest taRequest = new TipAdjustAuthRequest();
if (OrderPaymentsView.SelectedItems.Count == 1)
{
POSPayment posPayment = OrderPaymentsView.SelectedItems[0].Tag as POSPayment;
taRequest.OrderID = posPayment.OrderID;
taRequest.PaymentID = posPayment.PaymentID;
taRequest.TipAmount = tipAmount;
cloverConnector.TipAdjustAuth(taRequest);
}
}
catch (Exception)
{
AlertForm.Show(this, "Invalid Value", "Invalid tip amount: " + tipValue + " Format of 625 expected.");
}
}
};
inputForm.Show(this);
}