-
-
Save marvinhosea/61e2bcafb1ec7d3cfdfd79e3429543a2 to your computer and use it in GitHub Desktop.
final.main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
internal "marvinhosea/invoices/internal" | |
) | |
func main() { | |
// Generate sample invoice data | |
ecommerceInvoiceData, err := internal.NewInvoiceData("Ecommerce application", 1, 3000.50) | |
if err != nil { | |
panic(err) | |
} | |
laptopInvoiceData, err := internal.NewInvoiceData("Macbook Pro", 1, 200.70) | |
if err != nil { | |
panic(err) | |
} | |
// Invoice Items collection | |
invoiceItems := []*internal.InvoiceData{ecommerceInvoiceData, laptopInvoiceData} | |
// Create single invoice | |
invoice := internal.CreateInvoice("Example Shop1", "Example address", invoiceItems) | |
err = internal.GenerateInvoicePdf(*invoice) | |
fmt.Printf("The Total Invoice Amount is: %f", invoice.CalculateInvoiceTotalAmount()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment