4/18/1
This commit is contained in:
@@ -160,7 +160,7 @@ class MyTranslation extends Translations {
|
||||
"Copy this Promo to use it in your Ride!":
|
||||
"انسخ هذا العرض لاستخدامه في رحلتك!",
|
||||
"To change some Settings": "لتغيير بعض الإعدادات",
|
||||
"To change Languge the App": "لتغيير لغة التطبيق",
|
||||
"To change Language the App": "لتغيير لغة التطبيق",
|
||||
"Order Request Page": "صفحة طلب الطلب",
|
||||
"Rouats of Trip": "طرق الرحلة",
|
||||
"Passenger Name is ": "اسم الراكب هو ",
|
||||
@@ -688,6 +688,9 @@ class MyTranslation extends Translations {
|
||||
"إذا كنت تريد أن تفتح تطبيق خرائط جوجل مباشرة عند طلب الخدمة",
|
||||
"You can change the language of the app": "يمكنك تغيير لغة التطبيق",
|
||||
'Your Budget less than needed': 'القيمه المدخله اقل من رصيدك',
|
||||
'You can change the Country to get all features':
|
||||
'يمكنك تغيير البلد للحصول على جميع الميزات',
|
||||
'Change Country': 'تغيير الدولة',
|
||||
},
|
||||
"tr": {
|
||||
"Choose Language": "Dil Seçin",
|
||||
@@ -849,7 +852,7 @@ class MyTranslation extends Translations {
|
||||
"Copy this Promo to use it in your Ride!":
|
||||
"Bu Promosyonu seyahatinizde kullanmak için kopyalayın!",
|
||||
"To change some Settings": "Bazı ayarları değiştirmek için",
|
||||
"To change Languge the App": "Uygulama dilini değiştirmek için",
|
||||
"To change Language the App": "Uygulama dilini değiştirmek için",
|
||||
"Order Request Page": "Sipariş istek sayfası",
|
||||
"Rouats of Trip": "Seyahat yolları",
|
||||
"Passenger Name is ": "Yolcu adı ",
|
||||
|
||||
@@ -496,6 +496,7 @@ class PaymentController extends GetxController {
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'OK'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
method();
|
||||
@@ -543,11 +544,13 @@ class PaymentController extends GetxController {
|
||||
barrierDismissible: false,
|
||||
title: 'Payment Successful'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
// backgroundColor: AppColor.greenColor,
|
||||
content: Text(
|
||||
'The payment was approved.'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
kolor: AppColor.greenColor,
|
||||
title: 'OK'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
|
||||
@@ -39,15 +39,67 @@ class PaymobManager extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> payWithPayMob(int amount, String currency) async {
|
||||
String key = await PaymobManager().getPaymentKey(amount, currency);
|
||||
await launchUrl(
|
||||
Uri.parse(
|
||||
'https://accept.paymob.com/api/acceptance/iframes/837992?payment_token=$key'),
|
||||
);
|
||||
// 1. Fetch Payment Key (Assuming PaymobManager is a custom class)
|
||||
String paymentToken;
|
||||
try {
|
||||
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;
|
||||
}
|
||||
|
||||
// String paymentStatus = await _getStatusAfterPaid();
|
||||
// 2. Prepare Payment Data Payload
|
||||
final Map<String, dynamic> data = {
|
||||
"source": {
|
||||
"identifier": "01010101010", // Replace with actual source identifier
|
||||
"subtype": "WALLET",
|
||||
},
|
||||
"payment_token": paymentToken,
|
||||
};
|
||||
|
||||
// 3. Make Payment Request using Dio
|
||||
final dio = Dio();
|
||||
try {
|
||||
final response = await dio.post(
|
||||
'https://accept.paymob.com/api/acceptance/payments/pay',
|
||||
data: data,
|
||||
);
|
||||
|
||||
// 4. Handle Payment Response
|
||||
if (response.statusCode == 200) {
|
||||
// Payment successful: Process response data (e.g., transaction ID)
|
||||
final paymentData = response.data; // Assuming JSON response
|
||||
print("Payment successful: $paymentData");
|
||||
// Navigate to success screen or display success message
|
||||
} 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<void> payWithPayMob(int amount, String currency) async {
|
||||
// String key = await PaymobManager().getPaymentKey(amount, currency);
|
||||
// await launchUrl(Uri.parse(
|
||||
// // 'https://accept.paymob.com/api/acceptance/iframes/837992?payment_token=$key'),
|
||||
// 'https://accept.paymob.com/api/acceptance/payments/pay'));
|
||||
// print(key);
|
||||
// final dio.Response response = await Dio()
|
||||
// .post('https://accept.paymob.com/api/acceptance/payments/pay', data: {
|
||||
// "source": {
|
||||
// "identifier": "01010101010",
|
||||
// "subtype": "WALLET",
|
||||
// },
|
||||
// "payment_token": key, // token obtained in step 3
|
||||
// });
|
||||
//
|
||||
// // String paymentStatus = await _getStatusAfterPaid();
|
||||
// }
|
||||
|
||||
Future<String> _getStatusAfterPaid() async {
|
||||
print(authanticationToken1);
|
||||
print(orderId1);
|
||||
|
||||
Reference in New Issue
Block a user