-
Notifications
You must be signed in to change notification settings - Fork 658
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
Add konbini to PaymentSheet. #7308
Changes from all commits
2aa58a1
82d086e
d67679d
576c82b
d72cddb
d2e9350
38323fd
cf13ef5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -96,7 +96,8 @@ sealed interface StripeIntent : StripeModel { | |||||||
VerifyWithMicrodeposits("verify_with_microdeposits"), | ||||||||
UpiAwaitNotification("upi_await_notification"), | ||||||||
CashAppRedirect("cashapp_handle_redirect_or_display_qr_code"), | ||||||||
DisplayBoletoDetails("boleto_display_details"); | ||||||||
DisplayBoletoDetails("boleto_display_details"), | ||||||||
DisplayKonbiniDetails("konbini_display_details"); | ||||||||
|
||||||||
@Keep | ||||||||
override fun toString(): String { | ||||||||
|
@@ -197,6 +198,15 @@ sealed interface StripeIntent : StripeModel { | |||||||
val hostedVoucherUrl: String? = null, | ||||||||
) : NextActionData() | ||||||||
|
||||||||
@Parcelize | ||||||||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||||||||
data class DisplayKonbiniDetails( | ||||||||
/** | ||||||||
* URL of a webpage containing the voucher for this payment. | ||||||||
*/ | ||||||||
Comment on lines
+204
to
+206
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory we could expose this for bindings. I just copied what the others did. |
||||||||
val hostedVoucherUrl: String? = null, | ||||||||
) : NextActionData() | ||||||||
|
||||||||
/** | ||||||||
* Contains instructions for authenticating by redirecting your customer to another | ||||||||
* page or application. | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.stripe.android.payments.core.authentication | ||
|
||
import com.stripe.android.core.networking.ApiRequest | ||
import com.stripe.android.model.StripeIntent | ||
import com.stripe.android.model.StripeIntent.NextActionData | ||
import com.stripe.android.view.AuthActivityStarterHost | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
/** | ||
* [PaymentAuthenticator] for [NextActionData.DisplayKonbiniDetails], redirects to | ||
* [WebIntentAuthenticator] or [NoOpIntentAuthenticator] based on whether if there is a | ||
* hostedVoucherUrl set. | ||
*/ | ||
@Singleton | ||
internal class KonbiniAuthenticator @Inject constructor( | ||
private val webIntentAuthenticator: WebIntentAuthenticator, | ||
private val noOpIntentAuthenticator: NoOpIntentAuthenticator | ||
) : PaymentAuthenticator<StripeIntent>() { | ||
override suspend fun performAuthentication( | ||
host: AuthActivityStarterHost, | ||
authenticatable: StripeIntent, | ||
requestOptions: ApiRequest.Options | ||
) { | ||
(authenticatable.nextActionData as NextActionData.DisplayKonbiniDetails).let { detailsData -> | ||
if (detailsData.hostedVoucherUrl == null) { | ||
noOpIntentAuthenticator.authenticate( | ||
host, | ||
authenticatable, | ||
requestOptions | ||
) | ||
} else { | ||
webIntentAuthenticator.authenticate( | ||
host, | ||
authenticatable, | ||
requestOptions | ||
) | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,13 @@ internal class WebIntentAuthenticator @Inject constructor( | |
returnUrl = null | ||
shouldCancelIntentOnUserNavigation = false | ||
} | ||
is StripeIntent.NextActionData.DisplayKonbiniDetails -> { | ||
// nextActionData.hostedVoucherUrl will never be null as AuthenticatorRegistry won't direct it here | ||
authUrl = nextActionData.hostedVoucherUrl.takeIf { it!!.isNotEmpty() } | ||
?: throw IllegalArgumentException("null hostedVoucherUrl for DisplayKonbiniDetails") | ||
returnUrl = null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Providing a return URL would cause this to be opened in a Chrome Custom Tab instead of a web view. Should we do that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what the other vouchers do, so I just kept with it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably start using CCT. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you peaceful if I leave it like this for this PR and submit a new PR to update all voucher based LPMs to switch to CCT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or rather, what's the motivation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe for one-click auth to be enabled, we need CCT. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I think some payment methods are using CCT while others are using webview right? For example, bancontact uses CCT. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These wouldn't have auth though, you'd need to take them to a different app, or to a physical location, so they wouldn't benefit from that. |
||
shouldCancelIntentOnUserNavigation = false | ||
} | ||
is StripeIntent.NextActionData.CashAppRedirect -> { | ||
authUrl = nextActionData.mobileAuthUrl | ||
returnUrl = defaultReturnUrl.value | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="16dp" | ||
android:height="16dp" | ||
android:viewportWidth="16" | ||
android:viewportHeight="16"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m4.867,6a2.227,2.227 45,0 1,1.16 -1.867c0.547,-0.4 0.72,-0.533 0.72,-0.88s-0.173,-0.587 -0.493,-0.587 -0.533,0.24 -0.587,0.573l-0.813,0a1.333,1.333 0,0 1,1.4 -1.24c1,0 1.333,0.6 1.333,1.187s-0.227,0.813 -0.92,1.36c-0.48,0.333 -0.667,0.56 -0.733,0.733l1.813,0l-0.107,0.72z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m9.893,6l0,-0.88l-1.773,0l0,-0.747l1.627,-2.293l0.92,0l0,2.347l0.467,0l0,0.693l-0.467,0l0,0.88zM9.893,3.733c0,-0.427 0,-0.667 0,-0.92a17.107,17.107 0,0 1,-1.04 1.613l1.027,0z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m12,1.333l0,5.333l-8,0l0,-5.333zM12,0l-8,0a1.333,1.333 0,0 0,-1.333 1.333l0,5.333a1.333,1.333 0,0 0,1.333 1.333l8,0a1.333,1.333 0,0 0,1.333 -1.333l0,-5.333a1.333,1.333 0,0 0,-1.333 -1.333z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m10.667,10.667l0,4l-5.333,0l0,-4zM10.667,9.333l-5.333,0a1.333,1.333 0,0 0,-1.333 1.333l0,4a1.333,1.333 0,0 0,1.333 1.333l5.333,0a1.333,1.333 0,0 0,1.333 -1.333l0,-4a1.333,1.333 0,0 0,-1.333 -1.333z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m7.333,10l1.333,0l0,5.187l-1.333,0z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m1.093,5.333l2.707,0l0,2.667l-2.707,0z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m1.093,2.667l2.52,0l0,1.36l-2.52,0z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m12.413,2.667l2.52,0l0,1.36l-2.52,0z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m12.133,5.333l2.987,0l0,2.667l-2.987,0z" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="m14.667,1.333l-2.667,0l0,1.333l2.667,0l0,12l-13.333,0l0,-12l2.667,0l0,-1.333l-2.667,0a1.333,1.333 0,0 0,-1.333 1.333l0,12a1.333,1.333 0,0 0,1.333 1.333l13.333,0a1.333,1.333 0,0 0,1.333 -1.333l0,-12a1.333,1.333 0,0 0,-1.333 -1.333z" /> | ||
</vector> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,4 +77,8 @@ | |
<string name="stripe_setup_button_label">Set up</string> | ||
<!-- Label for UPI ID number field on form --> | ||
<string name="stripe_upi_id_label">UPI ID</string> | ||
<!-- Label for Konbini Payment Method --> | ||
<string name="stripe_paymentsheet_payment_method_konbini">Konbini</string> | ||
Comment on lines
+80
to
+81
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be in the no-translate file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is translated differently in Japanese. |
||
<!-- Label for Konbini Confirmation Number --> | ||
<string name="stripe_konbini_confirmation_number_label">Phone</string> | ||
</resources> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking this for a future refactor.