payment handler
This commit is contained in:
@@ -13,6 +13,7 @@ import 'package:grocery_app/src/data/banners.dart';
|
||||
import 'package:grocery_app/src/data/best_dealProduct.dart';
|
||||
import 'package:grocery_app/src/data/check_pin_response.dart';
|
||||
import 'package:grocery_app/src/data/login_response.dart';
|
||||
import 'package:grocery_app/src/data/order_paymnet.dart';
|
||||
import 'package:grocery_app/src/data/product_category.dart';
|
||||
import 'package:grocery_app/src/data/product_details.dart';
|
||||
import 'package:grocery_app/src/data/upload_image.dart';
|
||||
@@ -91,33 +92,28 @@ class ProductRepo {
|
||||
|
||||
return right(productCategory);
|
||||
} on DioException catch (e) {
|
||||
|
||||
var error = CustomDioExceptions.handleError(e);
|
||||
return left(error);
|
||||
}
|
||||
}
|
||||
|
||||
FutureResult<ProductCategory> paymentOrder(
|
||||
data) async
|
||||
{
|
||||
FutureResult<OrderPaymnet> paymentOrder(data) async {
|
||||
try {
|
||||
var response = await _productService.paymentOrder(data);
|
||||
print("kjdfglkjfdgjklfgkldj${data} ${response} ");
|
||||
|
||||
OrderPaymnet productCategory = orderPaymnetFromJson(response.toString());
|
||||
|
||||
ProductCategory productCategory = productCategoryFromJson(response.toString());
|
||||
|
||||
print("lkjdflkjfhgdkhfgkd ");
|
||||
// final String model = response.toString();
|
||||
|
||||
return right(productCategory);
|
||||
} on DioException catch (e) {
|
||||
|
||||
var error = CustomDioExceptions.handleError(e);
|
||||
return left(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
FutureResult<List<Product>> similarProduct(
|
||||
data, BuildContext context, id) async {
|
||||
try {
|
||||
@@ -176,33 +172,30 @@ class ProductRepo {
|
||||
return left(error);
|
||||
}
|
||||
}
|
||||
FutureResult<String> updateProfile(data) async {
|
||||
|
||||
FutureResult<String> updateProfile(data) async {
|
||||
try {
|
||||
var response = await _productService.updateProfile(data);
|
||||
|
||||
print("kdjfgkljfdkjlghflkgjh ${response}");
|
||||
final String model = response.toString();
|
||||
return right(model);
|
||||
final String model = response.toString();
|
||||
return right(model);
|
||||
} on DioException catch (e) {
|
||||
var error = CustomDioExceptions.handleError(e);
|
||||
return left(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
FutureResult<UploadImage> uploadImage(File imageFile)
|
||||
async {
|
||||
FutureResult<UploadImage> uploadImage(File imageFile) async {
|
||||
try {
|
||||
final response = await _productService.uploadImage(imageFile);
|
||||
UploadImage upload=uploadImageFromJson(response.toString());
|
||||
UploadImage upload = uploadImageFromJson(response.toString());
|
||||
return right(upload);
|
||||
} on DioException catch (e) {
|
||||
final error = CustomDioExceptions.handleError(e);
|
||||
return left(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FutureResult<CheckPinResponse> checkPin(data, pin) async {
|
||||
try {
|
||||
@@ -270,7 +263,8 @@ FutureResult<String> updateProfile(data) async {
|
||||
return left(error);
|
||||
}
|
||||
}
|
||||
FutureResult<String> decreaseQuantity(data) async {
|
||||
|
||||
FutureResult<String> decreaseQuantity(data) async {
|
||||
try {
|
||||
var response = await _productService.decreaseQuantity(data);
|
||||
|
||||
@@ -284,9 +278,6 @@ FutureResult<String> decreaseQuantity(data) async {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
FutureResult<WishListModel> gettAllWishList(data) async {
|
||||
try {
|
||||
var response = await _productService.gettAllWishList(data);
|
||||
@@ -337,9 +328,7 @@ FutureResult<String> decreaseQuantity(data) async {
|
||||
var response = await _productService.refresh_token(data);
|
||||
LoginResponse loginResponse = loginResponseFromJson(response.toString());
|
||||
|
||||
if (loginResponse.accessToken != null)
|
||||
{
|
||||
|
||||
if (loginResponse.accessToken != null) {
|
||||
await SharedPrefUtils.setToken(
|
||||
authToken: loginResponse.accessToken ?? "");
|
||||
await SharedPrefUtils.setRefreshToken(
|
||||
@@ -349,10 +338,7 @@ FutureResult<String> decreaseQuantity(data) async {
|
||||
final String model = response.toString();
|
||||
|
||||
return right(model);
|
||||
} on DioException catch (e)
|
||||
{
|
||||
|
||||
|
||||
} on DioException catch (e) {
|
||||
var error = CustomDioExceptions.handleError(e);
|
||||
return left(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user