Manos Chorianopoulos

add getMultilingualMerchantsAsync, MerchantModel

......@@ -97,6 +97,7 @@
- (void)getCampaignsAsyncNew:(NSString*)language :(NSDictionary*)filters :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure;
- (void)getCampaignsPersonalizedAsync:(NSString*)language :(NSDictionary*)filters :(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure;
- (void)getSharingHistoryAsync:(void (^)(NSDictionary *response))success failureBlock:(void (^)(NSError *error))failure;
- (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;
@end
#endif /* MyApi_h */
......
......@@ -1216,32 +1216,32 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
return resp;
}
- (NSDictionary*)retrieveMultilingualMerchantsWithCategories:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance {
__block NSDictionary *resp = [NSDictionary alloc];
__block BOOL isRunLoopNested = NO;
__block BOOL isOperationCompleted = NO;
[[Warply sharedService] retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:categories andDefaultShown:defaultShown andCenter:center andTags:tags andUuid:uuid andDistance:distance :^(NSDictionary *response) {
resp = response;
isOperationCompleted = YES;
if (isRunLoopNested) {
CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
}
} failureBlock:^(NSError *error) {
NSLog(@"%@", error);
resp = nil;
isOperationCompleted = YES;
if (isRunLoopNested) {
CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
}
}];
if ( ! isOperationCompleted) {
isRunLoopNested = YES;
NSLog(@"Waiting...");
CFRunLoopRun(); // Magic!
isRunLoopNested = NO;
}
return resp;
}
// - (NSDictionary*)retrieveMultilingualMerchantsWithCategories:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance {
// __block NSDictionary *resp = [NSDictionary alloc];
// __block BOOL isRunLoopNested = NO;
// __block BOOL isOperationCompleted = NO;
// [[Warply sharedService] retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:categories andDefaultShown:defaultShown andCenter:center andTags:tags andUuid:uuid andDistance:distance :^(NSDictionary *response) {
// resp = response;
// isOperationCompleted = YES;
// if (isRunLoopNested) {
// CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
// }
// } failureBlock:^(NSError *error) {
// NSLog(@"%@", error);
// resp = nil;
// isOperationCompleted = YES;
// if (isRunLoopNested) {
// CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
// }
// }];
// if ( ! isOperationCompleted) {
// isRunLoopNested = YES;
// NSLog(@"Waiting...");
// CFRunLoopRun(); // Magic!
// isRunLoopNested = NO;
// }
// return resp;
// }
- (NSDictionary*)getCouponSetsWithActive:(NSNumber*)active andVisible:(NSNumber*)visible andUuids:(NSArray*)uuids {
__block NSDictionary *resp = [NSDictionary alloc];
......@@ -1578,4 +1578,17 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}];
}
- (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 {
[[Warply sharedService] retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:categories andDefaultShown:defaultShown andCenter:center andTags:tags andUuid:uuid andDistance:distance parent_uuids:parent_uuids :^(NSDictionary *response) {
if (success) {
success(response);
}
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
}
}];
}
@end
......
......@@ -383,7 +383,7 @@ WL_VERSION_INTERFACE()
- (void)resetPasswordWithPasswordWithSuccessBlock:(NSString*)password andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid andConfToken:(NSString*)confToken :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (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;
- (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;
- (void) getCouponSetsWithSuccessBlock:(NSNumber*) active andVisible:(NSNumber*) visible andUuids:(NSArray*) uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
......
......@@ -2045,7 +2045,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
}];
}
- (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
- (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
{
NSString* appUuid = [NSString alloc];
appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
......@@ -2060,7 +2060,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
} else {
[data setValue:[NSNull null] forKey:@"default_shown"];
}
if (tags) {
if (tags && ![tags isEqual:@[]]) {
[data setValue:tags forKey:@"tags"];
} else {
[data setValue:[NSNull null] forKey:@"tags"];
......@@ -2068,7 +2068,7 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
if (uuid && ![uuid isEqual:@""]) {
[data setValue:uuid forKey:@"uuid"];
}
if (distance != 0 && center) {
if (distance && ![distance isEqual:@0] && center) {
NSMutableDictionary* dataLocation = [[NSMutableDictionary alloc] init];
[dataLocation setValue:distance forKey:@"distance"];
[dataLocation setValue:center forKey:@"center"];
......@@ -2078,7 +2078,11 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
} else {
[data setValue:[NSNull null] forKey:@"location"];
}
if (parent_uuids && ![parent_uuids isEqual:@[]]) {
[data setValue:parent_uuids forKey:@"parent_uuids"];
} else {
[data setValue:[NSNull null] forKey:@"parent_uuids"];
}
NSMutableDictionary* dataShops = [[NSMutableDictionary alloc] init];
[dataShops setValue:data forKey:@"shops"];
......@@ -2087,6 +2091,8 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
if (success) {
success(contextResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
......