vkn

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

VKN Query Library

This library is used to query registered individuals or businesses in the Revenue Administration of Turkey.

Getting Started

Installation

To add this library to your project:

go get github.com/9ssi7/vkn
Usage
package main

import (
    "fmt"
    "github.com/9ssi7/vkn"
)

func main() {
    config := vkn.Config{
        Username: "your-username",
        Password: "your-password",
    }

    client := vkn.New(config)
    data, err := client.GetRecipient("your-recipients-vkn-or-tck")
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    fmt.Println(data)
}

Important Notes

  • When querying with identity credentials (TCKN), you will receive the firstName and lastName fields, but the title (unvan) field will not be present.
  • When querying with a tax number (VKN), the title (unvan) field will be returned instead of the firstName and lastName fields.

Documentation

For detailed documentation, you can visit the here.

License

This library is licensed under the MIT license. For more information, see the LICENSE file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Username is the username for the VKN service.
	Username string
	// Password is the password for the VKN service.
	Password string
}

Config holds the configuration details for the VKN service.

type GetRecipientResponse

type GetRecipientResponse struct {
	Data struct {
		// FirstName provides if the recipient is a person.
		FirstName string `json:"adi"`
		// LastName provides if the recipient is a person.
		LastName string `json:"soyadi"`
		// Title provides if the recipient is a company.
		Title string `json:"unvan"`
		// TaxOffice provides the tax office of the recipient.
		TaxOffice string `json:"vergiDairesi"`
	} `json:"data"`
	Metadata struct {
		Optime string `json:"optime"`
	} `json:"metadata"`
}

GetRecipientResponse represents the response after querying recipient data.

type Vkn

type Vkn interface {
	// GetRecipientData fetches the recipient data for a given VKN.
	GetRecipient(vkn string) (*GetRecipientResponse, error)
}

Vkn represents the main interface for querying recipient data.

func New

func New(cnf Config) Vkn

New creates a new VKN service instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL