Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving examples from regimes to single folder #416

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

- `es-tbai-v1`: normalize address information to automatically add new `es-tbai-region` extension to invoices.

### Changes

- Moved regime examples into single `/examples` folder.

## [v0.204.1]

### Added
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ GOBL, the Go Business Language library and tools, aim to:
- Be flexible enough to support extreme local complexity but produce output that is easily legible in other countries.
- Build a global community of contributors tired of the complexity of current standards based on XML or EDI.

For examples on what GOBL document data looks like, please see the [examples directory](https://github.com/invopop/gobl/tree/main/examples).

## Community

The complexity around invoicing, particularly electronic invoicing, can quickly become overwhelming. Check out the following resources and get in touch:
Expand Down Expand Up @@ -166,26 +168,26 @@ Example uses:

```sh
# Calculate and validate a YAML invoice
gobl build ./samples/invoice-es.yaml
gobl build ./examples/es/invoice-es-es.yaml

# Output using indented formatting
gobl build -i ./samples/customer.yaml
gobl build -i ./examples/es/party.yaml

# Set the supplier from an external file
gobl build -i ./samples/invoice-es.yaml \
--set-file customer=./samples/customer.yaml
gobl build -i ./examples/es/invoice-es-es.yaml \
--set-file customer=./examples/es/party.yaml

# Set arbitrary values from the command line. Inputs are parsed as YAML.
gobl build -i ./samples/invoice-es.yaml \
gobl build -i ./examples/es/invoice-es-es.yaml \
--set meta.bar="a long string" \
--set series="TESTING"

# Set the top-level object:
gobl build -i ./samples/invoice-es.yaml \
--set-file .=./samples/envelope-invoice-es.yaml
gobl build -i ./examples/es/invoice-es-es.yaml \
--set-file .=./examples/es/invoice-es-es.env.yaml

# Insert a document into an envelope
gobl build -i --envelop ./samples/invoice-es.yaml
gobl build -i --envelop ./examples/es/invoice-es-es.yaml
```

### Correct
Expand All @@ -194,11 +196,11 @@ The GOBL CLI makes it easy to use the library and tax regime specific functional

```sh
# Correct an invoice with a credit note (this will error for ES invoice!)
gobl correct -i ./samples/invoice-es.yaml --credit
gobl correct -i ./examples/es/invoice-es-es.yaml --credit

# Specify tax regime specific details
gobl correct -i -d '{"credit":true,"changes":["line"],"method":"complete"}' \
./samples/invoice-es.yaml
./examples/es/invoice-es-es.yaml
```

### Sign
Expand All @@ -210,17 +212,17 @@ GOBL encourages users to sign data embedded into envelopes using digital signatu
gobl keygen

# Generate and output a JWK into a new file
gobl keygen ./samples/key.jwk
gobl keygen ./examples/key.jwk
```

Use the key to sign documents:

```sh
# Add a signature to the envelope using our personal key
gobl sign -i ./samples/envelope-invoice-es.yaml
gobl sign -i ./examples/es/invoice-es-es.env.yaml

# Add a signature using a specific key
gobl sign -i --key ./samples/key.jwk ./samples/envelope-invoice-es.yaml
gobl sign -i --key ./examples/key.jwk ./examples/es/invoice-es-es.env.yaml
```

It is only possible to sign non-draft envelopes, so the CLI will automatically remove this flag during the signing process. This implies that the document must be completely valid before signing.
Expand Down
5 changes: 4 additions & 1 deletion addons/es/tbai/tbai.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ const (

// Official stamps or codes validated by government agencies
const (
// StampCode contains the code required to be presented alongside
// the QR code.
StampCode cbc.Key = "tbai-code"
StampQR cbc.Key = "tbai-qr"
// StampQR contains the URL included in the QR code.
StampQR cbc.Key = "tbai-qr"
)

func init() {
Expand Down
8 changes: 4 additions & 4 deletions envelope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func TestEnvelopeCalculate(t *testing.T) {
func TestEnvelopeComplete(t *testing.T) {
e := new(gobl.Envelope)

data, err := os.ReadFile("./regimes/es/examples/invoice-es-es.env.yaml")
data, err := os.ReadFile("./examples/es/invoice-es-es.env.yaml")
require.NoError(t, err)
err = yaml.Unmarshal(data, e)
require.NoError(t, err)
Expand Down Expand Up @@ -302,7 +302,7 @@ func TestEnvelopeCorrect(t *testing.T) {
t.Run("correct invoice", func(t *testing.T) {
env := gobl.NewEnvelope()

data, err := os.ReadFile("./regimes/es/examples/invoice-es-es.env.yaml")
data, err := os.ReadFile("./examples/es/invoice-es-es.env.yaml")
require.NoError(t, err)
err = yaml.Unmarshal(data, env)
require.NoError(t, err)
Expand Down Expand Up @@ -331,7 +331,7 @@ func TestEnvelopeReplicate(t *testing.T) {
t.Run("replicate invoice", func(t *testing.T) {
env := gobl.NewEnvelope()

data, err := os.ReadFile("./regimes/es/examples/invoice-es-es.env.yaml")
data, err := os.ReadFile("./examples/es/invoice-es-es.env.yaml")
require.NoError(t, err)
err = yaml.Unmarshal(data, env)
require.NoError(t, err)
Expand Down Expand Up @@ -398,7 +398,7 @@ func TestDocumentValidation(t *testing.T) {
}

doc = new(schema.Object)
data, err := os.ReadFile("./regimes/es/examples/invoice-es-es.yaml")
data, err := os.ReadFile("./examples/es/invoice-es-es.yaml")
require.NoError(t, err)
err = yaml.Unmarshal(data, doc)
require.NoError(t, err)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
74 changes: 0 additions & 74 deletions examples/simple/main.go

This file was deleted.

File renamed without changes.
Loading