public void BuyBeer(BeerPaymentViewModel beerPaymentModel) { PaymentViewModel judoModel = new PaymentViewModel() { Amount = beerPaymentModel.GetSubTotal(), Currency = "GBP", ConsumerReference = "ImHereForTheBeer01", Card = new CardViewModel() }; JudoSuccessCallback successCallback = SuccessPayment; JudoFailureCallback failureCallback = FailurePayment; if (String.IsNullOrEmpty(Client.Instance.PaymentToken.CardToken)) { Judo.Instance.Payment(judoModel, successCallback, failureCallback); } else { TokenPaymentViewModel tokenModel = new TokenPaymentViewModel() { Amount = beerPaymentModel.GetSubTotal(), Currency = "GBP", ConsumerReference = "ImHereForTheBeer01", Token = Client.Instance.PaymentToken.CardToken, ConsumerToken = Client.Instance.PaymentToken.ConsumerToken, LastFour = Client.Instance.PaymentToken.CardLastfour, CardType = (CardType)Client.Instance.PaymentToken.CardType }; Judo.Instance.TokenPayment(tokenModel, successCallback, failureCallback); } }
public void BuyBeer (BeerPaymentViewModel beerPaymentModel) { PaymentViewModel judoModel = new PaymentViewModel () { Amount = beerPaymentModel.GetSubTotal (), Currency = "GBP", ConsumerReference = "ImHereForTheBeer01", Card = new CardViewModel () }; JudoSuccessCallback successCallback = SuccessPayment; JudoFailureCallback failureCallback = FailurePayment; if (String.IsNullOrEmpty (Client.Instance.PaymentToken.CardToken)) { Judo.Instance.Payment (judoModel, successCallback, failureCallback); } else { TokenPaymentViewModel tokenModel = new TokenPaymentViewModel () { Amount = beerPaymentModel.GetSubTotal (), Currency = "GBP", ConsumerReference = "ImHereForTheBeer01", Token = Client.Instance.PaymentToken.CardToken, ConsumerToken = Client.Instance.PaymentToken.ConsumerToken, LastFour = Client.Instance.PaymentToken.CardLastfour, CardType = (CardType)Client.Instance.PaymentToken.CardType }; Judo.Instance.TokenPayment (tokenModel, successCallback, failureCallback); } }
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 void TokenPreAuth(TokenPaymentViewModel payment, JudoSuccessCallback success, JudoFailureCallback failure, Activity context) { EvaluateRootCheck(failure); var innerModel = payment.Clone(); _judoSdkApi.TokenPreAuth(innerModel, success, failure, context); }
public void TokenPreAuth(TokenPaymentViewModel payment, SuccessCallback success, FailureCallback failure, UINavigationController navigationController) { var view = _viewLocator.GetTokenPreAuthView(); view.successCallback = success; view.failureCallback = failure; view.tokenPayment = payment; PresentView (navigationController, view); }
/// <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 void TokenPreAuth(TokenPaymentViewModel payment, JudoSuccessCallback success, JudoFailureCallback failure) { RootCheck(failure); var innerModel = payment.Clone(); _judoSdkApi.TokenPreAuth(innerModel, success, failure); }
public void TokenPreAuth(TokenPaymentViewModel payment, JudoSuccessCallback success, JudoFailureCallback failure, Activity context) { try { _paymentService.MakeTokenPreAuthorisation(payment, new ClientService()).ContinueWith(reponse => HandleResponse(success, failure, reponse)); } catch (Exception ex) { // Failure HandleFailure(failure, ex); } }
public IActionResult Index(TokenPaymentViewModel model) { var res = _service.VerifyPaymentResponse(model.BridgeProtocol_PaymentResponse); if (res != null) { model.BridgeProtocol_PaymentVerified = true; } return(View(model)); }
public void TokenPreAuth(TokenPaymentViewModel payment, SuccessCallback success, FailureCallback failure, UINavigationController navigationController) { try { _paymentService.MakeTokenPreAuthorisation(payment).ContinueWith(reponse => HandResponse(success, failure, reponse)); } catch (Exception ex) { // Failure HandleFailure (failure,ex); } }
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); }
public virtual void MakeTokenPayment() { TokenPaymentViewModel payment = new TokenPaymentViewModel() { Currency = judoCurrency, Amount = judoAmount, ConsumerToken = judoConsumer.ConsumerToken, JudoID = judoId, CardType = judoCardToken.CardType, Token = judoCardToken.Token, ConsumerReference = judoConsumer.YourConsumerReference, PaymentReference = judoPaymentRef, CV2 = cv2EntryView.GetCV2() }; ShowLoadingSpinner(true); _paymentService.MakeTokenPayment(payment, new ClientService()).ContinueWith(HandleServerResponse, TaskScheduler.FromCurrentSynchronizationContext()); }
public void TokenPreAuth(TokenPaymentViewModel payment, JudoSuccessCallback success, JudoFailureCallback failure) { var vc = GetCurrentViewController(); if (JudoSDKManager.UIMode && vc == null) { var error = new JudoError { Exception = new Exception("Navigation controller cannot be null with UIMode enabled.") }; failure(error); } else { var view = _viewLocator.GetTokenPreAuthView(); view.successCallback = success; view.failureCallback = failure; view.tokenPayment = payment; PresentView(vc as UINavigationController, view); } }
void SetUpTableView () { Dictionary<string, Action> buttonDictionary = new Dictionary<string, Action> (); JudoSuccessCallback successCallback = SuccessPayment; JudoFailureCallback failureCallback = FailurePayment; var tokenPayment = new TokenPaymentViewModel () { Amount = 3.5m, ConsumerReference = consumerRef, CV2 = cv2 }; buttonDictionary.Add ("Make a Payment", delegate { Judo.Instance.Payment (GetCardViewModel (), successCallback, failureCallback); }); buttonDictionary.Add ("PreAuthorise", delegate { Judo.Instance.PreAuth (GetCardViewModel (), successCallback, failureCallback); }); buttonDictionary.Add ("Token Payment", delegate { tokenPayment.Token = cardToken; tokenPayment.ConsumerToken = consumerToken; tokenPayment.LastFour = lastFour; tokenPayment.CardType = cardType; Judo.Instance.TokenPayment (tokenPayment, successCallback, failureCallback); }); buttonDictionary.Add ("Token PreAuthorise", delegate { tokenPayment.Token = cardToken; tokenPayment.ConsumerToken = consumerToken; tokenPayment.LastFour = lastFour; tokenPayment.CardType = cardType; Judo.Instance.TokenPreAuth (tokenPayment, successCallback, failureCallback); }); buttonDictionary.Add ("Register a Card", delegate { var payment = GetCardViewModel (); payment.Amount = 1.01m; //Minimum amount Gateways accept without question Judo.Instance.RegisterCard (payment, successCallback, failureCallback); }); if (_clientService.ApplePayAvailable) { buttonDictionary.Add ("Make a ApplePay Payment", delegate { Judo.Instance.MakeApplePayment (GetApplePayViewModel (), successCallback, failureCallback); }); buttonDictionary.Add ("Make a ApplePay PreAuthorise", delegate { Judo.Instance.MakeApplePreAuth (GetApplePayViewModel (), successCallback, failureCallback); }); } MainMenuSource menuSource = new MainMenuSource (buttonDictionary); ButtonTable.Source = menuSource; TableHeightConstrant.Constant = menuSource.GetTableHeight () + 60f; }
void SetUpTableView() { Dictionary <string, Action> buttonDictionary = new Dictionary <string, Action> (); JudoSuccessCallback successCallback = SuccessPayment; JudoFailureCallback failureCallback = FailurePayment; var tokenPayment = new TokenPaymentViewModel() { Amount = 3.5m, ConsumerReference = consumerRef, CV2 = cv2 }; buttonDictionary.Add("Make a Payment", delegate { Judo.Instance.Payment(GetCardViewModel(), successCallback, failureCallback); }); buttonDictionary.Add("PreAuthorise", delegate { Judo.Instance.PreAuth(GetCardViewModel(), successCallback, failureCallback); }); buttonDictionary.Add("Token Payment", delegate { tokenPayment.Token = cardToken; tokenPayment.ConsumerToken = consumerToken; tokenPayment.LastFour = lastFour; tokenPayment.CardType = cardType; Judo.Instance.TokenPayment(tokenPayment, successCallback, failureCallback); }); buttonDictionary.Add("Token PreAuthorise", delegate { tokenPayment.Token = cardToken; tokenPayment.ConsumerToken = consumerToken; tokenPayment.LastFour = lastFour; tokenPayment.CardType = cardType; Judo.Instance.TokenPreAuth(tokenPayment, successCallback, failureCallback); }); buttonDictionary.Add("Register a Card", delegate { var payment = GetCardViewModel(); payment.Amount = 1.01m; //Minimum amount Gateways accept without question Judo.Instance.RegisterCard(payment, successCallback, failureCallback); }); if (_clientService.ApplePayAvailable) { buttonDictionary.Add("Make a ApplePay Payment", delegate { Judo.Instance.MakeApplePayment(GetApplePayViewModel(), successCallback, failureCallback); }); buttonDictionary.Add("Make a ApplePay PreAuthorise", delegate { Judo.Instance.MakeApplePreAuth(GetApplePayViewModel(), successCallback, failureCallback); }); } MainMenuSource menuSource = new MainMenuSource(buttonDictionary); ButtonTable.Source = menuSource; TableHeightConstrant.Constant = menuSource.GetTableHeight() + 60f; }