Listening to Events
The CreateFlowListener
can be added to listen to vouchr create events. During CreateConfiguration
setup we can create:
class VoucherCreateFlowListener implements CreateFlowListener {
public void voucherWillCreate(PendingVoucher voucher) {}
public void voucherCreateCompleted(Voucher voucher) {}
public void voucherCreateFailed(Throwable throwable) {}
public void voucherWillActivate(Voucher voucher) {}
public void voucherActivationCompleted(Voucher voucher) {}
public void voucherActivationFailed(Throwable throwable) {}
}
class VoucherCreateFlowListener : CreateFlowListener {
fun voucherWillCreate(voucher: PendingVoucher) {}
fun voucherCreateCompleted(voucher: Voucher) {}
fun voucherCreateFailed(throwable: Throwable) {}
fun voucherWillActivate(voucher: Voucher) {}
fun voucherActivationCompleted(voucher: Voucher) {}
fun voucherActivationFailed(throwable: Throwable) {}
}
And then add it to the CreateConfiguration
:
CreateConfiguration createConfiguration = new CreateConfiguration.Builder(context);
createConfiguration.setCreateFlowListener(createListener);
val createConfiguration = CreateConfiguration.Builder(context)
createConfiguration.setCreateFlowListener(createListener)