MCPcopy Create free account
hub / github.com/google/go-github / OrgPaymentInformation

Method OrgPaymentInformation

scrape/payment.go:18–43  ·  view source on GitHub ↗

OrgPaymentInformation returns payment information for the specified org.

(org string)

Source from the content-addressed store, hash-verified

16
17// OrgPaymentInformation returns payment information for the specified org.
18func (c *Client) OrgPaymentInformation(org string) (PaymentInformation, error) {
19 var info PaymentInformation
20
21 doc, err := c.get("/organizations/%v/settings/billing/payment_information", org)
22 if err != nil {
23 return info, err
24 }
25
26 doc.Find("main h4.mb-1").Each(func(_ int, s *goquery.Selection) {
27 name := strings.TrimSpace(strings.ToLower(s.Text()))
28 value := strings.Join(strings.Fields(strings.TrimSpace(s.NextFiltered("p").Text())), " ")
29
30 switch name {
31 case "payment method":
32 info.PaymentMethod = value
33 case "last payment":
34 info.LastPayment = value
35 case "coupon":
36 info.Coupon = value
37 case "extra information":
38 info.ExtraInformation = value
39 }
40 })
41
42 return info, nil
43}
44
45// PaymentInformation for an organization on a paid plan.
46type PaymentInformation struct {

Callers

nothing calls this directly

Calls 1

getMethod · 0.95

Tested by

no test coverage detected