Merge pull request #757 from snake-eaterr/edit-debit-auths

update debitAccess
This commit is contained in:
Justin (shocknet) 2024-09-28 11:46:38 -04:00 committed by GitHub
commit 50f2866f92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 148 additions and 4 deletions

View file

@ -66,6 +66,7 @@ type Client struct {
// batching method: BatchUser not implemented
CreateOneTimeInviteLink func(req CreateOneTimeInviteLinkRequest) (*CreateOneTimeInviteLinkResponse, error)
DecodeInvoice func(req DecodeInvoiceRequest) (*DecodeInvoiceResponse, error)
EditDebit func(req DebitAuthorizationRequest) error
EncryptionExchange func(req EncryptionExchangeRequest) error
EnrollAdminToken func(req EnrollAdminTokenRequest) error
GetApp func() (*Application, error)
@ -433,6 +434,30 @@ func NewClient(params ClientParams) *Client {
}
return &res, nil
},
EditDebit: func(req DebitAuthorizationRequest) error {
auth, err := params.RetrieveUserAuth()
if err != nil {
return err
}
finalRoute := "/api/user/debit/edit"
body, err := json.Marshal(req)
if err != nil {
return err
}
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
if err != nil {
return err
}
result := ResultError{}
err = json.Unmarshal(resBody, &result)
if err != nil {
return err
}
if result.Status == "ERROR" {
return fmt.Errorf(result.Reason)
}
return nil
},
EncryptionExchange: func(req EncryptionExchangeRequest) error {
auth, err := params.RetrieveGuestAuth()
if err != nil {