-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.go
105 lines (74 loc) · 2.54 KB
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package KPSPublic
// Verify verifies the given information with the Turkish Identity Number
type VerifyConfig struct {
// TCIdentityNumber is the Turkish Identity Number
TCIdentityNumber string
// FirstName is the first name of the person
FirstName string
// LastName is the last name of the person
LastName string
// BirthYear is the birth year of the person
BirthYear int
// BirthMonth is the birth month of the person
BirthMonth int
// BirthDay is the birthday of the person
BirthDay int
// SerialNumber is the serial number of the ID card
SerialNumber string
}
// VerifyNewId verifies the given information with the Turkish Identity Number
type VerifyNewIdConfig struct {
// TCIdentityNumber is the Turkish Identity Number
TCIdentityNumber string
// FirstName is the first name of the person
FirstName string
// LastName is the last name of the person
LastName string
// BirthYear is the birth year of the person
BirthYear int
// BirthMonth is the birth month of the person
BirthMonth int
// BirthDay is the birthday of the person
BirthDay int
// WalletSerialNumber is the serial number of the new wallet
SerialNumber string
}
// VerifyOldId verifies the given information with the Turkish Identity Number
type VerifyOldIdConfig struct {
// TCIdentityNumber is the Turkish Identity Number
TCIdentityNumber string
// FirstName is the first name of the person
FirstName string
// LastName is the last name of the person
LastName string
// BirthYear is the birth year of the person
BirthYear int
// BirthMonth is the birth month of the person
BirthMonth int
// BirthDay is the birthday of the person
BirthDay int
// WalletSerialNumber is the serial number of the old wallet
WalletSerialNumber string
// WalletNumber is the number of the old wallet
WalletNumber string
}
// Service is the interface for the KPSPublic service
type Service interface {
// Verify verifies the given information with the Turkish Identity Number
// and returns true if the information is valid
// try to use VerifyNewId or VerifyOldId instead
Verify(config VerifyConfig) (bool, error)
// VerifyNewId verifies the given information with the new Turkish Identity Number
VerifyNewId(config VerifyNewIdConfig) (bool, error)
// VerifyOldId verifies the given information with the old Turkish Identity Number
VerifyOldId(config VerifyOldIdConfig) (bool, error)
}
type service struct {
url string
}
// New returns a new KPSPublic service
func New() Service {
return &service{
url: "https://tckimlik.nvi.gov.tr/Service/KPSPublicv2.asmx",
}
}