6/22/2
This commit is contained in:
@@ -31,7 +31,6 @@ class DriverWalletHistoryController extends GetxController {
|
||||
));
|
||||
}
|
||||
archive = 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 {
|
||||
|
||||
@@ -69,7 +69,6 @@ class PaymentController extends GetxController {
|
||||
'amount': amount.toString(),
|
||||
});
|
||||
var d = jsonDecode(res);
|
||||
print('paymentToken ${d['message']}');
|
||||
return d['message'];
|
||||
}
|
||||
|
||||
@@ -79,7 +78,6 @@ class PaymentController extends GetxController {
|
||||
'amount': amount.toString(),
|
||||
});
|
||||
var d = jsonDecode(res);
|
||||
// print('paymentToken ${d['message']}');
|
||||
return d['message'];
|
||||
}
|
||||
|
||||
@@ -160,13 +158,11 @@ class PaymentController extends GetxController {
|
||||
var decod = jsonDecode(value);
|
||||
|
||||
if (decod["status"] == "success") {
|
||||
print(totalPassenger);
|
||||
var firstElement = decod["message"][0];
|
||||
totalPassenger = totalPassenger -
|
||||
(totalPassenger * int.parse(firstElement['amount']));
|
||||
MapPassengerController().promoTaken = true;
|
||||
update();
|
||||
print(totalPassenger);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -193,7 +189,6 @@ class PaymentController extends GetxController {
|
||||
method();
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
} else {
|
||||
// Local authentication not available, proceed with payment without authentication
|
||||
@@ -264,7 +259,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) {
|
||||
@@ -292,7 +286,6 @@ class PaymentController extends GetxController {
|
||||
// User authenticated successfully, proceed with payment
|
||||
|
||||
if (selectedAmount != 0) {
|
||||
print(selectedAmount);
|
||||
changePromoSheetDialogue();
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
@@ -347,17 +340,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);
|
||||
}),
|
||||
@@ -369,7 +359,6 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -383,7 +372,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 {
|
||||
@@ -393,7 +381,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;
|
||||
@@ -454,11 +441,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;
|
||||
}
|
||||
|
||||
@@ -487,10 +472,8 @@ class PaymentController extends GetxController {
|
||||
payload: body,
|
||||
);
|
||||
final responseData = jsonDecode(response);
|
||||
print(responseData);
|
||||
final transactionId = responseData['id'];
|
||||
|
||||
print('transactionId = $transactionId');
|
||||
return transactionId;
|
||||
}
|
||||
|
||||
@@ -501,10 +484,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'
|
||||
@@ -526,16 +506,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') {
|
||||
@@ -577,7 +548,6 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
} else {
|
||||
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
||||
@@ -585,12 +555,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') {
|
||||
@@ -679,17 +644,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') {
|
||||
@@ -748,7 +703,6 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
} else {
|
||||
// Authentication failed, handle accordingly
|
||||
print('Authentication failed');
|
||||
}
|
||||
} else {
|
||||
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
||||
@@ -756,12 +710,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