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-06-20 19:18:45 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d3a6088ad1946ab18af6c0dd228777cbf6961999
d3a6088a
1 parent
d6cdc81f
add redeemCouponSetAsync request
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
3 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/CouponViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
d3a6088
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/CouponViewController.swift
View file @
d3a6088
...
...
@@ -79,15 +79,32 @@ import UIKit
termsButton
.
setImage
(
UIImage
(
named
:
"ic_down_dark.png"
,
in
:
Bundle
(
for
:
MyEmptyClass
.
self
),
compatibleWith
:
nil
),
for
:
.
normal
)
}
}
func
redeemCouponSetRequest
(
uuid
:
String
)
{
swiftApi
()
.
redeemCouponSetAsync
(
uuid
:
uuid
,
redeemCouponSetCallback
)
}
func
redeemCouponSetCallback
(
_
response
:
swiftApi
.
GenericResponseModel
?)
->
Void
{
if
(
response
!=
nil
)
{
DispatchQueue
.
main
.
async
{
if
(
response
?
.
getStatus
==
1
)
{
// Do something
}
}
}
else
{
}
}
// MARK: - Actions
@IBAction
func
redeemButtomAction
(
_
sender
:
Any
)
{
// SwiftEventBus.post("couponRedeem", sender: coupon)
redeemCouponSetRequest
(
uuid
:
couponset
?
.
uuid
??
""
)
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"MakeItAPresentViewController"
)
as
UIViewController
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
//
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
//
let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as UIViewController
//
self.navigationController?.pushViewController(vc, animated: true)
}
@IBAction
func
termsButtonAction
(
_
sender
:
Any
)
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
View file @
d3a6088
...
...
@@ -82,6 +82,7 @@
-
(
void
)
verifyTicketAsync
:(
NSString
*
)
guid
:
(
NSString
*
)
ticket
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getProfileAsync
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
consumerIntegrationAsync
:(
NSNumber
*
)
nonTelco
:
(
NSNumber
*
)
acceptedConsent
:
(
NSArray
*
)
msisdnList
:
(
NSString
*
)
guid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
redeemCouponSetAsync
:(
NSString
*
)
uuid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
@end
#endif
/* MyApi_h */
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
d3a6088
...
...
@@ -1366,4 +1366,17 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}];
}
-
(
void
)
redeemCouponSetAsync
:
(
NSString
*
)
uuid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
[[
Warply
sharedService
]
redeemCouponSetsWithSuccessBlock
:
uuid
:
^
(
NSDictionary
*
response
)
{
if
(
success
)
{
success
(
response
);
}
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
@end
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
d3a6088
...
...
@@ -1562,7 +1562,33 @@ public class swiftApi {
print
(
"===================="
)
consumerIntegrationCallback
(
nil
)
}
}
public
func
redeemCouponSetAsync
(
uuid
:
String
,
_
redeemCouponSetCallback
:
@escaping
(
_
responseData
:
GenericResponseModel
?)
->
Void
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
redeemCouponSetAsync
(
uuid
,
requestCallback
,
failureBlock
:
requestFailureCallback
)
func
requestCallback
(
_
responseData
:
[
AnyHashable
:
Any
]?)
->
Void
{
if
let
responseDataDictionary
=
responseData
as?
[
String
:
Any
]
{
let
tempResponse
=
GenericResponseModel
(
dictionary
:
responseDataDictionary
)
redeemCouponSetCallback
(
tempResponse
);
}
else
{
redeemCouponSetCallback
(
nil
)
}
}
func
requestFailureCallback
(
_
error
:
Error
?)
->
Void
{
print
(
"consumerIntegration error: "
)
print
(
error
)
print
(
"===================="
)
redeemCouponSetCallback
(
nil
)
}
}
}
...
...
Please
register
or
login
to post a comment