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-19 13:34:46 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
8664a39d927249013b5602fabe85a4a7bb88fa0d
8664a39d
1 parent
e3db36b4
add submitOrderAsync request
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 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 @
8664a39
...
...
@@ -88,6 +88,7 @@
-
(
void
)
cosmoteRetrieveSharingAsync
:(
NSString
*
)
sharingId
:
(
NSNumber
*
)
accept
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getCosmoteUserAsync
:(
NSString
*
)
guid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
cosmoteCouponSharingAsync
:(
NSString
*
)
coupon
:
(
NSString
*
)
sender
:
(
NSString
*
)
receiver
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
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
;
@end
#endif
/* MyApi_h */
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
8664a39
...
...
@@ -1444,4 +1444,17 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
}];
}
-
(
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
{
[[
Warply
sharedService
]
submitOrderWithSuccessBlock
:
campaign_session_uuid
:
user_msisdn
:
businessService
:
offerName
:
productType
:
provDuration
:
noOfRecurrance
:
price
:
discount
:
voiceCategory
:
dataCategory
:
minsValue
:
dataValue
:
provStepValueMins
:^
(
NSDictionary
*
response
)
{
if
(
success
)
{
success
(
response
);
}
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
@end
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.h
View file @
8664a39
...
...
@@ -384,6 +384,8 @@ WL_VERSION_INTERFACE()
-
(
void
)
cosmoteRetrieveSharingWithSuccessBlock
:(
NSString
*
)
sharingId
:
(
NSNumber
*
)
accept
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
submitOrderWithSuccessBlock
:(
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
;
-
(
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 @
8664a39
...
...
@@ -2077,6 +2077,47 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
}];
}
-
(
void
)
submitOrderWithSuccessBlock
:
(
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
{
NSDictionary
*
postDictionary
=
@{
@"wallet"
:
@{
@"action"
:
@"add_product"
,
@"product_uuid"
:
@"011d21908d984e3cbecbdfd2920a5d3b"
,
@"communication_uuid"
:
campaign_session_uuid
,
@"extra_data"
:
@{
@"user_msisdn"
:
user_msisdn
,
@"businessService"
:
businessService
,
@"offerName"
:
offerName
,
@"productType"
:
productType
,
@"provDuration"
:
provDuration
,
@"noOfRecurrance"
:
noOfRecurrance
,
@"price"
:
price
,
@"discount"
:
discount
,
@"voiceCategory"
:
voiceCategory
,
@"dataCategory"
:
dataCategory
,
@"minsValue"
:
minsValue
,
@"dataValue"
:
dataValue
,
@"provStepValueMins"
:
provStepValueMins
}}};
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 submit Order %@"
,
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 @
8664a39
...
...
@@ -3127,4 +3127,32 @@ public class swiftApi {
}
}
public
func
submitOrderAsync
(
campaign_session_uuid
:
String
,
user_msisdn
:
String
,
businessService
:
String
,
offerName
:
String
,
productType
:
String
,
provDuration
:
String
,
noOfRecurrance
:
String
,
price
:
String
,
discount
:
String
,
voiceCategory
:
String
,
dataCategory
:
String
,
minsValue
:
String
,
dataValue
:
String
,
provStepValueMins
:
String
,
_
submitOrderCallback
:
@escaping
(
_
responseData
:
GenericResponseModel
?)
->
Void
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
submitOrderAsync
(
campaign_session_uuid
,
user_msisdn
,
businessService
,
offerName
,
productType
,
provDuration
,
noOfRecurrance
,
price
,
discount
,
voiceCategory
,
dataCategory
,
minsValue
,
dataValue
,
provStepValueMins
,
requestCallback
,
failureBlock
:
requestFailureCallback
)
func
requestCallback
(
_
responseData
:
[
AnyHashable
:
Any
]?)
->
Void
{
if
let
responseDataDictionary
=
responseData
as?
[
String
:
Any
]
{
let
tempResponse
=
GenericResponseModel
(
dictionary
:
responseDataDictionary
)
submitOrderCallback
(
tempResponse
);
}
else
{
submitOrderCallback
(
nil
)
}
}
func
requestFailureCallback
(
_
error
:
Error
?)
->
Void
{
print
(
"submitOrder error: "
)
print
(
error
)
print
(
"===================="
)
submitOrderCallback
(
nil
)
}
}
}
...
...
Please
register
or
login
to post a comment