Skip to content

An anthology of a variety of tools for the Persian language in Golang

Notifications You must be signed in to change notification settings

h-varmazyar/gopet

 
 

Repository files navigation

Go Persian tools

An anthology of a variety of tools for the Persian language in Golang

CircleCI codecov


Todos

  • Bill calculator
  • Digits
  • Validate Bank card number.
  • Find Bank's name by Card number.
  • Check Iranian Sheba(IBAN) validation and recognize bank information by sheba code.
  • Add and remove commas to numbers.
  • Find city and province name by national code(code-e Melli).
  • Validate Iranian national number(code-e Melli).
  • Validate phone number and get Iranian phone number details.

How to use it?

first we have to create our request :

bills "github.com/h-varmazyar/gopet/bills"
.
.
.
currencyParam := bills.Currency{false, false}
params := bills.BillParams{1117753200140, 12070160, currency_param, "1"}

And pass it

Bills
result := bills.GetBillType(params) // تلفن ثابت 
amount := bills.GetCurrency(params) //120000
barcode := bills.GetBarCode(params) //  111775320014000012070160
verify := bills.VerifyBillID(params) //true
Digits
num2wordFa := digits.DigitToWord("۱۵۶۷۸۹") // صد پنجاه و شش هزار هفتصد هشتاد و نه 
num2wordEn := digits.DigitToWord("156789") // صد پنجاه و شش هزار هفتصد هشتاد و نه 
Negative := digits.DigitToWord("-156789") // منفی صد پنجاه و شش هزار هفتصد هشتاد و نه 
Phone number
phone, err := phone.GetPhoneNumberDetails("0930740741") // {011 33001112 01133001112 1133001112 مخابرات ایران [مازندران] ثابت} , nil
mobile, err := phone.GetPhoneNumberDetails("00989307407541") //{099913 07541 09991307541 9991307541 آپ‌تل [همه استان‌ها] دائمی}  , nil

Bank

CardInfo Method

Method has one entry card number and return bank name and error.

bank,error := CardInfo("") // "", error
bank,error := CardInfo("345345") // "", error
bank,error := CardInfo("6219861034529008") // "", error
bank,error := CardInfo("6037701689095443") // keshavarzi, nil
bank,error := CardInfo("6219861034529007") // saman, nil
Check Iranian Sheba

The types of results are :

type shebaResultHash struct {
	Name                   string
	Code                   string
	NickName               string
	PersianName            string
	AccountNumber          string
	AccountNumberAvailable bool
	FormattedAccountNumber string
	Process                func(str string) ShebaProcess
}
shebaCode := bank.ShebaCode{"IR820540102680020817909002"}
sheba := shebaCode.IsSheba() // {Parsian Bank 054 parsian بانک پارسیان  true  0x4c69f0}
shebaCode.Code= "IR820540102680020817909003"
sheba := shebaCode.IsSheba() // {  false }
Add Remove Commas to number
addComma := digits.AddCommas(14555478854)
removeComma := digits.RemoveCommas("4,555,522,212,12")

fmt.Printf("\n ADD COMMA : %v \n", addComma) // 14,555,478,854 
fmt.Printf("\n REMOVE COMMA : %v \n", removeComma)// 455552221212 
Get Place and city By NationalID
getPlaceByIranNationalId := city.GetPlaceByIranNationalId("0499370899")
fmt.Printf("\n Result : %v \n", getPlaceByIranNationalId)
Validate Iranian national number(code-e Melli)
verifyIranianNationalId := national_id.Validate("0067749828")
verifyIranianNationalIdFalse := national_id.Validate("0684159415")

fmt.Printf("\n Validate NationalID : %v \n", verifyIranianNationalId) // true
fmt.Printf("\n Validate NationalIDFalse : %v \n", verifyIranianNationalIdFalse) // false

About

An anthology of a variety of tools for the Persian language in Golang

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.4%
  • Other 0.6%