first commit
This commit is contained in:
commit
9ecbfa46f6
|
@ -0,0 +1,4 @@
|
|||
.env
|
||||
.DS_Store
|
||||
.idea/
|
||||
/vendor
|
|
@ -0,0 +1,7 @@
|
|||
FROM golang:1.14-alpine
|
||||
WORKDIR /go/src/app
|
||||
COPY . .
|
||||
RUN go get -d -v ./...
|
||||
RUN go install -v ./...
|
||||
CMD ordercollector --port 8080
|
||||
EXPOSE 8080
|
|
@ -0,0 +1,15 @@
|
|||
module github.com/m3tam3re/ordercollect
|
||||
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/m3tam3re/billbee v0.0.0-20200707150247-cfde6c03164e
|
||||
github.com/m3tam3re/errors v0.0.0-20200201180145-8839297f2f86
|
||||
github.com/m3tam3re/real v0.0.0-20200505062805-1d10f352e5dc
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||
github.com/valyala/fastjson v1.5.1
|
||||
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 // indirect
|
||||
google.golang.org/protobuf v1.25.0 // indirect
|
||||
)
|
|
@ -0,0 +1,129 @@
|
|||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
|
||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||
github.com/m3tam3re/billbee v0.0.0-20200707150247-cfde6c03164e h1:mr7uePEPOE0Zf20cUcHs9xwy7SGBDcj2bm+Rr2+v/rQ=
|
||||
github.com/m3tam3re/billbee v0.0.0-20200707150247-cfde6c03164e/go.mod h1:PaCBQhMOCDETGEcPgE0PZ1kLXCVjfK4bRwQxt98M02s=
|
||||
github.com/m3tam3re/errors v0.0.0-20200201180145-8839297f2f86 h1:GbcmzYQLY16apF3GR6Bzw6Z5yW9Mwqc73KVmTzX/vEQ=
|
||||
github.com/m3tam3re/errors v0.0.0-20200201180145-8839297f2f86/go.mod h1:1bon6t0gY0+3z4B4THyiVwGeg8jt/IAPGunOY6hzD64=
|
||||
github.com/m3tam3re/real v0.0.0-20200505062805-1d10f352e5dc h1:daeTZ5nyPLDpSIT0bbmhOxFxUZ9k+5+82X7lpn59Oaw=
|
||||
github.com/m3tam3re/real v0.0.0-20200505062805-1d10f352e5dc/go.mod h1:fj8ESvsruNab9C8H12r/VhFbvz5F7iIWI1BVLqtk8p4=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||
github.com/valyala/fastjson v1.5.1 h1:SXaQZVSwLjZOVhDEhjiCcDtnX0Feu7Z7A1+C5atpoHM=
|
||||
github.com/valyala/fastjson v1.5.1/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
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/sys v0.0.0-20200501145240-bc7a7d42d5c3 h1:5B6i6EAiSYyejWfvc5Rc9BbI3rzIsrrXfAQBWnYfn+w=
|
||||
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
@ -0,0 +1,104 @@
|
|||
package billbee
|
||||
|
||||
import (
|
||||
"github.com/m3tam3re/billbee/api/orders"
|
||||
"github.com/m3tam3re/ordercollect/internal/models"
|
||||
"github.com/m3tam3re/ordercollect/internal/shopify"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Wk24ToBillbee(order models.Wk24order) error {
|
||||
now := time.Now()
|
||||
switch order.Country {
|
||||
case "Österreich":
|
||||
order.Country = "AT"
|
||||
case "Austria":
|
||||
order.Country = "AT"
|
||||
default:
|
||||
order.Country = "DE"
|
||||
}
|
||||
bOrder := orders.Order{
|
||||
OrderNumber: order.Orderid,
|
||||
CreatedAt: now.String()[:10],
|
||||
State: 3,
|
||||
VatMode: 0,
|
||||
InvoiceAddress: &orders.InvoiceAddress{
|
||||
Company: "Weltkarten24.Com",
|
||||
Street: "Münchener Str.",
|
||||
HouseNumber: "18",
|
||||
City: "Germering",
|
||||
Zip: "82110",
|
||||
Country: "DE",
|
||||
CountryISO2: "DE",
|
||||
FirstName: "Peter-Holger",
|
||||
LastName: "Grützner",
|
||||
Phone: "",
|
||||
Email: "orders@weltkarten24.com",
|
||||
},
|
||||
ShippingAddress: &orders.ShippingAddress{
|
||||
Company: order.Name,
|
||||
Street: order.Street,
|
||||
City: order.City,
|
||||
Zip: order.Zip,
|
||||
Country: order.Country,
|
||||
CountryISO2: order.Country,
|
||||
Phone: "",
|
||||
},
|
||||
ShippingCost: 0,
|
||||
PaymentMethod: 3,
|
||||
OrderItems: nil,
|
||||
Customer: &orders.Customer{
|
||||
Id: 73771747,
|
||||
Number: 602,
|
||||
Type: 0,
|
||||
Name: "Weltkarten24.com",
|
||||
Email: "orders@weltkarten24.com",
|
||||
Tel1: "",
|
||||
},
|
||||
}
|
||||
tempOrderItems := []*orders.OrderItem{}
|
||||
for _, item := range order.Items {
|
||||
price, err := shopify.GetItemPrice(item.Sku)
|
||||
if err != nil {
|
||||
//TODO handle error
|
||||
return err
|
||||
}
|
||||
tempOrderItems = append(tempOrderItems, &orders.OrderItem{
|
||||
Discount: 20,
|
||||
Product: &orders.Product{
|
||||
Title: item.Sku,
|
||||
},
|
||||
Quantity: float32(item.Quantity),
|
||||
TotalPrice: price * float32(item.Quantity),
|
||||
})
|
||||
|
||||
if order.Country != "DE" {
|
||||
|
||||
var total float32
|
||||
|
||||
for _, item := range bOrder.OrderItems {
|
||||
total = total + item.TotalPrice
|
||||
}
|
||||
|
||||
switch {
|
||||
case total < 25.01:
|
||||
bOrder.ShippingCost = 6.90
|
||||
case total > 25.00 && total < 150.00:
|
||||
bOrder.ShippingCost = 13.90
|
||||
case total > 150.00:
|
||||
bOrder.ShippingCost = 79.90
|
||||
default:
|
||||
bOrder.ShippingCost = 0.00
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
bOrder.OrderItems = tempOrderItems
|
||||
|
||||
//TODO groroutine
|
||||
err := bOrder.Create("69659")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
real "github.com/m3tam3re/real/supplierapi/orders"
|
||||
|
||||
"github.com/m3tam3re/ordercollect/internal/billbee"
|
||||
"github.com/m3tam3re/ordercollect/internal/models"
|
||||
)
|
||||
|
||||
func Addorders(ctx *gin.Context) {
|
||||
user := ctx.MustGet(gin.AuthUserKey).(string)
|
||||
log.Println("User: ", user)
|
||||
|
||||
var body []models.Wk24order
|
||||
data, err := ioutil.ReadAll(ctx.Request.Body)
|
||||
if err != nil {
|
||||
log.Panicf("error reading request body: %s", err)
|
||||
}
|
||||
err = json.Unmarshal(data, &body)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
var raw json.RawMessage
|
||||
err = json.Unmarshal(data, &raw)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
log.Println("JSON: ", string(raw))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
for _, order := range body {
|
||||
err := billbee.Wk24ToBillbee(order)
|
||||
time.Sleep(time.Second * 2)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
//TODO make sure the order is stored to Billbee
|
||||
}
|
||||
ctx.JSON(200, gin.H{
|
||||
"result": "success",
|
||||
})
|
||||
}
|
||||
func ConfirmRealShipment(ctx *gin.Context) {
|
||||
ro, err := real.GetOrder(ctx.Query("orderid"))
|
||||
log.Println(ro)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
// http://localhost:8080/real/confirmshipment?orderid=6193059&carrier=DPD&trackingid=01096812392974
|
||||
for _, u := range ro.Units {
|
||||
if ctx.Query("carrier") == "DPD" || ctx.Query("carrier") == "dpd" {
|
||||
u.ShipmentData.Carrier = "dpd"
|
||||
} else {
|
||||
u.ShipmentData.Carrier = "other"
|
||||
}
|
||||
if ctx.Query("trackingid") == "" {
|
||||
u.ShipmentData.TrackingNumber = "nicht vorhanden"
|
||||
}
|
||||
u.ShipmentData.DeliveryNoteNumber = "LS" + ctx.Query("orderid")
|
||||
u.ShipmentData.TrackingNumber = ctx.Query("trackingid")
|
||||
}
|
||||
err = ro.Send()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
// TODO
|
||||
ctx.JSON(500, gin.H{
|
||||
"result": err,
|
||||
})
|
||||
return
|
||||
}
|
||||
ctx.JSON(200, gin.H{
|
||||
"result": "success",
|
||||
})
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package models
|
||||
|
||||
type Wk24order struct {
|
||||
Orderid string `json:"orderid"`
|
||||
Items []Item `json:"items"`
|
||||
Name string `json:"name"`
|
||||
Street string `json:"street"`
|
||||
Zip string `json:"zip"`
|
||||
City string `json:"city"`
|
||||
Country string `json:"country"`
|
||||
Phone string `json:"phone"`
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Sku string `json:"sku"`
|
||||
Quantity int `json:"quantity"`
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
// package shopify calls the Shopify GraphQL Apu Endpoint
|
||||
// This package rquires the follwing ENV vars to be set:
|
||||
//
|
||||
// SHOPIFY_GRAPHQL_ENDPOINT
|
||||
// SHOPIFY_TOKEN
|
||||
package shopify
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
"os"
|
||||
|
||||
"github.com/m3tam3re/errors"
|
||||
"github.com/valyala/fastjson"
|
||||
)
|
||||
|
||||
var endpoint = os.Getenv("SHOPIFY_GRAPHQL_ENDPOINT")
|
||||
|
||||
func StartRequest(body []byte) (*http.Response, error) {
|
||||
path := ""
|
||||
const op errors.Op = "func: startRequest"
|
||||
|
||||
client := http.Client{
|
||||
Timeout: time.Second * 120,
|
||||
}
|
||||
req, err := http.NewRequest("POST", endpoint, bytes.NewBuffer(body))
|
||||
if err != nil {
|
||||
return nil, errors.E(errors.Internal, op, path, err, "error building request")
|
||||
}
|
||||
req.Header.Add("X-Shopify-Access-Token",os.Getenv("SHOPIFY_TOKEN"))
|
||||
req.Header.Add("Content-Type", "application/graphql")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, errors.E(errors.Internal, op, path, err, "error executing request")
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func GetItemPrice(sku string) (float32, error) {
|
||||
qu := `{
|
||||
inventoryItems(first:1, query:"sku:` + sku + `") {
|
||||
edges{
|
||||
node{
|
||||
sku
|
||||
variant {
|
||||
price
|
||||
compareAtPrice
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
resp, err := StartRequest([]byte(qu))
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
//TODO handle error
|
||||
}
|
||||
p := fastjson.GetString(body, "data", "inventoryItems", "edges", "0", "node", "variant", "price")
|
||||
cp := fastjson.GetString(body, "data", "inventoryItems", "edges", "0", "node", "variant", "compareAtPrice")
|
||||
|
||||
var finalPrice string
|
||||
if cp != "" {
|
||||
finalPrice = cp
|
||||
} else {
|
||||
finalPrice = p
|
||||
}
|
||||
|
||||
price, err:= strconv.ParseFloat(finalPrice, 32)
|
||||
if err != nil {
|
||||
//TODO handle error
|
||||
}
|
||||
return float32(price), nil
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
"github.com/m3tam3re/ordercollect/internal/handlers"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var port string
|
||||
flag.StringVar(&port, "port", "8080", "Specify a port, default is 8080")
|
||||
flag.Parse()
|
||||
|
||||
r := gin.Default()
|
||||
authorized := r.Group("/wk24", gin.BasicAuth(gin.Accounts{
|
||||
"wk24": os.Getenv("WK24_PASSWORD"),
|
||||
"lanakk": os.Getenv("LANAKK_PASSWORD"),
|
||||
}))
|
||||
authorized.GET("/addorders", handlers.Addorders)
|
||||
r.GET("/real/confirmshipment", handlers.ConfirmRealShipment)
|
||||
r.Run(":" + port)
|
||||
}
|
Loading…
Reference in New Issue