Example #1
0
        public StartPage()
        {
            RenderContent();

            btnScanCreditCard.Clicked += (sender, args) => {
                CardIOConfig cardIOConfig = new CardIOConfig();
                var          ccPage       = new CreditCardEntryPage(cardIOConfig);

                // Not really called - Can't get reference to the CreditCardEntryPage right in Android.
                ccPage.ScanCancelled += HandleScanCancelled;
                ccPage.ScanSucceeded += HandleScanSucceeded;

                Navigation.PushModalAsync(ccPage);
            };

            MessagingCenter.Subscribe <CreditCard_PCL>(this, "CreditCardScanSuccess", (sender) => {
                // Do something whenever the "iOSCreditCardReceived" message is sent.
                // We could fill in CCV and expiration date things here, whatever else we need.
                // This is enough to show capability, however.
                txtCreditCardNumber.TextColor = Color.Black;
                txtCreditCardNumber.Text      = "Scanned number: " + sender.redactedCardNumber;
                Navigation.PopModalAsync();
            });

            MessagingCenter.Subscribe <CreditCard_PCL>(this, "CreditCardScanCancelled", (sender) => {
                // Do something whenever the "CreditCardCancelled" message is sent.
                Navigation.PopModalAsync();
            });
        }
Example #2
0
 public CreditCardEntryPage()
 {
     cardIOConfig = new CardIOConfig()
     {
         CollectCardholderName = true,
         HideCardIOLogo        = false,
         RequireCvv            = true,
         RequireExpiry         = true
     };
     InitializeComponent();
 }
Example #3
0
        /// <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;
        }
Example #4
0
 public CreditCardEntryPage(CardIOConfig config)
 {
     cardIOConfig = config;
 }