private static void HandleResult(string activityCode, Action <IPermissionResult> callback, GuestControllerResult <PermissionResponse> result) { if (!result.Success) { callback(MakeGenericFailure()); return; } PermissionResponse response = result.Response; if (response.error != null || response.data == null) { callback(GuestControllerErrorParser.GetPermissionResult(response.error) ?? MakeGenericFailure()); return; } ActivityApprovalStatus activityApprovalStatus = ActivityApprovalStatusConverter.Convert(response.data.approvalStatus); if (response.data.activityCode != activityCode || activityApprovalStatus == ActivityApprovalStatus.Unknown) { callback(MakeGenericFailure()); } else { callback(new PermissionResult(success: true, activityApprovalStatus)); } }
private static IPermissionResult ParseError(GuestControllerWebCallResponse response) { IPermissionResult permissionResult = GuestControllerErrorParser.GetPermissionResult(response.error); return(permissionResult ?? MakeGenericFailure()); }