This commit is contained in:
Hamza-Ayed
2024-06-22 13:12:35 +03:00
parent 1cc0156cfd
commit 3c5321f70b
67 changed files with 91 additions and 740 deletions

View File

@@ -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') {