Inheritance: BasePaymentViewModel
        public void TokenPayment(JudoDotNetXamarin.TokenPaymentViewModel payment, JudoDotNetXamarin.JudoSuccessCallback success, JudoDotNetXamarin.JudoFailureCallback failure, Activity context)
        {
            Intent i = new Intent(context, typeof(UIMethods));

            i.PutExtra(JudoSDKManager.REQUEST_CODE, ACTION_TOKEN_PAYMENT.ToString());
            i.PutExtra(JudoSDKManager.JUDO_PAYMENT_REF, payment.PaymentReference);
            i.PutExtra(JudoSDKManager.JUDO_CONSUMER, JsonConvert.SerializeObject(new Consumer()
            {
                YourConsumerReference = payment.ConsumerReference,
                ConsumerToken         = payment.ConsumerToken
            }));
            i.PutExtra(JudoSDKManager.JUDO_AMOUNT, payment.Amount.ToString());
            i.PutExtra(JudoSDKManager.JUDO_ID, (String.IsNullOrWhiteSpace(payment.JudoID) ? JudoConfiguration.Instance.JudoId : payment.JudoID));
            i.PutExtra(JudoSDKManager.JUDO_CURRENCY, payment.Currency);
            i.PutExtra(JudoSDKManager.JUDO_CARD_DETAILS, JsonConvert.SerializeObject(new CardToken()
            {
                CardLastFour  = payment.LastFour,
                CardType      = payment.CardType,
                Token         = payment.Token,
                ConsumerToken = payment.ConsumerToken
            }));
            _judoSuccessCallback = new Lazy <JudoSuccessCallback> (() => success);
            _judoFailureCallback = new Lazy <JudoFailureCallback> (() => failure);

            context.StartActivityForResult(i, ACTION_TOKEN_PAYMENT);
        }
		void PopulateTokenPaymentModel(TokenPaymentViewModel tokenPayment)
		{
			_judo.Validate();
			_sessionTokenPaymentModel.JudoId = (string.IsNullOrWhiteSpace(tokenPayment.JudoID) ? _judo.JudoId : tokenPayment.JudoID);
			_sessionTokenPaymentModel.YourConsumerReference = (string.IsNullOrWhiteSpace(tokenPayment.ConsumerReference) ? ("Consumer:" + _judo.JudoId) : tokenPayment.ConsumerReference);
			_sessionTokenPaymentModel.Amount = tokenPayment.Amount;
			_sessionTokenPaymentModel.CardToken = tokenPayment.Token;
			_sessionTokenPaymentModel.CV2 = tokenPayment.CV2;
			_sessionPaymentModel.CardAddress = new CardAddressModel()
			{
				PostCode = tokenPayment.PostCode,
				CountryCode = tokenPayment.Country.GetISOCode()
			};
			_sessionTokenPaymentModel.ConsumerToken = tokenPayment.ConsumerToken;
			_sessionTokenPaymentModel.YourPaymentMetaData = tokenPayment.YourPaymentMetaData;
			_sessionTokenPaymentModel.ClientDetails = clientService.GetClientDetails();
		}
        public async Task <IResult <ITransactionResult> > MakeTokenPayment(TokenPaymentViewModel tokenPayment, IClientService clientService)
        {
            JudoConfiguration.Instance.Validate();
            TokenPaymentModel payment = new TokenPaymentModel {
                JudoId = (String.IsNullOrWhiteSpace(tokenPayment.JudoID) ? JudoConfiguration.Instance.JudoId : tokenPayment.JudoID),
                YourPaymentReference  = tokenPayment.PaymentReference,
                YourConsumerReference = tokenPayment.ConsumerReference,
                Amount              = tokenPayment.Amount,
                CardToken           = tokenPayment.Token,
                CV2                 = tokenPayment.CV2,
                ConsumerToken       = tokenPayment.ConsumerToken,
                YourPaymentMetaData = tokenPayment.YourPaymentMetaData,
                ClientDetails       = clientService.GetClientDetails(),
                UserAgent           = clientService.GetSDKVersion()
            };
            Task <IResult <ITransactionResult> > task = _judoAPI.Payments.Create(payment);

            return(await task);
        }
		internal async void RegisterCardHandler(object sender, IResult<ITransactionResult> result)
		{
			await Navigation.PopAsync();

			if (result.HasError)
			{
				await DisplayAlert("Error adding card", "Code: " + result.Error.Code, "OK");
			}
			else if ("Success".Equals(result.Response.Result))
			{
				var receipt = result.Response as PaymentReceiptModel;
				var cardType = (CardNetwork)Enum.Parse(typeof(CardNetwork), receipt.CardDetails.CardType.ToString());

				var token = new TokenPaymentViewModel
				{
					LastFour = receipt.CardDetails.CardLastfour,
					ExpiryDate = receipt.CardDetails.EndDate,
					CardType = cardType,
					Token = receipt.CardDetails.CardToken,
					ConsumerToken = receipt.Consumer.ConsumerToken,
					ConsumerReference = receipt.Consumer.YourConsumerReference
				};

				Settings.CardToken = JsonConvert.SerializeObject(token);

				if (await DisplayAlert("Card added", "Perform token payment?", "Yes", "No"))
				{
					var page = new TokenPaymentPage(BuildJudo(), new TokenPaymentDefaultsViewModel(token.LastFour, token.ExpiryDate, token.Token, token.ConsumerToken, token.CardType));
					page.resultHandler += Handler;
					await Navigation.PushAsync(page);
				}
			}
		}
		public async Task<IResult<ITransactionResult>> TokenPreAuth(TokenPaymentViewModel tokenPayment)
		{
			PopulateTokenPaymentModel(tokenPayment);

			Task<IResult<ITransactionResult>> task = _judoAPI.PreAuths.Create(_sessionTokenPaymentModel);
			return await task;
		}
 TokenPaymentViewModel GetTokenCardViewModel ()
 {
     var tokenPayment = new TokenPaymentViewModel () {
         Amount = 3.5m,
         ConsumerReference = consumerRef,
         Currency = "GBP",
         CV2 = cv2,
         Token = cardToken,
         ConsumerToken = consumerToken,
         LastFour = lastFour,
         CardType = cardType
     };
     return tokenPayment;
 }