fixed error on payment

This commit is contained in:
2025-02-11 00:39:26 +05:30
parent 991a983d85
commit d230ab8d7f
12 changed files with 745 additions and 669 deletions

View File

@@ -156,6 +156,7 @@ class AddtocartProvider extends ChangeNotifier {
},
(response) {
allitem = response!;
_discount = 0.0;
_totalPrice = double.parse(response.subtotal.toString());
_grandPrice = double.parse(response.subtotal.toString());
@@ -275,14 +276,24 @@ class AddtocartProvider extends ChangeNotifier {
) async {
ispaymentLoader = true;
notifyListeners();
var data;
var data = {
"amount": originalAmount,
"addressId": addressId,
"cartId": cartId,
"couponId": couponId
};
if (couponId.isEmpty) {
data = {
"amount": originalAmount,
"addressId": addressId,
"cartId": cartId,
};
} else {
data = {
"amount": originalAmount,
"addressId": addressId,
"cartId": cartId,
"couponId": couponId
};
}
print("ksdjfkgjlhdfkg ${data}");
try {
var result = await _homeRepo.paymentOrder(data);
return result.fold(

View File

@@ -1218,11 +1218,15 @@ class _ProductDetailsState extends State<ProductDetails> {
child: Row(
children: [
InkWell(
onTap: () {
cartProvider.addToCart(
context,
cartProvider.productDetails.data!.id!,
cartProvider.quantity);
onTap: () async {
if (await SharedPrefUtils.getToken() != null) {
cartProvider.addToCart(
context,
cartProvider.productDetails.data!.id!,
cartProvider.quantity);
} else {
context.push(MyRoutes.SIGNUP);
}
},
child: cartProvider.isLoadingCart
? Padding(