void SetUpTableView () { Dictionary<string, Action> buttonDictionary = new Dictionary<string, Action> (); SuccessCallback successCallback = SuccessPayment; FailureCallback failureCallback = FailurePayment; var tokenPayment = new TokenPaymentViewModel { Amount = 3.5m, ConsumerReference = consumerRef, PaymentReference = paymentReference, CV2 = cv2 }; buttonDictionary.Add ("Make a Payment", () => { JudoSDKManager.Payment (GetCardViewModel (), successCallback, failureCallback, this.NavigationController); }); buttonDictionary.Add ("PreAuthorise", delegate { JudoSDKManager.PreAuth (GetCardViewModel (), successCallback, failureCallback, this.NavigationController); }); buttonDictionary.Add ("Token Payment", delegate { tokenPayment.Token = cardToken; tokenPayment.ConsumerToken = consumerToken; tokenPayment.LastFour = lastFour; tokenPayment.CardType = cardType; JudoSDKManager.TokenPayment (tokenPayment, successCallback, failureCallback, this.NavigationController); }); buttonDictionary.Add ("Token PreAuthorise", delegate { tokenPayment.Token = cardToken; tokenPayment.ConsumerToken = consumerToken; tokenPayment.LastFour = lastFour; tokenPayment.CardType = cardType; JudoSDKManager.TokenPreAuth (tokenPayment, successCallback, failureCallback, this.NavigationController); }); buttonDictionary.Add ("Register a Card", delegate { JudoSDKManager.RegisterCard (GetCardViewModel (), successCallback, failureCallback, this.NavigationController); }); MainMenuSource menuSource = new MainMenuSource (buttonDictionary); ButtonTable.Source = menuSource; TableHeightConstrant.Constant = menuSource.GetTableHeight () + 60f; }
/// <summary> /// Process a token authorisation payment /// </summary> /// <param name="payment">TokenPaymentViewModel to pass Amount and Token detail</param> /// <param name="success">Callback for success transaction</param> /// <param name="failure">Callback for fail transaction</param> /// <param name="navigationController">Navigation controller from UI this can be Null for non-UI Mode API</param> public static void TokenPreAuth (TokenPaymentViewModel payment, SuccessCallback success, FailureCallback failure, UINavigationController navigationController) { var innerModel = payment.Clone (); if (UIMode && navigationController == null) { var error = new JudoError { Exception = new Exception ("Navigation controller cannot be null with UIMode enabled.") }; failure (error); } else { _judoSdkApi.TokenPreAuth (innerModel, success, failure, navigationController); } }