voucher fixes 2
This commit is contained in:
@@ -256,153 +256,4 @@ public interface ApiInterface {
|
||||
Call<ResponseArray<PersonalCouponModel>> getPersonalCouponList(@Path("storeName") String storeName,
|
||||
@Query("token") String token);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@GET(ApiEndPoints.API_GET_ALL_CATEGORIES)
|
||||
Call<ResponseArray<CategoryModel>> getAllCategories(@Path("id") int id);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_IGNORED_CATEGORY_IDS)
|
||||
Call<ResponseArray<Integer>> getIgnoredCategoryIds();
|
||||
|
||||
@GET(ApiEndPoints.API_GET_PIZZA_CATEGORY_IDS)
|
||||
Call<ResponseArray<Integer>> getPizzaCategoryIds();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_REGISTER)
|
||||
Call<ResponseObject<UserModel>> register(@FieldMap HashMap<String, Object> body);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_LOGIN)
|
||||
Call<ResponseObject<UserModel>> login(@Field("email") String email, @Field("password") String password);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_LOGOUT)
|
||||
Call<ResponseObject> logout(@Field("token") String customerToken);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_ORDER_HISTORY)
|
||||
Call<ResponseArray<OrderHistoryModel>> getOrderHistory(@Query("token") String token);
|
||||
|
||||
@POST
|
||||
Call<ResponseObject<CartInfoModel>> getCartProducts(@Url String url);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<CartInfoModel>> getCartProductsForCommission(@Url String url,
|
||||
@Field("payment_method") String paymentMethodCode,
|
||||
@Field("shipping_method") String shippingMethodCode);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_CLEAR_CART)
|
||||
Call<ResponseObject> clearCart(@Query("token") String token);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_PRODUCTS_BY_CATEGORY)
|
||||
Call<ResponseArray<MenuProductModel>> getProductsByCategory(@Query("category_id") String categoryId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_GET_PRODUCT)
|
||||
Call<ResponseArray<MenuProductModel>> getProductById(@Field("product_id") int productId);
|
||||
|
||||
|
||||
// * Bu projedeki post servisler bizden form-data bekliyor. Bu serviste @FormUrlEncoded yapınca ve
|
||||
// * body'i @FieldMap HashMap<String, Object> body olarak verince, body içindeki alanlar
|
||||
// * encode ediliyor, mesela body içindeki "[" karakteri "%5D" ye falan dönüşüyor, dolayısı ile servis bunları okuyamıyor.
|
||||
// * Bu sebeple body olarak RequestBody verdim ve servisi çağırırken bod içindeki alanları FormBody olarak ekledim.
|
||||
@POST
|
||||
Call<ResponseObject<AddProductToBasketResponseModel>> addProductsToBasket(@Url String url,
|
||||
@Body RequestBody body);
|
||||
@GET(ApiEndPoints.API_GET_SHIPPING_METHODS)
|
||||
Call<ResponseArray<ShippingMethodModel>> getShippingMethods(@Query("token") String token);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_CUSTOMER_ADDRESSES)
|
||||
Call<ResponseArray<AddressModel>> getCustomerAddresses(@Query("token") String token);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<AddNewAddressResponseModel>> addNewAddress(@Url String url,
|
||||
@FieldMap HashMap<String, Object> body);
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<DeleteAddressResponseModel>> deleteAddress(@Url String url,
|
||||
@Field("address_id") String addressId);
|
||||
@GET(ApiEndPoints.API_GET_PAYMENT_METHODS)
|
||||
Call<ResponseObject<PaymentMethodsResponseModel>> getPaymentMethods(@Query("token") String token);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<Integer>> createOrder(@Url String url, @FieldMap HashMap<String, Object> body);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_CHECK_UPDATE)
|
||||
Call<ResponseObject<AppVersionModel>> checkUpdate(@FieldMap HashMap<String, Object> body);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_FORGOT_PASSWORD)
|
||||
Call<ResponseObject> forgotPassword(@Field("email") String emailAddress);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_CITY_LIST)
|
||||
Call<ResponseArray<CityModel>> getCityList();
|
||||
|
||||
@GET(ApiEndPoints.API_GET_COUNTRY_LIST)
|
||||
Call<ResponseArray<CountryModel>> getCountryList();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_GET_ZONE_LIST)
|
||||
Call<ResponseArray<ZoneModel>> getZoneList(@Field("country_id") String countryId);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_CUSTOMER_PROFILE)
|
||||
Call<ResponseObject<UserModel>> getCustomerProfile(@Query("token") String token);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject> updatePassword(@Url String url, @FieldMap HashMap<String, Object> body);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<UserModel>> updateProfile(@Url String url, @FieldMap HashMap<String, Object> body);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<RemoveProductFromCartResponseModel>> removeProductFromCart(@Url String url,
|
||||
@FieldMap HashMap<String, Object> body);
|
||||
@GET(ApiEndPoints.API_GET_STORE_INFO)
|
||||
Call<ResponseObject<StoreInfoModel>> getStoreInfo();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseArray<OrderHistoryProductModel>> getOrderProductList(@Url String url,
|
||||
@Field("order_id") String orderId);
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject<CheckCouponModel>> checkCoupon(@Url String url, @Field("coupon") String couponCode);
|
||||
|
||||
@GET(ApiEndPoints.API_CHECK_CAMPAIGN_PIZZAPASS)
|
||||
Call<ResponseObject<CampaignModel>> checkPizzapassCampaign(@Query("token") String token);
|
||||
|
||||
@GET(ApiEndPoints.API_CHECK_CAMPAIGN_KEBAPPASS)
|
||||
Call<ResponseObject<CampaignModel>> checkKebapPassCampaign(@Query("token") String token);
|
||||
|
||||
@GET(ApiEndPoints.API_CHECK_DELIVERY_TIME)
|
||||
Call<ResponseObject<Boolean>> checkDeliveryTime();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(ApiEndPoints.API_CHECK_DELIVERY_TIME)
|
||||
Call<ResponseObject<Boolean>> checkDeliveryTimeWithDateAndTime(@Field("delivery_date") String deliveryDateAndTime);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject> createPayment(@Url String url, @FieldMap HashMap<String, Object> body);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST
|
||||
Call<ResponseObject> repeatOrder(@Url String url, @FieldMap HashMap<String, Object> body);
|
||||
|
||||
@GET(ApiEndPoints.API_GET_STORE_LIST)
|
||||
Call<ResponseArray<StoreModel>> getStoreList();
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -236,32 +236,41 @@ public class PaymentMethodFragment extends CreateOrderBaseFragment {
|
||||
call.enqueue(new Callback<ResponseObject<PersonalCouponModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseObject<PersonalCouponModel>> call, Response<ResponseObject<PersonalCouponModel>> response) {
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
couponModel = response.body().getData();
|
||||
couponModel.setStoreName(SessionHelper.getSelectedStore().getStoreName());
|
||||
if(couponModel.isActive()){
|
||||
if(response.isSuccessful()){
|
||||
|
||||
String couponName = "";
|
||||
if(couponModel instanceof PersonalCouponModel){
|
||||
couponName = ((PersonalCouponModel) couponModel).getTheme();
|
||||
if(response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
|
||||
couponModel = response.body().getData();
|
||||
couponModel.setStoreName(SessionHelper.getSelectedStore().getStoreName());
|
||||
if(couponModel.isActive()){
|
||||
|
||||
String couponName = "";
|
||||
if(couponModel instanceof PersonalCouponModel){
|
||||
couponName = ((PersonalCouponModel) couponModel).getTheme();
|
||||
}
|
||||
|
||||
SessionHelper.saveSelectedCoupon(couponModel);
|
||||
DialogHelper.showDialogWithPositiveButton(
|
||||
couponUsedDialogTitle,
|
||||
BaseActivity.currentActivity,
|
||||
couponUsedDialogContentPart1 + " " + couponName + " " + couponUsedDialogContentPart2);
|
||||
getCartProducts();
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
ApiErrorUtils.parseError(response);
|
||||
}
|
||||
|
||||
SessionHelper.saveSelectedCoupon(couponModel);
|
||||
DialogHelper.showDialogWithPositiveButton(
|
||||
couponUsedDialogTitle,
|
||||
BaseActivity.currentActivity,
|
||||
couponUsedDialogContentPart1 + " " + couponName + " " + couponUsedDialogContentPart2);
|
||||
getCartProducts();
|
||||
}
|
||||
else {
|
||||
checkGeneralCoupon();
|
||||
DialogHelper.hideLoadingDialog();
|
||||
ApiErrorUtils.parseError(response);
|
||||
}
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
ApiErrorUtils.parseError(response);
|
||||
checkGeneralCoupon();
|
||||
//DialogHelper.hideLoadingDialog();
|
||||
//ApiErrorUtils.parseError(response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,10 +81,12 @@ public class SessionHelper {
|
||||
public static void saveSelectedCoupon(CouponModel couponModel){
|
||||
if(couponModel instanceof PersonalCouponModel){
|
||||
PersonalCouponModel personalCouponModel = (PersonalCouponModel) couponModel;
|
||||
SessionHelper.clearSelectedCoupon();
|
||||
SharedPrefsHelper.saveSelectedPersonalCoupon(personalCouponModel);
|
||||
}
|
||||
else if(couponModel instanceof GeneralCouponModel){
|
||||
GeneralCouponModel generalCouponModel = (GeneralCouponModel) couponModel;
|
||||
SessionHelper.clearSelectedCoupon();
|
||||
SharedPrefsHelper.saveSelectedGeneralCoupon(generalCouponModel);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user