protected override async void OnSubmit(CardViewModel card)
		{
			ShowLoading();

			if (await _networkDetector.CanConnect())
			{
				tokenViewModel.CV2 = card.SecurityCode;
				tokenViewModel.PostCode = card.Postcode;
				tokenViewModel.Country = card.Country;

				Presenter.HandleResult(await PaymentService.TokenPayment(tokenViewModel));
			}
			else
			{
				HideLoading();
				OnDisplayConnectionError();
			}
		}
Exemple #2
0
		protected override async void OnSubmit(CardViewModel card)
		{
			ShowLoading();
			if (await _networkDetector.CanConnect())
			{
				var payment = new PaymentViewModel();
				payment.Card = card;
				payment.Amount = Judo.Amount;
				payment.JudoID = Judo.JudoId;
				payment.ConsumerReference = Judo.ConsumerReference;
				payment.Currency = Judo.Currency;

				Presenter.HandleResult(await PaymentService.Payment(payment));
			}
			else
			{
				HideLoading();
				OnDisplayConnectionError();
			}
		}
Exemple #3
0
		protected override async void OnSubmit(CardViewModel card)
		{
			ShowLoading();
			if (await _networkDetector.CanConnect())
			{
				var payment = new PaymentViewModel();
				payment.Card = card;
				payment.Amount = Judo.Amount;
				payment.JudoID = Judo.JudoId;
				payment.ConsumerReference = Judo.ConsumerReference;
				payment.Currency = Judo.Currency;

				Presenter.HandleResult(await PaymentService.PreAuth(payment));
			}
			else
			{
				HideLoading();
				await DisplayAlert("Can't connect", "Please check your internet connection", "OK");
			}
		}
		public void InitializeView()
		{
			_advancer.RegisterNext(cardNumberEntry);
			_advancer.RegisterNext(startDateEntry);
			_advancer.RegisterNext(issueNumberEntry);
			_advancer.RegisterNext(expiryDateEntry);
			_advancer.RegisterNext(cvvEntry);
			_advancer.RegisterNext(postcodeEntry);
		
			InitializeTheme();

			_currentDiscoveredNetwork.SetAvsEnabled(Judo.AvsEnabled);

			foreach (var countryName in _countryDiscoverer.GetCountryNames())
			{
				countryPicker.Items.Add(countryName);
			}

			SetBillingCountry();

			cardNumberEntry.TextChanged += (sender, e) => { Validate(sender); };
			expiryDateEntry.TextChanged += (sender, e) => { Validate(sender); };
			cvvEntry.TextChanged += (sender, e) => { Validate(sender); };
			startDateEntry.TextChanged += (sender, e) => { Validate(sender); };
			issueNumberEntry.TextChanged += (sender, e) => { Validate(sender); };
			postcodeEntry.TextChanged += (sender, e) => { Validate(sender); };
			countryPicker.SelectedIndexChanged += (sender, e) => SetBillingCountry();

			DisplayPaymentButtonIfValidPartsMet();

			if (Device.OS == TargetPlatform.Android)
			{
				countryPicker.Margin = new Thickness(5, 0, 0, 0);
			}

			payButton.Clicked += (sender, e) =>
			{
				cardNumberEntry.HideKeyboard();

				var card = new CardViewModel()
				{
					CardNumber = cardNumberEntry.Text,
					ExpiryDate = expiryDateEntry.Text,
					SecurityCode = cvvEntry.Text,
					StartDate = startDateEntry.Text,
					IssueNumber = issueNumberEntry.Text,
					Postcode = postcodeEntry.Text,
					Country = _currentDiscoveredCountry
				};

				OnSubmit(card);
			};
		}
		protected abstract void OnSubmit(CardViewModel card);
 public PaymentViewModelBuilder WithCardViewModel(CardViewModel cardViewModel)
 {
     _paymentViewModel.Card = cardViewModel;
     return this;
 }