// // CashCoupon.m // FirstLink // // Created by ascii on 15/6/19. // Copyright (c) 2015年 FirstLink. All rights reserved. // #import "CashCouponItem.h" #import "FKSubmitUnitItem.h" @implementation CashCouponItem + (NSDictionary *)mts_mapping { return @{ @"id": mts_key(itemID), @"from_user_id": mts_key(fromUserID), @"code": mts_key(code), @"type": mts_key(type), @"description": mts_key(desc), @"time_description": mts_key(timeDesc), @"amount": mts_key(amount), @"min_use_amount": mts_key(minUseAmount), @"min_use_amount_type": mts_key(minUseAmountType), @"expiry_date": mts_key(expiryDate), @"start_date": mts_key(startDate), @"status": mts_key(status), @"create_time": mts_key(createTime), @"supplier_id": mts_key(supplierId), }; } + (BOOL)mts_shouldSetUndefinedKeys { return NO; } - (BOOL)isValidForUnitItem:(FKSubmitUnitItem *)unitItem{ if ([FLStringHelper isValidString:self.supplierId]) { if (![unitItem.supplierID isEqualToString:self.supplierId]) return NO; } if ([FLStringHelper isValidString:self.minUseAmount]) { CGFloat minUse = [FLStringHelper convertFenStringToYuanValue:self.minUseAmount]; if ([self.minUseAmountType isEqualToString:@"1"]) { if ([unitItem getProductTotalCount] < minUse) return NO; } else if ([self.minUseAmountType isEqualToString:@"2"]) { if ([unitItem getTotalInternationalPostage] < minUse) return NO; } } return YES; } @end