pizzapass campaign added
This commit is contained in:
@@ -97,7 +97,7 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
if(SessionHelper.isCustomerLoggedIn()){
|
||||
addProductToCart();
|
||||
/*
|
||||
if((campaignModel.getCode().equals(ApiConstants.PIZZAPROMOTION) && SessionHelper.isUserUsedPizzaPromotionCampaign()){
|
||||
if((campaignModel.getCode().equals(ApiConstants.PIZZAPASS) && SessionHelper.isUserUsedPizzaPassCampaign()){
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, cannotUseCampaignText);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class CampaignProductListActivity extends BaseActivity {
|
||||
Intent productPropertiesIntent = new Intent(BaseActivity.currentActivity, CampaignProductDetailsActivity.class);
|
||||
productPropertiesIntent.putExtra("menuProductModel", menuProductList.get(position));
|
||||
productPropertiesIntent.putExtra("campaignModel", campaignModel);
|
||||
//productPropertiesIntent.putExtra("isFromPizzaPromotionCampaign", categoryModel.isPizzaPromotionCampaign());
|
||||
//productPropertiesIntent.putExtra("isFromPizzaPassCampaign", categoryModel.isPizzaPassCampaign());
|
||||
startActivityForResult(productPropertiesIntent, REQUEST_CODE_CAMPAIGN_PRODUCT_PROPERTIES);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -171,14 +171,14 @@ public class CreateOrderActivity extends BaseActivity {
|
||||
*/
|
||||
|
||||
/**
|
||||
* eğer kampanya kullanıldıysa cartInfoModel de isPizzaPromotionCampaignUsed
|
||||
* eğer kampanya kullanıldıysa cartInfoModel de isPizzaPassCampaignUsed
|
||||
* alanalrını true olarak set ediyoruz. create order ekranlarında herhangi bir yerde sepet sorgusu yapınca
|
||||
* buradaki cartInfoModel i de güncelliyoruz. fakat isPizzaPromotionCampaignUsed alanları
|
||||
* buradaki cartInfoModel i de güncelliyoruz. fakat isPizzaPassCampaignUsed alanları
|
||||
* servisten gelmeyen değerler, bizim loaklde tuttuğumuz değişkenler. bu sebeple bu alanlar servisten hep false geliyor,
|
||||
* buradakinde true olsa bile değişkeni guncellediğimiz için bu alanlar kayboluyor. bunu engellemek için bu metodu yazdım.
|
||||
*/
|
||||
public void setCartInfoSafeForCampaigns(CartInfoModel cartInfoModel) {
|
||||
cartInfoModel.setPizzaPromotionCampaignUsed(this.cartInfoModel.isPizzaPromotionCampaignUsed());
|
||||
cartInfoModel.setPizzaPassCampaignUsed(this.cartInfoModel.isPizzaPassCampaignUsed());
|
||||
this.cartInfoModel = cartInfoModel;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class ApiConstants {
|
||||
public static final int PRODUCT_ID_MITTAGS_MENU = 732;
|
||||
public static final String PRODUCT_ID_VERSION_MENU = "-111";
|
||||
|
||||
public static final String CAMPAIGN_CODE_PIZZA_PROMOTION = "PIZZAPROMOTION";
|
||||
public static final String CAMPAIGN_CODE_PIZZAPASS = "PIZZAPASS";
|
||||
|
||||
public static final String PAYMENT_METHOD_CODE_CREDIT_DEBIT_CARD = "braintree"; // Credit / Debit Card
|
||||
public static final String PAYMENT_METHOD_CODE_BANK_CASH = "cod"; // Bar
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ApiEndPoints {
|
||||
public static final String API_GET_ZONE_LIST = PREFIX + "getZones" + SUFFIX;
|
||||
public static final String API_GET_CUSTOMER_PROFILE = PREFIX + "getCustomerInfo" + SUFFIX;
|
||||
public static final String API_GET_STORE_INFO = PREFIX + "getStoreInfo" + SUFFIX;
|
||||
public static final String API_CHECK_CAMPAIGN_PIZZA_PROMOTION = PREFIX + "detectPizzaPromotionCampaign" + SUFFIX + "&token=";
|
||||
public static final String API_CHECK_CAMPAIGN_PIZZAPASS = PREFIX + "detectPizzaPassCampaign" + SUFFIX + "&token=";
|
||||
public static final String API_CHECK_DELIVERY_TIME = PREFIX + "checkDeliveryTimeService" + SUFFIX;
|
||||
public static final String API_GET_DELIVERY_TIME_OF_STORE = PREFIX + "getDeliveryTimeForStore" + SUFFIX;
|
||||
|
||||
|
||||
@@ -204,8 +204,8 @@ public interface ApiInterface {
|
||||
Call<ResponseObject<PersonalCouponModel>> checkPersonalCoupon(@Url String url,
|
||||
@Field("voucher") String couponCode);
|
||||
|
||||
@GET("{storeName}" + ApiEndPoints.API_CHECK_CAMPAIGN_PIZZA_PROMOTION)
|
||||
Call<ResponseObject<CampaignModel>> checkPizzaPromotionCampaign(@Path("storeName") String storeName,
|
||||
@GET("{storeName}" + ApiEndPoints.API_CHECK_CAMPAIGN_PIZZAPASS)
|
||||
Call<ResponseObject<CampaignModel>> checkPizzaPassCampaign(@Path("storeName") String storeName,
|
||||
@Query("token") String token);
|
||||
|
||||
@GET("{storeName}" + ApiEndPoints.API_CHECK_DELIVERY_TIME)
|
||||
|
||||
@@ -83,12 +83,12 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
public static final java.lang.String FRAGMENT_NAME = "cartFragment";
|
||||
private int REQUEST_CODE_CAMPAIGN_PRODUCT_LIST = 7847;
|
||||
private String pizzaPromotionCampaignCategoryId = "";
|
||||
private String pizzaPassCampaignCategoryId = "";
|
||||
|
||||
private CartInfoModel cartInfoModel;
|
||||
private ArrayList<CartProductModel> cartProductList = new ArrayList<>();
|
||||
private CartRecyclerAdapter cartRecyclerAdapter;
|
||||
private ArrayList<MenuProductModel> pizzaPromotionCampaignProductList = new ArrayList<>();
|
||||
private ArrayList<MenuProductModel> pizzaPassCampaignProductList = new ArrayList<>();
|
||||
|
||||
public CartFragment() {}
|
||||
|
||||
@@ -146,8 +146,8 @@ public class CartFragment extends BaseFragment {
|
||||
case R.id.continueCartButton:
|
||||
|
||||
// without minimum price control for store. minimum price is contorlled by addOrder2() service.
|
||||
if(!pizzaPromotionCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzaPromotionOnContinueButtonClicked();
|
||||
if(!pizzaPassCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzaPassOnContinueButtonClicked();
|
||||
}
|
||||
else {
|
||||
openCreateOrderActivity();
|
||||
@@ -161,8 +161,8 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
if(cartCurrentPrice >= storeMinimumPrice){
|
||||
|
||||
if(!pizzaPromotionCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzaPromotionOnContinueButtonClicked();
|
||||
if(!pizzaPassCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzaPassOnContinueButtonClicked();
|
||||
}
|
||||
else {
|
||||
openCreateOrderActivity();
|
||||
@@ -228,7 +228,7 @@ public class CartFragment extends BaseFragment {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
}
|
||||
else {
|
||||
checkPizzaPromotionCampaign();
|
||||
checkPizzaPassCampaign();
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -410,10 +410,10 @@ public class CartFragment extends BaseFragment {
|
||||
}
|
||||
);
|
||||
|
||||
if(!pizzaPromotionCampaignProductList.isEmpty()){
|
||||
cartInfoModel.setPizzaPromotionCampaignUsed(
|
||||
if(!pizzaPassCampaignProductList.isEmpty()){
|
||||
cartInfoModel.setPizzaPassCampaignUsed(
|
||||
isBasketContainsCampaignProduct(
|
||||
pizzaPromotionCampaignProductList));
|
||||
pizzaPassCampaignProductList));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -467,10 +467,10 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
}
|
||||
|
||||
private void checkPizzaPromotionCampaign(){
|
||||
private void checkPizzaPassCampaign(){
|
||||
ApiService
|
||||
.apiInterface
|
||||
.checkPizzaPromotionCampaign(
|
||||
.checkPizzaPassCampaign(
|
||||
SessionHelper.getSelectedStore().getStoreName(),
|
||||
SessionHelper.getCustomerToken().getToken())
|
||||
.enqueue(new Callback<ResponseObject<CampaignModel>>() {
|
||||
@@ -486,7 +486,7 @@ public class CartFragment extends BaseFragment {
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
|
||||
}
|
||||
else {
|
||||
pizzaPromotionCampaignCategoryId = response.body().getData().getCategoryId();
|
||||
pizzaPassCampaignCategoryId = response.body().getData().getCategoryId();
|
||||
getCampaignProducts(response.body().getData());
|
||||
}
|
||||
}
|
||||
@@ -505,7 +505,7 @@ public class CartFragment extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
private void showPizzaPromotionCampaignDialog(final CampaignModel campaignModel){
|
||||
private void showPizzaPassCampaignDialog(final CampaignModel campaignModel){
|
||||
DialogHelper.showTwoButtonsDialog(
|
||||
campaignModel.getName(),
|
||||
campaignModel.getDescription(),
|
||||
@@ -540,7 +540,7 @@ public class CartFragment extends BaseFragment {
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()) {
|
||||
if(!isBasketContainsCampaignProduct(response.body().getData())){
|
||||
showPizzaPromotionCampaignDialog(campaignModel);
|
||||
showPizzaPassCampaignDialog(campaignModel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -555,13 +555,13 @@ public class CartFragment extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
private void getCampaignProductsForPizzaPromotionOnContinueButtonClicked(){
|
||||
private void getCampaignProductsForPizzaPassOnContinueButtonClicked(){
|
||||
|
||||
DialogHelper.showLoadingDialog();
|
||||
|
||||
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
|
||||
SessionHelper.getSelectedStore().getStoreName(),
|
||||
pizzaPromotionCampaignCategoryId);
|
||||
pizzaPassCampaignCategoryId);
|
||||
call.enqueue(new Callback<ResponseArray<MenuProductModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<MenuProductModel>> call, Response<ResponseArray<MenuProductModel>> response) {
|
||||
@@ -570,9 +570,9 @@ public class CartFragment extends BaseFragment {
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()) {
|
||||
|
||||
pizzaPromotionCampaignProductList.clear();
|
||||
pizzaPromotionCampaignProductList.addAll(response.body().getData());
|
||||
cartInfoModel.setPizzaPromotionCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
||||
pizzaPassCampaignProductList.clear();
|
||||
pizzaPassCampaignProductList.addAll(response.body().getData());
|
||||
cartInfoModel.setPizzaPassCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
||||
|
||||
DialogHelper.hideLoadingDialog();
|
||||
openCreateOrderActivity();
|
||||
|
||||
@@ -216,7 +216,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
params.put("payment_method_title", createOrderActivity.getSelectedPaymentMethod().getTitle());
|
||||
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
||||
params.put("comment", createOrderNote());
|
||||
params.put("is_pizza_promotion_campaign", createOrderActivity.getCartInfo().isPizzaPromotionCampaignUsed());
|
||||
params.put("is_pizza_pass_campaign", createOrderActivity.getCartInfo().isPizzaPassCampaignUsed());
|
||||
params.put("application_id", ApiConstants.APP_TYPE_ID_ANDROID);
|
||||
SessionHelper.addCouponCodeToRequestParamsIfNeeded(params);
|
||||
if(dateOfOrderString != null && !dateOfOrderString.isEmpty() &&
|
||||
@@ -708,7 +708,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
params.put("payment_method_title", createOrderActivity.getSelectedPaymentMethod().getTitle());
|
||||
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
||||
params.put("comment", createOrderNote());
|
||||
params.put("is_pizza_promotion_campaign", createOrderActivity.getCartInfo().isPizzaPromotionCampaignUsed());
|
||||
params.put("is_pizza_pass_campaign", createOrderActivity.getCartInfo().isPizzaPassCampaignUsed());
|
||||
params.put("application_id", ApiConstants.APP_TYPE_ID_ANDROID);
|
||||
if(paymentMethodNonce != null){
|
||||
params.put("payment_method_nonce", paymentMethodNonce);
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CartInfoModel implements Serializable {
|
||||
|
||||
private ArrayList<CartProductModel> products;
|
||||
private ArrayList<CartTotalModel> totals;
|
||||
private boolean isPizzaPromotionCampaignUsed;
|
||||
private boolean isPizzaPassCampaignUsed;
|
||||
|
||||
public ArrayList<CartProductModel> getProducts() {
|
||||
return products;
|
||||
@@ -62,11 +62,11 @@ public class CartInfoModel implements Serializable {
|
||||
|
||||
}
|
||||
|
||||
public boolean isPizzaPromotionCampaignUsed() {
|
||||
return isPizzaPromotionCampaignUsed;
|
||||
public boolean isPizzaPassCampaignUsed() {
|
||||
return isPizzaPassCampaignUsed;
|
||||
}
|
||||
|
||||
public void setPizzaPromotionCampaignUsed(boolean pizzaPromotionCampaignUsed) {
|
||||
isPizzaPromotionCampaignUsed = pizzaPromotionCampaignUsed;
|
||||
public void setPizzaPassCampaignUsed(boolean pizzaPassCampaignUsed) {
|
||||
isPizzaPassCampaignUsed = pizzaPassCampaignUsed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user