Showing
5 changed files
with
104 additions
and
0 deletions
| ... | @@ -89,6 +89,7 @@ | ... | @@ -89,6 +89,7 @@ |
| 89 | - (void)getCosmoteUserAsync:(NSString*)guid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 89 | - (void)getCosmoteUserAsync:(NSString*)guid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 90 | - (void)cosmoteCouponSharingAsync:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 90 | - (void)cosmoteCouponSharingAsync:(NSString*) coupon :(NSString*)sender :(NSString*)receiver :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 91 | - (void)submitOrderAsync:(NSString*) campaign_session_uuid :(NSString*)user_msisdn :(NSString*)businessService :(NSString*)offerName :(NSString*)productType :(NSString*)provDuration :(NSString*)noOfRecurrance :(NSString*)price :(NSString*)discount :(NSString*)voiceCategory :(NSString*)dataCategory :(NSString*)minsValue :(NSString*)dataValue :(NSString*)provStepValueMins :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 91 | - (void)submitOrderAsync:(NSString*) campaign_session_uuid :(NSString*)user_msisdn :(NSString*)businessService :(NSString*)offerName :(NSString*)productType :(NSString*)provDuration :(NSString*)noOfRecurrance :(NSString*)price :(NSString*)discount :(NSString*)voiceCategory :(NSString*)dataCategory :(NSString*)minsValue :(NSString*)dataValue :(NSString*)provStepValueMins :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 92 | +- (void)postEventAsync:(NSString*)Session_ID :(NSString*)OfferAudienceLevel :(NSString*)msisdn :(NSString*)UACIOfferTrackingCode :(NSString*)OFFERCODE1 :(NSString*)SCORE :(NSString*)ZONE :(NSString*)WAVE :(NSString*)VALIDITY :(NSString*)TREATMENT_CODE :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ||
| 92 | 93 | ||
| 93 | @end | 94 | @end |
| 94 | #endif /* MyApi_h */ | 95 | #endif /* MyApi_h */ | ... | ... |
| ... | @@ -1457,4 +1457,15 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -1457,4 +1457,15 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
| 1457 | }]; | 1457 | }]; |
| 1458 | } | 1458 | } |
| 1459 | 1459 | ||
| 1460 | +- (void)postEventAsync:(NSString*)Session_ID :(NSString*)OfferAudienceLevel :(NSString*)msisdn :(NSString*)UACIOfferTrackingCode :(NSString*)OFFERCODE1 :(NSString*)SCORE :(NSString*)ZONE :(NSString*)WAVE :(NSString*)VALIDITY :(NSString*)TREATMENT_CODE :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | ||
| 1461 | +{ | ||
| 1462 | + [[Warply sharedService] postEventWithSuccessBlock:Session_ID :OfferAudienceLevel :msisdn :UACIOfferTrackingCode :OFFERCODE1 :SCORE :ZONE :WAVE :VALIDITY :TREATMENT_CODE :^(NSDictionary *response) { | ||
| 1463 | + if (success) { | ||
| 1464 | + success(response); | ||
| 1465 | + } | ||
| 1466 | + } failureBlock:^(NSError *error) { | ||
| 1467 | + failure(error); | ||
| 1468 | + }]; | ||
| 1469 | +} | ||
| 1470 | + | ||
| 1460 | @end | 1471 | @end | ... | ... |
| ... | @@ -329,6 +329,9 @@ WL_VERSION_INTERFACE() | ... | @@ -329,6 +329,9 @@ WL_VERSION_INTERFACE() |
| 329 | 329 | ||
| 330 | - (void)getProfileWithSuccessBlock :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 330 | - (void)getProfileWithSuccessBlock :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 331 | 331 | ||
| 332 | +- (void)postEventWithSuccessBlock :(NSString*)Session_ID :(NSString*)OfferAudienceLevel :(NSString*)msisdn :(NSString*)UACIOfferTrackingCode :(NSString*)OFFERCODE1 :(NSString*)SCORE :(NSString*)ZONE :(NSString*)WAVE :(NSString*)VALIDITY :(NSString*)TREATMENT_CODE :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ||
| 333 | + | ||
| 334 | + | ||
| 332 | - (void)getPacingDetailsWithSuccessBlock :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 335 | - (void)getPacingDetailsWithSuccessBlock :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
| 333 | 336 | ||
| 334 | - (void)editProfileWithSuccessBlock:(NSString*)firstName andLastName:(NSString*)lastName andEmail:(NSString*)email andSalutation:(NSString*)salutation andMsisdn:(NSString*)msisdn | 337 | - (void)editProfileWithSuccessBlock:(NSString*)firstName andLastName:(NSString*)lastName andEmail:(NSString*)email andSalutation:(NSString*)salutation andMsisdn:(NSString*)msisdn | ... | ... |
| ... | @@ -961,6 +961,67 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -961,6 +961,67 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
| 961 | }]; | 961 | }]; |
| 962 | } | 962 | } |
| 963 | 963 | ||
| 964 | +//all parameters here : https://docs.google.com/spreadsheets/d/1kGtjZjO70EdygZxcRbwPBc5niNWEVl2bpl8RtCy5Bak/edit#gid=51763182 | ||
| 965 | +- (void)postEventWithSuccessBlock:(NSString*)Session_ID :(NSString*)OfferAudienceLevel :(NSString*)msisdn :(NSString*)UACIOfferTrackingCode :(NSString*)OFFERCODE1 :(NSString*)SCORE :(NSString*)ZONE :(NSString*)WAVE :(NSString*)VALIDITY :(NSString*)TREATMENT_CODE :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | ||
| 966 | +{ | ||
| 967 | + NSDictionary *postDictionary = @{@"consumer_data":@{@"method": @"postEvent", @"action": @"integration", @"data": @{@"InteractiveChannel": @"COSMOTE_OMNI", @"InteractionPoint": @"COSMOTE_APP_GIFTS4U", @"Session_ID": Session_ID, @"OfferAudienceLevel": OfferAudienceLevel, @"MSISDN": msisdn, @"GUID": @"", @"parameters": @[ | ||
| 968 | + @{@"Name": @"UACIOfferTrackingCode", @"Value": UACIOfferTrackingCode, @"Type": @"string"}, | ||
| 969 | + @{@"Name": @"UACICustomLoggerTableName", @"Value": @"VW_WHITELIST", @"Type": @"string"}, | ||
| 970 | + @{@"Name": @"MSISDN", @"Value": msisdn, @"Type": @"string"}, | ||
| 971 | + @{@"Name": @"OFFERCODE1", @"Value": OFFERCODE1, @"Type": @"string"}, | ||
| 972 | + @{@"Name": @"SCORE", @"Value": SCORE, @"Type": @"string"}, | ||
| 973 | + @{@"Name": @"PREDICATE", @"Value": @"0", @"Type": @"string"}, | ||
| 974 | + @{@"Name": @"ZONE", @"Value": ZONE, @"Type": @"string"}, | ||
| 975 | + @{@"Name": @"APPLICATIONNAME", @"Value": @"COSMOTE_APP_GIFTS4U", @"Type": @"string"}, | ||
| 976 | + @{@"Name": @"Session_ID", @"Value": Session_ID, @"Type": @"string"}, | ||
| 977 | + @{@"Name": @"CAMPAIGN_CODE", @"Value": @"MCC_00006", @"Type": @"string"}, | ||
| 978 | + @{@"Name": @"CAMPAIGN_TYPE", @"Value": @"Inbound", @"Type": @"string"}, | ||
| 979 | + @{@"Name": @"UACIResponseTypeCode", @"Value": @"CON", @"Type": @"string"}, | ||
| 980 | + @{@"Name": @"CHANNEL", @"Value": @"ONE_APP", @"Type": @"string"}, | ||
| 981 | + @{@"Name": @"WAVE", @"Value": WAVE, @"Type": @"string"}, | ||
| 982 | + @{@"Name": @"RESPONSECHANNEL", @"Value": @"ONE_APP", @"Type": @"string"}, | ||
| 983 | + @{@"Name": @"VALIDITY", @"Value": VALIDITY, @"Type": @"numeric"}, | ||
| 984 | + @{@"Name": @"TREATMENT_CODE", @"Value": TREATMENT_CODE, @"Type": @"string"}, | ||
| 985 | + @{@"Name": @"EventName", @"Value": @"INTEREST_P", @"Type": @"string"} | ||
| 986 | + ]}}}; | ||
| 987 | + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; | ||
| 988 | + [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
| 989 | + if (success) { | ||
| 990 | + success(contextResponse); | ||
| 991 | + } | ||
| 992 | + NSLog(@"**************** WARPLY Response *****************" ); | ||
| 993 | + NSLog(@"%@", contextResponse ); | ||
| 994 | + } failureBlock:^(NSError *error) { | ||
| 995 | + if (failure) { | ||
| 996 | + NSDictionary* dict = [NSDictionary alloc]; | ||
| 997 | + dict = [error userInfo]; | ||
| 998 | + NSString* errorCode = [dict objectForKey:@"NSLocalizedDescription"]; | ||
| 999 | + if ([errorCode isEqual:@"Request failed: unauthorized (401)"]) { | ||
| 1000 | + [self refreshToken:^(NSDictionary *response) { | ||
| 1001 | + [self sendContext8:jsonData successBlock:^(NSDictionary *contextResponse) { | ||
| 1002 | + if (success) { | ||
| 1003 | + success(contextResponse); | ||
| 1004 | + } | ||
| 1005 | + NSLog(@"**************** WARPLY Response *****************" ); | ||
| 1006 | + NSLog(@"%@", contextResponse ); | ||
| 1007 | + } failureBlock:^(NSError *error) { | ||
| 1008 | + if (failure) { | ||
| 1009 | + failure(error); | ||
| 1010 | + } | ||
| 1011 | + }]; | ||
| 1012 | + } failureBlock:^(NSError *error) { | ||
| 1013 | + if (failure) { | ||
| 1014 | + [_db executeUpdate:@"DROP TABLE requestVariables"]; | ||
| 1015 | + failure(error); | ||
| 1016 | + } | ||
| 1017 | + NSLog(@"Error at token %@", error ); | ||
| 1018 | + }]; | ||
| 1019 | + } | ||
| 1020 | + NSLog(@"Error at post Event %@", error ); | ||
| 1021 | + } | ||
| 1022 | + }]; | ||
| 1023 | +} | ||
| 1024 | + | ||
| 964 | - (void)editProfileWithSuccessBlock:(NSString*)firstName andLastName:(NSString*)lastName andEmail:(NSString*)email andSalutation:(NSString*)salutation andMsisdn:(NSString*)msisdn | 1025 | - (void)editProfileWithSuccessBlock:(NSString*)firstName andLastName:(NSString*)lastName andEmail:(NSString*)email andSalutation:(NSString*)salutation andMsisdn:(NSString*)msisdn |
| 965 | andNickname:(NSString*)nickname andGender:(NSString*)gender andBirthday:(NSString*)birthday andNameDay:(NSString*)nameday andTaxID:(NSString*)taxID andProfileMetadata:(NSDictionary*)profileMetadata optin:(NSNumber*) optin newsLetter:(NSNumber*)newsletter | 1026 | andNickname:(NSString*)nickname andGender:(NSString*)gender andBirthday:(NSString*)birthday andNameDay:(NSString*)nameday andTaxID:(NSString*)taxID andProfileMetadata:(NSDictionary*)profileMetadata optin:(NSNumber*) optin newsLetter:(NSNumber*)newsletter |
| 966 | andSMS:(NSNumber*)sms andSegmentation:(NSNumber*)segmentation andSMSSegmentation:(NSNumber*)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 1027 | andSMS:(NSNumber*)sms andSegmentation:(NSNumber*)segmentation andSMSSegmentation:(NSNumber*)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | ... | ... |
| ... | @@ -3190,4 +3190,32 @@ public class swiftApi { | ... | @@ -3190,4 +3190,32 @@ public class swiftApi { |
| 3190 | } | 3190 | } |
| 3191 | } | 3191 | } |
| 3192 | 3192 | ||
| 3193 | + | ||
| 3194 | + public func postEventAsync(Session_ID: String, OfferAudienceLevel: String, msisdn: String, UACIOfferTrackingCode: String, OFFERCODE1: String, SCORE: String, ZONE: String, WAVE: String, VALIDITY: String, TREATMENT_CODE: String, _ postEventCallback: @escaping (_ responseData: GenericResponseModel?) -> Void) -> Void { | ||
| 3195 | + | ||
| 3196 | + let instanceOfMyApi = MyApi() | ||
| 3197 | + instanceOfMyApi.postEventAsync(Session_ID, OfferAudienceLevel, msisdn, UACIOfferTrackingCode, OFFERCODE1, SCORE, ZONE, WAVE, VALIDITY, TREATMENT_CODE, requestCallback, failureBlock: requestFailureCallback) | ||
| 3198 | + | ||
| 3199 | + func requestCallback(_ responseData: [AnyHashable: Any]?) -> Void { | ||
| 3200 | + | ||
| 3201 | + if let responseDataDictionary = responseData as? [String: Any] { | ||
| 3202 | + | ||
| 3203 | + let tempResponse = GenericResponseModel(dictionary: responseDataDictionary) | ||
| 3204 | + | ||
| 3205 | + postEventCallback(tempResponse); | ||
| 3206 | + | ||
| 3207 | + } else { | ||
| 3208 | + postEventCallback(nil) | ||
| 3209 | + } | ||
| 3210 | + | ||
| 3211 | + } | ||
| 3212 | + | ||
| 3213 | + func requestFailureCallback(_ error: Error?) -> Void { | ||
| 3214 | + print("postEvent error: ") | ||
| 3215 | + print(error) | ||
| 3216 | + print("====================") | ||
| 3217 | + postEventCallback(nil) | ||
| 3218 | + } | ||
| 3219 | + } | ||
| 3220 | + | ||
| 3193 | } | 3221 | } | ... | ... |
-
Please register or login to post a comment