kebappass campaign added

This commit is contained in:
2019-03-23 13:57:22 +03:00
parent 03ff6d458b
commit 7333c1e773
12 changed files with 37 additions and 37 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -95,7 +95,7 @@ public class CampaignProductDetailsActivity extends BaseActivity {
addProductToCart(); addProductToCart();
/* /*
if((campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_PIZZAPASS) && SessionHelper.isUserUsedPizzapassCampaign()) || if((campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_PIZZAPASS) && SessionHelper.isUserUsedPizzapassCampaign()) ||
(campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_CHAMPAGNE) && SessionHelper.isUserUsedChampagneCampaign())){ (campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_KEBAPPASS) && SessionHelper.isUserUsedKebappassCampaign())){
DialogHelper.showAlertDialog(BaseActivity.currentActivity, cannotUseCampaignText); DialogHelper.showAlertDialog(BaseActivity.currentActivity, cannotUseCampaignText);
} }
else { else {

View File

@@ -81,7 +81,7 @@ public class CampaignProductListActivity extends BaseActivity {
productPropertiesIntent.putExtra("menuProductModel", menuProductList.get(position)); productPropertiesIntent.putExtra("menuProductModel", menuProductList.get(position));
productPropertiesIntent.putExtra("campaignModel", campaignModel); productPropertiesIntent.putExtra("campaignModel", campaignModel);
//productPropertiesIntent.putExtra("isFromPizzapassCampaign", categoryModel.isPizzapassCampaign()); //productPropertiesIntent.putExtra("isFromPizzapassCampaign", categoryModel.isPizzapassCampaign());
//productPropertiesIntent.putExtra("isFromChampagneCampaign", categoryModel.isChampagneCampaign()); //productPropertiesIntent.putExtra("isFromKebappassCampaign", categoryModel.isKebappassCampaign());
startActivityForResult(productPropertiesIntent, REQUEST_CODE_CAMPAIGN_PRODUCT_PROPERTIES); startActivityForResult(productPropertiesIntent, REQUEST_CODE_CAMPAIGN_PRODUCT_PROPERTIES);
} }
}); });

View File

@@ -209,7 +209,7 @@ public class OrderHistoryDetailsActivity extends BaseActivity {
SharedPrefsHelper.setCartItemCount(0); SharedPrefsHelper.setCartItemCount(0);
SharedPrefsHelper.setCartTotalPrice("0"); SharedPrefsHelper.setCartTotalPrice("0");
SharedPrefsHelper.setUserUsedPizzapassCampaign(false); SharedPrefsHelper.setUserUsedPizzapassCampaign(false);
SharedPrefsHelper.setUserUsedChampagneCampaign(false); SharedPrefsHelper.setUserUsedKebappassCampaign(false);
MainActivity mainActivity = (MainActivity) BaseActivity.currentActivity; MainActivity mainActivity = (MainActivity) BaseActivity.currentActivity;
mainActivity.setCartItemCount(); mainActivity.setCartItemCount();
*/ */

View File

@@ -14,7 +14,7 @@ public class ApiConstants {
public static final int APP_ERROR_CODE_AUTHORIZATION = 1; public static final int APP_ERROR_CODE_AUTHORIZATION = 1;
public static final String CAMPAIGN_CODE_PIZZAPASS = "PIZZAPASS"; public static final String CAMPAIGN_CODE_PIZZAPASS = "PIZZAPASS";
public static final String CAMPAIGN_CODE_CHAMPAGNE = "CHAMPAGNE"; public static final String CAMPAIGN_CODE_KEBAPPASS = "KEBAPPASS";
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

View File

@@ -28,7 +28,7 @@ public class ApiEndPoints {
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_PIZZAPASS = PREFIX + "detectPizzaPassCampaign" + SUFFIX + "&token="; public static final String API_CHECK_CAMPAIGN_PIZZAPASS = PREFIX + "detectPizzaPassCampaign" + SUFFIX + "&token=";
public static final String API_CHECK_CAMPAIGN_CHAMPAGNE = PREFIX + "detectChampagneCampaign" + SUFFIX + "&token="; public static final String API_CHECK_CAMPAIGN_KEBAPPASS = PREFIX + "detectKebapPassCampaign" + 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;

View File

@@ -197,8 +197,8 @@ public interface ApiInterface {
Call<ResponseObject<CampaignModel>> checkPizzapassCampaign(@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_CAMPAIGN_CHAMPAGNE) @GET("{storeName}" + ApiEndPoints.API_CHECK_CAMPAIGN_KEBAPPASS)
Call<ResponseObject<CampaignModel>> checkChampagneCampaign(@Path("storeName") String storeName, Call<ResponseObject<CampaignModel>> checkKebapPassCampaign(@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)
@@ -361,8 +361,8 @@ public interface ApiInterface {
@GET(ApiEndPoints.API_CHECK_CAMPAIGN_PIZZAPASS) @GET(ApiEndPoints.API_CHECK_CAMPAIGN_PIZZAPASS)
Call<ResponseObject<CampaignModel>> checkPizzapassCampaign(@Query("token") String token); Call<ResponseObject<CampaignModel>> checkPizzapassCampaign(@Query("token") String token);
@GET(ApiEndPoints.API_CHECK_CAMPAIGN_CHAMPAGNE) @GET(ApiEndPoints.API_CHECK_CAMPAIGN_KEBAPPASS)
Call<ResponseObject<CampaignModel>> checkChampagneCampaign(@Query("token") String token); Call<ResponseObject<CampaignModel>> checkKebapPassCampaign(@Query("token") String token);
@GET(ApiEndPoints.API_CHECK_DELIVERY_TIME) @GET(ApiEndPoints.API_CHECK_DELIVERY_TIME)
Call<ResponseObject<Boolean>> checkDeliveryTime(); Call<ResponseObject<Boolean>> checkDeliveryTime();

View File

@@ -84,7 +84,7 @@ 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 pizzapassCampaignCategoryId = ""; private String pizzapassCampaignCategoryId = "";
private String champagneCampaignCategoryId = ""; private String kebappassCampaignCategoryId = "";
private CartInfoModel cartInfoModel; private CartInfoModel cartInfoModel;
private ArrayList<CartProductModel> cartProductList = new ArrayList<>(); private ArrayList<CartProductModel> cartProductList = new ArrayList<>();
@@ -149,8 +149,8 @@ public class CartFragment extends BaseFragment {
if(!pizzapassCampaignCategoryId.isEmpty()){ if(!pizzapassCampaignCategoryId.isEmpty()){
getCampaignProductsForPizzapassOnContinueButtonClicked(); getCampaignProductsForPizzapassOnContinueButtonClicked();
} }
else if(!champagneCampaignCategoryId.isEmpty()){ else if(!kebappassCampaignCategoryId.isEmpty()){
getCampaignProductsForChampagneOnContinueButtonClicked(); getCampaignProductsForKebappassOnContinueButtonClicked();
} }
else { else {
openCreateOrderActivity(); openCreateOrderActivity();
@@ -167,8 +167,8 @@ public class CartFragment extends BaseFragment {
if(!pizzapassCampaignCategoryId.isEmpty()){ if(!pizzapassCampaignCategoryId.isEmpty()){
getCampaignProductsForPizzapassOnContinueButtonClicked(); getCampaignProductsForPizzapassOnContinueButtonClicked();
} }
else if(!champagneCampaignCategoryId.isEmpty()){ else if(!kebappassCampaignCategoryId.isEmpty()){
getCampaignProductsForChampagneOnContinueButtonClicked(); getCampaignProductsForKebappassOnContinueButtonClicked();
} }
else { else {
openCreateOrderActivity(); openCreateOrderActivity();
@@ -494,7 +494,7 @@ public class CartFragment extends BaseFragment {
} }
} }
else { else {
checkChampagneCampaign(); checkKebappassCampaign();
} }
} }
@@ -530,17 +530,17 @@ public class CartFragment extends BaseFragment {
@Override @Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
DialogHelper.showLoadingDialog(); DialogHelper.showLoadingDialog();
checkChampagneCampaign(); checkKebappassCampaign();
} }
}, },
false false
); );
} }
private void checkChampagneCampaign(){ private void checkKebappassCampaign(){
ApiService ApiService
.apiInterface .apiInterface
.checkChampagneCampaign( .checkKebapPassCampaign(
SessionHelper.getSelectedStore().getStoreName(), SessionHelper.getSelectedStore().getStoreName(),
SessionHelper.getCustomerToken().getToken()) SessionHelper.getCustomerToken().getToken())
.enqueue(new Callback<ResponseObject<CampaignModel>>() { .enqueue(new Callback<ResponseObject<CampaignModel>>() {
@@ -557,19 +557,19 @@ public class CartFragment extends BaseFragment {
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText); DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
} }
else { else {
champagneCampaignCategoryId = response.body().getData().getCategoryId(); kebappassCampaignCategoryId = response.body().getData().getCategoryId();
getCampaignProducts(response.body().getData(), false); getCampaignProducts(response.body().getData(), false);
} }
} }
/* /*
if(response.body().isSuccess() && !SessionHelper.isUserUsedChampagneCampaign()){ if(response.body().isSuccess() && !SessionHelper.isUserUsedKebappassCampaign()){
if(response.body().getData() == null){ if(response.body().getData() == null){
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText); DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
} }
else { else {
response.body().getData().checkNull(); response.body().getData().checkNull();
showChampagneCampaignDialog(response.body().getData()); showKebappassCampaignDialog(response.body().getData());
} }
} }
*/ */
@@ -588,7 +588,7 @@ public class CartFragment extends BaseFragment {
}); });
} }
private void showChampagneCampaignDialog(final CampaignModel campaignModel){ private void showKebappassCampaignDialog(final CampaignModel campaignModel){
DialogHelper.showTwoButtonsDialog( DialogHelper.showTwoButtonsDialog(
campaignModel.getName(), campaignModel.getName(),
campaignModel.getDescription(), campaignModel.getDescription(),
@@ -626,7 +626,7 @@ public class CartFragment extends BaseFragment {
if(isBasketContainsCampaignProduct(response.body().getData())){ if(isBasketContainsCampaignProduct(response.body().getData())){
if(isForPizzapass){ if(isForPizzapass){
checkChampagneCampaign(); checkKebappassCampaign();
} }
else { else {
DialogHelper.hideLoadingDialog(); DialogHelper.hideLoadingDialog();
@@ -638,7 +638,7 @@ public class CartFragment extends BaseFragment {
showPizzapassCampaignDialog(campaignModel); showPizzapassCampaignDialog(campaignModel);
} }
else { else {
showChampagneCampaignDialog(campaignModel); showKebappassCampaignDialog(campaignModel);
} }
} }
} }
@@ -672,8 +672,8 @@ public class CartFragment extends BaseFragment {
response.body().isSuccess()) { response.body().isSuccess()) {
cartInfoModel.setPizzapassCampaignUsed(isBasketContainsCampaignProduct(response.body().getData())); cartInfoModel.setPizzapassCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
if(!champagneCampaignCategoryId.isEmpty()){ if(!kebappassCampaignCategoryId.isEmpty()){
getCampaignProductsForChampagneOnContinueButtonClicked(); getCampaignProductsForKebappassOnContinueButtonClicked();
} }
else { else {
DialogHelper.hideLoadingDialog(); DialogHelper.hideLoadingDialog();
@@ -694,13 +694,13 @@ public class CartFragment extends BaseFragment {
}); });
} }
private void getCampaignProductsForChampagneOnContinueButtonClicked(){ private void getCampaignProductsForKebappassOnContinueButtonClicked(){
DialogHelper.showLoadingDialog(); DialogHelper.showLoadingDialog();
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory( Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
SessionHelper.getSelectedStore().getStoreName(), SessionHelper.getSelectedStore().getStoreName(),
champagneCampaignCategoryId); kebappassCampaignCategoryId);
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) {
@@ -710,7 +710,7 @@ public class CartFragment extends BaseFragment {
if(response.isSuccessful() && if(response.isSuccessful() &&
response.body().getData() != null && response.body().getData() != null &&
response.body().isSuccess()) { response.body().isSuccess()) {
cartInfoModel.setChampagneCampaignUsed(isBasketContainsCampaignProduct(response.body().getData())); cartInfoModel.setKebappassCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
openCreateOrderActivity(); openCreateOrderActivity();
} }
else { else {

View File

@@ -170,7 +170,7 @@ public class OrderHistoryFragment extends BaseFragment {
SharedPrefsHelper.setCartItemCount(0); SharedPrefsHelper.setCartItemCount(0);
SharedPrefsHelper.setCartTotalPrice("0"); SharedPrefsHelper.setCartTotalPrice("0");
SharedPrefsHelper.setUserUsedPizzapassCampaign(false); SharedPrefsHelper.setUserUsedPizzapassCampaign(false);
SharedPrefsHelper.setUserUsedChampagneCampaign(false); SharedPrefsHelper.setUserUsedKebappassCampaign(false);
MainActivity mainActivity = (MainActivity) BaseActivity.currentActivity; MainActivity mainActivity = (MainActivity) BaseActivity.currentActivity;
mainActivity.setCartItemCount(); mainActivity.setCartItemCount();
*/ */

View File

@@ -201,7 +201,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
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_pass_campaign", createOrderActivity.getCartInfo().isPizzapassCampaignUsed()); params.put("is_pizza_pass_campaign", createOrderActivity.getCartInfo().isPizzapassCampaignUsed());
params.put("is_champagne_campaign", createOrderActivity.getCartInfo().isChampagneCampaignUsed()); params.put("is_kebap_pass_campaign", createOrderActivity.getCartInfo().isKebappassCampaignUsed());
params.put("application_id", ApiConstants.APP_TYPE_ID_ANDROID); params.put("application_id", ApiConstants.APP_TYPE_ID_ANDROID);
if(SessionHelper.getSelectedCoupon() != null){ if(SessionHelper.getSelectedCoupon() != null){
params.put("coupon", SessionHelper.getSelectedCoupon().getCode()); params.put("coupon", SessionHelper.getSelectedCoupon().getCode());
@@ -561,7 +561,7 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
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_pass_campaign", createOrderActivity.getCartInfo().isPizzapassCampaignUsed()); params.put("is_pizza_pass_campaign", createOrderActivity.getCartInfo().isPizzapassCampaignUsed());
params.put("is_champagne_campaign", createOrderActivity.getCartInfo().isChampagneCampaignUsed()); params.put("is_kebap_pass_campaign", createOrderActivity.getCartInfo().isKebappassCampaignUsed());
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);

View File

@@ -14,7 +14,7 @@ public class CartInfoModel implements Serializable {
private ArrayList<CartProductModel> products; private ArrayList<CartProductModel> products;
private ArrayList<CartTotalModel> totals; private ArrayList<CartTotalModel> totals;
private boolean isPizzapassCampaignUsed; private boolean isPizzapassCampaignUsed;
private boolean isChampagneCampaignUsed; private boolean isKebappassCampaignUsed;
public ArrayList<CartProductModel> getProducts() { public ArrayList<CartProductModel> getProducts() {
return products; return products;
@@ -71,11 +71,11 @@ public class CartInfoModel implements Serializable {
isPizzapassCampaignUsed = pizzapassCampaignUsed; isPizzapassCampaignUsed = pizzapassCampaignUsed;
} }
public boolean isChampagneCampaignUsed() { public boolean isKebappassCampaignUsed() {
return isChampagneCampaignUsed; return isKebappassCampaignUsed;
} }
public void setChampagneCampaignUsed(boolean champagneCampaignUsed) { public void setKebappassCampaignUsed(boolean kebappassCampaignUsed) {
isChampagneCampaignUsed = champagneCampaignUsed; isKebappassCampaignUsed = kebappassCampaignUsed;
} }
} }