6/22/2
This commit is contained in:
@@ -33,8 +33,6 @@ class PaymobManager extends GetxController {
|
||||
update();
|
||||
return paymentKey;
|
||||
} catch (e) {
|
||||
print("Exc==========================================");
|
||||
print(e.toString());
|
||||
throw Exception();
|
||||
}
|
||||
}
|
||||
@@ -46,7 +44,6 @@ class PaymobManager extends GetxController {
|
||||
paymentToken = await PaymobManager().getPaymentKey(amount, currency);
|
||||
} on Exception catch (e) {
|
||||
// Handle errors gracefully, e.g., display error message to user
|
||||
print("Error fetching payment key: $e");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -71,23 +68,17 @@ class PaymobManager extends GetxController {
|
||||
if (response.statusCode == 200) {
|
||||
final paymentData = response.data; // Assuming JSON response
|
||||
|
||||
print("redirection_url: ${paymentData['iframe_redirection_url']}");
|
||||
|
||||
// Navigate to success screen or display success message
|
||||
launchUrl(Uri.parse(paymentData['iframe_redirection_url']));
|
||||
} else {
|
||||
// Payment failed: Handle errors (e.g., display error message)
|
||||
print("Payment failed: ${response.statusCode} - ${response.data}");
|
||||
}
|
||||
} on DioError catch (e) {
|
||||
// Handle network or Dio-related errors
|
||||
print("Error making payment request: $e");
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> _getStatusAfterPaid() async {
|
||||
print(authanticationToken1);
|
||||
print(orderId1);
|
||||
final dio.Response response = await Dio().post(
|
||||
"https://accept.paymob.com/api/ecommerce/orders/transaction_inquiry",
|
||||
data: {
|
||||
@@ -95,8 +86,6 @@ class PaymobManager extends GetxController {
|
||||
"merchant_order_id": "970960",
|
||||
"order_id": orderId1
|
||||
});
|
||||
print(response.data);
|
||||
print(response.data['success']);
|
||||
return response.data["success"];
|
||||
}
|
||||
|
||||
@@ -123,8 +112,6 @@ class PaymobManager extends GetxController {
|
||||
"delivery_needed": "false",
|
||||
"items": [],
|
||||
});
|
||||
print('id is');
|
||||
print(response.data["id"]);
|
||||
return response.data["id"];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user