Bug 34098 - StripeView.Card getter throws ArgumentOutOfBoundsException at a certain point
Summary: StripeView.Card getter throws ArgumentOutOfBoundsException at a certain point
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2015-09-20 16:25 UTC by Milan Senesi
Modified: 2017-09-28 14:29 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Milan Senesi 2015-09-20 16:25:56 UTC
When using StripeView UI on iOS as a custom renderer in Xamarin.Forms, after filling in card number (42424242 ...) and expiry month (12), StripeView.Card getter throws ArgumentOutOfBoundsException.
Comment 1 Jon Dick 2015-09-29 08:43:39 UTC
Can you attach a sample that reproduces this issue?
Comment 2 Milan Senesi 2015-10-12 01:57:47 UTC
Here is the code Im using (i dont have a stand alone test app):

using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;


[assembly: ExportRenderer(typeof(TestApp.Views.StripeView), typeof(TestApp.iOS.StripeViewRenderer))]
namespace TestApp.iOS
{
    public class StripeViewRenderer :  ViewRenderer<TestApp.Views.StripeView, Stripe.StripeView> , IVisualElementRenderer, IDisposable, IRegisterable
    {
        private Stripe.StripeView m_stripeView;

        public StripeViewRenderer ()
        {
        }

        private bool FindTextInputAndBindCardPropertyHack(UIKit.UIView View) {
            var Result = false;
            if (View == null) {
                return Result;
            }

            foreach (UIKit.UIView Subview in View.Subviews) {
                Result = FindTextInputAndBindCardPropertyHack (Subview) || Result;
            }

            if (View is UIKit.UITextField) {
                var TextField = View as UIKit.UITextField;
                TextField.EditingChanged += (object sender, EventArgs e) => {
                    try {
                        Element.Card = m_stripeView.Card;
                    } catch (Exception Ex) {

                        //
                        // StripeView.Card returns ArgumentOutOfBoundsException when expiry month is
                        // filled in
                        //

                        Console.WriteLine (Ex.ToString ());
                    }
                };

                Result = true;
            }

            return Result;
        }

        protected override void OnElementChanged(ElementChangedEventArgs<TestApp.Views.StripeView> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null || this.Element == null) {
                return;
            }

            m_stripeView = new Stripe.StripeView ();
            if (!FindTextInputAndBindCardPropertyHack (m_stripeView)) {
                Xamarin.Insights.Report (new Exception("StripeView.Card not bound, StripeView.Card property cannot be read!"), 
                                         Xamarin.Insights.Severity.Critical);
            }

            SetNativeControl(m_stripeView);
        }

        protected override void OnElementPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged (sender, e);
            if (Control == null || Element == null) {
                return;
            }
        }
    }
}
Comment 3 Jon Dick 2017-09-28 14:29:06 UTC
Stripe is no longer supporting this component.  Please check with Stripe for bindings to their native sdk's (there's also some community maintained bindings on github).