Manos Chorianopoulos

update wallet with LoyaltyBadgeModel

...@@ -34,6 +34,7 @@ import SwiftEventBus ...@@ -34,6 +34,7 @@ import SwiftEventBus
34 34
35 public var coupons:Array<swiftApi.CouponItemModel> = swiftApi().getCouponList() 35 public var coupons:Array<swiftApi.CouponItemModel> = swiftApi().getCouponList()
36 public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons() 36 public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons()
37 + public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge()
37 38
38 public override func viewDidLoad() { 39 public override func viewDidLoad() {
39 super.viewDidLoad() 40 super.viewDidLoad()
...@@ -100,11 +101,10 @@ import SwiftEventBus ...@@ -100,11 +101,10 @@ import SwiftEventBus
100 couponEarnView.layer.shadowOpacity = 1.0 101 couponEarnView.layer.shadowOpacity = 1.0
101 couponEarnView.layer.shadowRadius = 3.0 102 couponEarnView.layer.shadowRadius = 3.0
102 103
103 - var totalCouponDiscount = coupons.reduce(0) { $0 + (Float($1.discount ?? "") ?? 0) } 104 + let totalCouponDiscount = Float(round(100 * loyaltyBadge._value) / 100)
104 - totalCouponDiscount = Float(round(100 * totalCouponDiscount) / 100)
105 let totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) 105 let totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
106 106
107 - couponEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(coupons.count) + " κουπόνια!" 107 + couponEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!"
108 couponEarnAmountLabel.text = totalCouponDiscountString + "€" 108 couponEarnAmountLabel.text = totalCouponDiscountString + "€"
109 109
110 activeCodeView.layer.cornerRadius = 5.0 110 activeCodeView.layer.cornerRadius = 5.0
......