public void OnVaultCardResponse(VaultCardResponse vcResponse)
{
String screenResponseMsg = "";
if (vcResponse.Success && vcResponse.Card.token != null)
{
POSCard posCard = new POSCard();
posCard.Name = vcResponse.Card.cardholderName;
posCard.First6 = vcResponse.Card.first6;
posCard.Last4 = vcResponse.Card.last4;
posCard.Token = vcResponse.Card.token;
posCard.Month = vcResponse.Card.expirationDate.Substring(0, 2);
posCard.Year = vcResponse.Card.expirationDate.Substring(2, 2);
Store.Cards.Add(posCard);
uiThread.Send(delegate (object state)
{
addCardToUI(posCard);
screenResponseMsg = "Card" + vcResponse.Card.first6 + "xxxxxx" + vcResponse.Card.last4 + " was added";
AlertForm.Show(this, "Card Vaulted", screenResponseMsg);
}, null);
}
else
{
uiThread.Send(delegate (object state)
{
if (vcResponse.Success)
{
screenResponseMsg = "Card token was not populated by the payment gateway. This card cannot be saved.";
}
else {
screenResponseMsg = "Card was not successfully saved";
}
AlertForm.Show(this, screenResponseMsg, vcResponse.Reason);
}, null);
}
}