triniwiz / nativescript-stripe

Apache License 2.0
49 stars 32 forks source link

Postal code missing in CreditCardView input on Android. #114

Open jlbuganan opened 4 years ago

jlbuganan commented 4 years ago

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

  1. Run the demo-angular project in an Android emulator.
  2. Click on the Intent button.
  3. Notice that there is no postal code input within the credit card input. Is there a simple way to turn postal code input on?
  4. Repeat steps 1-3 on an iOS simulator.. the postal code input is there.

iOS on left, has ZIP input, Android on right, does not have ZIP input. How do I enable ZIP input on Android? image

RobertGardner commented 4 years ago

The ability to put the postal code in the CreditCardView on Android was introduced in Stripe's 12.7 SDK release, and then made the default setting in 13.0. The plugin is currently based on 12.0. I've been unable to upgrade to 13 because of problems with {NS}'s support for Kotlin. (See https://github.com/NativeScript/android-runtime/issues/1604)

You could try changing the Stripe version in your copy of the plugin (update platforms/android/include.gradle) to 12.7.0, though I can't guarantee it would build. You may then be able to use CreditCardView.android.postalCodeEnabled = true, or change that in stripe.android.js directly

If you get it to work, you could send me a PR so I can incorporate it into the plugin. I don't plan on upgrading the Android Stripe SDK myself until the Kotlin issues are resolved, which may be awhile.

jlbuganan commented 4 years ago

@RobertGardner Thanks for your suggestion, it seems to have worked. Posted up a PR (#117) to at least get the postal code showing in the CreditCardView on the Angular Intent Demo.

RobertGardner commented 4 years ago

Unfortunately, I can't merge this PR because I can't upgrade to SDK 12.7 yet.

Stripe converted the entire SDK to Kotlin in v12.6 but given the {NS} Kotlin bugs mentioned earlier, the plugin doesn't work on v12.6 and greater. I thought the conversion was in v13, but was dismayed to see the conversion mentioned in the v12.6 release notes!

Interestingly, the only thing that is keeping me from moving forward is Source support. If you aren't using sources, you can go ahead and use v12.7 without problem (as far as I can tell). Sources are no longer the preferred mechanism for working with Stripe, but I'm reluctant to drop support for them at this point.

I'll keep this PR open in case someone else has the same request so they can see how to proceed. Also, once {NS} fixes the problems I can come back and work on this. I created a branch android-12.7 that has my progress to date.