Forum Xamarin.Android

How to resolve CS0103 error on Stripe xamarin binding?

I'm trying to make a new binding for the Stripe Android SDK, because the bindings out there are outdated and lacks the SCA authentication, a new feature released recently that will be required in EU markets.

I'm using the last version available today, the 10.2.1, and I have only one error left:

Error CS0103 The name 'Start' does not exist in the current context

I have some experience making bindings for Android but this one is hard to resolve:

If I go to the autogenerated class where the error is reported -PaymentAuthWebViewStarter- I can see this:

// This method is explicitly implemented as a member of an instantiated Com.Stripe.Android.View.IAuthActivityStarter
void global::Com.Stripe.Android.View.IAuthActivityStarter.Start (global::Java.Lang.Object p0)
{
    Start (global::Java.Interop.JavaObjectExtensions.JavaCast<global::Com.Stripe.Android.PaymentAuthWebViewStarter.Data>(p0));
}

But there is no code for Start there. It is expected because the api.xml show me the following code for that class:

<class abstract="false" deprecated="not deprecated" extends="java.lang.Object" extends-generic-aware="java.lang.Object" jni-extends="Ljava/lang/Object;" final="false" name="PaymentAuthWebViewStarter" static="false" visibility="public" jni-signature="Lcom/stripe/android/PaymentAuthWebViewStarter;">
  <implements name="com.stripe.android.view.AuthActivityStarter" name-generic-aware="com.stripe.android.view.AuthActivityStarter&lt;com.stripe.android.PaymentAuthWebViewStarter.Data&gt;" jni-type="Lcom/stripe/android/view/AuthActivityStarter&lt;Lcom/stripe/android/PaymentAuthWebViewStarter$Data;&gt;;">
  </implements>
  <field deprecated="not deprecated" final="true" name="EXTRA_AUTH_URL" jni-signature="Ljava/lang/String;" static="true" transient="false" type="java.lang.String" type-generic-aware="java.lang.String" value="&quot;auth_url&quot;" visibility="public" volatile="false">
  </field>
  <field deprecated="not deprecated" final="true" name="EXTRA_CLIENT_SECRET" jni-signature="Ljava/lang/String;" static="true" transient="false" type="java.lang.String" type-generic-aware="java.lang.String" value="&quot;client_secret&quot;" visibility="public" volatile="false">
  </field>
  <field deprecated="not deprecated" final="true" name="EXTRA_RETURN_URL" jni-signature="Ljava/lang/String;" static="true" transient="false" type="java.lang.String" type-generic-aware="java.lang.String" value="&quot;return_url&quot;" visibility="public" volatile="false">
  </field>
  <field deprecated="not deprecated" final="true" name="EXTRA_UI_CUSTOMIZATION" jni-signature="Ljava/lang/String;" static="true" transient="false" type="java.lang.String" type-generic-aware="java.lang.String" value="&quot;ui_customization&quot;" visibility="public" volatile="false">
  </field>
</class>

As you can see, there is no trace of any Start method. the interface is declared and have the Start method signature as expected, like this:

<interface abstract="true" deprecated="not deprecated" final="false" name="AuthActivityStarter" static="false" visibility="public" jni-signature="Lcom/stripe/android/view/AuthActivityStarter;">
  <typeParameters>
    <typeParameter name="StartDataType" classBound="java.lang.Object" jni-classBound="Ljava/lang/Object;"></typeParameter>
  </typeParameters>
  <method abstract="true" deprecated="not deprecated" final="false" name="start" jni-signature="(Ljava/lang/Object;)V" bridge="false" native="false" return="void" jni-return="V" static="false" synchronized="false" synthetic="false" visibility="public">
    <parameter name="p0" type="StartDataType" jni-type="TStartDataType;">
    </parameter>
  </method>
</interface>

On the other hand, if I look into the .aar classes using JD-GUI (java decompiler) I can see that the Start is defined in the PaymentAuthWebViewStarter class:

  public void start(@NonNull Data data)
  {
    Bundle extras = new Bundle();
    extras.putString("client_secret", data.mClientSecret);
    extras.putString("auth_url", data.mUrl);
    extras.putString("return_url", data.mReturnUrl);
    extras.putParcelable("ui_customization", this.mToolbarCustomization);

    this.mHost.startActivityForResult(PaymentAuthWebViewActivity.class, extras, this.mRequestCode);
  }

My questions are:

Why this method is not being generated as any other method in any other class?

How to resolve this issue?

I've left my code in a github repo, just in case anyone wants to fork it and give it a try(just ask me for the link, it appear that I'm not allowed to post links yet)

Best Answer

  • guilloagguilloag Member ✭✭
    Accepted Answer

    Hi Clubbable_Nightlife, yes, I've found a solution and I have a working binding in the repo, but I did not fully test it yet. The basic functionality is working, though.

    It would be great if you can test it yourself and contribute with a fix (if there is any)

    This forum does not allow me to post links yet, but you can find the repo by looking for my github user: guillermo-gerard or the name of the repository: stripe.android.sdk.binding

Answers

  • Hi!
    Did you find a solution to this?

  • guilloagguilloag Member ✭✭
    Accepted Answer

    Hi Clubbable_Nightlife, yes, I've found a solution and I have a working binding in the repo, but I did not fully test it yet. The basic functionality is working, though.

    It would be great if you can test it yourself and contribute with a fix (if there is any)

    This forum does not allow me to post links yet, but you can find the repo by looking for my github user: guillermo-gerard or the name of the repository: stripe.android.sdk.binding

Sign In or Register to comment.