pizzapass campaign added
This commit is contained in:
@@ -97,7 +97,7 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
|||||||
if(SessionHelper.isCustomerLoggedIn()){
|
if(SessionHelper.isCustomerLoggedIn()){
|
||||||
addProductToCart();
|
addProductToCart();
|
||||||
/*
|
/*
|
||||||
if((campaignModel.getCode().equals(ApiConstants.PIZZAPROMOTION) && SessionHelper.isUserUsedPizzaPromotionCampaign()){
|
if((campaignModel.getCode().equals(ApiConstants.PIZZAPASS) && SessionHelper.isUserUsedPizzaPassCampaign()){
|
||||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, cannotUseCampaignText);
|
DialogHelper.showAlertDialog(BaseActivity.currentActivity, cannotUseCampaignText);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ public class CampaignProductListActivity extends BaseActivity {
|
|||||||
Intent productPropertiesIntent = new Intent(BaseActivity.currentActivity, CampaignProductDetailsActivity.class);
|
Intent productPropertiesIntent = new Intent(BaseActivity.currentActivity, CampaignProductDetailsActivity.class);
|
||||||
productPropertiesIntent.putExtra("menuProductModel", menuProductList.get(position));
|
productPropertiesIntent.putExtra("menuProductModel", menuProductList.get(position));
|
||||||
productPropertiesIntent.putExtra("campaignModel", campaignModel);
|
productPropertiesIntent.putExtra("campaignModel", campaignModel);
|
||||||
//productPropertiesIntent.putExtra("isFromPizzaPromotionCampaign", categoryModel.isPizzaPromotionCampaign());
|
//productPropertiesIntent.putExtra("isFromPizzaPassCampaign", categoryModel.isPizzaPassCampaign());
|
||||||
startActivityForResult(productPropertiesIntent, REQUEST_CODE_CAMPAIGN_PRODUCT_PROPERTIES);
|
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
|
* 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,
|
* 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.
|
* 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) {
|
public void setCartInfoSafeForCampaigns(CartInfoModel cartInfoModel) {
|
||||||
cartInfoModel.setPizzaPromotionCampaignUsed(this.cartInfoModel.isPizzaPromotionCampaignUsed());
|
cartInfoModel.setPizzaPassCampaignUsed(this.cartInfoModel.isPizzaPassCampaignUsed());
|
||||||
this.cartInfoModel = cartInfoModel;
|
this.cartInfoModel = cartInfoModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class ApiConstants {
|
|||||||
public static final int PRODUCT_ID_MITTAGS_MENU = 732;
|
public static final int PRODUCT_ID_MITTAGS_MENU = 732;
|
||||||
public static final String PRODUCT_ID_VERSION_MENU = "-111";
|
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_CREDIT_DEBIT_CARD = "braintree"; // Credit / Debit Card
|
||||||
public static final String PAYMENT_METHOD_CODE_BANK_CASH = "cod"; // Bar
|
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_ZONE_LIST = PREFIX + "getZones" + SUFFIX;
|
||||||
public static final String API_GET_CUSTOMER_PROFILE = PREFIX + "getCustomerInfo" + 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_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_CHECK_DELIVERY_TIME = PREFIX + "checkDeliveryTimeService" + SUFFIX;
|
||||||
public static final String API_GET_DELIVERY_TIME_OF_STORE = PREFIX + "getDeliveryTimeForStore" + SUFFIX;
|
public static final String API_GET_DELIVERY_TIME_OF_STORE = PREFIX + "getDeliveryTimeForStore" + SUFFIX;
|
||||||
|
|
||||||
|
|||||||
@@ -204,9 +204,9 @@ public interface ApiInterface {
|
|||||||
Call<ResponseObject<PersonalCouponModel>> checkPersonalCoupon(@Url String url,
|
Call<ResponseObject<PersonalCouponModel>> checkPersonalCoupon(@Url String url,
|
||||||
@Field("voucher") String couponCode);
|
@Field("voucher") String couponCode);
|
||||||
|
|
||||||
@GET("{storeName}" + ApiEndPoints.API_CHECK_CAMPAIGN_PIZZA_PROMOTION)
|
@GET("{storeName}" + ApiEndPoints.API_CHECK_CAMPAIGN_PIZZAPASS)
|
||||||
Call<ResponseObject<CampaignModel>> checkPizzaPromotionCampaign(@Path("storeName") String storeName,
|
Call<ResponseObject<CampaignModel>> checkPizzaPassCampaign(@Path("storeName") String storeName,
|
||||||
@Query("token") String token);
|
@Query("token") String token);
|
||||||
|
|
||||||
@GET("{storeName}" + ApiEndPoints.API_CHECK_DELIVERY_TIME)
|
@GET("{storeName}" + ApiEndPoints.API_CHECK_DELIVERY_TIME)
|
||||||
Call<ResponseObject<Boolean>> checkDeliveryTime(@Path("storeName") String storeName,
|
Call<ResponseObject<Boolean>> checkDeliveryTime(@Path("storeName") String storeName,
|
||||||
|
|||||||
@@ -83,12 +83,12 @@ public class CartFragment extends BaseFragment {
|
|||||||
|
|
||||||
public static final java.lang.String FRAGMENT_NAME = "cartFragment";
|
public static final java.lang.String FRAGMENT_NAME = "cartFragment";
|
||||||
private int REQUEST_CODE_CAMPAIGN_PRODUCT_LIST = 7847;
|
private int REQUEST_CODE_CAMPAIGN_PRODUCT_LIST = 7847;
|
||||||
private String pizzaPromotionCampaignCategoryId = "";
|
private String pizzaPassCampaignCategoryId = "";
|
||||||
|
|
||||||
private CartInfoModel cartInfoModel;
|
private CartInfoModel cartInfoModel;
|
||||||
private ArrayList<CartProductModel> cartProductList = new ArrayList<>();
|
private ArrayList<CartProductModel> cartProductList = new ArrayList<>();
|
||||||
private CartRecyclerAdapter cartRecyclerAdapter;
|
private CartRecyclerAdapter cartRecyclerAdapter;
|
||||||
private ArrayList<MenuProductModel> pizzaPromotionCampaignProductList = new ArrayList<>();
|
private ArrayList<MenuProductModel> pizzaPassCampaignProductList = new ArrayList<>();
|
||||||
|
|
||||||
public CartFragment() {}
|
public CartFragment() {}
|
||||||
|
|
||||||
@@ -146,8 +146,8 @@ public class CartFragment extends BaseFragment {
|
|||||||
case R.id.continueCartButton:
|
case R.id.continueCartButton:
|
||||||
|
|
||||||
// without minimum price control for store. minimum price is contorlled by addOrder2() service.
|
// without minimum price control for store. minimum price is contorlled by addOrder2() service.
|
||||||
if(!pizzaPromotionCampaignCategoryId.isEmpty()){
|
if(!pizzaPassCampaignCategoryId.isEmpty()){
|
||||||
getCampaignProductsForPizzaPromotionOnContinueButtonClicked();
|
getCampaignProductsForPizzaPassOnContinueButtonClicked();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
openCreateOrderActivity();
|
openCreateOrderActivity();
|
||||||
@@ -161,8 +161,8 @@ public class CartFragment extends BaseFragment {
|
|||||||
|
|
||||||
if(cartCurrentPrice >= storeMinimumPrice){
|
if(cartCurrentPrice >= storeMinimumPrice){
|
||||||
|
|
||||||
if(!pizzaPromotionCampaignCategoryId.isEmpty()){
|
if(!pizzaPassCampaignCategoryId.isEmpty()){
|
||||||
getCampaignProductsForPizzaPromotionOnContinueButtonClicked();
|
getCampaignProductsForPizzaPassOnContinueButtonClicked();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
openCreateOrderActivity();
|
openCreateOrderActivity();
|
||||||
@@ -228,7 +228,7 @@ public class CartFragment extends BaseFragment {
|
|||||||
DialogHelper.hideLoadingDialog();
|
DialogHelper.hideLoadingDialog();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
checkPizzaPromotionCampaign();
|
checkPizzaPassCampaign();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -410,10 +410,10 @@ public class CartFragment extends BaseFragment {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if(!pizzaPromotionCampaignProductList.isEmpty()){
|
if(!pizzaPassCampaignProductList.isEmpty()){
|
||||||
cartInfoModel.setPizzaPromotionCampaignUsed(
|
cartInfoModel.setPizzaPassCampaignUsed(
|
||||||
isBasketContainsCampaignProduct(
|
isBasketContainsCampaignProduct(
|
||||||
pizzaPromotionCampaignProductList));
|
pizzaPassCampaignProductList));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -467,10 +467,10 @@ public class CartFragment extends BaseFragment {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPizzaPromotionCampaign(){
|
private void checkPizzaPassCampaign(){
|
||||||
ApiService
|
ApiService
|
||||||
.apiInterface
|
.apiInterface
|
||||||
.checkPizzaPromotionCampaign(
|
.checkPizzaPassCampaign(
|
||||||
SessionHelper.getSelectedStore().getStoreName(),
|
SessionHelper.getSelectedStore().getStoreName(),
|
||||||
SessionHelper.getCustomerToken().getToken())
|
SessionHelper.getCustomerToken().getToken())
|
||||||
.enqueue(new Callback<ResponseObject<CampaignModel>>() {
|
.enqueue(new Callback<ResponseObject<CampaignModel>>() {
|
||||||
@@ -486,7 +486,7 @@ public class CartFragment extends BaseFragment {
|
|||||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
|
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pizzaPromotionCampaignCategoryId = response.body().getData().getCategoryId();
|
pizzaPassCampaignCategoryId = response.body().getData().getCategoryId();
|
||||||
getCampaignProducts(response.body().getData());
|
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(
|
DialogHelper.showTwoButtonsDialog(
|
||||||
campaignModel.getName(),
|
campaignModel.getName(),
|
||||||
campaignModel.getDescription(),
|
campaignModel.getDescription(),
|
||||||
@@ -540,7 +540,7 @@ public class CartFragment extends BaseFragment {
|
|||||||
response.body().getData() != null &&
|
response.body().getData() != null &&
|
||||||
response.body().isSuccess()) {
|
response.body().isSuccess()) {
|
||||||
if(!isBasketContainsCampaignProduct(response.body().getData())){
|
if(!isBasketContainsCampaignProduct(response.body().getData())){
|
||||||
showPizzaPromotionCampaignDialog(campaignModel);
|
showPizzaPassCampaignDialog(campaignModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -555,13 +555,13 @@ public class CartFragment extends BaseFragment {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getCampaignProductsForPizzaPromotionOnContinueButtonClicked(){
|
private void getCampaignProductsForPizzaPassOnContinueButtonClicked(){
|
||||||
|
|
||||||
DialogHelper.showLoadingDialog();
|
DialogHelper.showLoadingDialog();
|
||||||
|
|
||||||
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
|
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
|
||||||
SessionHelper.getSelectedStore().getStoreName(),
|
SessionHelper.getSelectedStore().getStoreName(),
|
||||||
pizzaPromotionCampaignCategoryId);
|
pizzaPassCampaignCategoryId);
|
||||||
call.enqueue(new Callback<ResponseArray<MenuProductModel>>() {
|
call.enqueue(new Callback<ResponseArray<MenuProductModel>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Call<ResponseArray<MenuProductModel>> call, Response<ResponseArray<MenuProductModel>> response) {
|
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().getData() != null &&
|
||||||
response.body().isSuccess()) {
|
response.body().isSuccess()) {
|
||||||
|
|
||||||
pizzaPromotionCampaignProductList.clear();
|
pizzaPassCampaignProductList.clear();
|
||||||
pizzaPromotionCampaignProductList.addAll(response.body().getData());
|
pizzaPassCampaignProductList.addAll(response.body().getData());
|
||||||
cartInfoModel.setPizzaPromotionCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
cartInfoModel.setPizzaPassCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
||||||
|
|
||||||
DialogHelper.hideLoadingDialog();
|
DialogHelper.hideLoadingDialog();
|
||||||
openCreateOrderActivity();
|
openCreateOrderActivity();
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
|||||||
params.put("payment_method_title", createOrderActivity.getSelectedPaymentMethod().getTitle());
|
params.put("payment_method_title", createOrderActivity.getSelectedPaymentMethod().getTitle());
|
||||||
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
||||||
params.put("comment", createOrderNote());
|
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);
|
params.put("application_id", ApiConstants.APP_TYPE_ID_ANDROID);
|
||||||
SessionHelper.addCouponCodeToRequestParamsIfNeeded(params);
|
SessionHelper.addCouponCodeToRequestParamsIfNeeded(params);
|
||||||
if(dateOfOrderString != null && !dateOfOrderString.isEmpty() &&
|
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_title", createOrderActivity.getSelectedPaymentMethod().getTitle());
|
||||||
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
||||||
params.put("comment", createOrderNote());
|
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);
|
params.put("application_id", ApiConstants.APP_TYPE_ID_ANDROID);
|
||||||
if(paymentMethodNonce != null){
|
if(paymentMethodNonce != null){
|
||||||
params.put("payment_method_nonce", paymentMethodNonce);
|
params.put("payment_method_nonce", paymentMethodNonce);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class CartInfoModel implements Serializable {
|
|||||||
|
|
||||||
private ArrayList<CartProductModel> products;
|
private ArrayList<CartProductModel> products;
|
||||||
private ArrayList<CartTotalModel> totals;
|
private ArrayList<CartTotalModel> totals;
|
||||||
private boolean isPizzaPromotionCampaignUsed;
|
private boolean isPizzaPassCampaignUsed;
|
||||||
|
|
||||||
public ArrayList<CartProductModel> getProducts() {
|
public ArrayList<CartProductModel> getProducts() {
|
||||||
return products;
|
return products;
|
||||||
@@ -62,11 +62,11 @@ public class CartInfoModel implements Serializable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPizzaPromotionCampaignUsed() {
|
public boolean isPizzaPassCampaignUsed() {
|
||||||
return isPizzaPromotionCampaignUsed;
|
return isPizzaPassCampaignUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPizzaPromotionCampaignUsed(boolean pizzaPromotionCampaignUsed) {
|
public void setPizzaPassCampaignUsed(boolean pizzaPassCampaignUsed) {
|
||||||
isPizzaPromotionCampaignUsed = pizzaPromotionCampaignUsed;
|
isPizzaPassCampaignUsed = pizzaPassCampaignUsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user