💥 Updated API routes
This commit is contained in:
@@ -30,7 +30,7 @@ part 'stellar_program_tab.g.dart';
|
||||
Future<SnWalletSubscription?> accountStellarSubscription(Ref ref) async {
|
||||
try {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get('/id/subscriptions/fuzzy/solian.stellar');
|
||||
final resp = await client.get('/pass/subscriptions/fuzzy/solian.stellar');
|
||||
return SnWalletSubscription.fromJson(resp.data);
|
||||
} catch (err) {
|
||||
if (err is DioException && err.response?.statusCode == 404) return null;
|
||||
@@ -46,7 +46,7 @@ Future<List<SnWalletGift>> accountSentGifts(
|
||||
}) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get(
|
||||
'/id/subscriptions/gifts/sent?offset=$offset&take=$take',
|
||||
'/pass/subscriptions/gifts/sent?offset=$offset&take=$take',
|
||||
);
|
||||
return (resp.data as List).map((e) => SnWalletGift.fromJson(e)).toList();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ Future<List<SnWalletGift>> accountReceivedGifts(
|
||||
}) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get(
|
||||
'/id/subscriptions/gifts/received?offset=$offset&take=$take',
|
||||
'/pass/subscriptions/gifts/received?offset=$offset&take=$take',
|
||||
);
|
||||
return (resp.data as List).map((e) => SnWalletGift.fromJson(e)).toList();
|
||||
}
|
||||
@@ -67,7 +67,7 @@ Future<List<SnWalletGift>> accountReceivedGifts(
|
||||
@riverpod
|
||||
Future<SnWalletGift> accountGift(Ref ref, String giftId) async {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
final resp = await client.get('/id/subscriptions/gifts/$giftId');
|
||||
final resp = await client.get('/pass/subscriptions/gifts/$giftId');
|
||||
return SnWalletGift.fromJson(resp.data);
|
||||
}
|
||||
|
||||
@@ -388,7 +388,9 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
final client = ref.watch(apiClientProvider);
|
||||
await client.post('/id/subscriptions/${membership.identifier}/cancel');
|
||||
await client.post(
|
||||
'/pass/subscriptions/${membership.identifier}/cancel',
|
||||
);
|
||||
ref.invalidate(accountStellarSubscriptionProvider);
|
||||
ref.read(userInfoProvider.notifier).fetchUser();
|
||||
if (context.mounted) {
|
||||
@@ -698,7 +700,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
final resp = await client.post(
|
||||
'/id/subscriptions',
|
||||
'/pass/subscriptions',
|
||||
data: {
|
||||
'identifier': tierId,
|
||||
'payment_method': 'solian.wallet',
|
||||
@@ -710,7 +712,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
final subscription = SnWalletSubscription.fromJson(resp.data);
|
||||
if (subscription.status == 1) return;
|
||||
final orderResp = await client.post(
|
||||
'/id/subscriptions/${subscription.identifier}/order',
|
||||
'/pass/subscriptions/${subscription.identifier}/order',
|
||||
);
|
||||
final order = SnWalletOrder.fromJson(orderResp.data);
|
||||
|
||||
@@ -1221,7 +1223,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
final resp = await client.post(
|
||||
'/id/subscriptions/gifts/purchase',
|
||||
'/pass/subscriptions/gifts/purchase',
|
||||
data: {
|
||||
'subscription_identifier': subscriptionId,
|
||||
if (recipientId != null) 'recipient_id': recipientId,
|
||||
@@ -1237,7 +1239,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
if (gift.status == 1) return; // Already paid
|
||||
|
||||
final orderResp = await client.post(
|
||||
'/id/subscriptions/gifts/${gift.id}/order',
|
||||
'/pass/subscriptions/gifts/${gift.id}/order',
|
||||
);
|
||||
final order = SnWalletOrder.fromJson(orderResp.data);
|
||||
|
||||
@@ -1258,7 +1260,9 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
// Get the updated gift
|
||||
final giftResp = await client.get('/id/subscriptions/gifts/${gift.id}');
|
||||
final giftResp = await client.get(
|
||||
'/pass/subscriptions/gifts/${gift.id}',
|
||||
);
|
||||
final updatedGift = SnWalletGift.fromJson(giftResp.data);
|
||||
|
||||
if (context.mounted) hideLoadingModal(context);
|
||||
@@ -1367,7 +1371,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
|
||||
// First check if gift can be redeemed
|
||||
final checkResp = await client.get(
|
||||
'/id/subscriptions/gifts/check/$giftCode',
|
||||
'/pass/subscriptions/gifts/check/$giftCode',
|
||||
);
|
||||
final checkData = checkResp.data as Map<String, dynamic>;
|
||||
|
||||
@@ -1379,7 +1383,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
|
||||
// Redeem the gift
|
||||
await client.post(
|
||||
'/id/subscriptions/gifts/redeem',
|
||||
'/pass/subscriptions/gifts/redeem',
|
||||
data: {'gift_code': giftCode},
|
||||
);
|
||||
|
||||
@@ -1424,7 +1428,7 @@ class StellarProgramTab extends HookConsumerWidget {
|
||||
final client = ref.watch(apiClientProvider);
|
||||
try {
|
||||
showLoadingModal(context);
|
||||
await client.post('/id/subscriptions/gifts/${gift.id}/cancel');
|
||||
await client.post('/pass/subscriptions/gifts/${gift.id}/cancel');
|
||||
ref.invalidate(accountSentGiftsProvider);
|
||||
if (context.mounted) {
|
||||
hideLoadingModal(context);
|
||||
|
||||
Reference in New Issue
Block a user