示例#1
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            UINavigationController navigationController;
            PaymentConfiguration   config;

            tableView.DeselectRow(indexPath, true);

            Demo example = (Demo)indexPath.Row;
            var  theme   = themeViewController.Theme.GetStripeTheme();

            switch (example)
            {
            case Demo.PaymentCardTextField:
                var cardFieldViewContoller = new CardFieldViewController();
                cardFieldViewContoller.Theme = theme;
                navigationController         = new UINavigationController(cardFieldViewContoller);
                navigationController.NavigationBar.SetStripeTheme(theme);
                PresentViewController(navigationController, true, null);
                break;

            case Demo.AddCardViewController:
                config = new PaymentConfiguration();
                config.RequiredBillingAddressFields = BillingAddressFields.Full;
                var viewController = new MockAddCardViewController(config, theme);
                viewController.Delegate = this;
                navigationController    = new UINavigationController(viewController);
                navigationController.NavigationBar.SetStripeTheme(theme);
                PresentViewController(navigationController, true, null);
                break;

            case Demo.PaymentMethodsViewController:
                config = new PaymentConfiguration();
                config.AdditionalPaymentMethods     = PaymentMethodType.All;
                config.RequiredBillingAddressFields = BillingAddressFields.None;
                config.AppleMerchantIdentifier      = "dummy-merchant-id";
                var paymentMethodsViewController = new PaymentMethodsViewController(config, theme, customerContext, this);
                navigationController = new UINavigationController(paymentMethodsViewController);
                navigationController.NavigationBar.SetStripeTheme(theme);
                PresentViewController(navigationController, true, null);
                break;

            case Demo.ShippingInfoViewController:
                config = new PaymentConfiguration();
                config.RequiredShippingAddressFields = PKAddressField.PostalAddress;
                var shippingAddressViewController = new ShippingAddressViewController(config, theme, "usd", null, null, null);
                shippingAddressViewController.Delegate = this;
                navigationController = new UINavigationController(shippingAddressViewController);
                navigationController.NavigationBar.SetStripeTheme(theme);
                PresentViewController(navigationController, true, null);
                break;

            case Demo.ChangeTheme:
                navigationController = new UINavigationController(themeViewController);
                PresentViewController(navigationController, true, null);
                break;

            default:
                throw new NotImplementedException();
            }
        }
示例#2
0
        public void ShowAddress()
        {
            var addreesVc = new ShippingAddressViewController(WebService.Shared.CurrentUser);

            addreesVc.ShippingComplete += (object sender, EventArgs e) => ProccessOrder();
            navigation.PushViewController(addreesVc, true);
        }
示例#3
0
        public void ShippingAddressViewControllerEnteredAddress(ShippingAddressViewController addressViewController, Address address, ShippingMethodsCompletionBlock completion)
        {
            var upsGround = new PKShippingMethod
            {
                Amount     = new NSDecimalNumber(0),
                Label      = "UPS Ground",
                Detail     = "Arrives in 3-5 days",
                Identifier = "ups_ground",
            };

            var upsWorldwide = new PKShippingMethod
            {
                Amount     = new NSDecimalNumber(10.99),
                Label      = "UPS Worldwide Express",
                Detail     = "Arrives in 1-3 days",
                Identifier = "ups_worldwide",
            };

            var fedEx = new PKShippingMethod
            {
                Amount     = new NSDecimalNumber(5.99),
                Label      = "FedEx",
                Detail     = "Arrives tomorrow",
                Identifier = "fedex",
            };

            DispatchQueue.MainQueue.DispatchAfter(new DispatchTime(DispatchTime.Now, new TimeSpan(0, 0, 0, 0, 600)), () =>
            {
                if (address.Country == null || address.Country == "US")
                {
                    completion(ShippingStatus.Valid, null, new PKShippingMethod[] { upsGround, fedEx }, fedEx);
                }
                else if (address.Country == "AQ")
                {
                    var error = new NSError(new NSString("ShippingError"), 123,
                                            new NSDictionary(NSError.LocalizedDescriptionKey, new NSString("Invalid Shipping Address"),
                                                             NSError.LocalizedFailureReasonErrorKey, new NSString("We can't ship to this country.")));

                    completion(ShippingStatus.Invalid, error, null, null);
                }
                else
                {
                    fedEx.Amount = new NSDecimalNumber(20.99);

                    completion(ShippingStatus.Valid, null, new PKShippingMethod[] { upsWorldwide, fedEx }, fedEx);
                }
            });
        }
示例#4
0
 public void ShippingAddressViewControllerFinished(ShippingAddressViewController addressViewController, Address address, PKShippingMethod method)
 {
     customerContext.UpdateCustomer(address, null);
     DismissViewController(true, null);
 }
示例#5
0
 public void ShippingAddressViewControllerCancelled(ShippingAddressViewController addressViewController)
 {
     DismissViewController(true, null);
 }
示例#6
0
		public void ShowAddress ()
		{
			var addreesVc = new ShippingAddressViewController (WebService.Shared.CurrentUser);
			addreesVc.ShippingComplete += (object sender, EventArgs e) => ProccessOrder ();
			navigation.PushViewController (addreesVc, true);
		}
 public static ShippingAddressViewController Fixture()
 {
     ShippingAddressViewController controller = new ShippingAddressViewController(new ShippingAddressViewRepository(), "", new LoginView());
     return controller;
 }
        public static ShippingAddressViewController Fixture()
        {
            ShippingAddressViewController controller = new ShippingAddressViewController(new ShippingAddressViewRepository(), "", new LoginView());

            return(controller);
        }