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
ff5d33a8
Commit
ff5d33a8
authored
5 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
mostly hlint cleanups
parent
36670d1b
No related branches found
No related tags found
1 merge request
!2
Stripe webhook
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/SpecStripe.hs
+5
-4
5 additions, 4 deletions
test/SpecStripe.hs
test/Util/Gen.hs
+13
-13
13 additions, 13 deletions
test/Util/Gen.hs
with
18 additions
and
17 deletions
test/SpecStripe.hs
+
5
−
4
View file @
ff5d33a8
...
@@ -25,11 +25,12 @@ import Test.Hspec.Wai
...
@@ -25,11 +25,12 @@ import Test.Hspec.Wai
,
liftIO
,
liftIO
)
)
import
Test.Hspec.Wai.QuickCheck
import
Test.Hspec.Wai.QuickCheck
(
-- Get Test.QuickCheck.Property.Testable instance for WaiExpectation
(
property
property
)
)
import
Test.QuickCheck
import
Test.QuickCheck
(
generate
(
Property
,
generate
,
forAll
)
)
import
Util.WAI
import
Util.WAI
(
postJSON
(
postJSON
...
@@ -61,7 +62,7 @@ spec_webhook = with (return app) $
...
@@ -61,7 +62,7 @@ spec_webhook = with (return app) $
spec_webhook'
::
Spec
spec_webhook'
::
Spec
spec_webhook'
=
with
(
return
app
)
$
spec_webhook'
=
with
(
return
app
)
$
describe
"success behavior of POST /webhook"
$
do
describe
"success behavior of POST /webhook"
$
it
"responds to a JSON Event body with 200 (OK)"
$
do
it
"responds to a JSON Event body with 200 (OK)"
$
do
event
<-
liftIO
aChargeEvent
event
<-
liftIO
aChargeEvent
postJSON
"/webhook"
event
`
shouldRespondWith
`
200
postJSON
"/webhook"
event
`
shouldRespondWith
`
200
This diff is collapsed.
Click to expand it.
test/Util/Gen.hs
+
13
−
13
View file @
ff5d33a8
...
@@ -50,24 +50,24 @@ import Test.QuickCheck.Instances.Text
...
@@ -50,24 +50,24 @@ import Test.QuickCheck.Instances.Text
instance
Arbitrary
Charge
where
instance
Arbitrary
Charge
where
arbitrary
=
Charge
arbitrary
=
Charge
<$>
arbitrary
-- chargeId :: ChargeId
<$>
arbitrary
-- chargeId :: ChargeId
<*>
(
return
"charge"
)
-- chargeObject :: Text
<*>
return
"charge"
-- chargeObject :: Text
<*>
arbitrary
-- chargeCreated :: UTCTime
<*>
arbitrary
-- chargeCreated :: UTCTime
<*>
arbitrary
-- chargeLiveMode :: Bool
<*>
arbitrary
-- chargeLiveMode :: Bool
<*>
arbitrary
-- chargePaid :: Bool
<*>
arbitrary
-- chargePaid :: Bool
<*>
arbitrary
-- chargeAmount :: Amount
<*>
arbitrary
-- chargeAmount :: Amount
<*>
(
return
UnknownCurrency
)
-- chargeCurrency :: Currency
<*>
return
UnknownCurrency
-- chargeCurrency :: Currency
<*>
(
return
False
)
-- chargeRefunded :: Bool
<*>
return
False
-- chargeRefunded :: Bool
<*>
(
return
Nothing
)
-- chargeCreditCard :: Maybe Card
<*>
return
Nothing
-- chargeCreditCard :: Maybe Card
<*>
arbitrary
-- chargeCaptured :: Bool
<*>
arbitrary
-- chargeCaptured :: Bool
<*>
(
return
mempty
)
-- chargeRefunds :: StripeList Refund
<*>
return
mempty
-- chargeRefunds :: StripeList Refund
<*>
(
return
Nothing
)
-- chargeBalanceTransaction :: Maybe (Expandable TransactionId)
<*>
return
Nothing
-- chargeBalanceTransaction :: Maybe (Expandable TransactionId)
<*>
(
return
Nothing
)
-- chargeFailureMessage :: Maybe Text
<*>
return
Nothing
-- chargeFailureMessage :: Maybe Text
<*>
(
return
Nothing
)
-- chargeFailureCode :: Maybe Text
<*>
return
Nothing
-- chargeFailureCode :: Maybe Text
<*>
(
return
0
)
-- chargeAmountRefunded :: Int
<*>
return
0
-- chargeAmountRefunded :: Int
<*>
arbitrary
-- chargeCustomerId :: Maybe (Expandable CustomerId)
<*>
arbitrary
-- chargeCustomerId :: Maybe (Expandable CustomerId)
<*>
(
return
Nothing
)
-- chargeInvoice :: Maybe (Expandable InvoiceId)
<*>
return
Nothing
-- chargeInvoice :: Maybe (Expandable InvoiceId)
<*>
arbitrary
-- chargeDescription :: Maybe Description
<*>
arbitrary
-- chargeDescription :: Maybe Description
<*>
(
return
Nothing
)
-- chargeDispute :: Maybe Dispute
<*>
return
Nothing
-- chargeDispute :: Maybe Dispute
<*>
arbitrary
-- chargeMetaData :: MetaData
<*>
arbitrary
-- chargeMetaData :: MetaData
<*>
arbitrary
-- chargeStatementDescription :: Maybe StatementDescription
<*>
arbitrary
-- chargeStatementDescription :: Maybe StatementDescription
<*>
arbitrary
-- chargeReceiptEmail :: Maybe Text
<*>
arbitrary
-- chargeReceiptEmail :: Maybe Text
...
@@ -123,10 +123,10 @@ chargeSucceededEvents =
...
@@ -123,10 +123,10 @@ chargeSucceededEvents =
<$>
arbitrary
-- eventId
<$>
arbitrary
-- eventId
<*>
arbitrary
-- eventCreated
<*>
arbitrary
-- eventCreated
<*>
arbitrary
-- eventLiveMode
<*>
arbitrary
-- eventLiveMode
<*>
(
return
ChargeSucceededEvent
)
-- eventType
<*>
return
ChargeSucceededEvent
-- eventType
<*>
(
ChargeEvent
<*>
(
ChargeEvent
<$>
arbitrary
-- the charge
<$>
arbitrary
-- the charge
)
-- eventData
)
-- eventData
<*>
(
return
"event"
)
-- eventObject
<*>
return
"event"
-- eventObject
<*>
arbitrary
-- eventPendingWebHooks
<*>
arbitrary
-- eventPendingWebHooks
<*>
arbitrary
-- eventRequest
<*>
arbitrary
-- eventRequest
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