Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of External Referral Management command #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1,982 changes: 1,982 additions & 0 deletions ObjC_SDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0193573247267A600A00159"
BuildableName = "ObjC_SDK-Universal"
BlueprintName = "ObjC_SDK-Universal"
ReferencedContainer = "container:ObjC_SDK.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0193573247267A600A00159"
BuildableName = "ObjC_SDK-Universal"
BlueprintName = "ObjC_SDK-Universal"
ReferencedContainer = "container:ObjC_SDK.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Empty file added ObjC_SDK/BaseCodeSDK/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#import <Foundation/Foundation.h>

@interface HpsBaseTableServiceResponse : NSObject

@property (nonatomic,assign) NSArray *messageIDs;
@property (nonatomic,assign) NSString *responseCode;
@property (nonatomic,assign) NSString *responseText;
@property (nonatomic,assign) NSString *Class;
@property (nonatomic,assign) NSString *action;
-(id)initWithResponseDictionary:(NSDictionary *)response;
-(void)mapResponse;
//-(NSString *)normalizeResponse:(NSString *)responseCode;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#import "HpsBaseTableServiceResponse.h"

@implementation HpsBaseTableServiceResponse

-(id)initWithResponseDictionary:(NSDictionary *)response;
{
if (self = [super init]) {
if (response!=nil) {

_responseCode = [self normalizeResponse:response [@"code"]];
_responseText = response[@"codeMsg"];
_Class = response [@"class"];
_action = response[@"action"];
if (![_responseCode isEqualToString:@"00"]) {
@throw [NSException exceptionWithName:@"MessageException" reason:_responseText userInfo:nil];
}
if (response[@"data"]){
if (response[@"data"][@"row"]){
[self mapResponse];
}
}

}
}
return self;
}

-(NSString *)normalizeResponse:(NSString *)responseCode{
NSArray *acceptedCodes = @[@"01"];
if ([acceptedCodes containsObject:responseCode]) {
return @"00";
}
return responseCode;
}

