From 16737ae902c718481bb26893de6cc4e5f5214a56 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Tue, 31 Oct 2023 12:53:24 +0800 Subject: [PATCH] fix: fix GetUserPayments() parameter --- casdoorsdk/base.go | 3 --- casdoorsdk/payment.go | 11 ++++------- casdoorsdk/payment_global.go | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/casdoorsdk/base.go b/casdoorsdk/base.go index 048045f..a551f65 100644 --- a/casdoorsdk/base.go +++ b/casdoorsdk/base.go @@ -12,9 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// TODO: add enforcer, syncer, subscription, session, resource, record, product, -// pricing, plan, payment, model, message, account, group, chat, cert, adapter, - package casdoorsdk import ( diff --git a/casdoorsdk/payment.go b/casdoorsdk/payment.go index 00f8d28..c8881fa 100644 --- a/casdoorsdk/payment.go +++ b/casdoorsdk/payment.go @@ -117,14 +117,11 @@ func (c *Client) GetPayment(name string) (*Payment, error) { return payment, nil } -func (c *Client) GetUserPayments() ([]*Payment, error) { - return nil, errors.New("Not implemented") +func (c *Client) GetUserPayments(userName string) ([]*Payment, error) { queryMap := map[string]string{ - "owner": c.OrganizationName, - "orgnization": c.OrganizationName, - // TODO: get user name - //"user": c. - + "owner": c.OrganizationName, + "organization": c.OrganizationName, + "user": userName, } url := c.GetUrl("get-user-payments", queryMap) diff --git a/casdoorsdk/payment_global.go b/casdoorsdk/payment_global.go index a4d1ef8..b2d740e 100644 --- a/casdoorsdk/payment_global.go +++ b/casdoorsdk/payment_global.go @@ -26,8 +26,8 @@ func GetPayment(name string) (*Payment, error) { return globalClient.GetPayment(name) } -func GetUserPayments() ([]*Payment, error) { - return globalClient.GetUserPayments() +func GetUserPayments(userName string) ([]*Payment, error) { + return globalClient.GetUserPayments(userName) } func UpdatePayment(payment *Payment) (bool, error) {