Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce suspend fun for Stripe Android SDK - part2 #3568

Merged
merged 7 commits into from
Apr 14, 2021
Merged

Conversation

ccen-stripe
Copy link
Collaborator

Summary

Introduce suspend fun for all existing Stripe APIs.

Note: the doc linked to in this PR is internal only

This is a follow up change on #3557, for the changes in 'get' APIs, the following changes are made:

  • expose isForPaymentintentResult, isForSetupIntentResult in Stripe.kt, checking if resultCode and Intent is for required StripeModel
  • expose getPaymentIntentResult, getSetupIntentResult and getSource in PaymentController
  • expose getPaymentIntentResult, getSetupIntentResult and getSource in StripeKtx.kt by invoking the functions above, retrieving StripeModel from resultCode and Intent on activity result

Will add these to the example app in a follow up PR.

Motivation

For details, please refer to this doc

Fixes #2642

Testing

  • Added tests
  • Modified tests
  • Manually verified

Copy link

@ebarrenechea-stripe ebarrenechea-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

The data comment is not a blocker but might be worth while investigating. IMO, the caller should determine if it has an Intent instance before calling the extension functions and handle that case appropriately. It may result in a better API or may end up complicating things too much on the calling code.

stripe/src/main/java/com/stripe/android/StripeKtx.kt Outdated Show resolved Hide resolved
@mshafrir-stripe
Copy link
Collaborator

@ccen-stripe can you hold off on merging this? I'd like to 👀 .

Copy link
Collaborator

@mshafrir-stripe mshafrir-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more pass on method docs

stripe/src/main/java/com/stripe/android/Stripe.kt Outdated Show resolved Hide resolved
stripe/src/main/java/com/stripe/android/Stripe.kt Outdated Show resolved Hide resolved
stripe/src/main/java/com/stripe/android/Stripe.kt Outdated Show resolved Hide resolved
stripe/src/main/java/com/stripe/android/Stripe.kt Outdated Show resolved Hide resolved
stripe/src/main/java/com/stripe/android/Stripe.kt Outdated Show resolved Hide resolved
@ccen-stripe ccen-stripe merged commit 6891e2a into master Apr 14, 2021
@ccen-stripe ccen-stripe deleted the suspend2 branch April 14, 2021 18:49
@ccen-stripe ccen-stripe changed the title Introduce suspend fun for Stripe Android SDK - part2 Introduce suspend fun for Stripe Android SDK - part2 May 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for suspended function
3 participants