Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Jan 28, 2020
1 parent d846b4e commit f1e64d7
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 20 deletions.
5 changes: 3 additions & 2 deletions doc/stripe_example_go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.13

require (
github.com/chromedp/chromedp v0.5.2
github.com/ysmood/digto v1.4.4
github.com/ysmood/kit v0.18.0
github.com/ysmood/digto v1.5.4
github.com/ysmood/kit v0.19.1
github.com/ysmood/rod v0.0.1
)
14 changes: 14 additions & 0 deletions doc/stripe_example_go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvF
github.com/bmatcuk/doublestar v1.1.4/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
github.com/bmatcuk/doublestar v1.2.1 h1:eetYiv8DDYOZcBADY+pRvRytf3Dlz1FhnpvL2FsClBc=
github.com/bmatcuk/doublestar v1.2.1/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c=
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU=
github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
Expand Down Expand Up @@ -159,6 +162,8 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORR
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down Expand Up @@ -216,6 +221,7 @@ github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA=
github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ=
github.com/mafredri/cdp v0.25.0/go.mod h1:hgdiA0yp1uqhSaDOHJWPgXpMbh+LAfUdD9vbN2AM8gE=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM=
github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=
Expand Down Expand Up @@ -361,13 +367,21 @@ github.com/ysmood/ddns v0.1.1 h1:TWq8B9VX9A6cO1RTgHYN9n/q2DiQOUgmJkr/nCGjw4M=
github.com/ysmood/ddns v0.1.1/go.mod h1:vvgR64LsRX85vFdcBbjGzffj+bhLuUha/Nm5kqOMT14=
github.com/ysmood/digto v1.4.4 h1:ltDr0ADb95zpOY5oOhDr4RHjqUFojrtRoLMBnDmt7cw=
github.com/ysmood/digto v1.4.4/go.mod h1:W7WwqObE1nsfCe1hdB6jj47IWM7+ewLb1HxyEy60RmA=
github.com/ysmood/digto v1.5.4 h1:ARPGL7orDDH32AjSA2IAcz8jbQ/9/W15+UjEJ8w/uLg=
github.com/ysmood/digto v1.5.4/go.mod h1:W7WwqObE1nsfCe1hdB6jj47IWM7+ewLb1HxyEy60RmA=
github.com/ysmood/kit v0.15.0/go.mod h1:CTrwSW71fHHXFKSCEs8iYWqR1R4xsD+4JbPbGi4PCuQ=
github.com/ysmood/kit v0.17.1/go.mod h1:vlMfce6eL0jSqDkYtUXid4VPvA5Cw+CwfiYHwv1iMVA=
github.com/ysmood/kit v0.18.0 h1:745mpPMpiXSVU+WhRDKk7npWHEQfiLvTUzXGODNUb7U=
github.com/ysmood/kit v0.18.0/go.mod h1:vlMfce6eL0jSqDkYtUXid4VPvA5Cw+CwfiYHwv1iMVA=
github.com/ysmood/kit v0.19.1 h1:C23oppqRpmlqyrVcC/EFWXu5VlBvD4UeRjAAR1IAUlo=
github.com/ysmood/kit v0.19.1/go.mod h1:q+qlHOnimF2fjHkJpjySiIWePM8pplsZLVxGnPIMkc8=
github.com/ysmood/lookpath v1.1.0 h1:heliJRj3thM8qw7236g5qDeI+vKELGndm+SWzwjxHqI=
github.com/ysmood/lookpath v1.1.0/go.mod h1:QQh4rXcDdYAacpl7Q8cgZqkf+NRMJ4wc+lpQp0FgW+0=
github.com/ysmood/myip v0.0.0-20190514144300-6576fde8f6c5/go.mod h1:bFlhE3USBVqP9q8XUaZZhU/Z1yUZ7cjXlXeitobanxk=
github.com/ysmood/myip v0.0.1 h1:DXeaHpZSY3BTvpSbfTokeqowRwNi3CsjLCsrrqzOWCY=
github.com/ysmood/myip v0.0.1/go.mod h1:bFlhE3USBVqP9q8XUaZZhU/Z1yUZ7cjXlXeitobanxk=
github.com/ysmood/rod v0.0.1 h1:pKzE6I+cbZ3h+9DqSmqpvx5z+UrHKtrl+ajHzVayH8Y=
github.com/ysmood/rod v0.0.1/go.mod h1:AYEUUZd0mfJ5DrAskU//M6VYaN5a7dUGPGDSSrg95eQ=
github.com/ysmood/storer v0.1.0 h1:1YnvBMt/3gAmiHmVulyglISoONpm19sORj8ftntPOio=
github.com/ysmood/storer v0.1.0/go.mod h1:OeEhi6VGU4OqcrVDneGleAsGBR6Dj60zS8MR+xRnfYU=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
Expand Down
26 changes: 10 additions & 16 deletions doc/stripe_example_go/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package main

