Update: 2026-05-16 01:40:56

This commit is contained in:
Hamza-Ayed
2026-05-16 01:40:56 +03:00
parent aceb7d324f
commit 9ad361e992
4 changed files with 126 additions and 25 deletions

View File

@@ -11,6 +11,7 @@ class SubscriptionController extends GetxController {
var isLoading = true.obs;
var isCreatingPayment = false.obs;
var activePaymentRequest = Rxn<Map<String, dynamic>>();
var isAnnual = true.obs; // Toggle between Monthly and Annual
@override
void onInit() {
@@ -69,7 +70,11 @@ class SubscriptionController extends GetxController {
Future<Map<String, dynamic>?> createPaymentRequest(String planId) async {
try {
isCreatingPayment.value = true;
final res = await DioClient().client.post('payments/create', data: {'plan_id': planId});
final cycle = isAnnual.value ? 'annual' : 'monthly';
final res = await DioClient().client.post('payments/create', data: {
'plan_id': planId,
'billing_cycle': cycle,
});
if (res.data['success'] == true && res.data['data'] != null) {
final result = Map<String, dynamic>.from(res.data['data']);
activePaymentRequest.value = result;