VOGiftManagerProtocol

@protocol VOGiftManagerProtocol

/**
 * Creates a pending voucher. This will save & validate the voucher created in the create process
 * This voucher will not be sent to users until activate call is made
 *
 * @param voucher - the voucher that is being created
 * @param onSucceed - success callblock when the request completes
 * @param onError - error callblock if the request fails
 *
 **/
- (void)createPendingVoucher:(Voucher *)voucher
                   onSuccess:(void(^)(Voucher *voucher))onSucceed
                     onError:(void(^)(NSError *error))onError;

/**
 * This validates payment and sends the Voucher to users
 *
 * @param voucherId - the id of the voucher sent to the server
 * @param paymentSourceDictionary - payment information if necessary, if nil it is assumed this is a FREE voucher
 * @param onSuccess - success callblock when the request completes
 * @param onError - error callblock if the request fails
 *
 **/
-(void)activateVoucherWithId:(long long)voucherId
     paymentSourceDictionary:(NSDictionary *)paymentSourceDictionary
                   onSuccess:(void(^)(Voucher *voucher))onSuccess
                     onError:(void(^)(NSError *error))onError;


/**
 * Unwraps a voucher
 * @discussion - Multiple people can unwrap a voucher but only one person can claim a voucher.
    Usually the unwrap & claim call occur one right after the other.
 * ## Note - Unwrap must be called before claim for the user.
 *
 * @param voucherId - the id of the voucher sent to the server
 * @param score - the score achieved in the game, if a game was played
 * @param onSuccess - success callblock when the request completes
 * @param onError - error callblock if the request fails
 *
 **/
- (void)unwrapVoucherWithId:(long long)voucherId
                      score:(NSInteger)score
                  onSuccess:(void(^)(Voucher *voucher))onSuccess
                    onError:(void(^)(NSError *error))onError;

/**
 * Claims a voucher. After a voucher is claimed no other users will be able to claim.
 *
 * @param voucherId - the id of the voucher sent to the server
 * @param onSuccess - success callblock when the request completes
 * @param onError - error callblock if the request fails
 *
 **/
- (void)claimVoucherWithId:(long long)voucherId
                 onSuccess:(void(^)(Voucher *voucher))onSuccess
                   onError:(void(^)(NSError *error))onError;

/**
 * Retrieves a voucher from server or cache
 *
 * @param voucherId - the id of the voucher sent to the server
 * @param forceUpdate - if true, will ignore cache
 * @param onSuccess - success callblock when the request completes
 * @param onError - error callblock if the request fails
 *
 **/
-(void)requestVoucher:(long long)voucherId
          forceUpdate:(BOOL)forceUpdate
            onSuccess:(void(^)(Voucher *voucher))onSuccess
              onError:(void(^)(NSError *error))onError;

- (void)requestActivityFeedWithFilterType:(ActivityFeedFilterType)filterType
                                    limit:(NSInteger)limit
                              forceUpdate:(BOOL)forceUpdate
                                onSuccess:(void(^)(NSArray <ActivityFeedVoucher *> *giftModels, NSString *nextPageUrl))onSuccess
                                  onError:(void(^)(NSError *error))onError;

- (void)requestActivityFeedPageWithPageUrl:(NSURL *)url
                                 onSuccess:(void(^)(NSArray <ActivityFeedVoucher *> *giftModels, NSString *nextPageUrl))onSuccess
                                   onError:(void(^)(NSError *error))onError;

@end

