Skip to content
Snippets Groups Projects
Commit c17a3779 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Parameterize token count in redeem

Probably useful for implementation later.
Useful for test suite right now.
parent c61727fb
No related branches found
No related tags found
1 merge request!59Unblinded token web interface
...@@ -389,9 +389,11 @@ class PaymentController(object): ...@@ -389,9 +389,11 @@ class PaymentController(object):
store = attr.ib() store = attr.ib()
redeemer = attr.ib() redeemer = attr.ib()
def redeem(self, voucher): def redeem(self, voucher, num_tokens=100):
""" """
:param unicode voucher: A voucher to redeem. :param unicode voucher: A voucher to redeem.
:param int num_tokens: A number of tokens to redeem.
""" """
# Pre-generate the random tokens to use when redeeming the voucher. # Pre-generate the random tokens to use when redeeming the voucher.
# These are persisted with the voucher so the redemption can be made # These are persisted with the voucher so the redemption can be made
...@@ -403,7 +405,7 @@ class PaymentController(object): ...@@ -403,7 +405,7 @@ class PaymentController(object):
# number of passes that can be constructed is still only the size of # number of passes that can be constructed is still only the size of
# the set of random tokens. # the set of random tokens.
self._log.info("Generating random tokens for a voucher ({voucher}).", voucher=voucher) self._log.info("Generating random tokens for a voucher ({voucher}).", voucher=voucher)
tokens = self.redeemer.random_tokens_for_voucher(Voucher(voucher), 100) tokens = self.redeemer.random_tokens_for_voucher(Voucher(voucher), num_tokens)
# Persist the voucher and tokens so they're available if we fail. # Persist the voucher and tokens so they're available if we fail.
self._log.info("Persistenting random tokens for a voucher ({voucher}).", voucher=voucher) self._log.info("Persistenting random tokens for a voucher ({voucher}).", voucher=voucher)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment