From 6c00db6613fd06181b0e1c8e1bb5c68dee8ac2b5 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 11:04:46 -0200 Subject: [PATCH 01/29] v1.0.0: Fix import packages on examples --- examples/carnet/cancel_carnet.go | 4 ++-- examples/carnet/cancel_parcel.go | 4 ++-- examples/carnet/create_carnet.go | 4 ++-- examples/carnet/create_carnet_history.go | 4 ++-- examples/carnet/detail_carnet.go | 4 ++-- examples/carnet/resend_carnet.go | 4 ++-- examples/carnet/resend_parcel.go | 4 ++-- examples/carnet/update_carnet_metadata.go | 4 ++-- examples/carnet/update_parcel.go | 4 ++-- examples/charge/billet.go | 4 ++-- examples/charge/cancel_charge.go | 4 ++-- examples/charge/card.go | 4 ++-- examples/charge/create_charge.go | 4 ++-- examples/charge/create_charge_history.go | 4 ++-- examples/charge/detail_charge.go | 4 ++-- examples/charge/link_charge.go | 4 ++-- examples/charge/resend_billet.go | 4 ++-- examples/charge/update_billet.go | 4 ++-- examples/charge/update_charge_metadata.go | 4 ++-- examples/charge/update_link_charge.go | 4 ++-- examples/extras/get_installments.go | 4 ++-- examples/extras/get_notification.go | 4 ++-- examples/subscription/cancel_subscription.go | 4 ++-- examples/subscription/create_plan.go | 4 ++-- examples/subscription/create_subscription.go | 4 ++-- examples/subscription/delete_plan.go | 4 ++-- examples/subscription/detail_subscription.go | 4 ++-- examples/subscription/list_plans.go | 4 ++-- examples/subscription/pay_subscription.go | 4 ++-- examples/subscription/update_subscription_metadata.go | 4 ++-- 30 files changed, 60 insertions(+), 60 deletions(-) diff --git a/examples/carnet/cancel_carnet.go b/examples/carnet/cancel_carnet.go index 85db588..5b2c314 100755 --- a/examples/carnet/cancel_carnet.go +++ b/examples/carnet/cancel_carnet.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/cancel_parcel.go b/examples/carnet/cancel_parcel.go index 57d73cf..a8877c3 100755 --- a/examples/carnet/cancel_parcel.go +++ b/examples/carnet/cancel_parcel.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/create_carnet.go b/examples/carnet/create_carnet.go index b523101..7325992 100755 --- a/examples/carnet/create_carnet.go +++ b/examples/carnet/create_carnet.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/create_carnet_history.go b/examples/carnet/create_carnet_history.go index 9783c5d..0526f04 100755 --- a/examples/carnet/create_carnet_history.go +++ b/examples/carnet/create_carnet_history.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/detail_carnet.go b/examples/carnet/detail_carnet.go index c1ee664..6e82eb4 100755 --- a/examples/carnet/detail_carnet.go +++ b/examples/carnet/detail_carnet.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/resend_carnet.go b/examples/carnet/resend_carnet.go index 434cfa3..a75e3e8 100755 --- a/examples/carnet/resend_carnet.go +++ b/examples/carnet/resend_carnet.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/resend_parcel.go b/examples/carnet/resend_parcel.go index 47ce967..aeca78f 100755 --- a/examples/carnet/resend_parcel.go +++ b/examples/carnet/resend_parcel.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/update_carnet_metadata.go b/examples/carnet/update_carnet_metadata.go index 701c9dc..0cf6911 100755 --- a/examples/carnet/update_carnet_metadata.go +++ b/examples/carnet/update_carnet_metadata.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/carnet/update_parcel.go b/examples/carnet/update_parcel.go index 9649a5f..35068a9 100755 --- a/examples/carnet/update_parcel.go +++ b/examples/carnet/update_parcel.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/billet.go b/examples/charge/billet.go index 7cf80f9..a1155a8 100755 --- a/examples/charge/billet.go +++ b/examples/charge/billet.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/cancel_charge.go b/examples/charge/cancel_charge.go index 491804b..4d0d4b3 100755 --- a/examples/charge/cancel_charge.go +++ b/examples/charge/cancel_charge.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/card.go b/examples/charge/card.go index 4604da4..310e330 100755 --- a/examples/charge/card.go +++ b/examples/charge/card.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/create_charge.go b/examples/charge/create_charge.go index cc8359f..55a0f23 100755 --- a/examples/charge/create_charge.go +++ b/examples/charge/create_charge.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/create_charge_history.go b/examples/charge/create_charge_history.go index 1035ac2..b6d7d13 100755 --- a/examples/charge/create_charge_history.go +++ b/examples/charge/create_charge_history.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/detail_charge.go b/examples/charge/detail_charge.go index 7bc42af..02a7cfd 100755 --- a/examples/charge/detail_charge.go +++ b/examples/charge/detail_charge.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/link_charge.go b/examples/charge/link_charge.go index 8130fde..319c8aa 100755 --- a/examples/charge/link_charge.go +++ b/examples/charge/link_charge.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/resend_billet.go b/examples/charge/resend_billet.go index 81e4519..dfa3664 100755 --- a/examples/charge/resend_billet.go +++ b/examples/charge/resend_billet.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/update_billet.go b/examples/charge/update_billet.go index 68012b2..ca5937c 100755 --- a/examples/charge/update_billet.go +++ b/examples/charge/update_billet.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/update_charge_metadata.go b/examples/charge/update_charge_metadata.go index 19cc00b..668e456 100755 --- a/examples/charge/update_charge_metadata.go +++ b/examples/charge/update_charge_metadata.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/charge/update_link_charge.go b/examples/charge/update_link_charge.go index 1a22fc6..fd0d690 100755 --- a/examples/charge/update_link_charge.go +++ b/examples/charge/update_link_charge.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/extras/get_installments.go b/examples/extras/get_installments.go index a16ad94..041578c 100755 --- a/examples/extras/get_installments.go +++ b/examples/extras/get_installments.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/extras/get_notification.go b/examples/extras/get_notification.go index fae6796..317c732 100755 --- a/examples/extras/get_notification.go +++ b/examples/extras/get_notification.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/cancel_subscription.go b/examples/subscription/cancel_subscription.go index 80930bb..8fabd9a 100755 --- a/examples/subscription/cancel_subscription.go +++ b/examples/subscription/cancel_subscription.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/create_plan.go b/examples/subscription/create_plan.go index 7f3e720..bdaabf6 100755 --- a/examples/subscription/create_plan.go +++ b/examples/subscription/create_plan.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/create_subscription.go b/examples/subscription/create_subscription.go index 2f04630..a6392c0 100755 --- a/examples/subscription/create_subscription.go +++ b/examples/subscription/create_subscription.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/delete_plan.go b/examples/subscription/delete_plan.go index 2e20fbc..00db42f 100755 --- a/examples/subscription/delete_plan.go +++ b/examples/subscription/delete_plan.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/detail_subscription.go b/examples/subscription/detail_subscription.go index ce5f11b..21001f3 100755 --- a/examples/subscription/detail_subscription.go +++ b/examples/subscription/detail_subscription.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/list_plans.go b/examples/subscription/list_plans.go index da9bad4..c1897e3 100755 --- a/examples/subscription/list_plans.go +++ b/examples/subscription/list_plans.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/pay_subscription.go b/examples/subscription/pay_subscription.go index 78f557b..765c99f 100755 --- a/examples/subscription/pay_subscription.go +++ b/examples/subscription/pay_subscription.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/subscription/update_subscription_metadata.go b/examples/subscription/update_subscription_metadata.go index ae5c52a..95ddbf0 100755 --- a/examples/subscription/update_subscription_metadata.go +++ b/examples/subscription/update_subscription_metadata.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" - "github.com/FilipeMata/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ From 27f2e9395eaed7ab3c31ebb682c692bb7f599db8 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 11:28:15 -0200 Subject: [PATCH 02/29] v1.0.0: CI --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100755 index 0000000..6ca0233 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: go +sudo: false +go: + - tip +before_install: + - go get -t ./... + - go get code.google.com/p/go.tools/cmd/cover + - go get github.com/mattn/goveralls +script: + - $GOPATH/bin/goveralls -service=travis-ci \ No newline at end of file From a931ffba69dae2999c2a17dce3d009f887d75bd2 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 11:31:21 -0200 Subject: [PATCH 03/29] v1.0.0: Update README --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7a1ba29..2ce9016 100755 --- a/README.md +++ b/README.md @@ -3,9 +3,8 @@ > A go library for integration of your backend with the payment services provided by [Gerencianet](http://gerencianet.com.br). -[![Build Status](https://travis-ci.org/gerencianet/gn-api-sdk-go.svg)](https://travis-ci.org/gerencianet/gn-api-sdk-python) -[![Coverage Status](https://coveralls.io/repos/gerencianet/gn-api-sdk-go/badge.svg?branch=master&service=github)](https://coveralls.io/github/gerencianet/gn-api-sdk-python?branch=master) -[![Code Climate](https://codeclimate.com/github/gerencianet/gn-api-sdk-go/badges/gpa.svg)](https://codeclimate.com/github/gerencianet/gn-api-sdk-python) +[![Build Status](https://travis-ci.org/gerencianet/gn-api-sdk-go.svg)](https://travis-ci.org/gerencianet/gn-api-sdk-go) +[![Coverage Status](https://coveralls.io/repos/github/gerencianet/gn-api-sdk-go/badge.svg?branch=master)](https://coveralls.io/github/gerencianet/gn-api-sdk-go?branch=master) ## Installation From 0faaeeead0216ed964a2b0842e6c79d9f875c325 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 11:45:38 -0200 Subject: [PATCH 04/29] v1.0.0: Update README --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6ca0233..b295eb7 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ sudo: false go: - tip before_install: - - go get -t ./... - - go get code.google.com/p/go.tools/cmd/cover - go get github.com/mattn/goveralls script: - $GOPATH/bin/goveralls -service=travis-ci \ No newline at end of file From 3cff19e3d648b58e581da80f1a71a0d5e17ec12a Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 11:59:18 -0200 Subject: [PATCH 05/29] v1.0.0: Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ce9016..2f2f753 100755 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ provided by [Gerencianet](http://gerencianet.com.br). Install with: ```bash -$ go get github.com/gerencianet/gn-api-sdk-go +$ go get github.com/gerencianet/gn-api-sdk-go/gerencianet ``` ## Tested with ``` From 17441836e3a816e02fe112bd1037501c3966c60d Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 12:22:21 -0200 Subject: [PATCH 06/29] v1.0.0: Fix CI --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b295eb7..9b7a78d 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,12 @@ language: go sudo: false go: - - tip + - 1.8.X before_install: + - go get -t ./... - go get github.com/mattn/goveralls script: - - $GOPATH/bin/goveralls -service=travis-ci \ No newline at end of file + - $GOPATH/bin/goveralls -service=travis-ci +group: "stable", +dist: "precise", +os: "linux" \ No newline at end of file From add5b664831235bd046f8653be52227d85e1a48c Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 13:50:10 -0200 Subject: [PATCH 07/29] v1.0.0: Fix CI --- .travis.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9b7a78d..517684a 100755 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,4 @@ before_install: - go get -t ./... - go get github.com/mattn/goveralls script: - - $GOPATH/bin/goveralls -service=travis-ci -group: "stable", -dist: "precise", -os: "linux" \ No newline at end of file + - $GOPATH/bin/goveralls -service=travis-ci \ No newline at end of file From 8697e6e2f7e13a689db5e7b973353f2557b71322 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 14:03:38 -0200 Subject: [PATCH 08/29] v1.0.0: Hide example folder at build --- {examples => _examples}/carnet/cancel_carnet.go | 0 {examples => _examples}/carnet/cancel_parcel.go | 0 {examples => _examples}/carnet/create_carnet.go | 0 {examples => _examples}/carnet/create_carnet_history.go | 0 {examples => _examples}/carnet/detail_carnet.go | 0 {examples => _examples}/carnet/resend_carnet.go | 0 {examples => _examples}/carnet/resend_parcel.go | 0 {examples => _examples}/carnet/update_carnet_metadata.go | 0 {examples => _examples}/carnet/update_parcel.go | 0 {examples => _examples}/charge/billet.go | 0 {examples => _examples}/charge/cancel_charge.go | 0 {examples => _examples}/charge/card.go | 0 {examples => _examples}/charge/create_charge.go | 0 {examples => _examples}/charge/create_charge_history.go | 0 {examples => _examples}/charge/detail_charge.go | 0 {examples => _examples}/charge/link_charge.go | 0 {examples => _examples}/charge/resend_billet.go | 0 {examples => _examples}/charge/update_billet.go | 0 {examples => _examples}/charge/update_charge_metadata.go | 0 {examples => _examples}/charge/update_link_charge.go | 0 {examples => _examples}/configs/configs.go | 0 {examples => _examples}/extras/get_installments.go | 0 {examples => _examples}/extras/get_notification.go | 0 {examples => _examples}/subscription/cancel_subscription.go | 0 {examples => _examples}/subscription/create_plan.go | 0 {examples => _examples}/subscription/create_subscription.go | 0 {examples => _examples}/subscription/delete_plan.go | 0 {examples => _examples}/subscription/detail_subscription.go | 0 {examples => _examples}/subscription/list_plans.go | 0 {examples => _examples}/subscription/pay_subscription.go | 0 .../subscription/update_subscription_metadata.go | 0 31 files changed, 0 insertions(+), 0 deletions(-) rename {examples => _examples}/carnet/cancel_carnet.go (100%) rename {examples => _examples}/carnet/cancel_parcel.go (100%) rename {examples => _examples}/carnet/create_carnet.go (100%) rename {examples => _examples}/carnet/create_carnet_history.go (100%) rename {examples => _examples}/carnet/detail_carnet.go (100%) rename {examples => _examples}/carnet/resend_carnet.go (100%) rename {examples => _examples}/carnet/resend_parcel.go (100%) rename {examples => _examples}/carnet/update_carnet_metadata.go (100%) rename {examples => _examples}/carnet/update_parcel.go (100%) rename {examples => _examples}/charge/billet.go (100%) rename {examples => _examples}/charge/cancel_charge.go (100%) rename {examples => _examples}/charge/card.go (100%) rename {examples => _examples}/charge/create_charge.go (100%) rename {examples => _examples}/charge/create_charge_history.go (100%) rename {examples => _examples}/charge/detail_charge.go (100%) rename {examples => _examples}/charge/link_charge.go (100%) rename {examples => _examples}/charge/resend_billet.go (100%) rename {examples => _examples}/charge/update_billet.go (100%) rename {examples => _examples}/charge/update_charge_metadata.go (100%) rename {examples => _examples}/charge/update_link_charge.go (100%) rename {examples => _examples}/configs/configs.go (100%) rename {examples => _examples}/extras/get_installments.go (100%) rename {examples => _examples}/extras/get_notification.go (100%) rename {examples => _examples}/subscription/cancel_subscription.go (100%) rename {examples => _examples}/subscription/create_plan.go (100%) rename {examples => _examples}/subscription/create_subscription.go (100%) rename {examples => _examples}/subscription/delete_plan.go (100%) rename {examples => _examples}/subscription/detail_subscription.go (100%) rename {examples => _examples}/subscription/list_plans.go (100%) rename {examples => _examples}/subscription/pay_subscription.go (100%) rename {examples => _examples}/subscription/update_subscription_metadata.go (100%) diff --git a/examples/carnet/cancel_carnet.go b/_examples/carnet/cancel_carnet.go similarity index 100% rename from examples/carnet/cancel_carnet.go rename to _examples/carnet/cancel_carnet.go diff --git a/examples/carnet/cancel_parcel.go b/_examples/carnet/cancel_parcel.go similarity index 100% rename from examples/carnet/cancel_parcel.go rename to _examples/carnet/cancel_parcel.go diff --git a/examples/carnet/create_carnet.go b/_examples/carnet/create_carnet.go similarity index 100% rename from examples/carnet/create_carnet.go rename to _examples/carnet/create_carnet.go diff --git a/examples/carnet/create_carnet_history.go b/_examples/carnet/create_carnet_history.go similarity index 100% rename from examples/carnet/create_carnet_history.go rename to _examples/carnet/create_carnet_history.go diff --git a/examples/carnet/detail_carnet.go b/_examples/carnet/detail_carnet.go similarity index 100% rename from examples/carnet/detail_carnet.go rename to _examples/carnet/detail_carnet.go diff --git a/examples/carnet/resend_carnet.go b/_examples/carnet/resend_carnet.go similarity index 100% rename from examples/carnet/resend_carnet.go rename to _examples/carnet/resend_carnet.go diff --git a/examples/carnet/resend_parcel.go b/_examples/carnet/resend_parcel.go similarity index 100% rename from examples/carnet/resend_parcel.go rename to _examples/carnet/resend_parcel.go diff --git a/examples/carnet/update_carnet_metadata.go b/_examples/carnet/update_carnet_metadata.go similarity index 100% rename from examples/carnet/update_carnet_metadata.go rename to _examples/carnet/update_carnet_metadata.go diff --git a/examples/carnet/update_parcel.go b/_examples/carnet/update_parcel.go similarity index 100% rename from examples/carnet/update_parcel.go rename to _examples/carnet/update_parcel.go diff --git a/examples/charge/billet.go b/_examples/charge/billet.go similarity index 100% rename from examples/charge/billet.go rename to _examples/charge/billet.go diff --git a/examples/charge/cancel_charge.go b/_examples/charge/cancel_charge.go similarity index 100% rename from examples/charge/cancel_charge.go rename to _examples/charge/cancel_charge.go diff --git a/examples/charge/card.go b/_examples/charge/card.go similarity index 100% rename from examples/charge/card.go rename to _examples/charge/card.go diff --git a/examples/charge/create_charge.go b/_examples/charge/create_charge.go similarity index 100% rename from examples/charge/create_charge.go rename to _examples/charge/create_charge.go diff --git a/examples/charge/create_charge_history.go b/_examples/charge/create_charge_history.go similarity index 100% rename from examples/charge/create_charge_history.go rename to _examples/charge/create_charge_history.go diff --git a/examples/charge/detail_charge.go b/_examples/charge/detail_charge.go similarity index 100% rename from examples/charge/detail_charge.go rename to _examples/charge/detail_charge.go diff --git a/examples/charge/link_charge.go b/_examples/charge/link_charge.go similarity index 100% rename from examples/charge/link_charge.go rename to _examples/charge/link_charge.go diff --git a/examples/charge/resend_billet.go b/_examples/charge/resend_billet.go similarity index 100% rename from examples/charge/resend_billet.go rename to _examples/charge/resend_billet.go diff --git a/examples/charge/update_billet.go b/_examples/charge/update_billet.go similarity index 100% rename from examples/charge/update_billet.go rename to _examples/charge/update_billet.go diff --git a/examples/charge/update_charge_metadata.go b/_examples/charge/update_charge_metadata.go similarity index 100% rename from examples/charge/update_charge_metadata.go rename to _examples/charge/update_charge_metadata.go diff --git a/examples/charge/update_link_charge.go b/_examples/charge/update_link_charge.go similarity index 100% rename from examples/charge/update_link_charge.go rename to _examples/charge/update_link_charge.go diff --git a/examples/configs/configs.go b/_examples/configs/configs.go similarity index 100% rename from examples/configs/configs.go rename to _examples/configs/configs.go diff --git a/examples/extras/get_installments.go b/_examples/extras/get_installments.go similarity index 100% rename from examples/extras/get_installments.go rename to _examples/extras/get_installments.go diff --git a/examples/extras/get_notification.go b/_examples/extras/get_notification.go similarity index 100% rename from examples/extras/get_notification.go rename to _examples/extras/get_notification.go diff --git a/examples/subscription/cancel_subscription.go b/_examples/subscription/cancel_subscription.go similarity index 100% rename from examples/subscription/cancel_subscription.go rename to _examples/subscription/cancel_subscription.go diff --git a/examples/subscription/create_plan.go b/_examples/subscription/create_plan.go similarity index 100% rename from examples/subscription/create_plan.go rename to _examples/subscription/create_plan.go diff --git a/examples/subscription/create_subscription.go b/_examples/subscription/create_subscription.go similarity index 100% rename from examples/subscription/create_subscription.go rename to _examples/subscription/create_subscription.go diff --git a/examples/subscription/delete_plan.go b/_examples/subscription/delete_plan.go similarity index 100% rename from examples/subscription/delete_plan.go rename to _examples/subscription/delete_plan.go diff --git a/examples/subscription/detail_subscription.go b/_examples/subscription/detail_subscription.go similarity index 100% rename from examples/subscription/detail_subscription.go rename to _examples/subscription/detail_subscription.go diff --git a/examples/subscription/list_plans.go b/_examples/subscription/list_plans.go similarity index 100% rename from examples/subscription/list_plans.go rename to _examples/subscription/list_plans.go diff --git a/examples/subscription/pay_subscription.go b/_examples/subscription/pay_subscription.go similarity index 100% rename from examples/subscription/pay_subscription.go rename to _examples/subscription/pay_subscription.go diff --git a/examples/subscription/update_subscription_metadata.go b/_examples/subscription/update_subscription_metadata.go similarity index 100% rename from examples/subscription/update_subscription_metadata.go rename to _examples/subscription/update_subscription_metadata.go From a7885d7aeb2021af3b42a4af9f5e359155c0a68d Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 14:16:56 -0200 Subject: [PATCH 09/29] v1.0.0: Fix CI --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 517684a..78ef8b7 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go sudo: false go: - - 1.8.X + - 1.8 before_install: - go get -t ./... - go get github.com/mattn/goveralls From a6fdbc75d7afe84bee41ce7c8668b98fb2e25a52 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 15:34:00 -0200 Subject: [PATCH 10/29] v1.0.0: Fix example folder imports --- _examples/carnet/cancel_carnet.go | 2 +- _examples/carnet/cancel_parcel.go | 2 +- _examples/carnet/create_carnet.go | 2 +- _examples/carnet/create_carnet_history.go | 2 +- _examples/carnet/detail_carnet.go | 2 +- _examples/carnet/resend_carnet.go | 2 +- _examples/carnet/resend_parcel.go | 2 +- _examples/carnet/update_carnet_metadata.go | 2 +- _examples/carnet/update_parcel.go | 2 +- _examples/charge/billet.go | 2 +- _examples/charge/cancel_charge.go | 2 +- _examples/charge/card.go | 2 +- _examples/charge/create_charge.go | 2 +- _examples/charge/create_charge_history.go | 2 +- _examples/charge/detail_charge.go | 2 +- _examples/charge/link_charge.go | 2 +- _examples/charge/resend_billet.go | 2 +- _examples/charge/update_billet.go | 2 +- _examples/charge/update_charge_metadata.go | 2 +- _examples/charge/update_link_charge.go | 2 +- _examples/extras/get_installments.go | 2 +- _examples/extras/get_notification.go | 2 +- _examples/subscription/cancel_subscription.go | 2 +- _examples/subscription/create_plan.go | 2 +- _examples/subscription/create_subscription.go | 2 +- _examples/subscription/delete_plan.go | 2 +- _examples/subscription/detail_subscription.go | 2 +- _examples/subscription/list_plans.go | 2 +- _examples/subscription/pay_subscription.go | 2 +- _examples/subscription/update_subscription_metadata.go | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/_examples/carnet/cancel_carnet.go b/_examples/carnet/cancel_carnet.go index 5b2c314..40d0a6c 100755 --- a/_examples/carnet/cancel_carnet.go +++ b/_examples/carnet/cancel_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/cancel_parcel.go b/_examples/carnet/cancel_parcel.go index a8877c3..34d666b 100755 --- a/_examples/carnet/cancel_parcel.go +++ b/_examples/carnet/cancel_parcel.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/create_carnet.go b/_examples/carnet/create_carnet.go index 7325992..4b3445b 100755 --- a/_examples/carnet/create_carnet.go +++ b/_examples/carnet/create_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/create_carnet_history.go b/_examples/carnet/create_carnet_history.go index 0526f04..7eb257a 100755 --- a/_examples/carnet/create_carnet_history.go +++ b/_examples/carnet/create_carnet_history.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/detail_carnet.go b/_examples/carnet/detail_carnet.go index 6e82eb4..2882a10 100755 --- a/_examples/carnet/detail_carnet.go +++ b/_examples/carnet/detail_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/resend_carnet.go b/_examples/carnet/resend_carnet.go index a75e3e8..70637e3 100755 --- a/_examples/carnet/resend_carnet.go +++ b/_examples/carnet/resend_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/resend_parcel.go b/_examples/carnet/resend_parcel.go index aeca78f..64dd02d 100755 --- a/_examples/carnet/resend_parcel.go +++ b/_examples/carnet/resend_parcel.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/update_carnet_metadata.go b/_examples/carnet/update_carnet_metadata.go index 0cf6911..c67e3f4 100755 --- a/_examples/carnet/update_carnet_metadata.go +++ b/_examples/carnet/update_carnet_metadata.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/carnet/update_parcel.go b/_examples/carnet/update_parcel.go index 35068a9..c4a974f 100755 --- a/_examples/carnet/update_parcel.go +++ b/_examples/carnet/update_parcel.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/billet.go b/_examples/charge/billet.go index a1155a8..c99e6c2 100755 --- a/_examples/charge/billet.go +++ b/_examples/charge/billet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/cancel_charge.go b/_examples/charge/cancel_charge.go index 4d0d4b3..ee999d2 100755 --- a/_examples/charge/cancel_charge.go +++ b/_examples/charge/cancel_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/card.go b/_examples/charge/card.go index 310e330..ff056b9 100755 --- a/_examples/charge/card.go +++ b/_examples/charge/card.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge.go b/_examples/charge/create_charge.go index 55a0f23..03d4ab4 100755 --- a/_examples/charge/create_charge.go +++ b/_examples/charge/create_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_history.go b/_examples/charge/create_charge_history.go index b6d7d13..6eab9a3 100755 --- a/_examples/charge/create_charge_history.go +++ b/_examples/charge/create_charge_history.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/detail_charge.go b/_examples/charge/detail_charge.go index 02a7cfd..b6251f2 100755 --- a/_examples/charge/detail_charge.go +++ b/_examples/charge/detail_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/link_charge.go b/_examples/charge/link_charge.go index 319c8aa..af962de 100755 --- a/_examples/charge/link_charge.go +++ b/_examples/charge/link_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/resend_billet.go b/_examples/charge/resend_billet.go index dfa3664..c8a6c7a 100755 --- a/_examples/charge/resend_billet.go +++ b/_examples/charge/resend_billet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/update_billet.go b/_examples/charge/update_billet.go index ca5937c..c486bb1 100755 --- a/_examples/charge/update_billet.go +++ b/_examples/charge/update_billet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/update_charge_metadata.go b/_examples/charge/update_charge_metadata.go index 668e456..5c7c240 100755 --- a/_examples/charge/update_charge_metadata.go +++ b/_examples/charge/update_charge_metadata.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/update_link_charge.go b/_examples/charge/update_link_charge.go index fd0d690..5813d13 100755 --- a/_examples/charge/update_link_charge.go +++ b/_examples/charge/update_link_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/extras/get_installments.go b/_examples/extras/get_installments.go index 041578c..e1c5b98 100755 --- a/_examples/extras/get_installments.go +++ b/_examples/extras/get_installments.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/extras/get_notification.go b/_examples/extras/get_notification.go index 317c732..9534d98 100755 --- a/_examples/extras/get_notification.go +++ b/_examples/extras/get_notification.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/cancel_subscription.go b/_examples/subscription/cancel_subscription.go index 8fabd9a..424c9e0 100755 --- a/_examples/subscription/cancel_subscription.go +++ b/_examples/subscription/cancel_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/create_plan.go b/_examples/subscription/create_plan.go index bdaabf6..109a38b 100755 --- a/_examples/subscription/create_plan.go +++ b/_examples/subscription/create_plan.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/create_subscription.go b/_examples/subscription/create_subscription.go index a6392c0..8ce7b24 100755 --- a/_examples/subscription/create_subscription.go +++ b/_examples/subscription/create_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/delete_plan.go b/_examples/subscription/delete_plan.go index 00db42f..c7e893e 100755 --- a/_examples/subscription/delete_plan.go +++ b/_examples/subscription/delete_plan.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/detail_subscription.go b/_examples/subscription/detail_subscription.go index 21001f3..76b92c9 100755 --- a/_examples/subscription/detail_subscription.go +++ b/_examples/subscription/detail_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/list_plans.go b/_examples/subscription/list_plans.go index c1897e3..2e74731 100755 --- a/_examples/subscription/list_plans.go +++ b/_examples/subscription/list_plans.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/pay_subscription.go b/_examples/subscription/pay_subscription.go index 765c99f..bbb1873 100755 --- a/_examples/subscription/pay_subscription.go +++ b/_examples/subscription/pay_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/subscription/update_subscription_metadata.go b/_examples/subscription/update_subscription_metadata.go index 95ddbf0..ffbebf9 100755 --- a/_examples/subscription/update_subscription_metadata.go +++ b/_examples/subscription/update_subscription_metadata.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/examples/configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ From 4765a109d0c1cebec77ffa0b0edf0fe840484935 Mon Sep 17 00:00:00 2001 From: Filipe Mata Date: Wed, 8 Nov 2017 15:35:03 -0200 Subject: [PATCH 11/29] Update README.md --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2f2f753..23be705 100755 --- a/README.md +++ b/README.md @@ -15,12 +15,11 @@ $ go get github.com/gerencianet/gn-api-sdk-go/gerencianet ``` ## Tested with ``` -go 1.x +go 1.8 ``` ## Basic usage ```go -# encoding: utf-8 import ( "github.com/gerencianet/gn-api-sdk-go/gerencianet" @@ -29,8 +28,8 @@ import ( credentials := map[string]interface{} { "client_id": "client_id", "client_secret": "client_secret", - "sandbox": true - "timeout": 10 + "sandbox": true, + "timeout": 10, } gn := gerencianet.NewGerencianet(credentials) @@ -39,11 +38,11 @@ body = { "items": [{ "name": "Product 1", "value": 1000, - "amount": 2 + "amount": 2, }], "shippings": [{ "name": "Default Shipping Cost", - "value": 100 + "value": 100, }] } @@ -53,7 +52,7 @@ res, err := gn.CreateCharge(body) ## Examples -You can run the examples inside `examples` with +You can run the examples inside `_examples` with `$ go run example.go`: ```bash From 202294acfcafc96a2b4cd7a3396c1f7d9a30fff0 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 18:28:43 -0200 Subject: [PATCH 12/29] v1.0.0: Add codeclimate --- .codeclimate.yml | 9 +++++++++ README.md | 1 + 2 files changed, 10 insertions(+) create mode 100755 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100755 index 0000000..68380af --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,9 @@ +engines: + govet: + enabled: true + +ratings: + paths: + - "gerencianet/**/*.rb" +exclude_paths: + - _examples/**/* diff --git a/README.md b/README.md index 23be705..e245ec1 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ provided by [Gerencianet](http://gerencianet.com.br). [![Build Status](https://travis-ci.org/gerencianet/gn-api-sdk-go.svg)](https://travis-ci.org/gerencianet/gn-api-sdk-go) [![Coverage Status](https://coveralls.io/repos/github/gerencianet/gn-api-sdk-go/badge.svg?branch=master)](https://coveralls.io/github/gerencianet/gn-api-sdk-go?branch=master) +[![Code Climate](https://codeclimate.com/github/gerencianet/gn-api-sdk-go/badges/gpa.svg)](https://codeclimate.com/github/gerencianet/gn-api-sdk-go) ## Installation From 1ed9fe7820a56a81fe4d772df6988052b474e0a3 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 18:33:59 -0200 Subject: [PATCH 13/29] v1.0.0: Fix codeclimate --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 68380af..d444132 100755 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -4,6 +4,6 @@ engines: ratings: paths: - - "gerencianet/**/*.rb" + - "gerencianet/**/*.go" exclude_paths: - _examples/**/* From e8d7c70e0cbf3ac6c8c753a4f5fe6d3e3bf29eba Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 18:42:58 -0200 Subject: [PATCH 14/29] v1.0.0: Fix codeclimate --- .codeclimate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index d444132..fad45f7 100755 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -4,6 +4,6 @@ engines: ratings: paths: - - "gerencianet/**/*.go" + - "gerencianet/*.go" exclude_paths: - - _examples/**/* + - "_examples/*.go" From 991f432237e01ac74ffa1dcad05d6683e19c2ce4 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 18:45:24 -0200 Subject: [PATCH 15/29] v1.0.0: Fix codeclimate --- .codeclimate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index fad45f7..c973ac1 100755 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -6,4 +6,4 @@ ratings: paths: - "gerencianet/*.go" exclude_paths: - - "_examples/*.go" + - _examples/**/* From c1c3e4afc07ebd11bbc50acc423ecf6bfede78c2 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 18:57:39 -0200 Subject: [PATCH 16/29] v1.0.0: change codeclimate --- .codeclimate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index c973ac1..408af8d 100755 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -4,6 +4,6 @@ engines: ratings: paths: - - "gerencianet/*.go" + - "**.go" exclude_paths: - - _examples/**/* + - "_examples/**/*" From d09c5e4296910f7b9338949b94b845bcd4e66916 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 20:05:54 -0200 Subject: [PATCH 17/29] v1.0.0: update codeclimate --- .codeclimate.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 408af8d..90b3c81 100755 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,9 +1,6 @@ -engines: - govet: - enabled: true - -ratings: - paths: - - "**.go" -exclude_paths: - - "_examples/**/*" +plugins: + govet: + enabled: true + +exclude_patterns: + - "_examples/**/*" \ No newline at end of file From 34d1786be82325af61019d881f8d311820341da7 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 20:18:26 -0200 Subject: [PATCH 18/29] v1.0.0: update codeclimate --- .codeclimate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.codeclimate.yml b/.codeclimate.yml index 90b3c81..18c80a3 100755 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -1,3 +1,4 @@ +version: "2" plugins: govet: enabled: true From 162902b812bbe3b77e053a3124e24f9a209c24a4 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Wed, 8 Nov 2017 20:57:54 -0200 Subject: [PATCH 19/29] v1.0.0: cacel codeclimate due there's no support for golang --- .codeclimate.yml | 7 ------- README.md | 1 - 2 files changed, 8 deletions(-) delete mode 100755 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100755 index 18c80a3..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: "2" -plugins: - govet: - enabled: true - -exclude_patterns: - - "_examples/**/*" \ No newline at end of file diff --git a/README.md b/README.md index e245ec1..23be705 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ provided by [Gerencianet](http://gerencianet.com.br). [![Build Status](https://travis-ci.org/gerencianet/gn-api-sdk-go.svg)](https://travis-ci.org/gerencianet/gn-api-sdk-go) [![Coverage Status](https://coveralls.io/repos/github/gerencianet/gn-api-sdk-go/badge.svg?branch=master)](https://coveralls.io/github/gerencianet/gn-api-sdk-go?branch=master) -[![Code Climate](https://codeclimate.com/github/gerencianet/gn-api-sdk-go/badges/gpa.svg)](https://codeclimate.com/github/gerencianet/gn-api-sdk-go) ## Installation From 93a48a1985a5b26c2688c265307171579172f236 Mon Sep 17 00:00:00 2001 From: Filipe Santos Date: Mon, 8 Jan 2018 10:11:54 -0200 Subject: [PATCH 20/29] v1.0.1: Add new endpoints --- CHANGELOG.md | 6 +++++ .../create_subscription_history.go | 25 +++++++++++++++++++ _examples/subscription/update_plan.go | 25 +++++++++++++++++++ gerencianet/constants.go | 2 +- gerencianet/endpoints.go | 10 ++++++++ gerencianet/endpoints_internal_test.go | 2 ++ 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100755 _examples/subscription/create_subscription_history.go create mode 100755 _examples/subscription/update_plan.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 02cf0a9..aaccf57 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 1.0.1 + +- Added: new endpoint (update plan) +- Added: new endpoint (create subscription history) +- Updated: examples + # 1.0.0 - Initial release diff --git a/_examples/subscription/create_subscription_history.go b/_examples/subscription/create_subscription_history.go new file mode 100755 index 0000000..021505b --- /dev/null +++ b/_examples/subscription/create_subscription_history.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + body := map[string]interface{} { + "description": "This subscription was not fully paid", + } + + res, err := gn.CreateSubscriptionHistory(13100, body) // no lugar do 1 coloque o subscription_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/_examples/subscription/update_plan.go b/_examples/subscription/update_plan.go new file mode 100755 index 0000000..b5f8f1a --- /dev/null +++ b/_examples/subscription/update_plan.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + body := map[string]interface{} { + "name": "My new plan", + } + + res, err := gn.UpdatePlan(1, body) // no lugar do 1 coloque o plan_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/gerencianet/constants.go b/gerencianet/constants.go index 124fea3..0786c11 100755 --- a/gerencianet/constants.go +++ b/gerencianet/constants.go @@ -1,6 +1,6 @@ package gerencianet -var Version = "1.0.0" +var Version = "1.0.1" const ( UrlSandbox = "https://sandbox.gerencianet.com.br/v1" diff --git a/gerencianet/endpoints.go b/gerencianet/endpoints.go index 7bf1f77..c407e8b 100755 --- a/gerencianet/endpoints.go +++ b/gerencianet/endpoints.go @@ -163,4 +163,14 @@ func (endpoints endpoints) ChargeLink(chargeID int, body map[string]interface{}) func (endpoints endpoints) UpdateChargeLink(chargeID int, body map[string]interface{}) (string, error) { params := map[string]string{ "id": strconv.Itoa(chargeID) } return endpoints.requester.request("/charge/:id/link", "PUT", params, body) +} + +func (endpoints endpoints) CreateSubscriptionHistory(subscriptionID int, body map[string]interface{}) (string, error) { + params := map[string]string{ "id": strconv.Itoa(subscriptionID) } + return endpoints.requester.request("/subscription/:id/history", "POST", params, body) +} + +func (endpoints endpoints) UpdatePlan(planID int, body map[string]interface{}) (string, error) { + params := map[string]string{ "id": strconv.Itoa(planID) } + return endpoints.requester.request("/plan/:id", "PUT", params, body) } \ No newline at end of file diff --git a/gerencianet/endpoints_internal_test.go b/gerencianet/endpoints_internal_test.go index deb53b5..40642bd 100755 --- a/gerencianet/endpoints_internal_test.go +++ b/gerencianet/endpoints_internal_test.go @@ -42,5 +42,7 @@ func Test_endpoints(t *testing.T) { endpoints.CancelParcel(1, 1) endpoints.ChargeLink(1, nil) endpoints.UpdateChargeLink(1, nil) + endpoints.UpdatePlan(1, nil) + endpoints.CreateSubscriptionHistory(1, nil) t.Skip("skipping endpoints tests") } \ No newline at end of file From 1daaeb668175d95b17c28f681c54de8f02abacd0 Mon Sep 17 00:00:00 2001 From: Cecilia Deveza Date: Mon, 9 Jul 2018 11:12:18 -0300 Subject: [PATCH 21/29] v1.0.2: Add new endpoint --- CHANGELOG.md | 4 + .../charge/create_charge_balance_sheet.go | 86 +++++++++++++++++++ gerencianet/endpoints.go | 5 ++ gerencianet/endpoints_internal_test.go | 1 + 4 files changed, 96 insertions(+) create mode 100755 _examples/charge/create_charge_balance_sheet.go diff --git a/CHANGELOG.md b/CHANGELOG.md index aaccf57..a00828c 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.2 + +- Added: new endpoint (create charge balance sheet) + # 1.0.1 - Added: new endpoint (update plan) diff --git a/_examples/charge/create_charge_balance_sheet.go b/_examples/charge/create_charge_balance_sheet.go new file mode 100755 index 0000000..289794e --- /dev/null +++ b/_examples/charge/create_charge_balance_sheet.go @@ -0,0 +1,86 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + body := map[string]interface{} { + "title": "Balancete Demonstrativo", + "body": []map[string]interface{} { + { + "header": "Demonstrativo de Consumo", + "tables": []map[string]interface{} { + { + "rows": [][]map[string]interface{} { + { + { + "align": "left", + "color": "#000000", + "style": "bold", + "text": "Exemplo de despesa", + "colspan": 2, + }, + { + "align": "left", + "color": "#000000", + "style": "bold", + "text": "Total lançado", + "colspan": 2, + }, + }, + { + { + "align": "left", + "color": "#000000", + "style": "normal", + "text": "Instalação", + "colspan": 2, + }, + { + "align": "left", + "color": "#000000", + "style": "normal", + "text": "R$ 100,00", + "colspan": 2, + }, + }, + }, + }, + }, + }, + { + "header": "Balancete Geral", + "tables": []map[string]interface{} { + { + "rows": [][]map[string]interface{} { + { + { + "align": "left", + "color": "#000000", + "style": "normal", + "text": "Confira na documentação da Gerencianet todas as configurações possíveis de um boleto balancete.", + "colspan": 4, + }, + }, + }, + }, + }, + }, + }, + } + + res, err := gn.CreateChargeBalanceSheet(1, body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/gerencianet/endpoints.go b/gerencianet/endpoints.go index c407e8b..28b79e4 100755 --- a/gerencianet/endpoints.go +++ b/gerencianet/endpoints.go @@ -173,4 +173,9 @@ func (endpoints endpoints) CreateSubscriptionHistory(subscriptionID int, body ma func (endpoints endpoints) UpdatePlan(planID int, body map[string]interface{}) (string, error) { params := map[string]string{ "id": strconv.Itoa(planID) } return endpoints.requester.request("/plan/:id", "PUT", params, body) +} + +func (endpoints endpoints) CreateChargeBalanceSheet(chargeID int, body map[string]interface{}) (string, error) { + params := map[string]string{ "id": strconv.Itoa(chargeID) } + return endpoints.requester.request("/charge/:id/balance-sheet", "POST", params, body) } \ No newline at end of file diff --git a/gerencianet/endpoints_internal_test.go b/gerencianet/endpoints_internal_test.go index 40642bd..fe8ea58 100755 --- a/gerencianet/endpoints_internal_test.go +++ b/gerencianet/endpoints_internal_test.go @@ -44,5 +44,6 @@ func Test_endpoints(t *testing.T) { endpoints.UpdateChargeLink(1, nil) endpoints.UpdatePlan(1, nil) endpoints.CreateSubscriptionHistory(1, nil) + endpoints.CreateChargeBalanceSheet(1, nil) t.Skip("skipping endpoints tests") } \ No newline at end of file From e7c77de10dd6e8e8abbdb249896902d8d6e3c8d2 Mon Sep 17 00:00:00 2001 From: Thiago Resende | Gerencianet Date: Wed, 26 Dec 2018 10:42:59 -0200 Subject: [PATCH 22/29] TZSD_729-SDK-com-Settle:Foi adicionado dois endpoints (SettleCharge e SettleCarnetParcel) --- _examples/carnet/settle_parcel.go | 21 +++++++++++++++++++++ _examples/charge/settle_charge.go | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 _examples/carnet/settle_parcel.go create mode 100644 _examples/charge/settle_charge.go diff --git a/_examples/carnet/settle_parcel.go b/_examples/carnet/settle_parcel.go new file mode 100644 index 0000000..139b264 --- /dev/null +++ b/_examples/carnet/settle_parcel.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + res, err := gn.SettleCarnetParcel(1, 1) // no lugar dos 1s coloque o carnet_id e o numero da parcela respectivamente + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/_examples/charge/settle_charge.go b/_examples/charge/settle_charge.go new file mode 100644 index 0000000..b9ec58d --- /dev/null +++ b/_examples/charge/settle_charge.go @@ -0,0 +1,21 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + res, err := gn.SettleCharge(1) // no lugar do 1 coloque o charge_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file From a358e0a3fbca0124f88c25f0e56612ed3e54c4e1 Mon Sep 17 00:00:00 2001 From: Thiago Resende | Gerencianet Date: Wed, 26 Dec 2018 11:12:57 -0200 Subject: [PATCH 23/29] TZSD_729-SDK-com-Settle:Foi adicionado dois endpoints (SettleCharge e SettleCarnetParcel) --- CHANGELOG.md | 5 +++++ README.md | 2 +- gerencianet/constants.go | 2 +- gerencianet/endpoints.go | 15 ++++++++++++++- gerencianet/endpoints_internal_test.go | 4 ++++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a00828c..6abf60b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 1.0.3 + +- Added: new endpoint (settle charge) +- Added: new endpoint (settle parcel carnet) + # 1.0.2 - Added: new endpoint (create charge balance sheet) diff --git a/README.md b/README.md index 23be705..ccd158f 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ $ go get github.com/gerencianet/gn-api-sdk-go/gerencianet ``` ## Tested with ``` -go 1.8 +go 1.8 and 1.11.4 ``` ## Basic usage diff --git a/gerencianet/constants.go b/gerencianet/constants.go index 0786c11..65f3c02 100755 --- a/gerencianet/constants.go +++ b/gerencianet/constants.go @@ -1,6 +1,6 @@ package gerencianet -var Version = "1.0.1" +var Version = "1.0.3" const ( UrlSandbox = "https://sandbox.gerencianet.com.br/v1" diff --git a/gerencianet/endpoints.go b/gerencianet/endpoints.go index 28b79e4..1758e8d 100755 --- a/gerencianet/endpoints.go +++ b/gerencianet/endpoints.go @@ -178,4 +178,17 @@ func (endpoints endpoints) UpdatePlan(planID int, body map[string]interface{}) ( func (endpoints endpoints) CreateChargeBalanceSheet(chargeID int, body map[string]interface{}) (string, error) { params := map[string]string{ "id": strconv.Itoa(chargeID) } return endpoints.requester.request("/charge/:id/balance-sheet", "POST", params, body) -} \ No newline at end of file +} + +func (endpoints endpoints) SettleCarnetParcel(carnetID int, parcel int) (string, error) { + params := map[string]string{ + "id": strconv.Itoa(carnetID), + "parcel": strconv.Itoa(parcel), + } + return endpoints.requester.request("/carnet/:id/parcel/:parcel/settle", "PUT", params, nil) +} + +func (endpoints endpoints) SettleCharge(chargeID int) (string, error) { + params := map[string]string{ "id": strconv.Itoa(chargeID) } + return endpoints.requester.request("/charge/:id/settle", "PUT", params, nil) +} diff --git a/gerencianet/endpoints_internal_test.go b/gerencianet/endpoints_internal_test.go index fe8ea58..682f68c 100755 --- a/gerencianet/endpoints_internal_test.go +++ b/gerencianet/endpoints_internal_test.go @@ -45,5 +45,9 @@ func Test_endpoints(t *testing.T) { endpoints.UpdatePlan(1, nil) endpoints.CreateSubscriptionHistory(1, nil) endpoints.CreateChargeBalanceSheet(1, nil) + endpoints.SettleCarnetParcel(1, 1) + endpoints.SettleCharge(1) + + t.Skip("skipping endpoints tests") } \ No newline at end of file From 9c185940d4b51255f5b2b9bb143aa52d618fd508 Mon Sep 17 00:00:00 2001 From: Diego Alberto Date: Wed, 28 Aug 2019 16:54:46 -0300 Subject: [PATCH 24/29] Add new endpoint (one step) --- CHANGELOG.md | 6 +- _examples/charge/create_charge_onestep.go | 50 +++++++++++++++ .../create_charge_onestep_credit_card.go | 64 +++++++++++++++++++ gerencianet/constants.go | 2 +- gerencianet/endpoints.go | 4 ++ 5 files changed, 124 insertions(+), 2 deletions(-) create mode 100755 _examples/charge/create_charge_onestep.go create mode 100755 _examples/charge/create_charge_onestep_credit_card.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 6abf60b..3cbc4f3 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.4 + +- Added: new endpoint (one step) + # 1.0.3 - Added: new endpoint (settle charge) @@ -15,4 +19,4 @@ # 1.0.0 -- Initial release +- Initial release \ No newline at end of file diff --git a/_examples/charge/create_charge_onestep.go b/_examples/charge/create_charge_onestep.go new file mode 100755 index 0000000..92c9be5 --- /dev/null +++ b/_examples/charge/create_charge_onestep.go @@ -0,0 +1,50 @@ +package main + +import ( + "fmt" + "github.com/dmalberto/gn-api-sdk-go/gerencianet" + "../configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + customer := map[string]interface{}{ + "name": "Gorbadoc Oldbuck", + "cpf": "04267484171", + "phone_number": "51944916523", + "email": "gorb.oldbuck@gerencianet.com.br", + } + + body := map[string]interface{} { + "payment": map[string]interface{} { + "banking_billet": map[string]interface{} { + "expire_at": "2020-12-12", + "customer": customer, + }, + }, + "items": []map[string]interface{}{ + { + "name": "Product 1", + "value": 1000, + "amount": 2, + }, + }, + "shippings": []map[string]interface{} { + { + "name": "Default Shipping Cost", + "value": 100, + }, + }, + } + + res, err := gn.CreateChargeOneStep(body) // no lugar do 1 coloque o charge_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/_examples/charge/create_charge_onestep_credit_card.go b/_examples/charge/create_charge_onestep_credit_card.go new file mode 100755 index 0000000..bf9510b --- /dev/null +++ b/_examples/charge/create_charge_onestep_credit_card.go @@ -0,0 +1,64 @@ +package main + +import ( + "fmt" + "github.com/dmalberto/gn-api-sdk-go/gerencianet" + "../configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + paymentToken := "428d7f3b2dc49117552ace464078557832c4ae4f"; + + customer := map[string]interface{}{ + "name": "Gorbadoc Oldbuck", + "cpf": "04267484171", + "phone_number": "51944916523", + "email": "gorb.oldbuck@gerencianet.com.br", + "birth": "1977-01-15", + } + + billingAddress := map[string]interface{} { + "street": "Av JK", + "number": 909, + "neighborhood": "Bauxita", + "zipcode": "35400000", + "city": "Ouro Preto", + "state": "MG", + } + + body := map[string]interface{} { + "payment": map[string]interface{} { + "credit_card": map[string]interface{} { + "installments": 1, + "billing_address": billingAddress, + "payment_token": paymentToken, + "customer": customer, + }, + }, + "items": []map[string]interface{}{ + { + "name": "Product 1", + "value": 1000, + "amount": 2, + }, + }, + "shippings": []map[string]interface{} { + { + "name": "Default Shipping Cost", + "value": 100, + }, + }, + } + + res, err := gn.CreateChargeOneStep(body) // no lugar do 1 coloque o charge_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/gerencianet/constants.go b/gerencianet/constants.go index 65f3c02..06b3942 100755 --- a/gerencianet/constants.go +++ b/gerencianet/constants.go @@ -1,6 +1,6 @@ package gerencianet -var Version = "1.0.3" +var Version = "1.0.4" const ( UrlSandbox = "https://sandbox.gerencianet.com.br/v1" diff --git a/gerencianet/endpoints.go b/gerencianet/endpoints.go index 1758e8d..4c5fd7d 100755 --- a/gerencianet/endpoints.go +++ b/gerencianet/endpoints.go @@ -12,6 +12,10 @@ func (endpoints endpoints) CreateCharge(body map[string]interface{}) (string, er return endpoints.requester.request("/charge", "POST", nil, body) } +func (endpoints endpoints) CreateChargeOneStep(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/charge/one-step", "POST", nil, body) +} + func (endpoints endpoints) DetailCharge(chargeID int) (string, error) { params := map[string]string{ "id": strconv.Itoa(chargeID) } return endpoints.requester.request("/charge/:id", "GET", params, nil) From 4d387cbab9dc4d2275a0ecb765719b418a95eec8 Mon Sep 17 00:00:00 2001 From: Diego Alberto Date: Mon, 9 Sep 2019 18:06:29 -0300 Subject: [PATCH 25/29] Minor release: endpoints --- CHANGELOG.md | 2 +- _examples/charge/create_charge_onestep.go | 4 ++-- _examples/charge/create_charge_onestep_credit_card.go | 4 ++-- gerencianet/constants.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cbc4f3..b05dad7 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 1.0.4 +# 1.1.0 - Added: new endpoint (one step) diff --git a/_examples/charge/create_charge_onestep.go b/_examples/charge/create_charge_onestep.go index 92c9be5..78eda79 100755 --- a/_examples/charge/create_charge_onestep.go +++ b/_examples/charge/create_charge_onestep.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/dmalberto/gn-api-sdk-go/gerencianet" - "../configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_onestep_credit_card.go b/_examples/charge/create_charge_onestep_credit_card.go index bf9510b..e15abc8 100755 --- a/_examples/charge/create_charge_onestep_credit_card.go +++ b/_examples/charge/create_charge_onestep_credit_card.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "github.com/dmalberto/gn-api-sdk-go/gerencianet" - "../configs" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ diff --git a/gerencianet/constants.go b/gerencianet/constants.go index 06b3942..caf5cde 100755 --- a/gerencianet/constants.go +++ b/gerencianet/constants.go @@ -1,6 +1,6 @@ package gerencianet -var Version = "1.0.4" +var Version = "1.1.0" const ( UrlSandbox = "https://sandbox.gerencianet.com.br/v1" From b601be0d9527ced17d35d31fd32f7eeb8ad6183c Mon Sep 17 00:00:00 2001 From: Sady Coimbra Date: Fri, 20 Sep 2019 11:11:24 -0300 Subject: [PATCH 26/29] add: New examples onestep marketplace --- ...reate_charge_onestep_billet_marketplace.go | 64 +++++++++++++++ ..._charge_onestep_credit_card_marketplace.go | 79 +++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100755 _examples/charge/create_charge_onestep_billet_marketplace.go create mode 100755 _examples/charge/create_charge_onestep_credit_card_marketplace.go diff --git a/_examples/charge/create_charge_onestep_billet_marketplace.go b/_examples/charge/create_charge_onestep_billet_marketplace.go new file mode 100755 index 0000000..3233b6b --- /dev/null +++ b/_examples/charge/create_charge_onestep_billet_marketplace.go @@ -0,0 +1,64 @@ +package main + import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "../configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + repassOne := map[string]interface{}{ + "payee_code": "informe_payee_code_conta", // identificador da conta Gerencianet (repasse 1) + "percentage": 2500, // porcentagem de repasse (2500 = 25%) + } + + repassTwo := map[string]interface{}{ + "payee_code": "informe_payee_code_conta", // identificador da conta Gerencianet (repasse 2) + "percentage": 1500, // porcentagem de repasse (1500 = 15%) + } + + customer := map[string]interface{}{ + "name": "Gorbadoc Oldbuck", + "cpf": "04267484171", + "phone_number": "51944916523", + } + + body := map[string]interface{} { + "payment": map[string]interface{} { + "banking_billet": map[string]interface{} { + "expire_at": "2019-09-13", + "customer": customer, + }, + }, + "items": []map[string]interface{}{ + { + "name": "Product 1", + "value": 500, + "amount": 1, + "marketplace": map[string]interface{}{ + "repasses": []map[string]interface{}{ + repassOne, + repassTwo, + }, + }, + }, + }, + "shippings": []map[string]interface{} { + { + "name": "Default Shipping Cost", + "value": 100, + }, + }, + } + + res, err := gn.CreateChargeOneStep(body) // no lugar do 1 coloque o charge_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/_examples/charge/create_charge_onestep_credit_card_marketplace.go b/_examples/charge/create_charge_onestep_credit_card_marketplace.go new file mode 100755 index 0000000..fc28902 --- /dev/null +++ b/_examples/charge/create_charge_onestep_credit_card_marketplace.go @@ -0,0 +1,79 @@ +package main + import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "../configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + paymentToken := "Insira_aqui_seu_paymentToken"; + + repassOne := map[string]interface{}{ + "payee_code": "informe_payee_code_conta", // identificador da conta Gerencianet (repasse 1) + "percentage": 2500, // porcentagem de repasse (2500 = 25%) + } + + repassTwo := map[string]interface{}{ + "payee_code": "informe_payee_code_conta", // identificador da conta Gerencianet (repasse 2) + "percentage": 1500, // porcentagem de repasse (1500 = 15%) + } + + customer := map[string]interface{}{ + "name": "Gorbadoc Oldbuck", + "cpf": "04267484171", + "phone_number": "51944916523", + "email": "gorb.oldbuck@gerencianet.com.br", + "birth": "1977-01-15", + } + + billingAddress := map[string]interface{} { + "street": "Av JK", + "number": 909, + "neighborhood": "Bauxita", + "zipcode": "35400000", + "city": "Ouro Preto", + "state": "MG", + } + + body := map[string]interface{} { + "payment": map[string]interface{} { + "credit_card": map[string]interface{} { + "installments": 1, + "billing_address": billingAddress, + "payment_token": paymentToken, + "customer": customer, + }, + }, + "items": []map[string]interface{}{ + { + "name": "Product 1", + "value": 500, + "amount": 1, + "marketplace": map[string]interface{}{ + "repasses": []map[string]interface{}{ + repassOne, + repassTwo, + }, + }, + }, + }, + "shippings": []map[string]interface{} { + { + "name": "Default Shipping Cost", + "value": 100, + }, + }, + } + + res, err := gn.CreateChargeOneStep(body) // no lugar do 1 coloque o charge_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file From cc0e9ed07a948587b8761de235262f43e3ea016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Whinter=20Gon=C3=A7alves?= Date: Tue, 24 Sep 2019 11:40:27 -0300 Subject: [PATCH 27/29] Update create_charge_onestep_billet_marketplace.go --- _examples/charge/create_charge_onestep_billet_marketplace.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_examples/charge/create_charge_onestep_billet_marketplace.go b/_examples/charge/create_charge_onestep_billet_marketplace.go index 3233b6b..0741ab7 100755 --- a/_examples/charge/create_charge_onestep_billet_marketplace.go +++ b/_examples/charge/create_charge_onestep_billet_marketplace.go @@ -2,7 +2,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "../configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ @@ -61,4 +61,4 @@ func main(){ } else { fmt.Println(res) } -} \ No newline at end of file +} From c90da26e5d229343b90307748670d028acadaa2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Whinter=20Gon=C3=A7alves?= Date: Tue, 24 Sep 2019 11:40:50 -0300 Subject: [PATCH 28/29] Update create_charge_onestep_credit_card_marketplace.go --- .../charge/create_charge_onestep_credit_card_marketplace.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_examples/charge/create_charge_onestep_credit_card_marketplace.go b/_examples/charge/create_charge_onestep_credit_card_marketplace.go index fc28902..20987d3 100755 --- a/_examples/charge/create_charge_onestep_credit_card_marketplace.go +++ b/_examples/charge/create_charge_onestep_credit_card_marketplace.go @@ -2,7 +2,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "../configs" + "github.com/gerencianet/gn-api-sdk-go/_examples/configs" ) func main(){ @@ -76,4 +76,4 @@ func main(){ } else { fmt.Println(res) } -} \ No newline at end of file +} From 8f53168d546c8087cc31cf8f7b40ef1b9ef4b3ed Mon Sep 17 00:00:00 2001 From: Matheus Rodrigues Date: Mon, 26 Jul 2021 11:34:14 -0300 Subject: [PATCH 29/29] =?UTF-8?q?Inclus=C3=A3o=20dos=20endpoints=20Pix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- _examples/configs/configs.go | 8 -- examples/configs/configs.go | 10 ++ .../default}/carnet/cancel_carnet.go | 2 +- .../default}/carnet/cancel_parcel.go | 2 +- .../default}/carnet/create_carnet.go | 2 +- .../default}/carnet/create_carnet_history.go | 2 +- .../default}/carnet/detail_carnet.go | 2 +- .../default}/carnet/resend_carnet.go | 2 +- .../default}/carnet/resend_parcel.go | 2 +- .../default}/carnet/settle_parcel.go | 3 +- .../default}/carnet/update_carnet_metadata.go | 2 +- .../default}/carnet/update_parcel.go | 2 +- .../default}/charge/billet.go | 2 +- .../default}/charge/cancel_charge.go | 2 +- .../default}/charge/card.go | 2 +- .../default}/charge/create_charge.go | 2 +- .../charge/create_charge_balance_sheet.go | 2 +- .../default}/charge/create_charge_history.go | 2 +- .../default}/charge/create_charge_onestep.go | 2 +- ...reate_charge_onestep_billet_marketplace.go | 2 +- .../create_charge_onestep_credit_card.go | 2 +- ..._charge_onestep_credit_card_marketplace.go | 2 +- .../default}/charge/detail_charge.go | 2 +- .../default}/charge/link_charge.go | 2 +- .../default}/charge/resend_billet.go | 2 +- .../default}/charge/settle_charge.go | 2 +- .../default}/charge/update_billet.go | 2 +- .../default}/charge/update_charge_metadata.go | 2 +- .../default}/charge/update_link_charge.go | 2 +- .../default}/extras/get_installments.go | 2 +- .../default}/extras/get_notification.go | 2 +- .../subscription/cancel_subscription.go | 2 +- .../default}/subscription/create_plan.go | 2 +- .../subscription/create_subscription.go | 2 +- .../create_subscription_history.go | 2 +- .../default}/subscription/delete_plan.go | 2 +- .../subscription/detail_subscription.go | 2 +- .../default}/subscription/list_plans.go | 2 +- .../default}/subscription/pay_subscription.go | 2 +- .../default}/subscription/update_plan.go | 2 +- .../update_subscription_metadata.go | 2 +- examples/gn/account/balance.go | 22 +++ examples/gn/account/listSettings.go | 22 +++ examples/gn/account/updateSettings.go | 46 +++++++ examples/gn/key/create.go | 24 ++++ examples/gn/key/delete.go | 24 ++++ examples/gn/key/list.go | 22 +++ examples/pix/charge/createCharge.go | 50 +++++++ examples/pix/charge/createImmediateCharge.go | 49 +++++++ examples/pix/charge/detailCharge.go | 26 ++++ examples/pix/charge/listCharges.go | 26 ++++ examples/pix/location/createLoc.go | 27 ++++ examples/pix/location/deleteTxid.go | 25 ++++ examples/pix/location/generateQRCode.go | 23 ++++ examples/pix/location/getLoc.go | 23 ++++ examples/pix/location/listLoc.go | 26 ++++ examples/pix/pix/createDevolution.go | 29 ++++ examples/pix/pix/devolutionList.go | 26 ++++ examples/pix/pix/pixDetail.go | 26 ++++ examples/pix/pix/pixList.go | 26 ++++ examples/pix/pix/pixSend.go | 34 +++++ examples/pix/webhook/delete.go | 26 ++++ examples/pix/webhook/detail.go | 26 ++++ examples/pix/webhook/list.go | 26 ++++ examples/pix/webhook/update.go | 29 ++++ gerencianet/auth_internal_test.go | 84 ----------- gerencianet/auth_pix.go | 86 ++++++++++++ gerencianet/constants_pix.go | 8 ++ gerencianet/endpoints_internal_test.go | 53 ------- gerencianet/endpoints_pix.go | 130 ++++++++++++++++++ gerencianet/gerencianet_pix.go | 19 +++ gerencianet/gerencianet_test.go | 18 --- gerencianet/requester_internal_test.go | 123 ----------------- gerencianet/requester_pix.go | 124 +++++++++++++++++ 75 files changed, 1103 insertions(+), 328 deletions(-) delete mode 100755 _examples/configs/configs.go create mode 100755 examples/configs/configs.go rename {_examples => examples/default}/carnet/cancel_carnet.go (80%) rename {_examples => examples/default}/carnet/cancel_parcel.go (82%) rename {_examples => examples/default}/carnet/create_carnet.go (87%) rename {_examples => examples/default}/carnet/create_carnet_history.go (84%) rename {_examples => examples/default}/carnet/detail_carnet.go (80%) rename {_examples => examples/default}/carnet/resend_carnet.go (83%) rename {_examples => examples/default}/carnet/resend_parcel.go (84%) rename {_examples => examples/default}/carnet/settle_parcel.go (86%) rename {_examples => examples/default}/carnet/update_carnet_metadata.go (84%) rename {_examples => examples/default}/carnet/update_parcel.go (84%) rename {_examples => examples/default}/charge/billet.go (87%) rename {_examples => examples/default}/charge/cancel_charge.go (80%) rename {_examples => examples/default}/charge/card.go (90%) rename {_examples => examples/default}/charge/create_charge.go (85%) rename {_examples => examples/default}/charge/create_charge_balance_sheet.go (92%) rename {_examples => examples/default}/charge/create_charge_history.go (84%) rename {_examples => examples/default}/charge/create_charge_onestep.go (89%) rename {_examples => examples/default}/charge/create_charge_onestep_billet_marketplace.go (92%) rename {_examples => examples/default}/charge/create_charge_onestep_credit_card.go (91%) rename {_examples => examples/default}/charge/create_charge_onestep_credit_card_marketplace.go (93%) rename {_examples => examples/default}/charge/detail_charge.go (80%) rename {_examples => examples/default}/charge/link_charge.go (85%) rename {_examples => examples/default}/charge/resend_billet.go (83%) rename {_examples => examples/default}/charge/settle_charge.go (85%) rename {_examples => examples/default}/charge/update_billet.go (83%) rename {_examples => examples/default}/charge/update_charge_metadata.go (84%) rename {_examples => examples/default}/charge/update_link_charge.go (86%) rename {_examples => examples/default}/extras/get_installments.go (80%) rename {_examples => examples/default}/extras/get_notification.go (80%) rename {_examples => examples/default}/subscription/cancel_subscription.go (81%) rename {_examples => examples/default}/subscription/create_plan.go (81%) rename {_examples => examples/default}/subscription/create_subscription.go (84%) rename {_examples => examples/default}/subscription/create_subscription_history.go (88%) rename {_examples => examples/default}/subscription/delete_plan.go (80%) rename {_examples => examples/default}/subscription/detail_subscription.go (81%) rename {_examples => examples/default}/subscription/list_plans.go (79%) rename {_examples => examples/default}/subscription/pay_subscription.go (87%) rename {_examples => examples/default}/subscription/update_plan.go (87%) rename {_examples => examples/default}/subscription/update_subscription_metadata.go (85%) create mode 100755 examples/gn/account/balance.go create mode 100755 examples/gn/account/listSettings.go create mode 100755 examples/gn/account/updateSettings.go create mode 100755 examples/gn/key/create.go create mode 100755 examples/gn/key/delete.go create mode 100755 examples/gn/key/list.go create mode 100755 examples/pix/charge/createCharge.go create mode 100755 examples/pix/charge/createImmediateCharge.go create mode 100755 examples/pix/charge/detailCharge.go create mode 100755 examples/pix/charge/listCharges.go create mode 100755 examples/pix/location/createLoc.go create mode 100755 examples/pix/location/deleteTxid.go create mode 100755 examples/pix/location/generateQRCode.go create mode 100755 examples/pix/location/getLoc.go create mode 100755 examples/pix/location/listLoc.go create mode 100755 examples/pix/pix/createDevolution.go create mode 100755 examples/pix/pix/devolutionList.go create mode 100755 examples/pix/pix/pixDetail.go create mode 100755 examples/pix/pix/pixList.go create mode 100755 examples/pix/pix/pixSend.go create mode 100755 examples/pix/webhook/delete.go create mode 100755 examples/pix/webhook/detail.go create mode 100755 examples/pix/webhook/list.go create mode 100755 examples/pix/webhook/update.go delete mode 100755 gerencianet/auth_internal_test.go create mode 100755 gerencianet/auth_pix.go create mode 100755 gerencianet/constants_pix.go delete mode 100755 gerencianet/endpoints_internal_test.go create mode 100755 gerencianet/endpoints_pix.go create mode 100755 gerencianet/gerencianet_pix.go delete mode 100755 gerencianet/gerencianet_test.go delete mode 100755 gerencianet/requester_internal_test.go create mode 100755 gerencianet/requester_pix.go diff --git a/README.md b/README.md index 11d9b1a..632a900 100755 --- a/README.md +++ b/README.md @@ -13,10 +13,11 @@ Install with: ```bash $ go get github.com/gerencianet/gn-api-sdk-go/gerencianet +$ go mod init github.com/gerencianet/gn-api-sdk-go ``` ## Tested with ``` -go 1.8 and 1.11.4 +go 1.8, 1.11.4 and 1.16.5 ``` ## Basic usage @@ -24,7 +25,8 @@ go 1.8 and 1.11.4 ```go import ( - "github.com/FilipeMata/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) credentials := map[string]interface{} { diff --git a/_examples/configs/configs.go b/_examples/configs/configs.go deleted file mode 100755 index 3427f44..0000000 --- a/_examples/configs/configs.go +++ /dev/null @@ -1,8 +0,0 @@ -package configs - -var Credentials = map[string]interface{} { - "client_id": "Your Client_Id", - "client_secret": "Your Client_Secret", - "sandbox": true, - "timeout": 20, -} \ No newline at end of file diff --git a/examples/configs/configs.go b/examples/configs/configs.go new file mode 100755 index 0000000..fe567e1 --- /dev/null +++ b/examples/configs/configs.go @@ -0,0 +1,10 @@ +package configs + +var Credentials = map[string]interface{} { + "client_id": "Client_Id_cc838f2acc53d20df92a4211a768c10c392f96ac", + "client_secret": "Client_Secret_74ec12aed00def635deca9a19cf6e24b1010c721", + "sandbox": false, + "timeout": 20, + "CA" : "", + "Key" : "", +} \ No newline at end of file diff --git a/_examples/carnet/cancel_carnet.go b/examples/default/carnet/cancel_carnet.go similarity index 80% rename from _examples/carnet/cancel_carnet.go rename to examples/default/carnet/cancel_carnet.go index 40d0a6c..5b2c314 100755 --- a/_examples/carnet/cancel_carnet.go +++ b/examples/default/carnet/cancel_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/cancel_parcel.go b/examples/default/carnet/cancel_parcel.go similarity index 82% rename from _examples/carnet/cancel_parcel.go rename to examples/default/carnet/cancel_parcel.go index 34d666b..a8877c3 100755 --- a/_examples/carnet/cancel_parcel.go +++ b/examples/default/carnet/cancel_parcel.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/create_carnet.go b/examples/default/carnet/create_carnet.go similarity index 87% rename from _examples/carnet/create_carnet.go rename to examples/default/carnet/create_carnet.go index 4b3445b..7325992 100755 --- a/_examples/carnet/create_carnet.go +++ b/examples/default/carnet/create_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/create_carnet_history.go b/examples/default/carnet/create_carnet_history.go similarity index 84% rename from _examples/carnet/create_carnet_history.go rename to examples/default/carnet/create_carnet_history.go index 7eb257a..0526f04 100755 --- a/_examples/carnet/create_carnet_history.go +++ b/examples/default/carnet/create_carnet_history.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/detail_carnet.go b/examples/default/carnet/detail_carnet.go similarity index 80% rename from _examples/carnet/detail_carnet.go rename to examples/default/carnet/detail_carnet.go index 2882a10..6e82eb4 100755 --- a/_examples/carnet/detail_carnet.go +++ b/examples/default/carnet/detail_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/resend_carnet.go b/examples/default/carnet/resend_carnet.go similarity index 83% rename from _examples/carnet/resend_carnet.go rename to examples/default/carnet/resend_carnet.go index 70637e3..a75e3e8 100755 --- a/_examples/carnet/resend_carnet.go +++ b/examples/default/carnet/resend_carnet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/resend_parcel.go b/examples/default/carnet/resend_parcel.go similarity index 84% rename from _examples/carnet/resend_parcel.go rename to examples/default/carnet/resend_parcel.go index 64dd02d..aeca78f 100755 --- a/_examples/carnet/resend_parcel.go +++ b/examples/default/carnet/resend_parcel.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/settle_parcel.go b/examples/default/carnet/settle_parcel.go similarity index 86% rename from _examples/carnet/settle_parcel.go rename to examples/default/carnet/settle_parcel.go index 139b264..9e34fe1 100644 --- a/_examples/carnet/settle_parcel.go +++ b/examples/default/carnet/settle_parcel.go @@ -3,8 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" -) + "github.com/gerencianet/gn-api-sdk-go/examples/configs" func main(){ diff --git a/_examples/carnet/update_carnet_metadata.go b/examples/default/carnet/update_carnet_metadata.go similarity index 84% rename from _examples/carnet/update_carnet_metadata.go rename to examples/default/carnet/update_carnet_metadata.go index c67e3f4..0cf6911 100755 --- a/_examples/carnet/update_carnet_metadata.go +++ b/examples/default/carnet/update_carnet_metadata.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/carnet/update_parcel.go b/examples/default/carnet/update_parcel.go similarity index 84% rename from _examples/carnet/update_parcel.go rename to examples/default/carnet/update_parcel.go index c4a974f..35068a9 100755 --- a/_examples/carnet/update_parcel.go +++ b/examples/default/carnet/update_parcel.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/billet.go b/examples/default/charge/billet.go similarity index 87% rename from _examples/charge/billet.go rename to examples/default/charge/billet.go index c99e6c2..a1155a8 100755 --- a/_examples/charge/billet.go +++ b/examples/default/charge/billet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/cancel_charge.go b/examples/default/charge/cancel_charge.go similarity index 80% rename from _examples/charge/cancel_charge.go rename to examples/default/charge/cancel_charge.go index ee999d2..4d0d4b3 100755 --- a/_examples/charge/cancel_charge.go +++ b/examples/default/charge/cancel_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/card.go b/examples/default/charge/card.go similarity index 90% rename from _examples/charge/card.go rename to examples/default/charge/card.go index ff056b9..310e330 100755 --- a/_examples/charge/card.go +++ b/examples/default/charge/card.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge.go b/examples/default/charge/create_charge.go similarity index 85% rename from _examples/charge/create_charge.go rename to examples/default/charge/create_charge.go index 03d4ab4..55a0f23 100755 --- a/_examples/charge/create_charge.go +++ b/examples/default/charge/create_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_balance_sheet.go b/examples/default/charge/create_charge_balance_sheet.go similarity index 92% rename from _examples/charge/create_charge_balance_sheet.go rename to examples/default/charge/create_charge_balance_sheet.go index 289794e..9640295 100755 --- a/_examples/charge/create_charge_balance_sheet.go +++ b/examples/default/charge/create_charge_balance_sheet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_history.go b/examples/default/charge/create_charge_history.go similarity index 84% rename from _examples/charge/create_charge_history.go rename to examples/default/charge/create_charge_history.go index 6eab9a3..b6d7d13 100755 --- a/_examples/charge/create_charge_history.go +++ b/examples/default/charge/create_charge_history.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_onestep.go b/examples/default/charge/create_charge_onestep.go similarity index 89% rename from _examples/charge/create_charge_onestep.go rename to examples/default/charge/create_charge_onestep.go index 78eda79..2f09632 100755 --- a/_examples/charge/create_charge_onestep.go +++ b/examples/default/charge/create_charge_onestep.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_onestep_billet_marketplace.go b/examples/default/charge/create_charge_onestep_billet_marketplace.go similarity index 92% rename from _examples/charge/create_charge_onestep_billet_marketplace.go rename to examples/default/charge/create_charge_onestep_billet_marketplace.go index 0741ab7..8ea7670 100755 --- a/_examples/charge/create_charge_onestep_billet_marketplace.go +++ b/examples/default/charge/create_charge_onestep_billet_marketplace.go @@ -2,7 +2,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_onestep_credit_card.go b/examples/default/charge/create_charge_onestep_credit_card.go similarity index 91% rename from _examples/charge/create_charge_onestep_credit_card.go rename to examples/default/charge/create_charge_onestep_credit_card.go index e15abc8..f15f658 100755 --- a/_examples/charge/create_charge_onestep_credit_card.go +++ b/examples/default/charge/create_charge_onestep_credit_card.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/create_charge_onestep_credit_card_marketplace.go b/examples/default/charge/create_charge_onestep_credit_card_marketplace.go similarity index 93% rename from _examples/charge/create_charge_onestep_credit_card_marketplace.go rename to examples/default/charge/create_charge_onestep_credit_card_marketplace.go index 20987d3..456ae30 100755 --- a/_examples/charge/create_charge_onestep_credit_card_marketplace.go +++ b/examples/default/charge/create_charge_onestep_credit_card_marketplace.go @@ -2,7 +2,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/detail_charge.go b/examples/default/charge/detail_charge.go similarity index 80% rename from _examples/charge/detail_charge.go rename to examples/default/charge/detail_charge.go index b6251f2..02a7cfd 100755 --- a/_examples/charge/detail_charge.go +++ b/examples/default/charge/detail_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/link_charge.go b/examples/default/charge/link_charge.go similarity index 85% rename from _examples/charge/link_charge.go rename to examples/default/charge/link_charge.go index af962de..319c8aa 100755 --- a/_examples/charge/link_charge.go +++ b/examples/default/charge/link_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/resend_billet.go b/examples/default/charge/resend_billet.go similarity index 83% rename from _examples/charge/resend_billet.go rename to examples/default/charge/resend_billet.go index c8a6c7a..dfa3664 100755 --- a/_examples/charge/resend_billet.go +++ b/examples/default/charge/resend_billet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/settle_charge.go b/examples/default/charge/settle_charge.go similarity index 85% rename from _examples/charge/settle_charge.go rename to examples/default/charge/settle_charge.go index b9ec58d..27e8f94 100644 --- a/_examples/charge/settle_charge.go +++ b/examples/default/charge/settle_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/update_billet.go b/examples/default/charge/update_billet.go similarity index 83% rename from _examples/charge/update_billet.go rename to examples/default/charge/update_billet.go index c486bb1..ca5937c 100755 --- a/_examples/charge/update_billet.go +++ b/examples/default/charge/update_billet.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/update_charge_metadata.go b/examples/default/charge/update_charge_metadata.go similarity index 84% rename from _examples/charge/update_charge_metadata.go rename to examples/default/charge/update_charge_metadata.go index 5c7c240..668e456 100755 --- a/_examples/charge/update_charge_metadata.go +++ b/examples/default/charge/update_charge_metadata.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/charge/update_link_charge.go b/examples/default/charge/update_link_charge.go similarity index 86% rename from _examples/charge/update_link_charge.go rename to examples/default/charge/update_link_charge.go index 5813d13..fd0d690 100755 --- a/_examples/charge/update_link_charge.go +++ b/examples/default/charge/update_link_charge.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/extras/get_installments.go b/examples/default/extras/get_installments.go similarity index 80% rename from _examples/extras/get_installments.go rename to examples/default/extras/get_installments.go index e1c5b98..041578c 100755 --- a/_examples/extras/get_installments.go +++ b/examples/default/extras/get_installments.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/extras/get_notification.go b/examples/default/extras/get_notification.go similarity index 80% rename from _examples/extras/get_notification.go rename to examples/default/extras/get_notification.go index 9534d98..317c732 100755 --- a/_examples/extras/get_notification.go +++ b/examples/default/extras/get_notification.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/cancel_subscription.go b/examples/default/subscription/cancel_subscription.go similarity index 81% rename from _examples/subscription/cancel_subscription.go rename to examples/default/subscription/cancel_subscription.go index 424c9e0..8fabd9a 100755 --- a/_examples/subscription/cancel_subscription.go +++ b/examples/default/subscription/cancel_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/create_plan.go b/examples/default/subscription/create_plan.go similarity index 81% rename from _examples/subscription/create_plan.go rename to examples/default/subscription/create_plan.go index 109a38b..bdaabf6 100755 --- a/_examples/subscription/create_plan.go +++ b/examples/default/subscription/create_plan.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/create_subscription.go b/examples/default/subscription/create_subscription.go similarity index 84% rename from _examples/subscription/create_subscription.go rename to examples/default/subscription/create_subscription.go index 8ce7b24..a6392c0 100755 --- a/_examples/subscription/create_subscription.go +++ b/examples/default/subscription/create_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/create_subscription_history.go b/examples/default/subscription/create_subscription_history.go similarity index 88% rename from _examples/subscription/create_subscription_history.go rename to examples/default/subscription/create_subscription_history.go index 021505b..ec61b05 100755 --- a/_examples/subscription/create_subscription_history.go +++ b/examples/default/subscription/create_subscription_history.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/delete_plan.go b/examples/default/subscription/delete_plan.go similarity index 80% rename from _examples/subscription/delete_plan.go rename to examples/default/subscription/delete_plan.go index c7e893e..00db42f 100755 --- a/_examples/subscription/delete_plan.go +++ b/examples/default/subscription/delete_plan.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/detail_subscription.go b/examples/default/subscription/detail_subscription.go similarity index 81% rename from _examples/subscription/detail_subscription.go rename to examples/default/subscription/detail_subscription.go index 76b92c9..21001f3 100755 --- a/_examples/subscription/detail_subscription.go +++ b/examples/default/subscription/detail_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/list_plans.go b/examples/default/subscription/list_plans.go similarity index 79% rename from _examples/subscription/list_plans.go rename to examples/default/subscription/list_plans.go index 2e74731..c1897e3 100755 --- a/_examples/subscription/list_plans.go +++ b/examples/default/subscription/list_plans.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/pay_subscription.go b/examples/default/subscription/pay_subscription.go similarity index 87% rename from _examples/subscription/pay_subscription.go rename to examples/default/subscription/pay_subscription.go index bbb1873..765c99f 100755 --- a/_examples/subscription/pay_subscription.go +++ b/examples/default/subscription/pay_subscription.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/update_plan.go b/examples/default/subscription/update_plan.go similarity index 87% rename from _examples/subscription/update_plan.go rename to examples/default/subscription/update_plan.go index b5f8f1a..681c7ae 100755 --- a/_examples/subscription/update_plan.go +++ b/examples/default/subscription/update_plan.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/_examples/subscription/update_subscription_metadata.go b/examples/default/subscription/update_subscription_metadata.go similarity index 85% rename from _examples/subscription/update_subscription_metadata.go rename to examples/default/subscription/update_subscription_metadata.go index ffbebf9..95ddbf0 100755 --- a/_examples/subscription/update_subscription_metadata.go +++ b/examples/default/subscription/update_subscription_metadata.go @@ -3,7 +3,7 @@ package main import ( "fmt" "github.com/gerencianet/gn-api-sdk-go/gerencianet" - "github.com/gerencianet/gn-api-sdk-go/_examples/configs" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" ) func main(){ diff --git a/examples/gn/account/balance.go b/examples/gn/account/balance.go new file mode 100755 index 0000000..2343ae0 --- /dev/null +++ b/examples/gn/account/balance.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + res, err := gn.Balance(nil) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/gn/account/listSettings.go b/examples/gn/account/listSettings.go new file mode 100755 index 0000000..5034a96 --- /dev/null +++ b/examples/gn/account/listSettings.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + res, err := gn.ListSettings(nil) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/gn/account/updateSettings.go b/examples/gn/account/updateSettings.go new file mode 100755 index 0000000..acb20de --- /dev/null +++ b/examples/gn/account/updateSettings.go @@ -0,0 +1,46 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + + body := map[string]interface{} { + + "pix": map[string]interface{}{ + "receberSemChave": false, + "chaves": map[string]interface{} { + "48044e07-e215-417f-b1ad-32ee2d99c2bc":map[string]interface{} { + "recebimento":map[string]interface{} { + "txidObrigatorio": false, + "qrCodeEstatico":map[string]interface{} { + "recusarTodos": false, + + }, + + }, + + }, + + }, + + }, + + } + + res, err := gn.UpdateSettings(body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/gn/key/create.go b/examples/gn/key/create.go new file mode 100755 index 0000000..e44bb7b --- /dev/null +++ b/examples/gn/key/create.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + body := map[string]interface{} {} + + + res, err := gn.CreateKey(body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/gn/key/delete.go b/examples/gn/key/delete.go new file mode 100755 index 0000000..4a2e8fe --- /dev/null +++ b/examples/gn/key/delete.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + body := map[string]interface{} {} + const key = "48044e07-e215-417f-b1ad-32ee2d99c2bc" + + res, err := gn.DeleteKey(key, body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/gn/key/list.go b/examples/gn/key/list.go new file mode 100755 index 0000000..ef22f12 --- /dev/null +++ b/examples/gn/key/list.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + res, err := gn.ListKey(nil) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/charge/createCharge.go b/examples/pix/charge/createCharge.go new file mode 100755 index 0000000..4362fe5 --- /dev/null +++ b/examples/pix/charge/createCharge.go @@ -0,0 +1,50 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const txid = "adssshdsjdsjeyccdyddsasdstxid29" + + body := map[string]interface{} { + + "calendario": map[string]interface{} { + "expiracao": 3600, + }, + "devedor": map[string]interface{}{ + + "cnpj": "12345678000195", + "nome": "Empresa de Serviços SA", + + }, + "valor": map[string]interface{} { + + "original": "00.01", + + }, + "chave": "48044e07-e215-417f-b1ad-32ee2d99c2bc", + "solicitacaoPagador": "Teste.", + "infoAdicionais": []map[string]interface{} { + { + "nome": "Campo 1", + "valor": "Informação Adicional1 do PSP-Recebedor", + }, + }, + } + + res, err := gn.CreateCharge(txid,body) // no lugar do 1 coloque o charge_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/charge/createImmediateCharge.go b/examples/pix/charge/createImmediateCharge.go new file mode 100755 index 0000000..100ee99 --- /dev/null +++ b/examples/pix/charge/createImmediateCharge.go @@ -0,0 +1,49 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + + body := map[string]interface{} { + + "calendario": map[string]interface{} { + "expiracao": 3600, + }, + "devedor": map[string]interface{}{ + + "cpf": "12345678909", + "nome": "Francisco da Silva", + + }, + "valor": map[string]interface{} { + + "original": "00.01", + + }, + "chave": "48044e07-e215-417f-b1ad-32ee2d99c2bc", + "solicitacaoPagador": "Teste.", + "infoAdicionais": []map[string]interface{} { + { + "nome": "Campo 1", + "valor": "Informação Adicional1 do PSP-Recebedor", + }, + }, + } + + res, err := gn.CreateImmediateCharge(body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/charge/detailCharge.go b/examples/pix/charge/detailCharge.go new file mode 100755 index 0000000..d3519d6 --- /dev/null +++ b/examples/pix/charge/detailCharge.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const txid = "adssshdsjdsjeyccdyddsasdstxid23" + + + + res, err := gn.DetailCharge(txid) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/charge/listCharges.go b/examples/pix/charge/listCharges.go new file mode 100755 index 0000000..7a4f491 --- /dev/null +++ b/examples/pix/charge/listCharges.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const inicio = "2021-03-01T03:01:35Z" + const fim = "2021-03-05T22:01:35Z" + + + res, err := gn.ListCharges(inicio, fim) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/location/createLoc.go b/examples/pix/location/createLoc.go new file mode 100755 index 0000000..480efa6 --- /dev/null +++ b/examples/pix/location/createLoc.go @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + + body := map[string]interface{} { + "tipoCob": "cob", + } + + res, err := gn.CreateLoc(body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/location/deleteTxid.go b/examples/pix/location/deleteTxid.go new file mode 100755 index 0000000..c8ac50a --- /dev/null +++ b/examples/pix/location/deleteTxid.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + body := map[string]interface{} {} + const id = "423" + + + res, err := gn.DeleteTxid(id, body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/location/generateQRCode.go b/examples/pix/location/generateQRCode.go new file mode 100755 index 0000000..5118ad1 --- /dev/null +++ b/examples/pix/location/generateQRCode.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + const id = "423" + + res, err := gn.GenerateQRCode(id) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/location/getLoc.go b/examples/pix/location/getLoc.go new file mode 100755 index 0000000..e5e7d2d --- /dev/null +++ b/examples/pix/location/getLoc.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + const id = "423" + + res, err := gn.GetLoc(id) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/location/listLoc.go b/examples/pix/location/listLoc.go new file mode 100755 index 0000000..e2c7727 --- /dev/null +++ b/examples/pix/location/listLoc.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const inicio = "2021-03-01T03:01:35Z" + const fim = "2021-03-05T22:01:35Z" + + + res, err := gn.ListLoc(inicio, fim) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/pix/createDevolution.go b/examples/pix/pix/createDevolution.go new file mode 100755 index 0000000..0c86a5b --- /dev/null +++ b/examples/pix/pix/createDevolution.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const e2eid = "E00416968202105211756Rh0iPsaJ1RK" + const id = "adssshdsjdsjeyccdyddsasdstxid29" + + body := map[string]interface{} { + "valor": "0.01", + } + + res, err := gn.CreateDevolution(e2eid,id,body) // no lugar do 1 coloque o charge_id certo + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/pix/devolutionList.go b/examples/pix/pix/devolutionList.go new file mode 100755 index 0000000..5a2a4f6 --- /dev/null +++ b/examples/pix/pix/devolutionList.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const e2eid = "E00416968202105211756Rh0iPsaJ1RK" + const id = "adssshdsjdsjeyccdyddsasdstxid29" + + + res, err := gn.DevolutionList(e2eid,id) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/pix/pixDetail.go b/examples/pix/pix/pixDetail.go new file mode 100755 index 0000000..82b7f6c --- /dev/null +++ b/examples/pix/pix/pixDetail.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const e2eid = "E00416968202105211756Rh0iPsaJ1RK" + + + + res, err := gn.PixDetail(e2eid) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/pix/pixList.go b/examples/pix/pix/pixList.go new file mode 100755 index 0000000..4d431a1 --- /dev/null +++ b/examples/pix/pix/pixList.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const inicio = "2021-03-01T03:01:35Z" + const fim = "2021-03-05T22:01:35Z" + + + res, err := gn.PixList(inicio, fim) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/pix/pixSend.go b/examples/pix/pix/pixSend.go new file mode 100755 index 0000000..8c8c62e --- /dev/null +++ b/examples/pix/pix/pixSend.go @@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + + body := map[string]interface{} { + "valor": "10.00", + "pagador": map[string]interface{} { + "chave": "48044e07-e215-417f-b1ad-32ee2d99c2bc", + "infoPagador": "Segue o pagamento da conta", + }, + "favorecido": map[string]interface{} { + "chave": "620e2ddb-9746-4e0e-9350-dc6dff699224", + }, + } + + res, err := gn.PixSend(body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/webhook/delete.go b/examples/pix/webhook/delete.go new file mode 100755 index 0000000..77e4a7e --- /dev/null +++ b/examples/pix/webhook/delete.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + body := map[string]interface{} {} + const chave = "2c5c7441-a91e-4982-8c25-61e18ae" + + + + res, err := gn.DeleteWebhook(chave, body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/webhook/detail.go b/examples/pix/webhook/detail.go new file mode 100755 index 0000000..08354d0 --- /dev/null +++ b/examples/pix/webhook/detail.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const chave = "2c5c7441-a91e-4982-8c25-e18ae" + + + + res, err := gn.GetWebhook(chave) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/webhook/list.go b/examples/pix/webhook/list.go new file mode 100755 index 0000000..3c3a2de --- /dev/null +++ b/examples/pix/webhook/list.go @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const inicio = "2021-03-01T03:01:35Z" + const fim = "2021-06-05T22:01:35Z" + + + res, err := gn.ListWebhooks(inicio, fim) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/examples/pix/webhook/update.go b/examples/pix/webhook/update.go new file mode 100755 index 0000000..8cf0fe2 --- /dev/null +++ b/examples/pix/webhook/update.go @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/gerencianet/gn-api-sdk-go/gerencianet" + "github.com/gerencianet/gn-api-sdk-go/examples/configs" +) + +func main(){ + + credentials := configs.Credentials + gn := gerencianet.NewGerencianet(credentials) + + + const chave = "937e676f-583b-42df-82cd-fbb4" + + body := map[string]interface{} { + + "webhookUrl": "https://seu_webhook", + } + + res, err := gn.UpdateWebhook(chave,body) + + if err != nil { + fmt.Println(err) + } else { + fmt.Println(res) + } +} \ No newline at end of file diff --git a/gerencianet/auth_internal_test.go b/gerencianet/auth_internal_test.go deleted file mode 100755 index 3a6ef01..0000000 --- a/gerencianet/auth_internal_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package gerencianet - -import ( - "bytes" - "errors" - "io/ioutil" - "net/http" - "testing" -) - -type MockClient struct { - authorized bool - DoFunc func(req *http.Request) (*http.Response, error) -} - -func (m *MockClient) Do(req *http.Request) (*http.Response, error) { - if m.DoFunc != nil { - return m.DoFunc(req) - } - return &http.Response{}, errors.New("auth error") -} - -func Test_newAuth(t *testing.T) { - actualResult := newAuth("cidTest", "csTest", true, 10) - if actualResult.clientID != "cidTest" || - actualResult.clientSecret != "csTest" || - actualResult.sandbox != true || - actualResult.timeout != 10 { - t.Error("Error on constructor") - } -} - -func Test_getAccessTokenToReturnTokenData(t *testing.T) { - - httpClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewReader([]byte("test"))), - }, nil - }, - } - - auth := auth{"cidTest", "csTest", true, 10, httpClient} - _, err := auth.getAccessToken() - if err != nil { - t.Error("Expected err to be nil") - } -} - -func Test_getAccessTokenToReturnUnauthorizedError(t *testing.T) { - - httpClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: 401, - Status: "Unauthorized", - Body: ioutil.NopCloser(bytes.NewReader([]byte("test"))), - }, nil - }, - } - - auth := auth{"cidTest", "csTest", false, 10, httpClient} - expected := "Status: Unauthorized Could not authenticate. \nPlease make sure you are using correct credentials and if you are using then in the correct environment." - _, err := auth.getAccessToken() - if err.Error() != expected { - t.Errorf("Error actual = %v, and Expected = %v.", err, expected) - } -} - -func Test_getAccessTokenToReturnHttpRequestError(t *testing.T) { - - httpClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return nil, errors.New("Test") - }, - } - - auth := auth{"cidTest", "csTest", true, 10, httpClient} - _, err := auth.getAccessToken() - if err == nil { - t.Errorf("Expected error but got no one") - } -} diff --git a/gerencianet/auth_pix.go b/gerencianet/auth_pix.go new file mode 100755 index 0000000..2bc5331 --- /dev/null +++ b/gerencianet/auth_pix.go @@ -0,0 +1,86 @@ +package pix + +import ( + "bytes" + b64 "encoding/base64" + "encoding/json" + "errors" + "net/http" + "time" + "crypto/tls" +) + +type auth struct { + clientID, clientSecret string + CA, Key string + sandbox bool + timeout int + netClient interface { + Do(req *http.Request) (*http.Response, error) + } +} + +type authResponseBody struct { + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + ExpiresIn int `json:"expires_in"` + EspiresAt string `json:"expire_at"` + TokenType string `json:"token_type"` +} + + +func newAuth(clientID string, clientSecret string,CA string, Key string, sandbox bool, timeout int) *auth { + var cert, erro = tls.LoadX509KeyPair(CA, Key) + if erro != nil { + println("Falha ao carregar par de chaves",erro) + } + var netTransport = &http.Transport{ + TLSClientConfig: &tls.Config{ + Certificates: []tls.Certificate{cert}, + }, + } + httpClient := &http.Client{Timeout: time.Second * time.Duration(timeout),Transport: netTransport} + return &auth{clientID, clientSecret,CA, Key, sandbox, timeout, httpClient} +} + + + +func (auth auth) getAccessToken() (authResponseBody, error) { + var response authResponseBody + credentials := auth.clientID + ":" + auth.clientSecret + authCredentials := b64.StdEncoding.EncodeToString([]byte(credentials)) + postParams := map[string]string{"grant_type": "client_credentials"} + buffer := new(bytes.Buffer) + json.NewEncoder(buffer).Encode(postParams) + + var gnURL string + if auth.sandbox { + gnURL = UrlSandbox + } else { + gnURL = UrlProduction + } + req, _ := http.NewRequest("POST", gnURL+"/oauth/token", buffer) + req.Header.Add("Authorization", "Basic "+authCredentials) + req.Header.Add("Content-Type", "application/json") + req.Header.Add("charset", "utf-8") + req.Header.Add("api-sdk", "go-" + Version) + + + res, resErr := auth.netClient.Do(req) + + + + + if resErr != nil { + return response, resErr + } + + if res.StatusCode != http.StatusOK { + return response, errors.New("Status: " + res.Status + " Could not authenticate. \nPlease make sure you are using correct credentials and if you are using then in the correct environment.") + } + + json.NewDecoder(res.Body).Decode(&response) + + return response, nil + +} \ No newline at end of file diff --git a/gerencianet/constants_pix.go b/gerencianet/constants_pix.go new file mode 100755 index 0000000..90cfc83 --- /dev/null +++ b/gerencianet/constants_pix.go @@ -0,0 +1,8 @@ +package pix + +var Version = "2.0.0" + +const ( + UrlSandbox = "https://api-pix-h.gerencianet.com.br" + UrlProduction = "https://api-pix.gerencianet.com.br" +) diff --git a/gerencianet/endpoints_internal_test.go b/gerencianet/endpoints_internal_test.go deleted file mode 100755 index 682f68c..0000000 --- a/gerencianet/endpoints_internal_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package gerencianet - -import ( - "testing" -) - -type MockRequester struct {} - -func (m *MockRequester) request(endpoint string, httpVerb string, requestParams map[string]string, body map[string]interface{}) (string, error) { - return "", nil -} - -func Test_endpoints(t *testing.T) { - requester := &MockRequester{} - endpoints := endpoints{requester} - endpoints.CreateCharge(nil) - endpoints.DetailCharge(1) - endpoints.UpdateChargeMetadata(1, nil) - endpoints.UpdateBillet(1, nil) - endpoints.PayCharge(1, nil) - endpoints.CancelCharge(1) - endpoints.CreateCarnet(nil) - endpoints.DetailCarnet(1) - endpoints.UpdateParcel(1, 1, nil) - endpoints.UpdateCarnetMetadata(1, nil) - endpoints.GetNotification("") - endpoints.GetPlans(1, 1) - endpoints.CreatePlan(nil) - endpoints.DeletePlan(1) - endpoints.CreateSubscription(1, nil) - endpoints.DetailSubscription(1) - endpoints.PaySubscription(1, nil) - endpoints.CancelSubscription(1) - endpoints.UpdateSubscriptionMetadata(1, nil) - endpoints.GetInstallments(20000, "visa") - endpoints.ResendBillet(1, nil) - endpoints.CreateChargeHistory(1, nil) - endpoints.ResendCarnet(1, nil) - endpoints.ResendParcel(1, 1, nil) - endpoints.CreateCarnetHistory(1, nil) - endpoints.CancelCarnet(1) - endpoints.CancelParcel(1, 1) - endpoints.ChargeLink(1, nil) - endpoints.UpdateChargeLink(1, nil) - endpoints.UpdatePlan(1, nil) - endpoints.CreateSubscriptionHistory(1, nil) - endpoints.CreateChargeBalanceSheet(1, nil) - endpoints.SettleCarnetParcel(1, 1) - endpoints.SettleCharge(1) - - - t.Skip("skipping endpoints tests") -} \ No newline at end of file diff --git a/gerencianet/endpoints_pix.go b/gerencianet/endpoints_pix.go new file mode 100755 index 0000000..6405202 --- /dev/null +++ b/gerencianet/endpoints_pix.go @@ -0,0 +1,130 @@ +package pix + + +type endpoints struct { + requester interface { + request(endpoint string, httpVerb string, requestParams map[string]string, body map[string]interface{}) (string, error) + } +} + + + + +func (endpoints endpoints) CreateImmediateCharge(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/cob", "POST", nil, body) +} + + +func (endpoints endpoints) CreateCharge(txid string, body map[string]interface{}) (string, error) { + params := map[string]string{ "txid": (txid) } + return endpoints.requester.request("/v2/cob/:txid", "PUT", params, body) +} + +func (endpoints endpoints) DetailCharge(txid string) (string, error) { + params := map[string]string{ "txid": (txid) } + return endpoints.requester.request("/v2/cob/:txid", "GET", params, nil) +} + +func (endpoints endpoints) ListCharges(inicio string, fim string) (string, error) { + params := map[string]string{ + "inicio": (inicio), + "fim": (fim), + } + return endpoints.requester.request("/v2/cob?inicio=:inicio&fim=:fim", "GET", params, nil) +} + +func (endpoints endpoints) CreateDevolution(e2eid string, id string, body map[string]interface{}) (string, error) { + params := map[string]string{ + "e2eid": (e2eid), + "id": (id), } + return endpoints.requester.request("/v2/pix/:e2eid/devolucao/:id", "PUT", params, body) +} + +func (endpoints endpoints) DevolutionList(e2eid string, id string) (string, error) { + params := map[string]string{ + "e2eid": (e2eid), + "id": (id), } + return endpoints.requester.request("/v2/pix/:e2eid/devolucao/:id", "GET", params, nil) +} + +func (endpoints endpoints) PixDetail(e2eid string) (string, error) { + params := map[string]string{ "e2eid": (e2eid) } + return endpoints.requester.request("/v2/pix/:e2eid", "GET", params, nil) +} + +func (endpoints endpoints) PixSend(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/pix", "POST", nil, body) +} + +func (endpoints endpoints) CreateLoc(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/loc", "POST", nil, body) +} + +func (endpoints endpoints) DeleteTxid(id string, body map[string]interface{}) (string, error) { + params := map[string]string{ "id": (id) } + return endpoints.requester.request("/v2/loc/:id/txid", "DELETE", params, body) +} + +func (endpoints endpoints) GetLoc(id string) (string, error) { + params := map[string]string{ "id": (id) } + return endpoints.requester.request("/v2/loc/:id", "GET", params, nil) +} + +func (endpoints endpoints) ListLoc(inicio string, fim string) (string, error) { + params := map[string]string{ + "inicio": (inicio), + "fim": (fim), + } + return endpoints.requester.request("/v2/loc?inicio=:inicio&fim=:fim", "GET", params, nil) +} + +func (endpoints endpoints) GenerateQRCode(id string) (string, error) { + params := map[string]string{ "id": (id) } + return endpoints.requester.request("/v2/loc/:id/qrcode", "GET", params, nil) +} + +func (endpoints endpoints) Balance(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/gn/saldo", "GET", nil, body) +} +func (endpoints endpoints) ListSettings(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/gn/config", "GET", nil, body) +} + +func (endpoints endpoints) UpdateSettings(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/gn/config", "PUT", nil, body) +} +func (endpoints endpoints) CreateKey(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/gn/evp", "POST", nil, body) +} + +func (endpoints endpoints) ListKey(body map[string]interface{}) (string, error) { + return endpoints.requester.request("/v2/gn/evp", "GET", nil, body) +} + +func (endpoints endpoints) DeleteKey(key string, body map[string]interface{}) (string, error) { + params := map[string]string{ "key": (key) } + return endpoints.requester.request("/v2/gn/evp/:key", "DELETE", params, body) +} + +func (endpoints endpoints) UpdateWebhook(chave string, body map[string]interface{}) (string, error) { + params := map[string]string{ "chave": (chave) } + return endpoints.requester.request("/v2/webhook/:chave", "PUT", params, body) +} + +func (endpoints endpoints) DeleteWebhook(chave string, body map[string]interface{}) (string, error) { + params := map[string]string{ "chave": (chave) } + return endpoints.requester.request("/v2/webhook/:chave", "DELETE", params, body) +} + +func (endpoints endpoints) GetWebhook(chave string) (string, error) { + params := map[string]string{ "chave": (chave) } + return endpoints.requester.request("/v2/webhook/:chave", "GET", params, nil) +} + +func (endpoints endpoints) ListWebhooks(inicio string, fim string) (string, error) { + params := map[string]string{ + "inicio": (inicio), + "fim": (fim), + } + return endpoints.requester.request("/v2/webhook?inicio=:inicio&fim=:fim", "GET", params, nil) +} \ No newline at end of file diff --git a/gerencianet/gerencianet_pix.go b/gerencianet/gerencianet_pix.go new file mode 100755 index 0000000..23e9099 --- /dev/null +++ b/gerencianet/gerencianet_pix.go @@ -0,0 +1,19 @@ +package pix + +type gerencianet struct { + endpoints +} + +func NewGerencianet(configs map[string]interface{}) *pix { + clientID := configs["client_id"].(string) + clientSecret := configs["client_secret"].(string) + CA := configs["CA"].(string) + Key := configs["Key"].(string) + sandbox := configs["sandbox"].(bool) + timeout := configs["timeout"].(int) + + requester := newRequester(clientID, clientSecret,CA, Key, sandbox, timeout) + gn := pix{} + gn.requester = *requester + return &gn +} \ No newline at end of file diff --git a/gerencianet/gerencianet_test.go b/gerencianet/gerencianet_test.go deleted file mode 100755 index c4c5b24..0000000 --- a/gerencianet/gerencianet_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package gerencianet - -import ( - "testing" -) - -func TestNewGerencianet(t *testing.T) { - params := map[string]interface{}{ - "client_id": "cidTest", - "client_secret": "csTest", - "sandbox": true, - "timeout": 10, - } - gn := NewGerencianet(params) - if gn == nil { - t.Error("Error on constructor") - } -} \ No newline at end of file diff --git a/gerencianet/requester_internal_test.go b/gerencianet/requester_internal_test.go deleted file mode 100755 index 2d38e87..0000000 --- a/gerencianet/requester_internal_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package gerencianet - -import ( - "bytes" - "errors" - "io/ioutil" - "net/http" - "testing" - "time" -) - -type MockAuth struct { - authorized bool -} - -func (a *MockAuth) getAccessToken() (authResponseBody, error) { - var response authResponseBody - if a.authorized == false { - return response, errors.New("401 error") - } - response.AccessToken = "token_test" - return response, nil -} - -func Test_newRequestToReturnSandboxRequester(t *testing.T) { - requester := newRequester("cidTest", "csTest", true, 10) - if requester.url != UrlSandbox || - requester.timeout != 10 { - t.Error("Error on constructor") - } -} - -func Test_newRequestToReturnProductionRequester(t *testing.T) { - requester := newRequester("cidTest", "csTest", false, 10) - if requester.url != UrlProduction || - requester.timeout != 10 { - t.Error("Error on constructor") - } -} - -func Test_requestToReturnString(t *testing.T) { - - httpClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewReader([]byte(req.URL.String()))), - }, nil - }, - } - - auth := auth{"cidTest", "csTest", true, 10, httpClient} - requester := requester{auth, "sandbox.com", 10, "token", time.Time{}, httpClient} - params := map[string]string{"id": "1", "token": "2", "data": "test"} - requestBody := map[string]interface{} {"test": "test"} - - res, err := requester.request("/test/:id", "POST", params, requestBody) - if err != nil { - t.Error("Expected err to be nil") - } - if res != "sandbox.com/test/1?token=2&data=test" { - t.Error("Expected parse params on route") - } -} - -func Test_requestToReturnAuthError(t *testing.T) { - - httpClient := &MockClient{} - auth := auth{"cidTest", "csTest", true, 10, httpClient} - requester := requester{auth, "sandbox.com", 10, "token", time.Time{}, httpClient} - _, err := requester.request("/test", "GET", nil, nil) - if err.Error() != "auth error" { - t.Error("Expected err to be an auth error") - } -} - - -func Test_requestToReturnServerError(t *testing.T) { - authClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewReader([]byte("auth test"))), - }, nil - }, - } - requestClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: 500, - Body: ioutil.NopCloser(bytes.NewReader([]byte("erro 500 test"))), - }, nil - }, - } - auth := auth{"cidTest", "csTest", true, 10, authClient} - requester := requester{auth, "sandbox.com", 10, "token", time.Time{}, requestClient} - _, err := requester.request("test", "PUT", nil, nil) - if err.Error() != "erro 500 test" { - t.Error("Expected err to be an 500 http error") - } -} - -func Test_requestToReturnHttpDoError(t *testing.T) { - authClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return &http.Response{ - StatusCode: http.StatusOK, - Body: ioutil.NopCloser(bytes.NewReader([]byte("auth test"))), - }, nil - }, - } - requestClient := &MockClient{ - DoFunc: func(req *http.Request) (*http.Response, error) { - return nil, errors.New("http Do error") - }, - } - auth := auth{"cidTest", "csTest", true, 10, authClient} - requester := requester{auth, "sandbox.com", 10, "token", time.Time{}, requestClient} - _, err := requester.request("test", "PUT", nil, nil) - if err.Error() != "http Do error" { - t.Error("Expected err to be an http/net error") - } -} diff --git a/gerencianet/requester_pix.go b/gerencianet/requester_pix.go new file mode 100755 index 0000000..6a218d9 --- /dev/null +++ b/gerencianet/requester_pix.go @@ -0,0 +1,124 @@ +package pix + +import ( + "bytes" + "encoding/json" + "errors" + "io/ioutil" + "net/http" + "net/url" + "regexp" + "strings" + "time" + "crypto/tls" +) + +type requester struct { + auth interface { + getAccessToken() (authResponseBody, error) + } + url string + timeout int + Token string + TokenDue time.Time + netClient interface { + Do(req *http.Request) (*http.Response, error) + } +} + +func newRequester(clientID string, clientSecret string, CA string, Key string, sandbox bool, timeout int) *requester { + auth := newAuth(clientID, clientSecret,CA, Key, sandbox, timeout) + var cert, _ = tls.LoadX509KeyPair(CA, Key) + + var netTransport = &http.Transport{ + TLSClientConfig: &tls.Config{ + Certificates: []tls.Certificate{cert}, + }, + } + httpClient := &http.Client{Timeout: time.Second * time.Duration(timeout),Transport: netTransport} + var gnURL string + if sandbox { + gnURL = UrlSandbox + } else { + gnURL = UrlProduction + } + return &requester{*auth, gnURL, timeout, "", time.Time{}, httpClient} +} + +func authenticate(requester *requester) (bool, error) { + if requester.Token == "" || requester.TokenDue.Before(time.Now()) { + tokenData, authErr := requester.auth.getAccessToken() + if authErr != nil { + return false, authErr + } + requester.Token = tokenData.AccessToken + requester.TokenDue = time.Now().Local().Add(time.Second * time.Duration(tokenData.ExpiresIn)) + } + return true, nil +} + +func (requester requester) request(endpoint string, httpVerb string, requestParams map[string]string, body map[string]interface{}) (string, error) { + requestBody := new(bytes.Buffer) + json.NewEncoder(requestBody).Encode(body) + + _, authErr := authenticate(&requester) + if authErr != nil { + _, authErr = authenticate(&requester) + } + if authErr != nil { + return "", authErr + } + + route := getRoute(endpoint, requestParams) + route += getQueryString(requestParams) + req, _ := http.NewRequest(httpVerb, requester.url+route, requestBody) + + if ( httpVerb == "POST" || httpVerb == "PUT" ) && body != nil { + req.Header.Add("Content-Type", "application/json") + } + req.Header.Add("accept", "application/json") + req.Header.Add("api-sdk", "go-" + Version) + req.Header.Add("Authorization", "Bearer "+requester.Token) + res, resErr := requester.netClient.Do(req) + + if resErr != nil { + return "", resErr + } + + defer res.Body.Close() + + reqResp, _ := ioutil.ReadAll(res.Body) + response := string(reqResp) + + if res.StatusCode != http.StatusOK { + return "", errors.New(response) + } + + return response, nil +} + +func getRoute(endpoint string, params map[string]string) string { + patern, _ := regexp.Compile("\\:(\\w+)") + variables := patern.FindAllStringSubmatch(endpoint, -1) + for i := 0; i < len(variables); i++ { + if value, exists := params[variables[i][1]]; exists { + endpoint = strings.Replace(endpoint, variables[i][0], value, -1) + delete(params, variables[i][1]) + } + } + return endpoint +} + +func getQueryString(params map[string]string) string { + var query string + for key, value := range params { + if query != "" { + query += "&" + } else { + query += "?" + } + query += key + "=" + url.QueryEscape(value) + } + + return query +} \ No newline at end of file