@@ -64,7 +64,7 @@ public class BillingViewModel public constructor(
64
64
isLoading = false ,
65
65
selectedPlan = selectedPlan,
66
66
plans = plans,
67
- token = token,
67
+ transactionToken = token,
68
68
queryParameters = queryParameters,
69
69
startDestination = when (paymentStatus) {
70
70
BillingPaymentStatus .Completed -> BillingDestination .Success
@@ -85,7 +85,7 @@ public class BillingViewModel public constructor(
85
85
isLoading = false ,
86
86
selectedPlan = selectedPlan,
87
87
plans = plans,
88
- token = token,
88
+ transactionToken = token,
89
89
queryParameters = queryParameters,
90
90
startDestination = when (paymentStatus) {
91
91
BillingPaymentStatus .Completed -> BillingDestination .Success
@@ -126,7 +126,8 @@ public class BillingViewModel public constructor(
126
126
invoice = getInvoice(
127
127
productId = productId,
128
128
currencyCode = currentState.selectedCryptoCurrency.currencyCode,
129
- currentInvoices = currentState.invoices
129
+ currentInvoices = currentState.invoices,
130
+ accessToken = currentState.queryParameters[" access_token" ]
130
131
)
131
132
}
132
133
@@ -177,7 +178,8 @@ public class BillingViewModel public constructor(
177
178
invoice = getInvoice(
178
179
productId = productId,
179
180
currencyCode = currentState.selectedCryptoCurrency.currencyCode,
180
- currentInvoices = currentState.invoices
181
+ currentInvoices = currentState.invoices,
182
+ accessToken = currentState.queryParameters[" access_token" ]
181
183
)
182
184
}
183
185
@@ -291,12 +293,10 @@ public class BillingViewModel public constructor(
291
293
.filter { plan -> plan.isAvailable(at = clock.now()) }
292
294
.sortedBy { plan -> plan.price.amount }
293
295
294
- private suspend fun getPlan (id : String? ): Plan ? =
295
- id?.let { billingApi.getPlan(id = it) }
296
-
297
296
private suspend fun getInvoice (
298
297
currencyCode : Currency .Code ,
299
298
productId : String? ,
299
+ accessToken : String? ,
300
300
currentInvoices : Map <CryptoCurrency , CryptoInvoice ?>
301
301
): CryptoInvoice ? {
302
302
CryptoCurrency [currencyCode]?.let { currentInvoices[it] }?.let { return it }
@@ -305,7 +305,8 @@ public class BillingViewModel public constructor(
305
305
306
306
return billingApi.getInvoice(
307
307
productId = productId,
308
- currencyCode = currencyCode
308
+ currencyCode = currencyCode,
309
+ accessToken = accessToken
309
310
)
310
311
}
311
312
0 commit comments