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-26 18:08:48 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4ad1e61bebf395d46bd5a5fcc6c7eeebf0802c7a
4ad1e61b
1 parent
f6c43950
fix SharingCouponModel
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
28 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
4ad1e61
...
...
@@ -3492,13 +3492,6 @@ public class swiftApi {
public
class
SharingCouponModel
:
Codable
{
// public let transactionMetadata: String?
// public let sharingType: String?
// public let discount: Float
// public let date: Date?
// public let couponsetUuid: String?
// public let name: String?
private
var
couponset_uuid
:
String
?
private
var
date
:
String
?
private
var
discount
:
String
?
...
...
@@ -3520,30 +3513,20 @@ public class swiftApi {
}
public
init
(
dictionary
:
[
String
:
Any
])
{
// self.transactionMetadata = dictionary["transaction_metadata"] as? String? ?? ""
// self.sharingType = dictionary["sharing_type"] as? String? ?? ""
// self.discount = dictionary["discount"] as? Float ?? 0.0
// self.couponsetUuid = dictionary["couponsetUuid"] as? String? ?? ""
// self.name = dictionary["name"] as? String? ?? ""
// let dateString = dictionary["date"] as? String? ?? ""
// let dateFormatter = DateFormatter()
// dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss"
// if let date = dateFormatter.date(from: dateString ?? "") {
// self.date = date
// } else {
// self.date = nil
// }
self
.
couponset_uuid
=
dictionary
[
"couponset_uuid"
]
as?
String
?
??
""
self
.
discount
=
dictionary
[
"discount"
]
as?
String
?
??
""
self
.
sharing_type
=
dictionary
[
"sharing_type"
]
as?
String
?
??
""
// self.transaction_metadata = dictionary["transaction_metadata"] as? String? ?? ""
self
.
name
=
dictionary
[
"name"
]
as?
String
?
??
""
self
.
name
=
""
let
couponsetsList
=
swiftApi
()
.
getCouponSetList
()
for
item
in
couponsetsList
{
if
(
item
.
uuid
==
self
.
couponset_uuid
)
{
self
.
name
=
item
.
name
??
""
break
;
}
}
// Example "date": "Thu, Jun 23 2022 16:24:44",
let
dateString
=
dictionary
[
"date"
]
as?
String
?
??
""
let
dateFormatter
=
DateFormatter
()
...
...
@@ -3660,8 +3643,17 @@ public class swiftApi {
for
item
in
responseDataResult
{
if
let
itemDictionary
=
item
{
let
tempHistoyItem
=
SharingCouponModel
(
dictionary
:
itemDictionary
)
historyArray
.
append
(
tempHistoyItem
)
let
couponsetUuid
=
itemDictionary
[
"couponset_uuid"
]
as?
String
?
??
""
let
couponsetsList
=
swiftApi
()
.
getCouponSetList
()
for
item
in
couponsetsList
{
if
(
item
.
uuid
==
couponsetUuid
)
{
let
tempHistoyItem
=
SharingCouponModel
(
dictionary
:
itemDictionary
)
historyArray
.
append
(
tempHistoyItem
)
break
;
}
}
}
}
...
...
Please
register
or
login
to post a comment