Voucher

@interface Voucher : NSObject <NSCoding>

Voucher is the model that encompases all components of a ‘gift’. This class is immutable. Use MutableVoucher if you need to change values.

  • vId

    The id of the Voucher. This will be unique for each Voucher and never change.

    Declaration

    Objective-C

    @property (readonly, nonatomic) long long vId;

    Swift

    var vId: Int64 { get }
  • The status of the Voucher. See VoucherStatus for all the possible states.

    Declaration

    Objective-C

    @property (readonly, nonatomic) VoucherStatus status;

    Swift

    var status: VoucherStatus { get }
  • The amount that is given to the User.

    Declaration

    Objective-C

    @property (readonly, nonatomic) double amount;

    Swift

    var amount: Double { get }
  • fee

    The fee associated with the given amount.

    Declaration

    Objective-C

    @property (readonly, nonatomic) double fee;

    Swift

    var fee: Double { get }
  • The currency of the gift. Eg. USD.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSString *currency;

    Swift

    var currency: String? { get }
  • The merchant associated with the Voucher. Eg. Paypal.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) Merchant *merchant;

    Swift

    var merchant: Merchant? { get }
  • The payment info provided by the Sender of the gift.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) VoucherPayment *paymentInfo;

    Swift

    var paymentInfo: VoucherPayment? { get }
  • Require a thank you photo to be taken by the claimer of the gift before they are able to claim it.

    Declaration

    Objective-C

    @property (readonly, nonatomic) BOOL isThankYouPhotoRequired;

    Swift

    var isThankYouPhotoRequired: Bool { get }
  • The date the thank you photo was taken for a gift.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSDate *thankYouDate;

    Swift

    var thankYouDate: Date? { get }
  • The last date the Voucher was modified. Anytime a value changes in the Voucher, this property will update.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) NSDate *_Nonnull dateModified;

    Swift

    var dateModified: Date { get }
  • The date the Voucher was created. This date will never change.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) NSDate *_Nonnull dateCreated;

    Swift

    var dateCreated: Date { get }
  • The date the Voucher is first able to be claimed. This date will never change.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) NSDate *_Nonnull dateClaimable;

    Swift

    var dateClaimable: Date { get }
  • The creator of the Voucher.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic) User *_Nonnull creator;

    Swift

    var creator: User { get }
  • The claimer of the Voucher.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) User *claimer;

    Swift

    var claimer: User? { get }
  • Any Users who are able to view the Voucher.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSArray<User *> *viewers;

    Swift

    var viewers: [User]? { get }
  • Any Users who are able to claim the Voucher before it has been claimed.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSArray<User *> *recipients;

    Swift

    var recipients: [User]? { get }
  • Any user ids who have unwrapped the Voucher.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        NSArray<NSNumber *> *unwrappedUsers;

    Swift

    var unwrappedUsers: [NSNumber]? { get }
  • The title of the Voucher. Customizable by the user when creating the Voucher.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSString *title;

    Swift

    var title: String? { get }
  • TODO: this property

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) NSString *shareImageUrl;

    Swift

    var shareImageUrl: String? { get }
  • The privacy status of the Voucher. Either Private / Friends / Public.

    Declaration

    Objective-C

    @property (readonly, nonatomic) VoucherPrivacyStatus privacy;

    Swift

    var privacy: VoucherPrivacyStatus { get }
  • The game the User must play to claim the Voucher.

    Declaration

    Objective-C

    @property (readonly, nonatomic) GameData *_Nonnull gameData;

    Swift

    var gameData: GameData { get }
  • An array of all media items. This includes pictures, videos, sounds, notes. Customizable by the user when sending the Voucher.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        NSArray<VoucherMedia *> *medias;

    Swift

    var medias: [VoucherMedia]? { get }
  • The WrappingPaperMedia that shows up on the envelope before the Voucher has been claimed.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable)
        WrappingPaperMedia *wrappingPaperMedia;

    Swift

    var wrappingPaperMedia: WrappingPaperMedia? { get }
  • Boolean value that tracks if the voucher was prepopulated from ‘PreviewVoucherContentsViewController’

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL isPrepopulated;

    Swift

    var isPrepopulated: Bool { get set }
  • Default initializer to create a Voucher.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDictionary:(nonnull NSDictionary *)dictionary;

    Swift

    init(dictionary: [AnyHashable : Any])

    Parameters

    dictionary

    - the dictionary representation of the the Voucher.

    Return Value

    instance of Voucher.

  • Static initializer to create a Voucher. Internally calls initWithDictionary:.

    Declaration

    Objective-C

    + (nonnull instancetype)voucherWithDictionary:
        (nonnull NSDictionary *)dictionary;

    Parameters

    dictionary

    - the dictionary representation of the the Voucher.

    Return Value

    instance of Voucher.

  • Converts a Voucher to an NSDictionary that can be used for caching.

    Declaration

    Objective-C

    - (nonnull NSDictionary *)dictionaryRepresentation;

    Swift

    func dictionaryRepresentation() -> [AnyHashable : Any]

    Return Value

    dictionary - Dictionary form of a Voucher.

  • Converts a Voucher to an NSDictionary that can be used for sending to the server.

    Declaration

    Objective-C

    - (nonnull NSDictionary *)dictionaryRepresentationForNetwork;

    Swift

    func dictionaryRepresentationForNetwork() -> [AnyHashable : Any]

    Return Value

    dictionary - Dictionary form of a Voucher without media data.