Ejemplo n.º 1
0
        public void StartCapture()
        {
            InitCardService();
            var paymentViewController = new CardIOPaymentViewController(this);

            rootViewController.PresentViewController(paymentViewController, true, null);
        }
Ejemplo n.º 2
0
 public override void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     // Console.WriteLine("Scanning Canceled!");
     paymentViewController.DismissViewController(true, null);
     // ccPage.OnScanCancelled();
     Xamarin.Forms.MessagingCenter.Send <CreditCard_PCL>(ccPCL, "CreditCardScanCancelled");
 }
Ejemplo n.º 3
0
        public override void UserDidProvideCreditCardInfo(CreditCardInfo card, CardIOPaymentViewController paymentViewController)
        {
            paymentViewController.DismissViewController(true, null);

            if (card == null)
            {
                Console.WriteLine("Scanning Canceled!");

                //ccPage.OnScanCancelled();
                Xamarin.Forms.MessagingCenter.Send <CreditCard_PCL>(ccPCL, "CreditCardScanCancelled");
            }
            else
            {
                //Console.WriteLine("Card Scanned: " + card.CardNumber);

                // Feel free to extend the CreditCard_PCL object to include more than what's here.
                ccPCL.cardNumber         = card.CardNumber;
                ccPCL.ccv                = card.Cvv;
                ccPCL.expr               = card.ExpiryMonth.ToString() + card.ExpiryYear.ToString();
                ccPCL.redactedCardNumber = card.RedactedCardNumber;
                ccPCL.cardholderName     = card.CardholderName;

                //ccPage.OnScanSucceeded (ccPCL);
                Xamarin.Forms.MessagingCenter.Send <CreditCard_PCL>(ccPCL, "CreditCardScanSuccess");
            }
        }
Ejemplo n.º 4
0
 public override void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     ScanningDone?.BeginInvoke(this, new CardInfoEventArgs
     {
         CardInfo = null
     }, null, null);
 }
Ejemplo n.º 5
0
        public void StartCapture()
        {
            InitCreditCardService();
            var cardIOPaymentViewController = new CardIOPaymentViewController(this);

            cardIOPaymentViewController.ScanExpiry            = true;
            cardIOPaymentViewController.CollectCardholderName = true;
            _viewController.PresentViewController(cardIOPaymentViewController, true, null);
        }
Ejemplo n.º 6
0
 public void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     _retrieveCardCancelled?.Invoke();
     if (!_formsConfig.StoreUserData)
     {
         ClearUserData();
     }
 }
Ejemplo n.º 7
0
        public void StartCapture()
        {
            InitCardService();
            var paymentViewController = new CardIOPaymentViewController(this);

            paymentViewController.DisableManualEntryButtons = true;

            rootViewController.PresentViewController(paymentViewController, true, null);
        }
Ejemplo n.º 8
0
 public void UserDidProvideCreditCardInfo(CardIOCreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     _retrieveCardSuccess?.Invoke(cardInfo);
     if (!_formsConfig.StoreUserData)
     {
         ClearUserData();
     }
 }
Ejemplo n.º 9
0
        public override void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
        {
            _creditCardInfo = cardInfo;

            Debug.WriteLine($"CardholderName : {cardInfo.CardholderName}");
            Debug.WriteLine($"Card Type : {cardInfo.CardType}");
            Debug.WriteLine($"ExpiryMonth : {cardInfo.ExpiryMonth}");
            Debug.WriteLine($"ExpiryYear : {cardInfo.ExpiryYear}");

            paymentViewController.DismissViewController(true, null);
        }
Ejemplo n.º 10
0
 /// <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;
 }
