Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PaymentServer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Administrator
PaymentServer
Commits
8a0a8aa4
Unverified
Commit
8a0a8aa4
authored
4 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
uglify for haddock
parent
be445627
No related branches found
Branches containing commit
No related tags found
1 merge request
!54
The backend logic to make different counter values distinct
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/PaymentServer/Persistence.hs
+19
-17
19 additions, 17 deletions
src/PaymentServer/Persistence.hs
with
19 additions
and
17 deletions
src/PaymentServer/Persistence.hs
+
19
−
17
View file @
8a0a8aa4
...
@@ -201,23 +201,25 @@ getVoucherCounterForFingerprint dbConn fingerprint =
...
@@ -201,23 +201,25 @@ getVoucherCounterForFingerprint dbConn fingerprint =
-- | Allow a voucher to be redeemed if it has been paid for and not redeemed
-- | Allow a voucher to be redeemed if it has been paid for and not redeemed
-- before or redeemed with the same fingerprint.
-- before or redeemed with the same fingerprint.
redeemVoucherHelper
redeemVoucherHelper
-- | Has the given voucher been paid for?
::
(
Voucher
->
IO
Bool
)
-- ^ Has the given voucher been
::
(
Voucher
->
IO
Bool
)
-- paid for?
-- | If it has been redeemed, with what fingerprint?
->
(
RedemptionKey
->
IO
(
Maybe
Fingerprint
))
-- ^ If it has been redeemed,
->
(
RedemptionKey
->
IO
(
Maybe
Fingerprint
))
-- with what fingerprint?
-- | What redemption attempt has the given fingerprint been used with
->
(
Fingerprint
->
IO
(
Maybe
RedemptionKey
))
-- ^ What redemption attempt
-- before, if any?
-- has the given fingerprint
->
(
Fingerprint
->
IO
(
Maybe
RedemptionKey
))
-- been used with before, if
-- | Mark the redemption as successful.
-- any?
->
(
RedemptionKey
->
Fingerprint
->
IO
()
)
->
(
RedemptionKey
->
Fingerprint
->
IO
()
)
-- ^ Mark the redemption as
-- | The voucher being used in this attempt.
-- successful.
->
Voucher
->
Voucher
-- ^ The voucher being used in
-- | The counter being used in this account.
-- this attempt.
->
Integer
->
Integer
-- ^ The counter being used in
-- | The fingerprint of the this attempt.
-- this account.
->
Fingerprint
->
Fingerprint
-- ^ The fingerprint of the
-- | Right for successful redemption, left with details about why it failed.
-- this attempt.
->
IO
(
Either
RedeemError
()
)
->
IO
(
Either
RedeemError
()
)
-- ^ Right for successful
-- redemption, left with
-- details about why it failed.
redeemVoucherHelper
isVoucherPaid
lookupFingerprint
lookupVoucherCounter
markVoucherRedeemed
voucher
counter
fingerprint
=
do
redeemVoucherHelper
isVoucherPaid
lookupFingerprint
lookupVoucherCounter
markVoucherRedeemed
voucher
counter
fingerprint
=
do
paid
<-
isVoucherPaid
voucher
paid
<-
isVoucherPaid
voucher
priorUse
<-
lookupVoucherCounter
fingerprint
priorUse
<-
lookupVoucherCounter
fingerprint
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment