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

Singapore #451

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Singapore #451

wants to merge 12 commits into from

Conversation

alvarolivie
Copy link

@alvarolivie alvarolivie commented Jan 19, 2025

Describe your changes

Implemented the regime for Singapore following the documentation provided by IRAS

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added thorough tests with at least 90% code coverage.
  • I've modified or created example GOBL documents the show my changes in use, if appropriate.
  • When adding or modifying a tax regime or addon, I've added links to the source of the changes either structured or in the comments.
  • I've run go generate . to ensure that Schemas and Regime data are up to date.
  • All linter warnings have been reviewed and fixed.
  • I've been obsessive with pointer nil checks to avoid panics.
  • The CHANGELOG.md has been updated with an overview of my changes.
  • Requested a review from @samlown.

Considerations

I am not sure if receipts need to be added as an invoice. IRAS states that they are a valid form of invoicing in certain situations. I followed the format used in Portugal as they have a similar type of invoice.

I did not divide the different type of GST registration numbers as different Identities as they are all GST reg. numbers even if they are also used elsewhere.

Please check the examples as I had to set a tag in my local branch to build using mage and I am not sure if that caused any issues when validating my examples.

Copy link
Collaborator

@samlown samlown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great first attempt! Nice one! I'd question if the concept of "receipt" should be there, it feels like something that would be used with a payment device rather than for invoicing.

I'm also unsure about the identity code handling given so many options.


### Simplified Tax Invoice

This invoice is referenced by the tax tag "simplified". This invoice can only be used when the total amount (inclusive of GST) is less than $1000. This invoice has less requirements:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be useful to add the currency code of $1000 here.

Comment on lines +54 to +61
### Reciept

This type of invoice can be issued to a non-GST registered costumer. This invoice requires the following:

1. Suplier name, address and GST registration number;
2. The date of issue of the invoice.
3. The total amount payable including tax.
4. The word “Price Payable includes GST”.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on this description, it feels like the receipt is probably not needed in GOBL, the "simplified" version will cover most cases.

}

// Validate checks the document type and determines if it can be validated.
func Validate(doc interface{}) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny observation:

Suggested change
func Validate(doc interface{}) error {
func Validate(doc any) error {

},
Values: []*tax.RateValueDef{
{
Since: cal.NewDate(2024, 1, 1),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very recent. It wouldn't hurt to include the last standard rate if available for the sake of backwards compatibility.

)
}

func validateTaxCode(value interface{}) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no checksum validation in SG for any of the codes?

Comment on lines +18 to +22
regexp.MustCompile(`^(19[0-9]{2}|20[0-9]{2})\d{5}[A-Z]$`), // UEN (ROC)
regexp.MustCompile(`^\d{9}[A-Z]$`), // UEN (ROB)
regexp.MustCompile(`^[TS]\d{2}[A-Z]\w{1}\d{4}[A-Z]$`), // UEN (Others)
regexp.MustCompile(`^[STFGM]\d{7}[A-Z]$`), // NIRC/FIN
regexp.MustCompile(`^\w{2}\d{7}[A-Z]$`), // GST
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With so many to choose from, I get the impression that maybe some companies choose to use multiple numbers at the same time on their invoices, suggesting that only one should be used for the main tax identity.

It could be that the GST makes the most sense in the tax identity, and everything else should be moved to the org.Identity. An additional (not obvious) option here is to switch to using the identities array instead of the tax.Identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants