diff --git a/Bento.xcworkspace/xcuserdata/JosephLauSF.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Bento.xcworkspace/xcuserdata/JosephLauSF.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index 221ea8bd..8cb4a940 100755
--- a/Bento.xcworkspace/xcuserdata/JosephLauSF.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/Bento.xcworkspace/xcuserdata/JosephLauSF.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -466,12 +466,12 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Bento/ViewController/Order/CompleteOrderViewController.m"
- timestampString = "477612402.140892"
+ timestampString = "477617380.66686"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "159"
- endingLineNumber = "159"
- landmarkName = "-viewDidLoad"
+ startingLineNumber = "1882"
+ endingLineNumber = "1882"
+ landmarkName = "-buildRequest:"
landmarkType = "5">
diff --git a/Bento/Base.lproj/Main.storyboard b/Bento/Base.lproj/Main.storyboard
index f9f3598f..155b655d 100755
--- a/Bento/Base.lproj/Main.storyboard
+++ b/Bento/Base.lproj/Main.storyboard
@@ -1436,13 +1436,6 @@
-
@@ -1530,12 +1523,19 @@
+
diff --git a/Bento/ViewController/Order/CompleteOrderViewController.m b/Bento/ViewController/Order/CompleteOrderViewController.m
index 40b17f98..90e926ad 100755
--- a/Bento/ViewController/Order/CompleteOrderViewController.m
+++ b/Bento/ViewController/Order/CompleteOrderViewController.m
@@ -154,9 +154,6 @@ - (BOOL)applePayEnabled
- (void)viewDidLoad {
[super viewDidLoad];
- NSDictionary *userInfo = [[DataManager shareDataManager] getUserInfo];
- NSLog(@"user info - %i", [userInfo[@"has_oa_subscription"] boolValue]);
-
allowCommitOnKeep = YES;
// Mixpanel track for Placed An Order
@@ -673,6 +670,15 @@ - (void)updatePromoView
#pragma mark Calculations
+- (BOOL)isSubscribedToOA {
+ NSDictionary *userInfo = [[DataManager shareDataManager] getUserInfo];
+ if (userInfo[@"has_oa_subscription"] == nil) {
+ return NO;
+ }
+
+ return [userInfo[@"has_oa_subscription"] boolValue];
+}
+
// works for x.xxxxxxxx
- (float)roundToNearestHundredth:(float)originalNumber {
originalNumber += 0.005;
@@ -707,6 +713,12 @@ - (float)getTotalPriceByMainPlusDeliveryFee {
return [self getTotalPriceByMain] + [[BentoShop sharedInstance] getDeliveryPrice];
}
+ // OA
+
+ if ([self isSubscribedToOA]) {
+ return [self getTotalPriceByMain] + 0;
+ }
+
return [self getTotalPriceByMain] + [self.orderAheadMenu.deliveryPrice floatValue];
}
@@ -773,7 +785,12 @@ - (void)updatePriceLabels
self.lblDeliveryPrice.text = [NSString stringWithFormat:@"$%.2f", [[BentoShop sharedInstance] getDeliveryPrice]];
}
else if (self.orderMode == OrderAhead) {
- self.lblDeliveryPrice.text = [NSString stringWithFormat:@"$%.2f", [self.orderAheadMenu.deliveryPrice floatValue]];
+ if ([self isSubscribedToOA]) {
+ self.lblDeliveryPrice.text = @"$0";
+ }
+ else {
+ self.lblDeliveryPrice.text = [NSString stringWithFormat:@"$%.2f", [self.orderAheadMenu.deliveryPrice floatValue]];
+ }
}
// if no promo added
@@ -838,6 +855,23 @@ - (void)updateUI
}
[self.btnGetItNow setTitle:strTitle forState:UIControlStateNormal];
+
+ // subscribed
+ if (self.orderMode == OrderAhead) {
+ if (self.orderAheadMenu.deliveryPrice != nil) {
+ NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"$%.2f", [self.orderAheadMenu.deliveryPrice floatValue]]];
+
+ [titleString addAttribute:NSStrikethroughStyleAttributeName
+ value:[NSNumber numberWithInteger:NSUnderlineStyleSingle]
+ range:NSMakeRange(0, [titleString length])];
+
+ self.lblDeliveryPricePrevious.attributedText = titleString;
+ }
+
+ if ([self isSubscribedToOA]) {
+ self.lblDeliveryPricePrevious.hidden = NO;
+ }
+ }
}
- (void)clearCart {
@@ -1788,7 +1822,14 @@ - (NSDictionary *)buildRequest:(NSString *)stripeToken
[detailInfo setObject:[NSString stringWithFormat:@"%.2f", [[BentoShop sharedInstance] getDeliveryPrice]] forKey:@"delivery_price"];
}
else if (self.orderMode == OrderAhead) {
- [detailInfo setObject:[NSString stringWithFormat:@"%.2f", [self.orderAheadMenu.deliveryPrice floatValue]] forKey:@"delivery_price"];
+
+ if ([self isSubscribedToOA]) {
+ [detailInfo setObject:@"0" forKey:@"delivery_price"];
+ }
+ else {
+ [detailInfo setObject:[NSString stringWithFormat:@"%.2f", [self.orderAheadMenu.deliveryPrice floatValue]] forKey:@"delivery_price"];
+ }
+
}
[request setObject:detailInfo forKey:@"OrderDetails"];