Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2022-07-04 16:12:33 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e5f79ff13f5516da6a7e7da33f35913c4bc2c6c2
e5f79ff1
1 parent
9debb6e3
add cosmoteRetrieveSharingAsync request
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.h
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
View file @
e5f79ff
...
...
@@ -85,6 +85,7 @@
-
(
void
)
redeemCouponSetAsync
:(
NSString
*
)
uuid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getPacingDetailsAsync
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
cosmoteSharingAsync
:(
NSString
*
)
sharingId
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
cosmoteRetrieveSharingAsync
:(
NSString
*
)
sharingId
:
(
NSNumber
*
)
accept
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
@end
#endif
/* MyApi_h */
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
e5f79ff
...
...
@@ -1405,4 +1405,17 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}];
}
-
(
void
)
cosmoteRetrieveSharingAsync
:
(
NSString
*
)
sharingId
:
(
NSNumber
*
)
accept
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
[[
Warply
sharedService
]
cosmoteRetrieveSharingWithSuccessBlock
:
sharingId
:
accept
:^
(
NSDictionary
*
response
)
{
if
(
success
)
{
success
(
response
);
}
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
@end
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.h
View file @
e5f79ff
...
...
@@ -376,6 +376,8 @@ WL_VERSION_INTERFACE()
-
(
void
)
cosmoteSharingWithSuccessBlock
:(
NSString
*
)
sharingId
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
cosmoteRetrieveSharingWithSuccessBlock
:(
NSString
*
)
sharingId
:
(
NSNumber
*
)
accept
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
validateCouponWithSuccessBlock
:(
NSString
*
)
coupon
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
loginCosmoteWithSuccessBlock
:(
NSString
*
)
guid
andAppUuid
:(
NSString
*
)
appUuid
andTicket
:(
NSString
*
)
ticket
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
View file @
e5f79ff
...
...
@@ -1958,6 +1958,47 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
}];
}
-
(
void
)
cosmoteRetrieveSharingWithSuccessBlock
:
(
NSString
*
)
sharingId
:
(
NSNumber
*
)
accept
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSDictionary
*
postDictionary
=
@{
@"wallet"
:
@{
@"action"
:
@"sharing_response"
,
@"sharing_id"
:
sharingId
,
@"accept"
:
accept
}};
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
postDictionary
options
:
0
error
:
NULL
];
[
self
sendContext8
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
success
(
contextResponse
);
}
NSLog
(
@"**************** WARPLY Response *****************"
);
NSLog
(
@"%@"
,
contextResponse
);
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
NSDictionary
*
dict
=
[
NSDictionary
alloc
];
dict
=
[
error
userInfo
];
NSString
*
errorCode
=
[
dict
objectForKey
:
@"NSLocalizedDescription"
];
if
([
errorCode
isEqual
:
@"Request failed: unauthorized (401)"
])
{
[
self
refreshToken
:
^
(
NSDictionary
*
response
)
{
[
self
sendContext8
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
success
(
contextResponse
);
}
NSLog
(
@"**************** WARPLY Response *****************"
);
NSLog
(
@"%@"
,
contextResponse
);
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
failureBlock
:
^
(
NSError
*
error
)
{
if
(
failure
)
{
[
_db
executeUpdate
:
@"DROP TABLE requestVariables"
];
failure
(
error
);
}
NSLog
(
@"Error at token %@"
,
error
);
}];
}
NSLog
(
@"Error at cosmote retrieve sharing %@"
,
error
);
}
}];
}
-
(
void
)
validateCouponWithSuccessBlock
:
(
NSString
*
)
coupon
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSDictionary
*
postDictionary
=
@{
@"coupon"
:
@{
@"action"
:
@"validate"
,
@"coupon"
:
coupon
}};
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
e5f79ff
...
...
@@ -2600,4 +2600,41 @@ public class swiftApi {
}
}
public
func
cosmoteRetrieveSharingAsync
(
sharingId
:
String
,
accept
:
Bool
,
_
cosmoteSharingCallback
:
@escaping
(
_
responseData
:
GenericResponseModel
?)
->
Void
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
cosmoteRetrieveSharingAsync
(
sharingId
,
accept
as
NSNumber
,
requestCallback
,
failureBlock
:
requestFailureCallback
)
func
requestCallback
(
_
responseData
:
[
AnyHashable
:
Any
]?)
->
Void
{
if
let
responseDataDictionary
=
responseData
as?
[
String
:
AnyObject
]
{
if
(
responseDataDictionary
[
"status"
]
as?
Int
==
1
)
{
if
let
responseDataDictionary
=
responseData
as?
[
String
:
Any
]
{
let
tempResponse
=
GenericResponseModel
(
dictionary
:
responseDataDictionary
)
cosmoteSharingCallback
(
tempResponse
);
}
else
{
cosmoteSharingCallback
(
nil
)
}
}
else
{
cosmoteSharingCallback
(
nil
)
}
}
else
{
cosmoteSharingCallback
(
nil
)
}
}
func
requestFailureCallback
(
_
error
:
Error
?)
->
Void
{
print
(
"cosmoteRetrieveSharing error: "
)
print
(
error
)
print
(
"===================="
)
cosmoteSharingCallback
(
nil
)
}
}
}
...
...
Please
register
or
login
to post a comment