Ejemplo n.º 11
0
        public void UserDidProvideCreditCardInfo (CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
        {
            if (cardInfo == null) {
                elemCardNumber.Caption = "xxxx xxxx xxxx xxxx";
                Console.WriteLine("Cancelled");
            } else {
                elemCardNumber.Caption = cardInfo.CardNumber;
            }

            ReloadData();

            paymentViewController.DismissViewController(true, null);        
        }
Ejemplo n.º 12
0
        public void UserDidProvideCreditCardInfo(Card.IO.CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
        {
            if (cardInfo == null)
            {
                Console.WriteLine("Scanning Cancelled!");
            }
            else
            {
                this.cardInfo = cardInfo;
            }

            paymentViewController.DismissViewController(true, null);
        }
Ejemplo n.º 13
0
        public void Present()
        {
            var window = UIApplication.SharedApplication.KeyWindow;
            var vc     = window.RootViewController;

            while (vc.PresentedViewController != null)
            {
                vc = vc.PresentedViewController;
            }

            paymentViewController = new CardIOPaymentViewController(this);

            vc.PresentViewController(paymentViewController, true, null);
        }
Ejemplo n.º 14
0
 public override void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     ScanningDone?.BeginInvoke(this, new CardInfoEventArgs
     {
         CardInfo = new CardInfo
         {
             PAN    = cardInfo.CardNumber,
             CVV    = cardInfo.Cvv,
             Expiry = cardInfo.ExpiryMonth + "/" + cardInfo.ExpiryYear,
             Name   = cardInfo.CardholderName
         }
     }, null, null);
 }
        public void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
        {
            var creditCard = cardInfo == null ? AddCreditCard.Empty : new AddCreditCard
            {
                //CardNumber = cardInfo.CardNumber,
                //Cvv = cardInfo.Cvv,
                //ExpirationMonth = cardInfo.ExpiryMonth,
                //ExpirationYear = cardInfo.ExpiryYear
            };

            _callback?.Invoke(creditCard);
            _paymentViewController.DismissViewController(true, null);
            _modalHost.NativeModalViewControllerDisappearedOnItsOwn();
        }
        public void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
        {
            if (cardInfo == null)
            {
                elemCardNumber.Caption = "xxxx xxxx xxxx xxxx";
                Console.WriteLine("Cancelled");
            }
            else
            {
                elemCardNumber.Caption = cardInfo.CardNumber;
            }

            ReloadData();

            paymentViewController.DismissViewController(true, null);
        }
Ejemplo n.º 17
0
        public void UserDidProvideCreditCardInfo(CreditCardInfo card, CardIOPaymentViewController paymentViewController)
        {
            paymentViewController.DismissViewController(true, null);

            if (card != null)
            {
                var creditCardInfo = new CreditCardInformation
                {
                    CardNumber      = card.CardNumber,
                    ExpirationMonth = card.ExpiryMonth.ToString(),
                    ExpirationYear  = card.ExpiryYear.ToString()
                };

                MessagingCenter.Send(creditCardInfo, MessengerKeys.CreditCardScanned);
            }
        }
        public void ScanCardInfo(Action <AddCreditCard> callback, CreditCardScanOptions creditCardScanOptions = null)
        {
            if (creditCardScanOptions == null)
            {
                creditCardScanOptions = new CreditCardScanOptions();
            }

            _callback              = callback;
            _modalHost             = Mvx.Resolve <IMvxIosModalHost>();
            _paymentViewController = new CardIOPaymentViewController()
            {
                GuideColor = new UIColor(255, 255, 255, 1.0f)//ColorFromHex(creditCardScanOptions.GuideColor)
            };

            _modalHost.PresentModalViewController(_paymentViewController, true);
        }
Ejemplo n.º 19
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
            	
			elemCardNumber = new StyledStringElement ("xxxx xxxx xxxx xxxx");

			Root = new RootElement ("card.io") {
				new Section {
					elemCardNumber,
					new StyledStringElement("Enter your Credit Card", () => {
                        paymentViewController = new CardIOPaymentViewController (this);

						NavigationController.PresentViewController(paymentViewController, true, null);
					}) { Accessory = UITableViewCellAccessory.DisclosureIndicator }
				}
			};
		}
        public void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
        {
            creditCardInfo = cardInfo;


            edtCreditCardData.Text = cardInfo.RedactedCardNumber;            // String.Format ("#### #### #### {0} {1}/{2}", cardInfo.RedactedCardNumber.Substring (l, 4).ToString (), cardInfo.ExpiryMonth, cardInfo.ExpiryYear.ToString ().Substring (2, 2));
            edtCCV.Text            = cardInfo.Cvv;
            edtCreditDate.Text     = String.Format("{0}/{1}", cardInfo.ExpiryMonth.ToString(), cardInfo.ExpiryYear.ToString());

            switch (creditCardInfo.CardType)
            {
            case CreditCardType.Mastercard:
                imgAddCard.Image = UIImage.FromBundle(@"fa-cc-mastercard");
                crditCardType    = CardType.Mastercard;
                break;

            case CreditCardType.Visa:
                imgAddCard.Image = UIImage.FromBundle(@"fa-cc-visa");
                crditCardType    = CardType.Visa;
                break;

            case CreditCardType.Amex:
                imgAddCard.Image = UIImage.FromBundle(@"fa-cc-amex");
                crditCardType    = CardType.AmericanExpress;
                break;

            case CreditCardType.Discover:
                imgAddCard.Image = UIImage.FromBundle(@"fa-cc-discover");
                crditCardType    = CardType.Discover;
                break;

            case CreditCardType.JCB:
                imgAddCard.Image = UIImage.FromBundle(@"fa-cc-diners-club");
                crditCardType    = CardType.DinersClub;
                break;

            default:
                imgAddCard.Image = UIImage.FromBundle(@"oi-credit-card");
                crditCardType    = CardType.Unknown;
                break;
            }

            paymentViewController.DismissViewController(true, null);
        }
