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
4794d63b
Commit
4794d63b
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
hlint suggested improvements
parent
79abc9ea
No related branches found
No related tags found
1 merge request
!2
Stripe webhook
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/SpecPersistence.hs
+6
-7
6 additions, 7 deletions
test/SpecPersistence.hs
test/SpecStripe.hs
+1
-1
1 addition, 1 deletion
test/SpecStripe.hs
test/Util/Gen.hs
+2
-2
2 additions, 2 deletions
test/Util/Gen.hs
with
9 additions
and
10 deletions
test/SpecPersistence.hs
+
6
−
7
View file @
4794d63b
...
@@ -7,10 +7,6 @@
...
@@ -7,10 +7,6 @@
module
SpecPersistence
where
module
SpecPersistence
where
import
Test.QuickCheck
(
Property
,
(
==>
)
)
import
Control.Monad.IO.Class
import
Control.Monad.IO.Class
(
liftIO
(
liftIO
)
)
...
@@ -23,7 +19,9 @@ import Test.Hspec.Expectations
...
@@ -23,7 +19,9 @@ import Test.Hspec.Expectations
(
shouldReturn
(
shouldReturn
)
)
import
Test.QuickCheck
import
Test.QuickCheck
(
property
(
Property
,
property
,
(
==>
)
)
)
import
Test.QuickCheck.Monadic
import
Test.QuickCheck.Monadic
(
monadicIO
(
monadicIO
...
@@ -77,8 +75,9 @@ paidVoucherMismatchFingerprint getDB = property $ \voucher fingerprint fingerpri
...
@@ -77,8 +75,9 @@ paidVoucherMismatchFingerprint getDB = property $ \voucher fingerprint fingerpri
redeem
fingerprint'
`
shouldReturn
`
Left
AlreadyRedeemed
redeem
fingerprint'
`
shouldReturn
`
Left
AlreadyRedeemed
makeSpec
::
VoucherDatabase
d
=>
IO
d
->
Spec
makeSpec
::
VoucherDatabase
d
=>
IO
d
->
Spec
makeSpec
getDB
=
do
makeSpec
getDB
=
describe
"voucher interactions"
$
do
describe
"voucher interactions"
$
do
it
"denies redemption of a not-paid-for voucher"
$
unpaidVoucherNotRedeemable
getDB
it
"denies redemption of a not-paid-for voucher"
$
unpaidVoucherNotRedeemable
getDB
it
"allows redemption of paid-for vouchers"
$
paidVoucherRedeemable
getDB
it
"allows redemption of paid-for vouchers"
$
paidVoucherRedeemable
getDB
it
"allows multiple redemption as long as the same fingerprint is used"
$
paidVoucherMultiRedeemable
getDB
it
"allows multiple redemption as long as the same fingerprint is used"
$
paidVoucherMultiRedeemable
getDB
...
...
This diff is collapsed.
Click to expand it.
test/SpecStripe.hs
+
1
−
1
View file @
4794d63b
...
@@ -77,7 +77,7 @@ stripeAPI :: Proxy StripeAPI
...
@@ -77,7 +77,7 @@ stripeAPI :: Proxy StripeAPI
stripeAPI
=
Proxy
stripeAPI
=
Proxy
app
::
IO
Application
app
::
IO
Application
app
=
memory
>>=
return
.
stripeServer
>>=
return
.
serve
stripeAPI
app
=
serve
stripeAPI
.
stripeServer
<$>
memory
spec_webhook
::
Spec
spec_webhook
::
Spec
spec_webhook
=
with
app
$
do
spec_webhook
=
with
app
$
do
...
...
This diff is collapsed.
Click to expand it.
test/Util/Gen.hs
+
2
−
2
View file @
4794d63b
...
@@ -163,7 +163,7 @@ charges withVoucher =
...
@@ -163,7 +163,7 @@ charges withVoucher =
if
withVoucher
then
if
withVoucher
then
metaDatasWithVoucher
metaDatasWithVoucher
else
else
metaDatasWithVoucher
metaDatasWith
out
Voucher
)
-- chargeMetaData :: MetaData
)
-- chargeMetaData :: MetaData
<*>
arbitrary
-- chargeStatementDescription :: Maybe StatementDescription
<*>
arbitrary
-- chargeStatementDescription :: Maybe StatementDescription
<*>
arbitrary
-- chargeReceiptEmail :: Maybe Text
<*>
arbitrary
-- chargeReceiptEmail :: Maybe Text
...
@@ -184,4 +184,4 @@ posixTimes :: Gen UTCTime
...
@@ -184,4 +184,4 @@ posixTimes :: Gen UTCTime
posixTimes
=
(
arbitrary
::
Gen
Integer
)
`
suchThatMap
`
(
Just
.
posixSecondsToUTCTime
.
fromIntegral
.
abs
)
posixTimes
=
(
arbitrary
::
Gen
Integer
)
`
suchThatMap
`
(
Just
.
posixSecondsToUTCTime
.
fromIntegral
.
abs
)
hasVoucher
::
MetaData
->
Bool
hasVoucher
::
MetaData
->
Bool
hasVoucher
(
MetaData
items
)
=
any
(
==
"Voucher"
)
.
(
map
fst
)
$
items
hasVoucher
(
MetaData
items
)
=
elem
"Voucher"
.
map
fst
$
items
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