/// <inheritdoc/> public async Task<CardIOResult> Scan(CardIOConfig config = null) { if(this._paymentViewController == null) this._paymentViewController = new CardIOPaymentViewController(); if (config == null) config = new CardIOConfig(); this._result = null; this._finished = false; this._paymentViewController.CollectExpiry = config.RequireExpiry; this._paymentViewController.CollectCVV = config.RequireCvv; this._paymentViewController.CollectPostalCode = config.RequirePostalCode; this._paymentViewController.UseCardIOLogo = config.ShowPaypalLogo; if (!string.IsNullOrEmpty(config.ScanInstructions)) this._paymentViewController.ScanInstructions = config.ScanInstructions; if (!string.IsNullOrEmpty(config.Localization)) this._paymentViewController.LanguageOrLocale = config.Localization; if(!string.IsNullOrEmpty(config.ScanInstructions)) this._paymentViewController.ScanInstructions = config.ScanInstructions; Device.BeginInvokeOnMainThread(() => { var window= UIApplication.SharedApplication.KeyWindow; var vc = window.RootViewController; while (vc.PresentedViewController != null) { vc = vc.PresentedViewController; } vc.PresentViewController( this._paymentViewController, true, null); }); while (!this._finished) await Task.Delay(100); return this._result; }
/// <inheritdoc/> public void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController) { this._result = new CardIOResult { CreditCardType = cardInfo.CardType.ToPclCardType(), CardNumber = cardInfo.CardNumber, Cvv = cardInfo.Cvv, Expiry = new DateTime((int)cardInfo.ExpiryYear, (int)cardInfo.ExpiryMonth, 1), PostalCode = cardInfo.PostalCode, Success = true }; this._finished = true; }
/// <inheritdoc/> public void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController) { this._result = new CardIOResult() { Success = false }; this._finished = true; }