-
Notifications
You must be signed in to change notification settings - Fork 33
/
invoice_info.go
53 lines (45 loc) · 1.33 KB
/
invoice_info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/tursodatabase/turso-cli/internal/turso"
)
func init() {
invoiceCmd.AddCommand(showInvoiceInfoCmd)
}
var showInvoiceInfoCmd = &cobra.Command{
Use: "info",
Short: "Show billing information added to invoices.",
Args: cobra.NoArgs,
ValidArgsFunction: noFilesArg,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.SilenceUsage = true
client, err := authedTursoClient()
if err != nil {
return err
}
customer, err := client.Billing.GetBillingCustomer()
if err != nil {
return err
}
fmt.Println("Billing Information:")
printBillingInfo(customer)
return nil
},
}
func printBillingInfo(customer turso.BillingCustomer) {
fmt.Println("Name:", customer.Name)
fmt.Println("Email:", customer.Email)
fmt.Println()
fmt.Println("Billing Address:")
fmt.Println("Line 1:", customer.BillingAddress.Line1)
fmt.Println("Line 2:", customer.BillingAddress.Line2)
fmt.Println("City:", customer.BillingAddress.City)
fmt.Println("State:", customer.BillingAddress.State)
fmt.Println("Zip:", customer.BillingAddress.PostalCode)
fmt.Println("Country:", customer.BillingAddress.Country)
fmt.Println()
fmt.Println("Tax Information:")
fmt.Println("VAT:", customer.TaxID.Value)
fmt.Println("Tax Country:", customer.TaxID.Country)
}