-(void)mapResponse
{
[NSException raise:NSInternalInconsistencyException format:@"Method Not Implememnted %@ in %@",NSStringFromSelector(_cmd),NSStringFromClass([self class])];
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#import <Foundation/Foundation.h>

@interface HpsBumpStatusCollection : NSObject

@property NSMutableDictionary *bumpstatus;

-(id)initWithBumpStatusCollectoion:(NSString *)statusString;

@end
18 changes: 18 additions & 0 deletions ObjC_SDK/BaseCodeSDK/Entity/TableService/HpsBumpStatusCollection.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import "HpsBumpStatusCollection.h"

@implementation HpsBumpStatusCollection

-(id)initWithBumpStatusCollectoion:(NSString *)statusString{
if (self = [super init])
{
_bumpstatus = [[NSMutableDictionary alloc]init];
NSArray *array_status = [statusString componentsSeparatedByString:@","];
NSInteger index = 1;
for (NSString *status in array_status) {
[_bumpstatus setObject:[NSString stringWithFormat:@"%ld",(long)(index ++)] forKey:status];
}
}
return self;
}

@end
12 changes: 12 additions & 0 deletions ObjC_SDK/BaseCodeSDK/Entity/TableService/HpsLoginResponse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#import "HpsTableServiceResponse.h"

@interface HpsLoginResponse : HpsTableServiceResponse

@property NSString *locationId ;
@property NSString * token;
@property NSString *sessionId;
@property NSString *tableStatus;

-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary;

@end
17 changes: 17 additions & 0 deletions ObjC_SDK/BaseCodeSDK/Entity/TableService/HpsLoginResponse.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#import "HpsLoginResponse.h"

@implementation HpsLoginResponse

-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary{
if (self = [super initWithResponseDictionary:responseDictionary]) {
_locationId = responseDictionary[@"data"][@"row"][@"locID"];
_sessionId = responseDictionary[@"data"][@"row"][@"sessionID"];
_token = responseDictionary[@"data"][@"row"][@"token"];
_tableStatus = responseDictionary[@"data"][@"row"][@"tableStatus"];
}
self.expectedAction = @"login";

return self;
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#import "HpsTableServiceResponse.h"

@interface HpsServerAssignmentResponse : HpsTableServiceResponse

@property NSMutableDictionary *assignments;

-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#import "HpsServerAssignmentResponse.h"

@implementation HpsServerAssignmentResponse{
}
-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary{
if (self = [super initWithResponseDictionary:responseDictionary]) {
self.assignments = [[NSMutableDictionary alloc]init];
[self AddAssignments:responseDictionary[@"data"]];
}
self.expectedAction = @"getServerAssignment";

return self;
}

-(void)AddAssignments:(NSDictionary *)responseDictionary
{

[responseDictionary enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
if ([key isEqualToString:@"row"] && [obj isKindOfClass:[NSArray class]] ) {
NSLog(@"key = %@ Obj = %@",key,obj);
for (int i = 0; i < [(NSArray*)obj count]; i ++) {
NSDictionary *assignmentDetail = [obj objectAtIndex:i];
NSLog(@"Assignment Detail = %@",assignmentDetail);
NSString * tableString = assignmentDetail[@"tables"];
tableString = [tableString stringByReplacingOccurrencesOfString:@"[(\n)]"
withString:@""
options:NSRegularExpressionSearch
range:NSMakeRange(0, tableString.length)];
NSArray* arrayOfStrings = [tableString componentsSeparatedByString:@","];
NSMutableArray* arrayOfNumbers = [NSMutableArray arrayWithCapacity:arrayOfStrings.count];
for (NSString* string in arrayOfStrings) {
[arrayOfNumbers addObject:[NSDecimalNumber decimalNumberWithString:string]];
}
[self.assignments setObject:arrayOfNumbers forKey:assignmentDetail[@"server"]];
}
}else if([key isEqualToString:@"row"] && [obj isKindOfClass:[NSDictionary class]]){
NSLog(@"OBJECT = %@",obj);
if (![obj objectForKey:@"resultSet"] && ![obj objectForKey:@"success"])
[self.assignments setValue:obj[@"tables"] forKey:obj[@"server"]];
}

}];

NSLog(@"*** Assignments = %@",self.assignments);
}

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#import "HpsTableServiceResponse.h"

@interface HpsServerListResponse : HpsTableServiceResponse

@property NSArray *servers;

-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary;

@end
18 changes: 18 additions & 0 deletions ObjC_SDK/BaseCodeSDK/Entity/TableService/HpsServerListResponse.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#import "HpsServerListResponse.h"

@implementation HpsServerListResponse

-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary{
if (self = [super initWithResponseDictionary:responseDictionary]) {
_servers = [[NSArray alloc]init];
if (responseDictionary[@"data"][@"row"][@"serverList"]) {
NSString *servers = responseDictionary[@"data"][@"row"][@"serverList"];
_servers = [servers componentsSeparatedByString:@","];
}

}
self.expectedAction= @"getServerList";
return self;
}

@end
13 changes: 13 additions & 0 deletions ObjC_SDK/BaseCodeSDK/Entity/TableService/HpsTableServiceResponse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#import <Foundation/Foundation.h>
#import "HpsBaseTableServiceResponse.h"

@interface HpsTableServiceResponse : HpsBaseTableServiceResponse

@property (strong)NSString *expectedAction;
@property (strong)NSString *configName;

-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary;

-(void)sendRequestwithEndPoint:(NSString *)endPoint withMultiPartForm:(NSDictionary *)formData withCompletion:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock;

@end
41 changes: 41 additions & 0 deletions ObjC_SDK/BaseCodeSDK/Entity/TableService/HpsTableServiceResponse.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#import "HpsTableServiceResponse.h"
#import "HpsServiceContainer.h"

@interface HpsTableServiceResponse()
@end

@implementation HpsTableServiceResponse

-(id)initWithResponseDictionary:(NSDictionary *)responseDictionary{
if (self = [super initWithResponseDictionary:responseDictionary]){
_configName = @"default";
}

return self;
}

-(void)mapResponse{

if (!(_expectedAction == nil) && (![self.action isEqualToString:_expectedAction])) {
@throw [NSException exceptionWithName:@"HpsXMLParsingException" reason:[ NSString stringWithFormat:@"Unexpected message type received. = %@",self.action] userInfo:nil];
}
}

-(void)sendRequestwithEndPoint:(NSString *)endPoint withMultiPartForm:(NSDictionary *)formData withCompletion:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock
{
HpsServiceContainer *container = [HpsServiceContainer sharedInstance] ;
HpsTableServiceConnector *connector = [container GetTableServiceClient:_configName];

if (![connector Configured] && ![endPoint isEqualToString:@"/user/login"]) {
NSLog(@"configName = %@",_configName);
@throw [NSException exceptionWithName:@"TableService Configuration Exception" reason:[ NSString stringWithFormat:@"Reservation service has not been configured properly. Please ensure you have logged in first."] userInfo:nil];
}

[connector callWithEndPoint:endPoint withMultipartForm:formData withCompletion:^(NSDictionary *response_dic, NSError *error) {
HpsTableServiceResponse *response = [[HpsTableServiceResponse alloc]initWithResponseDictionary:response_dic];
responseBlock(response,error);
}];

}

@end
35 changes: 35 additions & 0 deletions ObjC_SDK/BaseCodeSDK/Entity/TableService/HpsTicket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#import <Foundation/Foundation.h>
#import "HpsTableServiceResponse.h"

@interface HpsTicket : HpsTableServiceResponse

@property (nonatomic,assign) NSInteger bumpStatusId ;
@property (nonatomic,assign) NSInteger checkId ;
@property (nonatomic,assign) NSDate *checkIntime ;
@property (nonatomic,assign) NSString *partyName ;
@property (nonatomic,assign) NSInteger partyNumber ;
@property (nonatomic,assign) NSString *section ;
@property (nonatomic,assign)NSInteger tableNumber ;
@property (nonatomic,assign) NSInteger waitTime ;

-(instancetype)initWithDictionary:(NSDictionary *)response_dictionary ;

+ (HpsTicket *) FromId:(NSInteger ) checkId withTableNumber:(NSInteger)tableNumber;

//OPEN ORDER
- (void) openOrderWithCompletion:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock;
//BUMP STAUS
-(void) bumpStatusWithStatus:(NSString *)bumpStatus withComplition:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock ;
- (void ) bumpStatusWithBumpStatusId :(NSInteger )bumpStatusId withComplition:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock;
//SETTLE CHECK
- (void) settleCheck:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock ;
- (void) settleCheckWithStatus:(NSString *)bumpStatus withCompletion:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock ;
- (void) settleCheckwithID:(NSInteger ) bumpStatusId withCompletion:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock;

//CLEAR TABLE
- (void) clearTableWithComplition:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock;
- (void) transferWithTableNumber:(NSInteger )newTableNumber withComplition:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock;

- (void) updateWithComplition:(void(^)(HpsTableServiceResponse *, NSError*))responseBlock;

@end
Loading