Undocumented

  • Creates a pending voucher. This will save & validate the voucher created in the create process This voucher will not be sent to users until activate call is made

    Declaration

    Objective-C

    - (void)createPendingVoucher:(Voucher *)voucher
                       onSuccess:(void (^)(Voucher *))onSucceed
                         onError:(void (^)(NSError *))onError;

    Swift

    func createPendingVoucher(_ voucher: Voucher!, onSuccess onSucceed: ((Voucher?) -> Void)!, onError: ((UnsafeMutablePointer<Int32>?) -> Void)!)

    Parameters

    voucher

    - the voucher that is being created

    onSucceed

    - success callblock when the request completes

    onError

    - error callblock if the request fails

  • This validates payment and sends the Voucher to users

    Declaration

    Objective-C

    - (void)activateVoucherWithId:(long long)voucherId
          paymentSourceDictionary:(NSDictionary *)paymentSourceDictionary
                        onSuccess:(void (^)(Voucher *))onSuccess
                          onError:(void (^)(NSError *))onError;

    Swift

    func activateVoucher(withId voucherId: Int64, paymentSourceDictionary: Any!, onSuccess: ((Voucher?) -> Void)!, onError: ((UnsafeMutablePointer<Int32>?) -> Void)!)

    Parameters

    voucherId

    - the id of the voucher sent to the server

    paymentSourceDictionary

    - payment information if necessary, if nil it is assumed this is a FREE voucher

    onSuccess

    - success callblock when the request completes

    onError

    - error callblock if the request fails

  • Unwraps a voucher @discussion - Multiple people can unwrap a voucher but only one person can claim a voucher. Usually the unwrap & claim call occur one right after the other. ## Note - Unwrap must be called before claim for the user.

    Declaration

    Objective-C

    - (void)unwrapVoucherWithId:(long long)voucherId
                          score:(NSInteger)score
                      onSuccess:(void (^)(Voucher *))onSuccess
                        onError:(void (^)(NSError *))onError;

    Swift

    func unwrapVoucher(withId voucherId: Int64, score: Any!, onSuccess: ((Voucher?) -> Void)!, onError: ((UnsafeMutablePointer<Int32>?) -> Void)!)

    Parameters

    voucherId

    - the id of the voucher sent to the server

    score

    - the score achieved in the game, if a game was played

    onSuccess

    - success callblock when the request completes

    onError

    - error callblock if the request fails

  • Claims a voucher. After a voucher is claimed no other users will be able to claim.

    Declaration

    Objective-C

    - (void)claimVoucherWithId:(long long)voucherId
                     onSuccess:(void (^)(Voucher *))onSuccess
                       onError:(void (^)(NSError *))onError;

    Swift

    func claimVoucher(withId voucherId: Int64, onSuccess: ((Voucher?) -> Void)!, onError: ((UnsafeMutablePointer<Int32>?) -> Void)!)

    Parameters

    voucherId

    - the id of the voucher sent to the server

    onSuccess

    - success callblock when the request completes

    onError

    - error callblock if the request fails

  • Retrieves a voucher from server or cache

    Declaration

    Objective-C

    - (void)requestVoucher:(long long)voucherId
               forceUpdate:(BOOL)forceUpdate
                 onSuccess:(void (^)(Voucher *))onSuccess
                   onError:(void (^)(NSError *))onError;

    Swift

    func requestVoucher(_ voucherId: Int64, forceUpdate: Any!, onSuccess: ((Voucher?) -> Void)!, onError: ((UnsafeMutablePointer<Int32>?) -> Void)!)

    Parameters

    voucherId

    - the id of the voucher sent to the server

    forceUpdate

    - if true, will ignore cache

    onSuccess

    - success callblock when the request completes

    onError

    - error callblock if the request fails

  • Undocumented

    Declaration

    Objective-C

    - (void)requestActivityFeedWithFilterType:(ActivityFeedFilterType)filterType
                                        limit:(NSInteger)limit
                                  forceUpdate:(BOOL)forceUpdate
                                    onSuccess:(void(^)(NSArray <ActivityFeedVoucher *> *giftModels, NSString *nextPageUrl))onSuccess
                                      onError:(void(^)(NSError *error))onError;

    Swift

    func requestActivityFeed(withFilterType filterType: Any!, limit: Any!, forceUpdate: Any!, onSuccess: ((Int32) -> Void)!, onError: ((UnsafeMutablePointer<Int32>?) -> Void)!)
  • Undocumented

    Declaration

    Objective-C

    - (void)requestActivityFeedPageWithPageUrl:(NSURL *)url
                                     onSuccess:(void(^)(NSArray <ActivityFeedVoucher *> *giftModels, NSString *nextPageUrl))onSuccess
                                       onError:(void(^)(NSError *error))onError;

    Swift

    func requestActivityFeedPage(withPageUrl url: Any!, onSuccess: ((Int32) -> Void)!, onError: ((UnsafeMutablePointer<Int32>?) -> Void)!)