-
Notifications
You must be signed in to change notification settings - Fork 629
/
LinkRepository.kt
100 lines (89 loc) · 2.91 KB
/
LinkRepository.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.stripe.android.link.repositories
import com.stripe.android.link.LinkPaymentDetails
import com.stripe.android.link.ui.paymentmethod.SupportedPaymentMethod
import com.stripe.android.model.ConsumerPaymentDetails
import com.stripe.android.model.ConsumerPaymentDetailsUpdateParams
import com.stripe.android.model.ConsumerSession
import com.stripe.android.model.ConsumerSessionLookup
import com.stripe.android.model.PaymentMethodCreateParams
import com.stripe.android.model.StripeIntent
/**
* Interface for a repository that interacts with Link services.
*/
internal interface LinkRepository {
/**
* Check if the email already has a link account.
*/
suspend fun lookupConsumer(
email: String?,
authSessionCookie: String?
): Result<ConsumerSessionLookup>
/**
* Sign up for a new Link account.
*/
suspend fun consumerSignUp(
email: String,
phone: String,
country: String,
authSessionCookie: String?
): Result<ConsumerSession>
/**
* Start an SMS verification.
*/
suspend fun startVerification(
consumerSessionClientSecret: String,
consumerPublishableKey: String?,
authSessionCookie: String?
): Result<ConsumerSession>
/**
* Confirm an SMS verification code.
*/
suspend fun confirmVerification(
verificationCode: String,
consumerSessionClientSecret: String,
consumerPublishableKey: String?,
authSessionCookie: String?
): Result<ConsumerSession>
/**
* Logs out the current consumer.
*/
suspend fun logout(
consumerSessionClientSecret: String,
consumerPublishableKey: String?,
authSessionCookie: String?
): Result<ConsumerSession>
/**
* Fetch all saved payment methods for the consumer.
*/
suspend fun listPaymentDetails(
consumerSessionClientSecret: String,
consumerPublishableKey: String?
): Result<ConsumerPaymentDetails>
/**
* Create a new payment method in the consumer account.
*/
suspend fun createPaymentDetails(
paymentMethod: SupportedPaymentMethod,
paymentMethodCreateParams: PaymentMethodCreateParams,
userEmail: String,
stripeIntent: StripeIntent,
consumerSessionClientSecret: String,
consumerPublishableKey: String?
): Result<LinkPaymentDetails>
/**
* Update an existing payment method in the consumer account.
*/
suspend fun updatePaymentDetails(
updateParams: ConsumerPaymentDetailsUpdateParams,
consumerSessionClientSecret: String,
consumerPublishableKey: String?
): Result<ConsumerPaymentDetails>
/**
* Delete the payment method from the consumer account.
*/
suspend fun deletePaymentDetails(
paymentDetailsId: String,
consumerSessionClientSecret: String,
consumerPublishableKey: String?
): Result<Unit>
}