Manos Chorianopoulos

add getMultilingualMerchantsAsync, MerchantModel

...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
97 - (void)getCampaignsAsyncNew:(NSString*)language :(NSDictionary*)filters :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure; 97 - (void)getCampaignsAsyncNew:(NSString*)language :(NSDictionary*)filters :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure;
98 - (void)getCampaignsPersonalizedAsync:(NSString*)language :(NSDictionary*)filters :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure; 98 - (void)getCampaignsPersonalizedAsync:(NSString*)language :(NSDictionary*)filters :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure;
99 - (void)getSharingHistoryAsync:(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure; 99 - (void)getSharingHistoryAsync:(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure;
100 +- (void)getMultilingualMerchantsAsync:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance parent_uuids:(NSArray*)parent_uuids :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure;
100 101
101 @end 102 @end
102 #endif /* MyApi_h */ 103 #endif /* MyApi_h */
......
...@@ -1216,32 +1216,32 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; ...@@ -1216,32 +1216,32 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
1216 return resp; 1216 return resp;
1217 } 1217 }
1218 1218
1219 -- (NSDictionary*)retrieveMultilingualMerchantsWithCategories:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance { 1219 +// - (NSDictionary*)retrieveMultilingualMerchantsWithCategories:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance {
1220 - __block NSDictionary *resp = [NSDictionary alloc]; 1220 +// __block NSDictionary *resp = [NSDictionary alloc];
1221 - __block BOOL isRunLoopNested = NO; 1221 +// __block BOOL isRunLoopNested = NO;
1222 - __block BOOL isOperationCompleted = NO; 1222 +// __block BOOL isOperationCompleted = NO;
1223 - [[Warply sharedService] retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:categories andDefaultShown:defaultShown andCenter:center andTags:tags andUuid:uuid andDistance:distance :^(NSDictionary *response) { 1223 +// [[Warply sharedService] retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:categories andDefaultShown:defaultShown andCenter:center andTags:tags andUuid:uuid andDistance:distance :^(NSDictionary *response) {
1224 - resp = response; 1224 +// resp = response;
1225 - isOperationCompleted = YES; 1225 +// isOperationCompleted = YES;
1226 - if (isRunLoopNested) { 1226 +// if (isRunLoopNested) {
1227 - CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns 1227 +// CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
1228 - } 1228 +// }
1229 - } failureBlock:^(NSError *error) { 1229 +// } failureBlock:^(NSError *error) {
1230 - NSLog(@"%@", error); 1230 +// NSLog(@"%@", error);
1231 - resp = nil; 1231 +// resp = nil;
1232 - isOperationCompleted = YES; 1232 +// isOperationCompleted = YES;
1233 - if (isRunLoopNested) { 1233 +// if (isRunLoopNested) {
1234 - CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns 1234 +// CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
1235 - } 1235 +// }
1236 - }]; 1236 +// }];
1237 - if ( ! isOperationCompleted) { 1237 +// if ( ! isOperationCompleted) {
1238 - isRunLoopNested = YES; 1238 +// isRunLoopNested = YES;
1239 - NSLog(@"Waiting..."); 1239 +// NSLog(@"Waiting...");
1240 - CFRunLoopRun(); // Magic! 1240 +// CFRunLoopRun(); // Magic!
1241 - isRunLoopNested = NO; 1241 +// isRunLoopNested = NO;
1242 - } 1242 +// }
1243 - return resp; 1243 +// return resp;
1244 -} 1244 +// }
1245 1245
1246 - (NSDictionary*)getCouponSetsWithActive:(NSNumber*)active andVisible:(NSNumber*)visible andUuids:(NSArray*)uuids { 1246 - (NSDictionary*)getCouponSetsWithActive:(NSNumber*)active andVisible:(NSNumber*)visible andUuids:(NSArray*)uuids {
1247 __block NSDictionary *resp = [NSDictionary alloc]; 1247 __block NSDictionary *resp = [NSDictionary alloc];
...@@ -1578,4 +1578,17 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; ...@@ -1578,4 +1578,17 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
1578 }]; 1578 }];
1579 } 1579 }
1580 1580
1581 +- (void)getMultilingualMerchantsAsync:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance parent_uuids:(NSArray*)parent_uuids :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure {
1582 +
1583 + [[Warply sharedService] retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:categories andDefaultShown:defaultShown andCenter:center andTags:tags andUuid:uuid andDistance:distance parent_uuids:parent_uuids :^(NSDictionary *response) {
1584 + if (success) {
1585 + success(response);
1586 + }
1587 + } failureBlock:^(NSError *error) {
1588 + if (failure) {
1589 + failure(error);
1590 + }
1591 + }];
1592 +}
1593 +
1581 @end 1594 @end
......
...@@ -383,7 +383,7 @@ WL_VERSION_INTERFACE() ...@@ -383,7 +383,7 @@ WL_VERSION_INTERFACE()
383 383
384 - (void)resetPasswordWithPasswordWithSuccessBlock:(NSString*)password andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid andConfToken:(NSString*)confToken :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; 384 - (void)resetPasswordWithPasswordWithSuccessBlock:(NSString*)password andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid andConfToken:(NSString*)confToken :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
385 385
386 -- (void)retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; 386 +- (void)retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance parent_uuids:(NSArray*)parent_uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
387 387
388 - (void) getCouponSetsWithSuccessBlock:(NSNumber*) active andVisible:(NSNumber*) visible andUuids:(NSArray*) uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; 388 - (void) getCouponSetsWithSuccessBlock:(NSNumber*) active andVisible:(NSNumber*) visible andUuids:(NSArray*) uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
389 389
......
...@@ -2045,7 +2045,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2045,7 +2045,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2045 }]; 2045 }];
2046 } 2046 }
2047 2047
2048 -- (void)retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure 2048 +- (void)retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance parent_uuids:(NSArray*)parent_uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure
2049 { 2049 {
2050 NSString* appUuid = [NSString alloc]; 2050 NSString* appUuid = [NSString alloc];
2051 appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; 2051 appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
...@@ -2060,7 +2060,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2060,7 +2060,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2060 } else { 2060 } else {
2061 [data setValue:[NSNull null] forKey:@"default_shown"]; 2061 [data setValue:[NSNull null] forKey:@"default_shown"];
2062 } 2062 }
2063 - if (tags) { 2063 + if (tags && ![tags isEqual:@[]]) {
2064 [data setValue:tags forKey:@"tags"]; 2064 [data setValue:tags forKey:@"tags"];
2065 } else { 2065 } else {
2066 [data setValue:[NSNull null] forKey:@"tags"]; 2066 [data setValue:[NSNull null] forKey:@"tags"];
...@@ -2068,7 +2068,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2068,7 +2068,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2068 if (uuid && ![uuid isEqual:@""]) { 2068 if (uuid && ![uuid isEqual:@""]) {
2069 [data setValue:uuid forKey:@"uuid"]; 2069 [data setValue:uuid forKey:@"uuid"];
2070 } 2070 }
2071 - if (distance != 0 && center) { 2071 + if (distance && ![distance isEqual:@0] && center) {
2072 NSMutableDictionary* dataLocation = [[NSMutableDictionary alloc] init]; 2072 NSMutableDictionary* dataLocation = [[NSMutableDictionary alloc] init];
2073 [dataLocation setValue:distance forKey:@"distance"]; 2073 [dataLocation setValue:distance forKey:@"distance"];
2074 [dataLocation setValue:center forKey:@"center"]; 2074 [dataLocation setValue:center forKey:@"center"];
...@@ -2078,7 +2078,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2078,7 +2078,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2078 } else { 2078 } else {
2079 [data setValue:[NSNull null] forKey:@"location"]; 2079 [data setValue:[NSNull null] forKey:@"location"];
2080 } 2080 }
2081 - 2081 + if (parent_uuids && ![parent_uuids isEqual:@[]]) {
2082 + [data setValue:parent_uuids forKey:@"parent_uuids"];
2083 + } else {
2084 + [data setValue:[NSNull null] forKey:@"parent_uuids"];
2085 + }
2082 2086
2083 NSMutableDictionary* dataShops = [[NSMutableDictionary alloc] init]; 2087 NSMutableDictionary* dataShops = [[NSMutableDictionary alloc] init];
2084 [dataShops setValue:data forKey:@"shops"]; 2088 [dataShops setValue:data forKey:@"shops"];
...@@ -2087,6 +2091,8 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) ...@@ -2087,6 +2091,8 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
2087 if (success) { 2091 if (success) {
2088 success(contextResponse); 2092 success(contextResponse);
2089 } 2093 }
2094 + NSLog(@"**************** WARPLY Response *****************" );
2095 + NSLog(@"%@", contextResponse );
2090 } failureBlock:^(NSError *error) { 2096 } failureBlock:^(NSError *error) {
2091 if (failure) { 2097 if (failure) {
2092 failure(error); 2098 failure(error);
......