Ejemplo n.º 21
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;
        }
Ejemplo n.º 22
0
        private void ScanCard()
        {
            if (_cardScanner == null)
            {
                _cardScannerDelegate = new CardScannerDelegate(PopulateCreditCardName);
                _cardScanner         = new CardIOPaymentViewController(_cardScannerDelegate)
                {
                    GuideColor = this.View.BackgroundColor,
                    SuppressScanConfirmation = true,
                    CollectCVV                           = false,
                    CollectExpiry                        = false,
                    DisableManualEntryButtons            = true,
                    DisableBlurWhenBackgrounding         = true,
                    AutomaticallyAdjustsScrollViewInsets = false,
                    HideCardIOLogo                       = true,
                };
            }

            PresentViewController(_cardScanner, true, null);
        }
Ejemplo n.º 23
0
        public void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
        {
            if (cardInfo != null)
            {
                if (CardFound != null)
                {
                    CardFound(cardInfo.RedactedCardNumber, (int)cardInfo.ExpiryMonth, (int)cardInfo.ExpiryYear, cardInfo.CardholderName, cardInfo.CardType);
                }
            }

            //if (cardInfo == null)
            //{
            //	Console.WriteLine("Scanning Canceled!");
            //}
            //else {
            //	Console.WriteLine("Card Scanned: " + cardInfo.CardNumber);
            //}

            paymentViewController.DismissViewController(true, null);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            elemCardNumber = new StyledStringElement("xxxx xxxx xxxx xxxx");

            Root = new RootElement("card.io")
            {
                new Section {
                    elemCardNumber,
                    new StyledStringElement("Enter your Credit Card", () => {
                        paymentViewController = new CardIOPaymentViewController(this);

                        NavigationController.PresentViewController(paymentViewController, true, null);
                    })
                    {
                        Accessory = UITableViewCellAccessory.DisclosureIndicator
                    }
                }
            };
        }
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            // I don't know why ViewDidAppear keeps firing again, but we're able to shut it down
            // by checking bViewAlreadyDisappeared.
            if (bViewAlreadyDisappeared)
            {
                return;
            }

            //var paymentDelegate = new CardIOPaymentViewControllerDg(ccPage);

            // Create and Show the View Controller
            //var paymentViewController = new CardIOPaymentViewController(paymentDelegate);
            CardIOPaymentViewController paymentViewController = new CardIOPaymentViewController(this);

            paymentViewController.CollectExpiry         = ccPage.cardIOConfig.RequireExpiry;
            paymentViewController.CollectCVV            = ccPage.cardIOConfig.RequireCvv;
            paymentViewController.CollectPostalCode     = ccPage.cardIOConfig.RequirePostalCode;
            paymentViewController.HideCardIOLogo        = ccPage.cardIOConfig.HideCardIOLogo;
            paymentViewController.CollectCardholderName = ccPage.cardIOConfig.CollectCardholderName;

            if (!string.IsNullOrEmpty(ccPage.cardIOConfig.Localization))
            {
                paymentViewController.LanguageOrLocale = ccPage.cardIOConfig.Localization;
            }
            if (!string.IsNullOrEmpty(ccPage.cardIOConfig.ScanInstructions))
            {
                paymentViewController.ScanInstructions = ccPage.cardIOConfig.ScanInstructions;
            }



            // Not sure if this needs to be diabled, but it doesn't seem like something I want to do.
            paymentViewController.AllowFreelyRotatingCardGuide = false;

            // Display the card.io interface
            PresentViewController(paymentViewController, true, null);
        }
