VOVoucherCreationFlowDelegate

@protocol VOVoucherCreationFlowDelegate <NSObject, VOVoucherGameDelegate>

VOVoucherCreationFlowDelegates are responsible for supplying additional information needed for subsequent screens as well as handling VOVoucher related request callbacks.

  • This delegate method is called if payment information needs to be provided to complete activation of the voucher or if the user would like to edit their payment information. The delegate occurs when the user hits send on the summary screen or if the user taps on the credit card cell.

    Note

    The contents of the paymentInfo dictionary will be dependent on the payment system being used and will require discussion with the Vouchr backend team.

    Declaration

    Objective-C

    - (void)collectPaymentInfoOnViewController:
                (nonnull UIViewController *)viewController
                                    forVoucher:(nonnull VOVoucher *)voucher
                                  onCompletion:
                                      (nonnull void (^)(
                                          NSDictionary<NSString *, id> *_Nullable,
                                          NSError *_Nullable))completion;

    Swift

    func collectPaymentInfo(on viewController: UIViewController, for voucher: VOVoucher, onCompletion completion: @escaping ([String : Any]?, Error?) -> Void)

    Parameters

    viewController

    - the current top view controller. If a view controller needs to be presented to retrieve additional payment information, it should be presented on this view controller.

    voucher

    - The voucher that needs the payment information.

    completion

    - Completion block to be executed when the payment information has been obtained. Supply a dictionary with payment info as the paymentInfo. This will be used in the activateVoucher call. Pass nill if the user has cancelled the collection of payment info. Supply an error if an error has occurred or nil if there was no error.

  • This delegate method is called if payment information needs to be approved to complete activation of the voucher.

    Note

    The contents of the paymentInfo dictionary will be dependent on the payment system being used and will require discussion with the Vouchr backend team.

    Declaration

    Objective-C

    - (void)approvePaymentInfoOnViewController:
                (nonnull UIViewController *)viewController
                                    forVoucher:(nonnull VOVoucher *)voucher
                                  onCompletion:
                                      (nonnull void (^)(
                                          NSDictionary<NSString *, id> *_Nullable,
                                          NSError *_Nullable))completion;

    Swift

    func approvePaymentInfo(on viewController: UIViewController, for voucher: VOVoucher, onCompletion completion: @escaping ([String : Any]?, Error?) -> Void)

    Parameters

    viewController

    - the current top view controller. If a view controller needs to be presented to retrieve approval information, it should be presented on this view controller.

    voucher

    - The voucher that needs to be approved

    completion

    - Completion block to be executed when the approval information has been obtained. Supply a dictionary with payment info as the paymentInfo. This will be used in the activateVoucher call. Pass nill if the user has cancelled the collection of the approval information. Supply an error if an error has occurred or nil if there was no error.

  • This delegate method is called when a user needs to be logged in to proceed with the flow. Users can start with creation of a voucher without being logged in, but must be logged in to send it.

    Note

    This callback will occur if the VOUserManager in the CreationManager returns false for isLoggedIn.

    Declaration

    Objective-C

    - (void)showLoginOnViewController:(nonnull UIViewController *)viewController
                         onCompletion:
                             (nonnull void (^)(NSError *_Nullable))completion;

    Swift

    func showLogin(on viewController: UIViewController, onCompletion completion: @escaping (Error?) -> Void)

    Parameters

    viewController

    - the current top viewController. If a loginViewController needs to be presented as part of login, it should be presented on this viewController.

    completion

    - completionBlock when login has completed. If an error occurred it will be returned in the completion block. This completion block does not need to be called, however it is recommended that it should be.

  • This delegate method is called when the user has completed their actions for the current screen. Implement the dismissal of the view controller currently being displayed.

    Declaration

    Objective-C

    - (void)dismissPresentedViewControllerAnimated:(BOOL)animated
                                        completion:
                                            (nullable void (^)(void))completion;

    Swift

    func dismissPresentedViewController(animated: Bool, completion: (() -> Void)? = nil)

    Parameters

    animated

    - If the dismissal of the presented view controller should have animation.

    completion

    - The completion block to be executed after the dismissal of the presented view controller.

  • This delegate method is called when the user presses the preview button. If no preview should be shown or the default preview should be used, don’t implement this method.

    Declaration

    Objective-C

    - (nonnull UIViewController *)previewViewControllerForVoucher:
        (nonnull VOVoucher *)voucher;

    Swift

    optional func previewViewController(for voucher: VOVoucher) -> UIViewController
  • This delegate method is called when a personalization screen needs to be displayed to the user. If a nil object is returned, the default implementation of the personalization screen will be used.

    Declaration

    Objective-C

    - (nullable UIViewController<VOPersonalizationOptionViewControllerProtocol> *)
        personalizationViewControllerForPersonalizationOption:
            (nonnull VOPersonalizationOption *)personalizationOption;

    Swift

    optional func personalizationViewController(for personalizationOption: VOPersonalizationOption) -> (UIViewController & VOPersonalizationOptionViewControllerProtocol)?

    Parameters

    personalizationOption

    - the personalization option that has been selected by the user.

    Return Value

    - The view controller returned must adhere to VOPersonalizationOptionViewControllerProtocol

  • This delegate method is called after a personalization screen completes with a personalizedObject. If using a non-default Personalization View Controller, it is recommended implementing this method. This method can still be overridden if using a default Personalization View Controller, if you want something other than the default VOCreationItemView.

    Declaration

    Objective-C

    - (nullable VOCreationItemView *)
        creationItemViewForPersonalizationOption:
            (nonnull VOPersonalizationOption *)personalizationOption
                              personalizedObject:(nonnull id)personalizedObject;

    Swift

    optional func creationItemView(for personalizationOption: VOPersonalizationOption, personalizedObject: Any) -> VOCreationItemView?

    Parameters

    personalizationOption

    - the personalization option that was selected by the user.

    personalizedObject

    - the object returned by the Personalization View Controller.

    Return Value

    VOCreationItemView - the VOCreationItemView to be dropped in the EnvelopeView. Nil if the default should be used.

  • This delegate method is called when the default summary screen is displayed to the user. The summary screen requires an array of data sources, each representing sections of cells in the tableView. They will be displayed in the default summary screen in the order given. Custom data sources & cells can be added as long as they follow the VOSectionDataSourceProtocol.

    @note If this method is not implemented, or if nil is returned, it will use the default data sources: 1) VOSummaryScreenClaimerInfoDataSource - shows who the gift is being sent to (if there is one) - shows when the gift is claimable 2) VOSummaryScreenPriceDataSource - shows the gift card envelope - shows the amount, fees and total cost - shows any credits used (if any were used) - shows who the gift is visible to 3) VOSummaryScreenPaymentDataSource - shows which credit card will be used (last 4 digits and type of card) if a credit card is provided 4) VOSummaryScreenEndInfoDataSource - shows where the receipt is being emailed to - shows legal disclaimerText if any is in the VOVoucher - shows terms and conditions if any is in the VOVoucher - shows cardHolderAgreementUrl if one is in the VOVoucher

    Declaration

    Objective-C

    - (nonnull NSArray<id<VOSectionDataSourceProtocol>> *)
        summaryScreenDataSourcesForVoucher:(nonnull VOVoucher *)voucher;
  • This delegate method is called when a summary screen needs to be displayed to the user. If a nil object is returned, the default implementation will be used

    Declaration

    Objective-C

    - (nonnull UIViewController<VOVoucherSummaryScreenProtocol> *)
        summaryScreenViewControllerForVoucherPayment:
            (nonnull VOVoucherPayment *)payment
                                transitionController:
                                    (nullable NSObject<
                                        UIViewControllerAnimatedTransitioning> *)
                                        transitionController;

    Parameters

    payment

    - the payment type of the VOVoucher

    transitionController

    - the transition animator for displaying personalization screens.

  • Undocumented

    Declaration

    Objective-C

    - (void)customSummaryFlowForVoucher:(VOVoucher *)voucher onNavigationController:(UINavigationController *)navigationController;

    Swift

    optional func customSummaryFlow(for voucher: VOVoucher, on navigationController: UINavigationController)
  • This delegate will be called before the presentation of theVOSummaryScreenViewController. If this delegate is not implemented or this delegate returns NO, the terms and condition cell will not be shown.

    Declaration

    Objective-C

    - (BOOL)shouldShowTermsAndConditionsOnSummaryScreenForVoucher:
        (nonnull VOVoucher *)voucher;

    Swift

    optional func shouldShowTermsAndConditionsOnSummaryScreen(for voucher: VOVoucher) -> Bool

    Parameters

    voucher

    - The VOVoucher that is being displayed on the VOSummaryScreenViewController.

    Return Value

    YES if the default summary screen should, NO otherwise.

  • This delegate will be called if the user taps on the Terms And Conditions cell of the VOSummaryScreenViewController.

    Declaration

    Objective-C

    - (void)showTermsAndConditions:(nonnull NSString *)termsAndConditions
                  onViewController:(nonnull UIViewController *)viewController;

    Swift

    optional func showTermsAndConditions(_ termsAndConditions: String, on viewController: UIViewController)

    Parameters

    termsAndConditions

    - The terms and conditions string found inside the VOVoucher.

    viewController

    - The top most view controller that can be presented on.

  • This delegate method is called before the network request to the Vouchr server is made to create a voucher.

    Note

    Creating a voucher puts it in a ‘pending’ state. The contents of the voucher will be validated, payment requirements and fees will be added, and the voucher will be saved in the Vouchr database.

    Declaration

    Objective-C

    - (void)voucherCreationVoucherWillCreate:(nonnull VOMutableVoucher *)voucher;

    Swift

    optional func voucherCreationVoucherWillCreate(_ voucher: VOMutableVoucher)

    Parameters

    voucher

    - This is the voucher that will be sent to the server for validation. Can be modified before being sent.

  • This delegate method is called when a merchant is required to present a disclaimer to the user.

    Declaration

    Objective-C

    - (void)productDetailsViewController:(nonnull UIViewController *)viewController
        showDisclaimerForPaymentMerchantInfo:
            (nonnull VOPaymentMerchantInfo *)paymentMerchantInfo
                              withCompletion:(nonnull void (^)(void))onCompletion;

    Swift

    optional func productDetailsViewController(_ viewController: UIViewController, showDisclaimerFor paymentMerchantInfo: VOPaymentMerchantInfo, withCompletion onCompletion: @escaping () -> Void)

    Parameters

    viewController

    - the view controller that informs the delegate of this impending event and presents the disclaimer

    paymentMerchantInfo

    - VOPaymentMerchantInfo of the merchant requesting the user to accept the terms of agreement.

    onCompletion

    - completion block that is called when the disclaimer is accepted/dismissed

  • This delegate method is called to setup the card views in the VOProductDetailsViewController.

    Declaration

    Objective-C

    - (BOOL)productDetailsViewController:(nonnull UIViewController *)viewController
        shouldShowOverlayingCardsForPaymentMerchantInfo:
            (nonnull VOPaymentMerchantInfo *)paymentMerchantInfo;

    Swift

    optional func productDetailsViewController(_ viewController: UIViewController, shouldShowOverlayingCardsFor paymentMerchantInfo: VOPaymentMerchantInfo) -> Bool

    Parameters

    viewController

    - the view controller informing the delegate of this impending event.

    paymentMerchantInfo

    - details of the merchant that will be presented to the user.

    Return Value

    - whether or not a secondary overlaying card view is presented.

  • This delegate method is called after the network request to the Vouchr server is made to wrap a voucher completes successfully.

    Declaration

    Objective-C

    - (void)voucherCreationVoucherWrapCompleted:(nonnull VOVoucher *)voucher;

    Swift

    optional func voucherCreationVoucherWrapCompleted(_ voucher: VOVoucher)

    Parameters

    voucher

    - The finalized voucher returned from the server.

  • This delegate method is called if the network request to the Vouchr server fails during validation.

    Declaration

    Objective-C

    - (void)voucherCreationVoucherWrapFailedWithError:(nonnull NSError *)error;

    Swift

    optional func voucherCreationVoucherWrapFailedWithError(_ error: Error)

    Parameters

    error

    - The error returned from the server.

  • This delegate method is called when the user has selected an voucher template in the discovery screen

    Declaration

    Objective-C

    - (void)discoverViewController:
                (nonnull UIViewController<VODiscoverScreenViewControllerProtocol> *)
                    discoverViewController
        didSelectVoucherTemplateWithMutableVoucher:
            (nonnull VOMutableVoucher *)mutableVoucher;

    Swift

    optional func discover(_ discoverViewController: UIViewController & VODiscoverScreenViewControllerProtocol, didSelectVoucherTemplateWith mutableVoucher: VOMutableVoucher)

    Parameters

    discoverViewController

    - the discovery screen that was displaying the voucher templates

    mutableVoucher

    - the VOMutableVoucher for the voucher template that was selected

  • This delegate method is called before the network request to the VOVoucher server is made to activate a voucher. Activating a voucher will process the payment, put the voucher in an active state, and notify the claimer(s) they have been sent a voucher.

    Declaration

    Objective-C

    - (void)voucherCreationVoucherWillActivate:(nonnull VOVoucher *)voucher;

    Swift

    optional func voucherCreationVoucherWillActivate(_ voucher: VOVoucher)

    Parameters

    voucher

    - The voucher that is being activated.

  • This delegate method is called when a voucher is activated successfully.

    Declaration

    Objective-C

    - (void)voucherCreationVoucherActivationCompleted:(nonnull VOVoucher *)voucher;

    Swift

    optional func voucherCreationVoucherActivationCompleted(_ voucher: VOVoucher)

    Parameters

    voucher

    - The voucher that was activated.

  • This delegate method is called if the network request to the Vouchr server fails when activating a voucher.

    Declaration

    Objective-C

    - (void)voucherCreationVoucherActivationFailedWithError:
        (nonnull NSError *)error;

    Swift

    optional func voucherCreationVoucherActivationFailedWithError(_ error: Error)

    Parameters

    error

    - The error returned from the server.

  • This delegate method is called by the voucher creation flow coordinator when attempting to initialize its creation view controller property. If it is not implemented, the flow coordinator will use the default creation view controller. Only implement this method if you want to use a custom creation view controller. This method is used to setup and configure your custom creation view controller.

    Declaration

    Objective-C

    - (nonnull UIViewController<VOVoucherCreationViewControllerProtocol> *)
        customCreationViewController;

    Swift

    optional func customCreationViewController() -> UIViewController & VOVoucherCreationViewControllerProtocol
  • This delegate method is called by the voucher creation flow coordinator when attempting to initialize its discover view controller property. If it is not implemented, the flow coordinator will use the default discover view controller. Only implement this method if you want to use a custom discover view controller. This method is used to setup and configure your custom discover view controller.

    Declaration

    Objective-C

    - (nonnull UIViewController<VODiscoverScreenViewControllerProtocol> *)
        customDiscoverViewController;

    Swift

    optional func customDiscoverViewController() -> UIViewController & VODiscoverScreenViewControllerProtocol
  • This delegate method is called when the user opens the recipient friend selection screen. Implement it to fetch your own users.

    Declaration

    Objective-C

    - (void)getRecipientsOnSuccess:
                (nonnull void (^)(NSArray<VOUser *> *_Nonnull))onSuccess
                           onError:(nonnull void (^)(void))onError;

    Swift

    optional func getRecipientsOnSuccess(_ onSuccess: @escaping ([VOUser]) -> Void, onError: @escaping () -> Void)