6/22/1
This commit is contained in:
@@ -32,7 +32,6 @@ class DriverWalletHistoryController extends GetxController {
|
||||
));
|
||||
}
|
||||
archive = jsonDecode(res)['message'];
|
||||
print(archive);
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
@@ -43,7 +42,6 @@ class DriverWalletHistoryController extends GetxController {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getDriverWeekPaymentMove,
|
||||
payload: {'driverID': box.read(BoxName.driverID)});
|
||||
print(res);
|
||||
if (res == 'failure') {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
@@ -58,7 +56,6 @@ class DriverWalletHistoryController extends GetxController {
|
||||
));
|
||||
}
|
||||
weeklyList = jsonDecode(res)['message'];
|
||||
print(archive);
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ class PassengerWalletHistoryController extends GetxController {
|
||||
payload: {'passenger_id': box.read(BoxName.passengerID)});
|
||||
if (res != 'failure') {
|
||||
archive = jsonDecode(res)['message'];
|
||||
print(archive);
|
||||
isLoading = false;
|
||||
update();
|
||||
} else {
|
||||
|
||||
@@ -131,7 +131,6 @@ class PaymentController extends GetxController {
|
||||
method();
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
} else {
|
||||
// Local authentication not available, proceed with payment without authentication
|
||||
@@ -202,7 +201,6 @@ class PaymentController extends GetxController {
|
||||
|
||||
// Convert the res object to a JSON object
|
||||
final jsonResponse = jsonDecode(res);
|
||||
print(jsonResponse);
|
||||
// Check if the client_secret property exists and is not null
|
||||
if (jsonResponse.containsKey('client_secret') &&
|
||||
jsonResponse['client_secret'] != null) {
|
||||
@@ -230,7 +228,6 @@ class PaymentController extends GetxController {
|
||||
// User authenticated successfully, proceed with payment
|
||||
|
||||
if (selectedAmount != 0) {
|
||||
print(selectedAmount);
|
||||
changePromoSheetDialogue();
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
@@ -285,17 +282,14 @@ class PaymentController extends GetxController {
|
||||
],
|
||||
note: "Contact us for any questions on your order.".tr,
|
||||
onSuccess: (Map params) async {
|
||||
print("onSuccess: $params");
|
||||
addPassengerWallet();
|
||||
changePromoSheetDialogue();
|
||||
await getPassengerWallet();
|
||||
},
|
||||
onError: (error) {
|
||||
print("onError: $error");
|
||||
Toast.show(context, ' $error'.tr, AppColor.redColor);
|
||||
},
|
||||
onCancel: (params) {
|
||||
print('cancelled: $params');
|
||||
Toast.show(context, 'Pyament Cancelled .'.tr,
|
||||
AppColor.yellowColor);
|
||||
}),
|
||||
@@ -307,7 +301,6 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -321,7 +314,6 @@ class PaymentController extends GetxController {
|
||||
link: AppLink.getLicense,
|
||||
payload: {'driverID': box.read(BoxName.driverID)});
|
||||
licenseDetailsMap = jsonDecode(res);
|
||||
// print(licenseDetailsMap['message'][0]['name']);
|
||||
}
|
||||
|
||||
Future createConnectAccount() async {
|
||||
@@ -331,7 +323,6 @@ class PaymentController extends GetxController {
|
||||
DateTime.parse(licenseDetailsMap['message'][0]['dateOfBirth']);
|
||||
int currentTimestamp =
|
||||
(DateTime.now().millisecondsSinceEpoch / 1000).round();
|
||||
print('Current Unix timestamp: $currentTimestamp');
|
||||
int day = dob.day;
|
||||
int month = dob.month;
|
||||
int year = dob.year;
|
||||
@@ -392,11 +383,9 @@ class PaymentController extends GetxController {
|
||||
payload: body,
|
||||
);
|
||||
final responseData = jsonDecode(response);
|
||||
// print(responseData);
|
||||
final accountId = responseData['id'];
|
||||
box.write(BoxName.accountIdStripeConnect, accountId);
|
||||
await updateCaptainAccountBank();
|
||||
print('accountId = $accountId');
|
||||
return accountId;
|
||||
}
|
||||
|
||||
@@ -425,10 +414,8 @@ class PaymentController extends GetxController {
|
||||
payload: body,
|
||||
);
|
||||
final responseData = jsonDecode(response);
|
||||
print(responseData);
|
||||
final transactionId = responseData['id'];
|
||||
|
||||
print('transactionId = $transactionId');
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
@@ -439,10 +426,7 @@ class PaymentController extends GetxController {
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
ip = jsonDecode(response.body)['ip'];
|
||||
print(ip);
|
||||
} else {
|
||||
print('Request failed with status: ${response.statusCode}');
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
|
||||
// 'https://accept.paymob.com/unifiedcheckout/?publicKey=egy_pk_live_mbjDC9Ni6FSHKmsz8sOHiVk2xd7oWRve&clientSecret=egy_sk_live_c0904e9cf04506ae64f818d4e075b4a957e3713fdf7a22cb7da30a29e72442b5'
|
||||
@@ -464,16 +448,7 @@ class PaymentController extends GetxController {
|
||||
amountInCents: newAmount, // 19.00 EGP
|
||||
|
||||
billingData: PaymobBillingData(),
|
||||
onPayment: (PaymobResponse response) {
|
||||
print('Success: ${response.success}');
|
||||
print('Transaction ID: ${response.transactionID}');
|
||||
print('Response Code: ${response.responseCode}');
|
||||
// print('Message: ${response.message}');
|
||||
print(box.read(BoxName.passengerWalletTotal));
|
||||
print(box.read(BoxName.name));
|
||||
print(box.read(BoxName.phone));
|
||||
// print();
|
||||
},
|
||||
onPayment: (PaymobResponse response) {},
|
||||
);
|
||||
|
||||
if (response!.responseCode == 'APPROVED') {
|
||||
@@ -515,7 +490,6 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
} else {
|
||||
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
||||
@@ -523,12 +497,7 @@ class PaymentController extends GetxController {
|
||||
currency: currency, //"EGP",
|
||||
amountInCents: newAmount, // 19.00 EGP
|
||||
billingData: PaymobBillingData(),
|
||||
onPayment: (PaymobResponse response) {
|
||||
// print('Success: ${response.success}');
|
||||
// print('Transaction ID: ${response.transactionID}');
|
||||
// print('Response Code: ${response.responseCode}');
|
||||
// print('Message: ${response.message}');
|
||||
},
|
||||
onPayment: (PaymobResponse response) {},
|
||||
);
|
||||
|
||||
if (response!.responseCode == 'APPROVED') {
|
||||
@@ -617,17 +586,7 @@ class PaymentController extends GetxController {
|
||||
amountInCents: newAmount, // 19.00 EGP
|
||||
|
||||
billingData: PaymobBillingDataWallet(),
|
||||
onPayment: (PaymobResponseWallet response) {
|
||||
// print('Success: ${response.success}');
|
||||
// print('Transaction ID: ${response.transactionID}');
|
||||
// print('Response Code: ${response.responseCode}');
|
||||
// print('Message: ${response.message}');
|
||||
|
||||
// print(box.read(BoxName.passengerWalletTotal));//
|
||||
// print(box.read(BoxName.name));
|
||||
// print(box.read(BoxName.phone));
|
||||
// print();
|
||||
},
|
||||
onPayment: (PaymobResponseWallet response) {},
|
||||
);
|
||||
|
||||
if (response!.success == true && response.responseCode == '200') {
|
||||
@@ -686,7 +645,6 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
} else {
|
||||
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
||||
@@ -694,12 +652,7 @@ class PaymentController extends GetxController {
|
||||
currency: currency, //"EGP",
|
||||
amountInCents: newAmount, // 19.00 EGP
|
||||
billingData: PaymobBillingData(),
|
||||
onPayment: (PaymobResponse response) {
|
||||
// print('Success: ${response.success}');
|
||||
// print('Transaction ID: ${response.transactionID}');
|
||||
// print('Response Code: ${response.responseCode}');
|
||||
// print('Message: ${response.message}');
|
||||
},
|
||||
onPayment: (PaymobResponse response) {},
|
||||
);
|
||||
|
||||
if (response!.responseCode == 'APPROVED') {
|
||||
|
||||
@@ -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"];
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ class PaymobPayment {
|
||||
'api_key': _apiKey,
|
||||
},
|
||||
);
|
||||
print(response.data['token']);
|
||||
|
||||
return response.data['token'];
|
||||
} catch (e) {
|
||||
@@ -105,7 +104,6 @@ class PaymobPayment {
|
||||
"items": items,
|
||||
},
|
||||
);
|
||||
print(response.data['id']);
|
||||
|
||||
return response.data['id'];
|
||||
} catch (e) {
|
||||
@@ -138,7 +136,6 @@ class PaymobPayment {
|
||||
if (message != null) {
|
||||
throw Exception(message);
|
||||
}
|
||||
print(response.data['token']);
|
||||
return response.data['token'];
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ class PaymobPaymentWallet {
|
||||
'api_key': _apiKey,
|
||||
},
|
||||
);
|
||||
print(response.data['token']);
|
||||
return response.data['token'];
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
@@ -104,7 +103,6 @@ class PaymobPaymentWallet {
|
||||
"items": items,
|
||||
},
|
||||
);
|
||||
print(response.data['id']);
|
||||
return response.data['id'];
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
@@ -136,7 +134,6 @@ class PaymobPaymentWallet {
|
||||
// if (message != null) {
|
||||
// throw Exception(message);
|
||||
// }
|
||||
print(response.data['token']);
|
||||
return response.data['token'];
|
||||
}
|
||||
|
||||
@@ -161,16 +158,13 @@ class PaymobPaymentWallet {
|
||||
if (response.statusCode == 200) {
|
||||
final paymentData = response.data; // Assuming JSON response
|
||||
|
||||
print("redirection_url: ${paymentData['iframe_redirection_url']}");
|
||||
return paymentData['iframe_redirection_url'];
|
||||
// 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");
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user