Ejemplo n.º 26
0
        public void RequestCardData(Action onCancelled, Action <CardIOCreditCardInfo> onSuccess, PayPal.Forms.Abstractions.Enum.CardIOLogo scannerLogo)
        {
            RetrieveCardCancelled = onCancelled;
            RetrieveCardSuccess   = onSuccess;
            var scanViewController = new CardIOPaymentViewController(new CustomCardIOPaymentViewControllerDelegate(this));

            switch (scannerLogo)
            {
            case Abstractions.Enum.CardIOLogo.CardIO:
                scanViewController.HideCardIOLogo = false;
                scanViewController.UseCardIOLogo  = true;
                break;

            case Abstractions.Enum.CardIOLogo.None:
                scanViewController.HideCardIOLogo = true;
                scanViewController.UseCardIOLogo  = false;
                break;
            }
            var top = GetTopViewController(UIApplication.SharedApplication.KeyWindow);

            top.PresentViewController(scanViewController, true, null);
        }
Ejemplo n.º 27
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            if (_appeared)
            {
                DismissViewController(false, null);
                return;
            }

            _appeared = true;

            var paymentViewController = new CardIOPaymentViewController(this);

            paymentViewController.CollectExpiry             = true;
            paymentViewController.CollectCVV                = false;
            paymentViewController.CollectPostalCode         = false;
            paymentViewController.HideCardIOLogo            = true;
            paymentViewController.UseCardIOLogo             = false;
            paymentViewController.DisableManualEntryButtons = true;

            paymentViewController.AllowFreelyRotatingCardGuide = true;
            PresentViewController(paymentViewController, true, null);
        }
		/// <summary>
		/// Overrides the Card IO delegate method called after the user completes the Card IO view controller.
		/// </summary>
		/// <param name="CreditCardInfo">The retrieved credit card information.</param>
		/// <param name="PaymentViewController">The Card IO payment view controller.</param>
		public override void InPaymentViewController (CardIOCreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
		{
			if ( CardIORetrievalCompleted != null )
				CardIORetrievalCompleted.Invoke (new CardIORetrievalCompletedEventArgs (paymentViewController, cardInfo));
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="CardIOSDK.CardIOGenericEventArgs"/> class.
		/// </summary>
		/// <param name="ViewController">The Card IO view controller that ultimately triggered the event.</param>
		public CardIOGenericEventArgs( CardIOPaymentViewController ViewController )
		{
			this.ViewController = ViewController;
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="CardIOSDK.CardIORetrievalCanceledEventArgs"/> class.
		/// </summary>
		/// <param name="ViewController">The Card IO view controller that ultimately triggered the event.</param>
		public CardIORetrievalCanceledEventArgs(CardIOPaymentViewController ViewController)
			: base(ViewController)
		{
		}
Ejemplo n.º 31
0
 public override void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     Console.WriteLine("Scanning Canceled!");
     paymentViewController.DismissViewController(true, null);
 }
Ejemplo n.º 32
0
 /// <inheritdoc/>
 public void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     this._result = new CardIOResult() { Success = false };
     this._finished = true;
 }
Ejemplo n.º 33
0
 public void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="CardIOSDK.CardIORetrievalCompletedEventArgs"/> class.
		/// </summary>
		/// <param name="ViewController">The Card IO view controller that ultimately triggered the event.</param>
		/// <param name="CreditCardInfo">The retrieved credit card information.</param>
		public CardIORetrievalCompletedEventArgs(CardIOPaymentViewController ViewController, CardIOCreditCardInfo CreditCardInfo)
			: base(ViewController)
		{
			this.CreditCardInfo = CreditCardInfo;
		}
Ejemplo n.º 35
0
 public void UserDidProvideCreditCardInfo(CardIOCreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     RetrieveCardSuccess?.Invoke(cardInfo);
 }
Ejemplo n.º 36
0
 public void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     RetrieveCardCancelled?.Invoke();
 }
