Manos Chorianopoulos

fix verifyTicketAsync

......@@ -159,6 +159,7 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError *
///////////////////////////////////////////////////////////////////////////////
+ (void)launchWithAppUUIDWithCallback:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushDelegate:(id <WLCustomPushHandler>)customPushDelegate serverBaseUrl:(NSString *)url andSuccessBlock:(void (^)(NSDictionary *))success andFailureBlock:(void (^)(NSError *error))failure
{
NSLog(@"=== _sharedService: %@", _sharedService );
//Launch Once
if (_sharedService != nil) {
// TODO: Maybe add failure callback here? - msg: "already launched"
......@@ -1907,13 +1908,17 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
WL_FMDBLogError
[_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken];
NSDictionary *successResponse = @{@"result": @"success", @"status":@1};
NSNumber* status = [NSNumber alloc];
status = [contextResponse objectForKey:@"result"];
NSString* result = @"";
result = [status isEqual: @1] ? @"success" : @"error";
NSDictionary *successResponse = @{@"result": result, @"status": status};
if (success) {
success(successResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", successResponse );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
......@@ -1945,12 +1950,16 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
[_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken];
NSDictionary *successResponse = @{@"result": @"success", @"status":@1};
NSNumber* status = [NSNumber alloc];
status = [contextResponse objectForKey:@"result"];
NSString* result = @"";
result = [status isEqual: @1] ? @"success" : @"error";
NSDictionary *successResponse = @{@"result": result, @"status": status};
if (success) {
success(successResponse);
}
NSLog(@"**************** WARPLY Response *****************" );
NSLog(@"%@", successResponse );
NSLog(@"%@", contextResponse );
} failureBlock:^(NSError *error) {
if (failure) {
failure(error);
......
......@@ -2456,16 +2456,26 @@ public class swiftApi {
if let verifyTicketDataDictionary = verifyTicketData as? [String: Any] {
let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
dynatraceEvent._eventName = "custom_success_login_loyalty"
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
let tempResponse = VerifyTicketResponseModel(dictionary: verifyTicketDataDictionary)
verifyTicketCallback(tempResponse);
swiftApi().getProfileAsync(getProfileCallback)
if (tempResponse.getStatus == 1) {
let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
dynatraceEvent._eventName = "custom_success_login_loyalty"
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
verifyTicketCallback(tempResponse);
swiftApi().getProfileAsync(getProfileCallback)
} else {
let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
dynatraceEvent._eventName = "custom_error_login_loyalty"
dynatraceEvent._parameters = nil
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
verifyTicketCallback(tempResponse);
}
} else {
let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
......