示例#1
0
        public void Initialize(StripeConfig stripeConfig)
        {
            if (_paymentContext != null)
            {
                return;
            }

            if (STPPaymentConfiguration.SharedConfiguration().PublishableKey == null)
            {
                STPPaymentConfiguration.SharedConfiguration().PublishableKey = stripeConfig.ApiKey;
            }

            var stripeRemoteService =
                new StripeRemoteService(stripeConfig, _restHttpClient, _logManager, _jsonSerializer);
            var provider        = new StripeEphemeralKeyProvider(stripeRemoteService, _logManager);
            var customerContext = new CustomerContext(provider, stripeRemoteService);

            _paymentContext = new STPPaymentContext(
                customerContext,
                STPPaymentConfiguration.SharedConfiguration(),
                STPTheme.DefaultTheme)
            {
                HostViewController = _getUiViewControllerFunc(),
                Delegate           = new PaymentDelegate(_messageHub, stripeRemoteService)
            };
        }
示例#2
0
            public override async void PaymentContext(STPPaymentContext paymentContext, STPPaymentResult paymentResult,
                                                      STPErrorBlock completion)
            {
                var result = await _stripeRemoteService.RequestPaymentAsync((int)paymentContext.PaymentAmount,
                                                                            paymentResult.Source.StripeID, paymentContext.PaymentCurrency, "test_ios");

                completion(result ? null : new NSError());
            }
示例#3
0
            public override void PaymentContextDidChange(STPPaymentContext paymentContext)
            {
                var paymentMethod = paymentContext.SelectedPaymentMethod;
                var message       = paymentMethod == null
                    ? new PaymentMethodChangedMessage()
                    : new PaymentMethodChangedMessage
                {
                    Label = paymentMethod.Label,
                    Image = paymentMethod.Image?.AsPNG().AsStream()
                };

                _messageHub.SendMessage(message);
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            var config = STPPaymentConfiguration.SharedConfiguration();

            config.ShippingType = STPShippingType.Shipping;
            config.RequiredShippingAddressFields = PassKit.PKAddressField.PostalAddress | PassKit.PKAddressField.Phone;

            paymentContext = new STPPaymentContext(new MyAPIClient(), config, STPTheme.DefaultTheme);

            paymentContext.PaymentCurrency = "USD";
            paymentContext.PaymentAmount   = 1000;

            paymentContext.WeakDelegate       = this;
            paymentContext.HostViewController = this;
        }
 public void PaymentContext(STPPaymentContext paymentContext, STPPaymentStatus status, NSError error)
 {
 }
 public void PaymentContext(STPPaymentContext paymentContext, STPPaymentResult paymentResult, STPErrorBlock completion)
 {
 }
 public void PaymentContextDidChange(STPPaymentContext paymentContext)
 {
 }
 public void PaymentContext(STPPaymentContext paymentContext, NSError error)
 {
 }
示例#9
0
 public override void PaymentContext(STPPaymentContext paymentContext, NSError error)
 {
 }