Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/efipay/efipay.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package efipay

type efipay struct {
type Efipay struct {
endpoints
}

func NewEfiPay(configs map[string]interface{}) *efipay {
func NewEfiPay(configs map[string]interface{}) *Efipay {
clientID := configs["client_id"].(string)
clientSecret := configs["client_secret"].(string)
sandbox := configs["sandbox"].(bool)
timeout := configs["timeout"].(int)
//partner_token := configs["partner_token"].(string)

requester := newRequester(clientID, clientSecret, sandbox, timeout)
efi := efipay{}
efi := Efipay{}
efi.requester = *requester
return &efi
}
10 changes: 5 additions & 5 deletions src/efipay/open_finance/efiPay_of.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package open_finance

type pix struct {
type Of struct {
endpoints
}

func NewEfiPay(configs map[string]interface{}) *pix {
func NewEfiPay(configs map[string]interface{}) *Of {
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)
efi := pix{}
requester := newRequester(clientID, clientSecret, CA, Key, sandbox, timeout)
efi := Of{}
efi.requester = *requester
return &efi
}
}
10 changes: 5 additions & 5 deletions src/efipay/payments/efiPay_payments.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package payments

type pix struct {
type Payment struct {
endpoints
}

func NewEfiPay(configs map[string]interface{}) *pix {
func NewEfiPay(configs map[string]interface{}) *Payment {
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)
efi := pix{}
requester := newRequester(clientID, clientSecret, CA, Key, sandbox, timeout)
efi := Payment{}
efi.requester = *requester
return &efi
}
}
10 changes: 5 additions & 5 deletions src/efipay/pix/efiPay_pix.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package pix

type pix struct {
type Pix struct {
endpoints
}

func NewEfiPay(configs map[string]interface{}) *pix {
func NewEfiPay(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)
efi := pix{}
requester := newRequester(clientID, clientSecret, CA, Key, sandbox, timeout)
efi := Pix{}
efi.requester = *requester
return &efi
}
}
88 changes: 44 additions & 44 deletions src/efipay/pix/endpoints_pix.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,63 @@ package pix
type endpoints struct {
requester interface {
request(endpoint string, httpVerb string, requestParams map[string]string, body map[string]interface{}) (string, error)
request2(endpoint string, httpVerb string, requestParams map[string]string, body map[string]interface{}, headers map[string]string) (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) }
params := map[string]string{"txid": (txid)}
return endpoints.requester.request("/v2/cob/:txid", "PUT", params, body)
}

func (endpoints endpoints) UpdateCharge(txid string) (string, error) {
params := map[string]string{ "txid": (txid) }
params := map[string]string{"txid": (txid)}
return endpoints.requester.request("/v2/cob/:txid", "PATCH", params, nil)
}

func (endpoints endpoints) DetailCharge(txid string) (string, error) {
params := map[string]string{ "txid": (txid) }
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{
params := map[string]string{
"inicio": (inicio),
"fim": (fim),
"fim": (fim),
}
return endpoints.requester.request("/v2/cob?inicio=:inicio&fim=:fim", "GET", params, nil)
}

func (endpoints endpoints) PixDevolution(e2eid string, id string, body map[string]interface{}) (string, error) {
params := map[string]string{
"e2eid": (e2eid),
"id": (id), }
"e2eid": (e2eid),
"id": (id)}
return endpoints.requester.request("/v2/pix/:e2eid/devolucao/:id", "PUT", params, body)
}

func (endpoints endpoints) PixDetailDevolution(e2eid string, id string) (string, error) {
params := map[string]string{
"e2eid": (e2eid),
"id": (id), }
"e2eid": (e2eid),
"id": (id)}
return endpoints.requester.request("/v2/pix/:e2eid/devolucao/:id", "GET", params, nil)
}

func (endpoints endpoints) PixSend(idEnvio string, body map[string]interface{}) (string, error) {
params := map[string]string{ "idEnvio": (idEnvio) }
params := map[string]string{"idEnvio": (idEnvio)}
return endpoints.requester.request("/v2/gn/pix/:idEnvio", "PUT", params, body)
}

func (endpoints endpoints) PixSendList(e2eid string) (string, error) {
params := map[string]string{ "e2eid": (e2eid) }
params := map[string]string{"e2eid": (e2eid)}
return endpoints.requester.request("/v2/pix/:e2eid", "GET", params, nil)
}

func (endpoints endpoints) PixSendDetail(e2eid string) (string, error) {
params := map[string]string{ "e2eid": (e2eid) }
params := map[string]string{"e2eid": (e2eid)}
return endpoints.requester.request("/v2/gn/pix/enviados/:e2eid", "GET", params, nil)
}

Expand All @@ -68,25 +68,25 @@ func (endpoints endpoints) PixCreateLocation(body map[string]interface{}) (strin
}

func (endpoints endpoints) PixUnlinkTxidLocation(id string, body map[string]interface{}) (string, error) {
params := map[string]string{ "id": (id) }
params := map[string]string{"id": (id)}
return endpoints.requester.request("/v2/loc/:id/txid", "DELETE", params, body)
}

func (endpoints endpoints) PixDetailLocation(id string) (string, error) {
params := map[string]string{ "id": (id) }
params := map[string]string{"id": (id)}
return endpoints.requester.request("/v2/loc/:id", "GET", params, nil)
}

func (endpoints endpoints) PixLocationList(inicio string, fim string) (string, error) {
params := map[string]string{
params := map[string]string{
"inicio": (inicio),
"fim": (fim),
"fim": (fim),
}
return endpoints.requester.request("/v2/loc?inicio=:inicio&fim=:fim", "GET", params, nil)
}

func (endpoints endpoints) PixGenerateQRCode(id string) (string, error) {
params := map[string]string{ "id": (id) }
params := map[string]string{"id": (id)}
return endpoints.requester.request("/v2/loc/:id/qrcode", "GET", params, nil)
}

Expand All @@ -111,45 +111,45 @@ func (endpoints endpoints) PixListEvp(body map[string]interface{}) (string, erro
}

func (endpoints endpoints) PixDeleteEvp(key string, body map[string]interface{}) (string, error) {
params := map[string]string{ "key": (key) }
params := map[string]string{"key": (key)}
return endpoints.requester.request("/v2/gn/evp/:key", "DELETE", params, body)
}

func (endpoints endpoints) PixConfigWebhook(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) PixConfigWebhook(chave string, body map[string]interface{}, headers map[string]string) (string, error) {
params := map[string]string{"chave": (chave)}
return endpoints.requester.request2("/v2/webhook/:chave", "PUT", params, body, headers)
}

func (endpoints endpoints) PixDeleteWebhook(chave string, body map[string]interface{}) (string, error) {
params := map[string]string{ "chave": (chave) }
params := map[string]string{"chave": (chave)}
return endpoints.requester.request("/v2/webhook/:chave", "DELETE", params, body)
}

func (endpoints endpoints) PixDetailWebhook(chave string) (string, error) {
params := map[string]string{ "chave": (chave) }
params := map[string]string{"chave": (chave)}
return endpoints.requester.request("/v2/webhook/:chave", "GET", params, nil)
}

func (endpoints endpoints) PixListWebhooks(inicio string, fim string) (string, error) {
params := map[string]string{
params := map[string]string{
"inicio": (inicio),
"fim": (fim),
"fim": (fim),
}
return endpoints.requester.request("/v2/webhook?inicio=:inicio&fim=:fim", "GET", params, nil)
}

func (endpoints endpoints) CreateDueCharge(txid string, body map[string]interface{}) (string, error) {
params := map[string]string{ "txid": (txid) }
params := map[string]string{"txid": (txid)}
return endpoints.requester.request("/v2/cobv/:txid", "PUT", params, body)
}

func (endpoints endpoints) PixUpdateDueCharge(txid string, body map[string]interface{}) (string, error) {
params := map[string]string{ "txid": (txid) }
params := map[string]string{"txid": (txid)}
return endpoints.requester.request("/v2/cobv/:txid", "PATCH", params, body)
}

func (endpoints endpoints) DetailDueCharge(txid string) (string, error) {
params := map[string]string{ "txid": (txid) }
params := map[string]string{"txid": (txid)}
return endpoints.requester.request("/v2/cobv/:txid", "GET", params, nil)
}

Expand All @@ -162,7 +162,7 @@ func (endpoints endpoints) CreateReport(body map[string]interface{}) (string, er
}

func (endpoints endpoints) DetailReport(id string) (string, error) {
params := map[string]string{ "id": (id) }
params := map[string]string{"id": (id)}
return endpoints.requester.request("/v2/gn/relatorios/:id", "GET", params, nil)
}

Expand All @@ -171,47 +171,47 @@ func (endpoints endpoints) PixReceivedList(params map[string]string) (string, er
}

func (endpoints endpoints) PixDetailReceived(e2eid string) (string, error) {
params := map[string]string{ "e2eid": (e2eid) }
params := map[string]string{"e2eid": (e2eid)}
return endpoints.requester.request("/v2/pix/:e2eid", "GET", params, nil)
}

func (endpoints endpoints) PixSplitDetailCharge(txid string) (string, error) {
params := map[string]string{ "txid": (txid) }
params := map[string]string{"txid": (txid)}
return endpoints.requester.request("/v2/gn/split/cob/:txid", "GET", params, nil)
}

func (endpoints endpoints) PixSplitLinkCharge(txid string, splitConfigId string) (string, error) {
params := map[string]string{
"txid": (txid),
params := map[string]string{
"txid": (txid),
"splitConfigId": (splitConfigId),
}
return endpoints.requester.request("/v2/gn/split/cob/:txid/vinculo/:splitConfigId", "PUT", params, nil)
}

func (endpoints endpoints) PixSplitUnlinkCharge(txid string, splitConfigId string) (string, error) {
params := map[string]string{
"txid": (txid),
params := map[string]string{
"txid": (txid),
"splitConfigId": (splitConfigId),
}
return endpoints.requester.request("/v2/gn/split/cob/:txid/vinculo/:splitConfigId", "DELETE", params, nil)
}

func (endpoints endpoints) PixSplitDetailDueCharge(txid string) (string, error) {
params := map[string]string{ "txid": (txid) }
params := map[string]string{"txid": (txid)}
return endpoints.requester.request("/v2/gn/split/cobv/:txid", "GET", params, nil)
}

func (endpoints endpoints) PixSplitLinkDueCharge(txid string, splitConfigId string) (string, error) {
params := map[string]string{
"txid": (txid),
params := map[string]string{
"txid": (txid),
"splitConfigId": (splitConfigId),
}
return endpoints.requester.request("/v2/gn/split/cobv/:txid/vinculo/:splitConfigId", "PUT", params, nil)
}

func (endpoints endpoints) PixSplitUnlinkDueCharge(txid string, splitConfigId string) (string, error) {
params := map[string]string{
"txid": (txid),
params := map[string]string{
"txid": (txid),
"splitConfigId": (splitConfigId),
}
return endpoints.requester.request("/v2/gn/split/cobv/:txid/vinculo/:splitConfigId", "DELETE", params, nil)
Expand All @@ -222,11 +222,11 @@ func (endpoints endpoints) PixSplitConfig(body map[string]interface{}) (string,
}

func (endpoints endpoints) PixSplitConfigId(id string, body map[string]interface{}) (string, error) {
params := map[string]string{ "id": (id) }
params := map[string]string{"id": (id)}
return endpoints.requester.request("/v2/gn/split/config/:id", "PUT", params, body)
}

func (endpoints endpoints) PixSplitDetailConfig(id string) (string, error) {
params := map[string]string{ "id": (id) }
params := map[string]string{"id": (id)}
return endpoints.requester.request("/v2/gn/split/config/:id", "GET", params, nil)
}
}
Loading