kps

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: MIT Imports: 16 Imported by: 0

README

kpsclient

NVİ KPS Client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTumKutukBody

func BuildTumKutukBody(r QueryRequest) string

BuildTumKutukBody, TumKutukDogrulamaServisi için <Sorgula> gövdesini üretir.

Types

type Client

type Client struct {
	Username   string
	Password   string
	HTTPClient *http.Client
}

func New

func New(username, password string, httpClient *http.Client) *Client

New: basit kurucu. httpClient nil ise makul timeout’lu varsayılan kullanılır.

func (*Client) DoQuery

func (c *Client) DoQuery(ctx context.Context, req QueryRequest) (Result, error)

DoQuery: STS → imzalı servis → parse akışını yürütür.

type Person

type Person string
const (
	PersonTC    Person = "tc_vatandasi"
	PersonYab   Person = "yabanci"
	PersonMavi  Person = "mavi"
	PersonEmpty Person = ""
)

type QueryRequest

type QueryRequest struct {
	TCNo       string `json:"tcno"`
	FirstName  string `json:"firstname"`
	LastName   string `json:"lastname"`
	BirthYear  string `json:"birthyear"`
	BirthMonth string `json:"birthmonth,omitempty"`
	BirthDay   string `json:"birthday,omitempty"`
}

QueryRequest: sorgu girdisi

type Result

type Result struct {
	Status   bool              `json:"status"`             // code == 1 ?
	Code     int               `json:"code"`               // 1, 2, 3
	Aciklama string            `json:"aciklama,omitempty"` // Durum açıklaması
	Person   Person            `json:"person,omitempty"`   // tc_vatandasi | yabanci | mavi
	Extra    map[string]string `json:"extra,omitempty"`    // Ad, Soyad, KimlikNo, Uyruk, DogumTarih, OlumTarih...
	Raw      string            `json:"raw,omitempty"`      // Ham SOAP cevabı (debug)
}

Result: dışa açık nihai dönüş code: 1=Açık, 2=Hatalı/Bulunamadı, 3=Ölüm

func ParseTumKutukResponse

func ParseTumKutukResponse(respXML string) (Result, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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