Comments (15)
Not sure where to document things like this, latest 2.0.0 release metadata to hide the IParcelableCreator classes/interfaces since Java supports covariant return interfaces and c# doesn't. First one fixes the return type, 2nd set just removes the creator classes.
Stripe team, if this is better in a wiki or a GIST let me know.
<metadata>
<!--
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
/api/package[@name='com.stripe.stripeterminal']/interface[@name='Callback']
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
-->
<attr
path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='PaymentMethod.Creator']/method[@name='createFromParcel' and count(parameter)=1 and parameter[1][@type='android.os.Parcel']]"
name="managedReturn">
Java.Lang.Object
</attr>
<attr
path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='PaymentMethod.Creator']/method[@name='newArray' and count(parameter)=1 and parameter[1][@type='int']]"
name="managedReturn">
Java.Lang.Object[]
</attr>
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.api']/class[@name='ApiError.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='Address.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='CardDetails.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='CardOptions.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='CardPresentDetails.Creator']"/>
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='Charge.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='Location.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='PaymentIntent.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='PaymentMethodDetails.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='PaymentMethodOptions.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='ReceiptDetails.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='RedirectUrl.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='Refund.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='SetupAttempt.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='SetupError.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='SetupIntent.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='SetupIntentCardPresentDetails.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='SetupIntentNextAction.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.models']/class[@name='SetupIntentPaymentMethodDetails.Creator']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.external.serialization']/class[@name='InnerError.Creator']" />
</metadata>
`
from stripe-terminal-android.
I wrote a Java library to wrap the Callback interface to work around the compiler issue. Using the latest version of Xamarin, since lambdas are used, the d8 compiler messes up something and the init terminal call throws a ClassNotFoundException from DexPathList. At this time, I can't see a way to have this library work with a Xamarin application.
from stripe-terminal-android.
I started a brand new Xamarin project, and that took care of most of the d8 issues. Pulled in all the dependencies.
Now the biggest hangup is that ErrorCallback is not public. DiscoverReaders and ReaderCallback extending that messes up the Xamarin linker, which either drops them from the C# binding, or throws an error. Making it officially public would allow them all to work without having to write a Java wrapper class around the library to get it working with C#, which is what I'm doing at the moment.
from stripe-terminal-android.
Thanks for the feedback. We're excited you're writing Xamarin bindings! We'll be sure to make ErrorCallback public in our next release to help you out. Would you be able to share your work with us / make the bindings open-source so that we can make sure we're supporting this use case in the future?
from stripe-terminal-android.
Most likely yes. Right now everything is prefixed with our company initials to get a demo going. I'm going back and forth between this and the iOS version. The second hardest part of the bindings was getting the dependencies because the Gradle plugin for Visual Studio 2019 seems to be broken, and those had to be pulled in manually. If I can get through the payment intent and reader update, I can see if there is any other interfaces that need to be updated to make things eaiser.
from stripe-terminal-android.
The b8 release fixed a lot of the issues with the Xamarin bindings. About 2 lines of configuration to switch things around in the binding library (very minor) and was able to get a successful payment through Xamarin using b8. I have to work on the iOS side, which may take a bit to have a common C# interface against the Android model and iOS model since Swift has a style different than the java side.
from stripe-terminal-android.
Great! Glad to hear it.
from stripe-terminal-android.
@joshbartley do you have any tips on how to wrap this stripe sdk? I am trying to do the same thing but I keep getting the error below. I have added the kotlin xamarin library. I am using classparse in vs 2019.
Error "generator.exe" exited with code -1073741819
from stripe-terminal-android.
@Xandroid4Net I'll need more details as to what the error is or more build output, and likely a different issue then the one in this thread. Once the private interfaces were marked public I didn't have any issues generating the binding library using VS 2019.
from stripe-terminal-android.
@joshbartley I am not sure how to contact you directly. I tried a new project with just the stripe library aar and tried to build and got the same generator error. Do you know how to get a more detailed build output? Or would you be willing to share your project in a github repo?
from stripe-terminal-android.
@joshbartley I would like to second this question from @Xandroid4Net . Were you able to get the release version of the andriod library to build for Xamarin with Kotlin included? The beta version didn't include Kotlin and we were able to get that to build, but not the release version.
from stripe-terminal-android.
@Xandroid4Net I never had luck with the .aar file. I had to unzip it, pull in each .jar as a separate reference. Then look up the dependencies of each .jar on the Maven Repository to be able to pull them down. I have not tried the latest version, but I do need to update our app as we have some people interested in it again.
from stripe-terminal-android.
@joshbartley The best I can tell is Stripe has rolled their own versions of Kotlin, okhttp3, okio, in the BBPOSSDK, which is a dependency in the terminal AAR file. The initial release wasn't bloated with all that stuff. I think they should have used a reference. I don't really understand why they went down this new route because now creating the bindings is a nightmare. I'd love a second opinion. @danwaters-stripe
from stripe-terminal-android.
It's a common pattern for hardware SDKs, Even the AWS SDKs do these for some dependencies.
from stripe-terminal-android.
@chris-oswald you have to provide details and I think this method of communicating on an old thread is not ideal. You say you are getting a java error, you should provide those full details. This likely either needs a new thread or moved to StackOverflow.
I just tried the 1.0.0 version and was able to get it to compile with a minimal metadata file. I believe some of these may even be duplicates and could be reduced further.
<remove-node path="/api/package[@name='com.stripe.stripeterminal']/interface[@name='TerminalComponent']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.rpc']/class[@name='ProxyTrace']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.rpc']/class[@name='ReportTraceRequest']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.rpc']/class[@name='ReportEventRequest']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal']/class[@name='TerminalSession']/method[@name='setRpcSessionToken' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal']/class[@name='TerminalSession']/method[@name='setAccountId' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.log']/class[@name='Event.Companion']" />
<remove-node path="/api/package[@name='com.stripe.stripeterminal.log']/class[@name='Log']" />
<attr path="/api/package[@name='com.stripe.stripeterminal']/class[@name='Terminal']" name="managedName">StripeTerminal</attr>
`
from stripe-terminal-android.
Related Issues (20)
- Failed to generate key pair HOT 6
- Canβt read card info and collectPaymentMethod time out HOT 3
- My Android device cannot reconnect to the card reader after running for a long time HOT 18
- "KeyStoreException: the master key exists but is unusable" while trying to connect to the Tap to Pay on specific Samsung devices HOT 2
- ProGuard Rules Issues HOT 6
- Add callback to know when a card is inserted or removed outside collect state HOT 7
- Android Tap to Pay screen stuck in "Done" state HOT 2
- Stripe Contactless Activity doesn't showing the tap to pay spot and amount while using latest sdk version 3.4.0 HOT 2
- Collect payment method for setup intent doesn't update its `status` HOT 12
- READER_MISSING_ENCRYPTION_KEYS Error still coming in SDK 3.4.0 HOT 4
- Stripe M2 reader disconnects from USB if another device tries to connect to it over Bluetooth HOT 1
- Tap to Pay HOT 2
- Card reader overheating and crashing HOT 6
- Setting to turn off Play audible tones on contactless payment
- Tap to Pay- Crash at initTerminal when used along with Retrofit HOT 10
- Warning: com.google.android.gms:play-services-safetynet HOT 1
- Failed to decrypt an offline entity. HOT 4
- Tap to pay android via Stripe dashboard app failing to accept interac payments HOT 12
- Stop Discovery not working after reader disconnect HOT 3
- Question about HTTP timeout HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stripe-terminal-android.