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
ded42e07
Commit
ded42e07
authored
5 years ago
by
Ramakrishnan Muthukrishnan
Browse files
Options
Downloads
Patches
Plain Diff
add a commandline parameter to take in the stripe API key
parent
7d58f8a1
No related branches found
Branches containing commit
No related tags found
1 merge request
!30
Expose a browser facing API for charge
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/PaymentServer/Main.hs
+9
-2
9 additions, 2 deletions
src/PaymentServer/Main.hs
src/PaymentServer/Server.hs
+8
-5
8 additions, 5 deletions
src/PaymentServer/Server.hs
with
17 additions
and
7 deletions
src/PaymentServer/Main.hs
+
9
−
2
View file @
ded42e07
...
...
@@ -11,6 +11,8 @@ import Text.Printf
)
import
Data.Maybe
(
maybeToList
import
Data
.
ByteString
(
ByteString
)
import
Data
.
Text
(
Text
...
...
@@ -90,6 +92,7 @@ data ServerConfig = ServerConfig
,
database
::
Database
,
databasePath
::
Maybe
Text
,
endpoint
::
Endpoint
,
stripeKey
::
ByteString
}
deriving
(
Show
,
Eq
)
...
...
@@ -159,7 +162,9 @@ sample = ServerConfig
<>
help
"
Path
to
on
-
disk
database
(
sqlite3
only
)
"
<>
showDefault
)
)
<*>
(
http
<|>
https
)
<*>
option
str
(
long
"
stripe
-
key
"
<>
help
"
Stripe
API
key
"
)
opts
::
ParserInfo
ServerConfig
opts
=
info
(
sample
<**>
helper
)
...
...
@@ -221,6 +226,8 @@ getApp config =
exitFailure
Right
getDB
->
do
db
<-
getDB
let
app
=
paymentServerApp
issuer
db
let
port
=
8081
let
key
=
stripeKey
config
let
app
=
paymentServerApp
key
issuer
db
logger
<-
mkRequestLogger
(
def
{
outputFormat
=
Detailed
True
}
)
return
$
logger
app
This diff is collapsed.
Click to expand it.
src/PaymentServer/Server.hs
+
8
−
5
View file @
ded42e07
...
...
@@ -8,6 +8,9 @@ module PaymentServer.Server
(
paymentServerApp
)
where
import
Data.ByteString
(
ByteString
)
import
Servant
(
Proxy
(
Proxy
)
,
Server
...
...
@@ -37,9 +40,9 @@ type PaymentServerAPI
:<|>
"v1"
:>
"redeem"
:>
RedemptionAPI
-- | Create a server which uses the given database.
paymentServer
::
VoucherDatabase
d
=>
Issuer
->
d
->
Server
PaymentServerAPI
paymentServer
issuer
database
=
stripeServer
database
"test"
paymentServer
::
VoucherDatabase
d
=>
ByteString
->
Issuer
->
d
->
Server
PaymentServerAPI
paymentServer
key
issuer
database
=
stripeServer
database
key
:<|>
redemptionServer
issuer
database
paymentServerAPI
::
Proxy
PaymentServerAPI
...
...
@@ -47,5 +50,5 @@ paymentServerAPI = Proxy
-- | Create a Servant Application which serves the payment server API using
-- the given database.
paymentServerApp
::
VoucherDatabase
d
=>
Issuer
->
d
->
Application
paymentServerApp
issuer
=
serve
paymentServerAPI
.
paymentServer
issuer
paymentServerApp
::
VoucherDatabase
d
=>
ByteString
->
Issuer
->
d
->
Application
paymentServerApp
key
issuer
=
serve
paymentServerAPI
.
paymentServer
key
issuer
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