import (
"context"

"github.com/chromedp/chromedp"
digto "github.com/ysmood/digto/client"
"github.com/ysmood/kit"
"github.com/ysmood/rod"
)

func main() {
Expand All @@ -20,8 +18,6 @@ func main() {
},
).MustJSON().Get("id").String()

kit.Log("get card token:", token)

url := req("https://api.stripe.com/v1/payment_intents").Post().Form(
"amount", "2000",
"currency", "usd",
Expand All @@ -35,18 +31,16 @@ func main() {
"return_url", dig.PublicURL(),
).MustJSON().Get("next_action.redirect_to_url.url").String()

kit.Log("get 3ds auth url:", url)

// handle the callback from stripe
go dig.One(func(ctx kit.GinContext) {
ctx.Writer.WriteString(`<html><body id="done-3ds">ok</body></html>`)
})

ctx, _ := chromedp.NewContext(context.Background())
browser := rod.Open(nil)
defer browser.Close()
browser.Page(url).
Element("[name=__privateStripeFrame4]").Frame().
Element("#challengeFrame").Frame().
Element("#test-source-authorize-3ds").Click()

kit.E(chromedp.Run(ctx,
chromedp.Navigate(url),
))
_, res, err := dig.Next()
kit.E(err)
kit.E(res(200, nil, nil))
}

func req(url string) *kit.ReqContext {
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ require (
github.com/go-acme/lego/v3 v3.2.0
github.com/stretchr/testify v1.4.0
github.com/ysmood/ddns v0.1.1
github.com/ysmood/kit v0.17.1
github.com/ysmood/kit v0.19.1
github.com/ysmood/myip v0.0.1
github.com/ysmood/storer v0.1.0
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 // indirect
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ github.com/ysmood/ddns v0.1.1/go.mod h1:vvgR64LsRX85vFdcBbjGzffj+bhLuUha/Nm5kqOM
github.com/ysmood/kit v0.15.0/go.mod h1:CTrwSW71fHHXFKSCEs8iYWqR1R4xsD+4JbPbGi4PCuQ=
github.com/ysmood/kit v0.17.1 h1:LH7WTjXeBu6hGZ8a3HVtp0KJxuyyQYdEIoIxbTSjTi0=
github.com/ysmood/kit v0.17.1/go.mod h1:vlMfce6eL0jSqDkYtUXid4VPvA5Cw+CwfiYHwv1iMVA=
github.com/ysmood/kit v0.19.1 h1:C23oppqRpmlqyrVcC/EFWXu5VlBvD4UeRjAAR1IAUlo=
github.com/ysmood/kit v0.19.1/go.mod h1:q+qlHOnimF2fjHkJpjySiIWePM8pplsZLVxGnPIMkc8=
github.com/ysmood/lookpath v1.1.0 h1:heliJRj3thM8qw7236g5qDeI+vKELGndm+SWzwjxHqI=
github.com/ysmood/lookpath v1.1.0/go.mod h1:QQh4rXcDdYAacpl7Q8cgZqkf+NRMJ4wc+lpQp0FgW+0=
github.com/ysmood/myip v0.0.0-20190514144300-6576fde8f6c5/go.mod h1:bFlhE3USBVqP9q8XUaZZhU/Z1yUZ7cjXlXeitobanxk=
github.com/ysmood/myip v0.0.1 h1:DXeaHpZSY3BTvpSbfTokeqowRwNi3CsjLCsrrqzOWCY=
github.com/ysmood/myip v0.0.1/go.mod h1:bFlhE3USBVqP9q8XUaZZhU/Z1yUZ7cjXlXeitobanxk=
Expand Down Expand Up @@ -428,6 +432,8 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449 h1:gSbV7h1NRL2G1xTg/owz62CST1oJBmxy4QpMMregXVQ=
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
Expand Down
2 changes: 1 addition & 1 deletion server/version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package server

// Version ...
const Version = "v1.5.4"
const Version = "v1.5.5"

0 comments on commit f1e64d7

Please sign in to comment.