Pre-populating a Voucher
The Voucher Create Flow process can be started with personalizations already added. Some examples of prepopulating are:
- Creating a gift with a
Merchant
(eg. Gift Card). - Sending a gift to a specific
User
(ie. sending back to someone). - Sending an occasion with preset
VoucherMedia
s. (eg. Happy Birthday).
To pre-populate simply start the VoucherCreationFlowCoordinator
normally and then call populateWithVoucher
:
Example pre-population
// Prepopulate with wrapping paper, a game, and a couple of media items.
MutableVoucher *mutableVoucher = [MutableVoucher new];
mutableVoucher.wrappingPaper = defaultWrappingPaper;
mutableVoucher.gameData = [GameManager gameDatas].firstObject;
[mutableVoucher addMedia:[ImageMedia imageMediaWithId:0 data:imageData animated:NO width:300 height:300]];
[mutableVoucher addMedia:[[NoteMedia alloc] initWithText:@"Happy Birthday!" font:[UIFont systemFontOfSize:12] colorString:@"#ff00ff" angle:0 size:12]]];
[self.voucherCreationFlowCoordinator startFlowOnViewController:self
personalizationOptions:personalizationOptions
[self.voucherCreationFlowCoordinator populateWithVoucher:mutableVoucher];