-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83d5bb9
commit fc381b6
Showing
5 changed files
with
211 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
payments-model/src/main/java/com/stripe/android/model/SignUpParams.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.stripe.android.model; | ||
|
||
import androidx.annotation.RestrictTo | ||
import java.util.Locale | ||
|
||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX) | ||
data class SignUpParams( | ||
val email: String, | ||
val phoneNumber: String, | ||
val country: String, | ||
val name: String?, | ||
val locale: Locale?, | ||
val amount: Long?, | ||
val currency: String?, | ||
val incentiveEligibilitySession: IncentiveEligibilitySession?, | ||
val requestSurface: String, | ||
val consentAction: ConsumerSignUpConsentAction, | ||
val verificationToken: String? = null, | ||
val appId: String? = null | ||
) { | ||
fun toParamMap(): Map<String, *> { | ||
val params = mutableMapOf( | ||
"email_address" to email.lowercase(), | ||
"phone_number" to phoneNumber, | ||
"country" to country, | ||
"country_inferring_method" to "PHONE_NUMBER", | ||
"amount" to amount, | ||
"currency" to currency, | ||
"consent_action" to consentAction.value, | ||
"request_surface" to requestSurface | ||
) | ||
|
||
locale?.let { | ||
params["locale"] = it.toLanguageTag() | ||
} | ||
|
||
name?.let { | ||
params["legal_name"] = it | ||
} | ||
|
||
verificationToken?.let { | ||
params["android_verification_token"] = it | ||
} | ||
|
||
appId?.let { | ||
params["app_id"] = it | ||
} | ||
|
||
params.putAll(incentiveEligibilitySession?.toParamMap().orEmpty()) | ||
|
||
return params.toMap() | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.