Mm 49495 Show past invoices for prior self-hosted purchases (#22397)
* future proof license queries * add client method for fetching self-hosted invoices
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
552ca6fb0b
Коммит
7a8c1f587b
@@ -8677,6 +8677,30 @@ func (c *Client4) SelfHostedSignupConfirm(form *SelfHostedConfirmPaymentMethodRe
|
|||||||
return BuildResponse(r), &response, nil
|
return BuildResponse(r), &response, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client4) GetSelfHostedInvoices() (*Response, []*Invoice, error) {
|
||||||
|
r, err := c.DoAPIGet(c.hostedCustomerRoute()+"/invoices", "")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return BuildResponse(r), nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
data, err := io.ReadAll(r.Body)
|
||||||
|
if err != nil {
|
||||||
|
return BuildResponse(r), nil, err
|
||||||
|
}
|
||||||
|
defer closeBody(r)
|
||||||
|
|
||||||
|
invoices := []*Invoice{}
|
||||||
|
err = json.Unmarshal(data, &invoices)
|
||||||
|
if err != nil {
|
||||||
|
return BuildResponse(r), nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
defer closeBody(r)
|
||||||
|
|
||||||
|
return BuildResponse(r), invoices, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client4) GetPostInfo(postId string) (*PostInfo, *Response, error) {
|
func (c *Client4) GetPostInfo(postId string) (*PostInfo, *Response, error) {
|
||||||
r, err := c.DoAPIGet(c.postRoute(postId)+"/info", "")
|
r, err := c.DoAPIGet(c.postRoute(postId)+"/info", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ func (ls SqlLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseReco
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
query := ls.getQueryBuilder().
|
query := ls.getQueryBuilder().
|
||||||
Select("*").
|
Select("Id, CreateAt, Bytes").
|
||||||
From("Licenses").
|
From("Licenses").
|
||||||
Where(sq.Eq{"Id": license.Id})
|
Where(sq.Eq{"Id": license.Id})
|
||||||
queryString, args, err := query.ToSql()
|
queryString, args, err := query.ToSql()
|
||||||
@@ -64,7 +64,7 @@ func (ls SqlLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseReco
|
|||||||
// http.StatusNotFound in the StatusCode field.
|
// http.StatusNotFound in the StatusCode field.
|
||||||
func (ls SqlLicenseStore) Get(id string) (*model.LicenseRecord, error) {
|
func (ls SqlLicenseStore) Get(id string) (*model.LicenseRecord, error) {
|
||||||
query := ls.getQueryBuilder().
|
query := ls.getQueryBuilder().
|
||||||
Select("*").
|
Select("Id, CreateAt, Bytes").
|
||||||
From("Licenses").
|
From("Licenses").
|
||||||
Where(sq.Eq{"Id": id})
|
Where(sq.Eq{"Id": id})
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ func (ls SqlLicenseStore) Get(id string) (*model.LicenseRecord, error) {
|
|||||||
|
|
||||||
func (ls SqlLicenseStore) GetAll() ([]*model.LicenseRecord, error) {
|
func (ls SqlLicenseStore) GetAll() ([]*model.LicenseRecord, error) {
|
||||||
query := ls.getQueryBuilder().
|
query := ls.getQueryBuilder().
|
||||||
Select("*").
|
Select("Id, CreateAt, Bytes").
|
||||||
From("Licenses")
|
From("Licenses")
|
||||||
|
|
||||||
queryString, _, err := query.ToSql()
|
queryString, _, err := query.ToSql()
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user