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-10-06 13:09:54 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
59aefde7851821a4bbce0d6d23195dd5b37c2fdc
59aefde7
1 parent
a1c3be06
fix coupon discount type
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
SwiftWarplyFramework/SwiftWarplyFramework/CouponsTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/CouponsTableViewCell.swift
View file @
59aefde
...
...
@@ -42,7 +42,7 @@ import UIKit
func
configureCell
(
coupon
:
swiftApi
.
CouponItemModel
)
{
// COUPONSET: desc, img_preview, name, terms, merchant_uuid
// COUPONSET: desc, img_preview, name, terms, merchant_uuid
, discount_type, final_price
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
...
...
@@ -62,7 +62,11 @@ import UIKit
// couponImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
// nameLabel.text = couponSetData?.name ?? ""
dicountLabel
.
text
=
(
coupon
.
discount
??
""
)
+
"€"
let
discount
=
couponSetData
?
.
discount_type
==
"value"
?
((
coupon
.
discount
??
""
)
+
"€"
)
:
couponSetData
?
.
discount_type
==
"percentage"
?
((
coupon
.
discount
??
""
)
+
"%"
)
:
couponSetData
?
.
discount_type
==
"plus_one"
?
"1+1"
:
((
coupon
.
discount
??
""
)
+
"€"
)
dicountLabel
.
text
=
discount
let
htmlText
=
couponSetData
?
.
inner_text
??
""
discriptionLabel
.
text
=
htmlText
.
htmlToString
expirationLabel
.
text
=
"Ισχύει έως "
+
(
coupon
.
expiration
??
""
)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
59aefde
...
...
@@ -425,6 +425,8 @@ public class swiftApi {
public
let
visible
:
Bool
?
public
let
terms
:
String
?
public
let
merchant_uuid
:
String
?
public
let
discount_type
:
String
?
// "value" / "percentage" / "plus_one"
public
let
final_price
:
Float
?
public
init
(
dictionary
:
[
String
:
Any
])
{
self
.
uuid
=
dictionary
[
"uuid"
]
as?
String
?
??
""
...
...
@@ -440,6 +442,8 @@ public class swiftApi {
self
.
visible
=
dictionary
[
"visible"
]
as?
Bool
?
??
false
self
.
terms
=
dictionary
[
"terms"
]
as?
String
?
??
""
self
.
merchant_uuid
=
dictionary
[
"merchant_uuid"
]
as?
String
?
??
""
self
.
discount_type
=
dictionary
[
"discount_type"
]
as?
String
?
??
""
self
.
final_price
=
dictionary
[
"final_price"
]
as?
Float
?
??
0.0
let
expirationObject
=
dictionary
[
"expiration"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
let
expirationString
=
expirationObject
?[
"value"
]
as?
String
?
??
""
...
...
Please
register
or
login
to post a comment