public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            paymentDelegate = new PaymentViewControllerDelegate ();
            paymentDelegate.OnScanCompleted += (viewController, cardInfo) => {

                if (cardInfo == null) {
                    elemCardNumber.Caption = "xxxx xxxx xxxx xxxx";
                    Console.WriteLine("Cancelled");
                } else {
                    elemCardNumber.Caption = cardInfo.CardNumber;
                }

                ReloadData();

                paymentViewController.DismissViewController(true, null);
            };

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

            Root = new RootElement ("card.io") {
                new Section {
                    elemCardNumber,
                    new StyledStringElement("Enter your Credit Card", () => {
                        paymentViewController = new PaymentViewController(paymentDelegate);
                        paymentViewController.AppToken = "YOUR-APP-TOKEN";

                        NavigationController.PresentViewController(paymentViewController, true, null);
                    }) { Accessory = UITableViewCellAccessory.DisclosureIndicator }
                }
            };
        }
Пример #2
0
        public void ReadCard()
        {
            var appcontroller = UIApplication.SharedApplication.KeyWindow.RootViewController;

            var paymentDelegate       = new PaymentViewControllerDelegate();
            var paymentViewController = new PaymentViewController(paymentDelegate);

            paymentViewController.CollectCVV            = false;
            paymentViewController.CollectExpiry         = false;
            paymentViewController.MaskManualEntryDigits = true;
            paymentViewController.AppToken = "e63c673c88c44b179dcbaa9f7a1f76af";

            paymentDelegate.OnScanCompleted += (viewController, cardInfo) => {
                if (cardInfo != null)
                {
                    if (CardFound != null)
                    {
                        CardFound(cardInfo.CardNumber);
                    }
                }

                appcontroller.DismissViewController(true, null);
            };

            appcontroller.PresentViewController(paymentViewController, true, null);
        }
Пример #3
0
        public override void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, PaymentViewController paymentViewController)
        {
            var evt = OnScanCompleted;

            if (evt != null)
            {
                evt(paymentViewController, cardInfo);
            }
        }
Пример #4
0
        public override void UserDidCancel(PaymentViewController paymentViewController)
        {
            var evt = OnScanCompleted;

            if (evt != null)
            {
                evt(paymentViewController, null);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            paymentDelegate = new PaymentViewControllerDelegate();
            paymentDelegate.OnScanCompleted += (viewController, cardInfo) => {
                if (cardInfo == null)
                {
                    elemCardNumber.Caption = "xxxx xxxx xxxx xxxx";
                    Console.WriteLine("Cancelled");
                }
                else
                {
                    elemCardNumber.Caption = cardInfo.CardNumber;
                }

                ReloadData();

                paymentViewController.DismissViewController(true, null);
            };

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

            Root = new RootElement("card.io")
            {
                new Section {
                    elemCardNumber,
                    new StyledStringElement("Enter your Credit Card", () => {
                        paymentViewController          = new PaymentViewController(paymentDelegate);
                        paymentViewController.AppToken = "YOUR-APP-TOKEN";

                        NavigationController.PresentViewController(paymentViewController, true, null);
                    })
                    {
                        Accessory = UITableViewCellAccessory.DisclosureIndicator
                    }
                }
            };
        }
 public override void UserDidProvideCreditCardInfo(CreditCardInfo cardInfo, PaymentViewController paymentViewController)
 {
     var evt = OnScanCompleted;
     if (evt != null)
         evt(paymentViewController, cardInfo);
 }
 public override void UserDidCancel(PaymentViewController paymentViewController)
 {
     var evt = OnScanCompleted;
     if (evt != null)
         evt(paymentViewController, null);
 }