Ejemplo n.º 37
0
 public override void UserDidProvideCreditCardInfo(CardIOCreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
 {
     PayPalManager.UserDidProvideCreditCardInfo(cardInfo, paymentViewController);
 }
Ejemplo n.º 38
0
 public override void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     PayPalManager.UserDidCancelPaymentViewController(paymentViewController);
 }
Ejemplo n.º 39
0
 public void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     RetrieveCardCancelled?.Invoke();
 }
Ejemplo n.º 40
0
 public void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     Console.WriteLine("Scanning Cancelled!");
 }
		/// <summary>
		/// Overrides the Card IO delegate method called after the user cancels the Card IO view controller.
		/// </summary>
		/// <param name="PaymentViewController">The Card IO payment view controller.</param>
		public override void UserDidCancelPaymentViewController (CardIOPaymentViewController PaymentViewController)
		{
			if(CardIORetrievalCanceled!=null)
				CardIORetrievalCanceled.Invoke (new CardIORetrievalCanceledEventArgs(PaymentViewController));
		}
Ejemplo n.º 42
0
 public override void UserDidProvideCreditCardInfo(CardIOCreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
 {
     PayPalManager.UserDidProvideCreditCardInfo(cardInfo, paymentViewController);
 }
Ejemplo n.º 43
0
 public override void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
 {
     PayPalManager.UserDidCancelPaymentViewController(paymentViewController);
 }
Ejemplo n.º 44
0
        public void RequestCardData(Action onCancelled, Action<CardIOCreditCardInfo> onSuccess, PayPal.Forms.Abstractions.Enum.CardIOLogo scannerLogo)
        {
            RetrieveCardCancelled = onCancelled;
            RetrieveCardSuccess = onSuccess;
            var scanViewController = new CardIOPaymentViewController(new CustomCardIOPaymentViewControllerDelegate(this));

            switch (scannerLogo)
            {
                case Abstractions.Enum.CardIOLogo.CardIO:
                    scanViewController.HideCardIOLogo = false;
                    scanViewController.UseCardIOLogo = true;
                    break;
                case Abstractions.Enum.CardIOLogo.None:
                    scanViewController.HideCardIOLogo = true;
                    scanViewController.UseCardIOLogo = false;
                    break;
            }
            var top = GetTopViewController(UIApplication.SharedApplication.KeyWindow);
            top.PresentViewController(scanViewController, true, null);
        }
Ejemplo n.º 45
0
 public void UserDidCancelPaymentViewController (CardIOPaymentViewController paymentViewController)
 {
 	paymentViewController.DismissViewController(true, null);
 }
Ejemplo n.º 46
0
 public void UserDidProvideCreditCardInfo(CardIOCreditCardInfo cardInfo, CardIOPaymentViewController paymentViewController)
 {
     paymentViewController.DismissViewController(true, null);
     RetrieveCardSuccess?.Invoke(cardInfo);
 }