Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
Kush223 committed Jun 14, 2021
1 parent bdd01f1 commit feae62e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "com.barbera.barberaconsumerapp"
minSdkVersion 23
targetSdkVersion 29
versionCode 15
versionName "2.6.19"
versionCode 17
versionName "2.7.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
18 changes: 13 additions & 5 deletions app/src/main/java/com/barbera/barberaconsumerapp/BookingPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,10 @@ public void onComplete(@NonNull Task<DocumentSnapshot> task) {
.collection("EligibleCustomers")
.document(FirebaseAuth.getInstance().getCurrentUser().getUid()).get()
.addOnCompleteListener(task1 -> {
if (task1.getResult().get("couponCode").toString().equals(couponcodeEditText.getText().toString().trim())){
if (task1.getResult().contains("couponCode") && task1.getResult().get("couponCode").toString().equals(couponcodeEditText.getText().toString().trim()) && BookingTotalAmount>300){
if(task1.getResult().get("used").toString().equals("N")) {
BookingTotalAmount = (BookingTotalAmount > 100 ? BookingTotalAmount - 50 : BookingTotalAmount / 2);

BookingTotalAmount = (BookingTotalAmount > 300 ? BookingTotalAmount - 50 : BookingTotalAmount);
totalAmount.setText("Total Amount Rs" + BookingTotalAmount + "(Coupon Applied)");
isReferApplied =true;
isCouponApplied = true;
Expand All @@ -974,12 +975,19 @@ public void onComplete(@NonNull Task<DocumentSnapshot> task) {
couponApply.setEnabled(false);
Toast.makeText(getApplicationContext(), "Coupon Applied Successfully.", Toast.LENGTH_LONG).show();
}else{
couponcodeEditText.setError("Already Used");
if(BookingTotalAmount<300)
couponcodeEditText.setError("Amount Must be above Rs.300");
else {
couponcodeEditText.setError("No Such Coupons Exist");

}
couponcodeEditText.requestFocus();
}
} else {
couponcodeEditText.setError("No Such Coupons Exist");
couponcodeEditText.requestFocus();
if(BookingTotalAmount<300) {
couponcodeEditText.setError("Booking amount should be greater than 300");
couponcodeEditText.requestFocus();
}
}

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void AddUserToReferAndEarn() {
Map<String, Object> map = new HashMap<>();
String coupon = "BARBERA"+(int)(Math.random()*1000);
map.put("couponCode",coupon);
map.put("description","10% off on bookings upto Rs.200");
map.put("description","Rs.50 off on booking amount above 300");
map.put("used","N");
FirebaseFirestore.getInstance().collection("AppData").document("Earn&Refer").collection("EligibleCustomers")
.document(FirebaseAuth.getInstance().getCurrentUser().getUid()).set(map).addOnCompleteListener(task -> {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_congratulations_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorAccent"
android:text="We Will Sent an Email Confirmation Soon"
android:text="We will send an Email Confirmation soon"
android:layout_centerHorizontal="true"
android:textSize="20sp"
android:layout_marginTop="30sp"/>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_rating.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/logo"
android:src="@drawable/log"
android:layout_centerHorizontal="true"
android:layout_margin="50dp"/>

Expand Down

0 comments on commit feae62e

Please sign in to comment.