Showing
2 changed files
with
66 additions
and
0 deletions
No preview for this file type
... | @@ -481,6 +481,9 @@ public class swiftApi { | ... | @@ -481,6 +481,9 @@ public class swiftApi { |
481 | public let ccms_offer: String? | 481 | public let ccms_offer: String? |
482 | public var loyaltyPackageId: String? | 482 | public var loyaltyPackageId: String? |
483 | public var badge: String? | 483 | public var badge: String? |
484 | + public var campaign_type: String? | ||
485 | + // public var campaign_type_settings: [String: Any]? | ||
486 | + public var couponset: String? | ||
484 | 487 | ||
485 | public init() { | 488 | public init() { |
486 | self.index_url = "" | 489 | self.index_url = "" |
... | @@ -497,6 +500,9 @@ public class swiftApi { | ... | @@ -497,6 +500,9 @@ public class swiftApi { |
497 | self.ccms_offer = "false" | 500 | self.ccms_offer = "false" |
498 | self.loyaltyPackageId = "" | 501 | self.loyaltyPackageId = "" |
499 | self.badge = "" | 502 | self.badge = "" |
503 | + self.campaign_type = "" | ||
504 | + // self.campaign_type_settings = [String: Any]() | ||
505 | + self.couponset = "" | ||
500 | } | 506 | } |
501 | 507 | ||
502 | public init(dictionary: [String: Any]) { | 508 | public init(dictionary: [String: Any]) { |
... | @@ -509,6 +515,7 @@ public class swiftApi { | ... | @@ -509,6 +515,7 @@ public class swiftApi { |
509 | self.is_new = dictionary["is_new"] as? Bool? ?? false | 515 | self.is_new = dictionary["is_new"] as? Bool? ?? false |
510 | self.message = dictionary["message"] as? String? ?? "" | 516 | self.message = dictionary["message"] as? String? ?? "" |
511 | self.loyaltyPackageId = "" | 517 | self.loyaltyPackageId = "" |
518 | + self.campaign_type = dictionary["campaign_type"] as? String? ?? "" | ||
512 | 519 | ||
513 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] | 520 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] |
514 | let extra_fields = dictionary["extra_fields"] as AnyObject | 521 | let extra_fields = dictionary["extra_fields"] as AnyObject |
... | @@ -540,6 +547,38 @@ public class swiftApi { | ... | @@ -540,6 +547,38 @@ public class swiftApi { |
540 | self.badge = "" | 547 | self.badge = "" |
541 | print(error) | 548 | print(error) |
542 | } | 549 | } |
550 | + | ||
551 | + // campaign_type_settings | ||
552 | + if let campaign_type_settings_obj = dictionary["campaign_type_settings"] as? AnyObject { | ||
553 | + | ||
554 | + if ((!(campaign_type_settings_obj is NSNull)) && (campaign_type_settings_obj != nil)) { | ||
555 | + var campaign_type_settings_parsed:[String: Any] | ||
556 | + | ||
557 | + let campaign_type_settings_json = campaign_type_settings_obj.data(using: String.Encoding.utf8.rawValue) | ||
558 | + do { | ||
559 | + if let jsonArray = try JSONSerialization.jsonObject(with: campaign_type_settings_json!, options: .allowFragments) as? [String:AnyObject] | ||
560 | + { | ||
561 | + campaign_type_settings_parsed = jsonArray; | ||
562 | + // self.campaign_type_settings = campaign_type_settings_parsed as? [String: Any]? ?? [String: Any]() | ||
563 | + self.couponset = campaign_type_settings_parsed["couponset"] as? String? ?? "" | ||
564 | + } else { | ||
565 | + // self.campaign_type_settings = [String: Any]() | ||
566 | + self.couponset = "" | ||
567 | + print("bad json") | ||
568 | + } | ||
569 | + } catch let error as NSError { | ||
570 | + // self.campaign_type_settings = [String: Any]() | ||
571 | + self.couponset = "" | ||
572 | + print(error) | ||
573 | + } | ||
574 | + } else { | ||
575 | + self.couponset = "" | ||
576 | + } | ||
577 | + | ||
578 | + } else { | ||
579 | + self.couponset = "" | ||
580 | + } | ||
581 | + | ||
543 | } | 582 | } |
544 | 583 | ||
545 | public var _logo_url: String? { | 584 | public var _logo_url: String? { |
... | @@ -577,6 +616,33 @@ public class swiftApi { | ... | @@ -577,6 +616,33 @@ public class swiftApi { |
577 | self.badge = newValue | 616 | self.badge = newValue |
578 | } | 617 | } |
579 | } | 618 | } |
619 | + | ||
620 | + public var _campaign_type: String? { | ||
621 | + get { // getter | ||
622 | + return self.campaign_type | ||
623 | + } | ||
624 | + set(newValue) { //setter | ||
625 | + self.campaign_type = newValue | ||
626 | + } | ||
627 | + } | ||
628 | + | ||
629 | + // public var _campaign_type_settings: [String: Any]? { | ||
630 | + // get { // getter | ||
631 | + // return self.campaign_type_settings | ||
632 | + // } | ||
633 | + // set(newValue) { //setter | ||
634 | + // self.campaign_type_settings = newValue | ||
635 | + // } | ||
636 | + // } | ||
637 | + | ||
638 | + public var _couponset: String? { | ||
639 | + get { // getter | ||
640 | + return self.couponset | ||
641 | + } | ||
642 | + set(newValue) { //setter | ||
643 | + self.couponset = newValue | ||
644 | + } | ||
645 | + } | ||
580 | } | 646 | } |
581 | 647 | ||
582 | public class CampaignDataModel { | 648 | public class CampaignDataModel { | ... | ... |
-
Please register or login to post a comment