OrgPaymentInformation returns payment information for the specified org.
(org string)
| 16 | |
| 17 | // OrgPaymentInformation returns payment information for the specified org. |
| 18 | func (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. |
| 46 | type PaymentInformation struct { |