Documentation
¶
Index ¶
- Constants
- type Bpjs
- func (m Bpjs) CalculateBPJSKes(salary float64) (float64, float64, float64)
- func (m Bpjs) CalculateBPJSTkJht(salary float64) (float64, float64, float64)
- func (m Bpjs) CalculateBPJSTkJkk(salary float64, risk string) (float64, float64)
- func (m Bpjs) CalculateBPJSTkJkm(salary float64) float64
- func (m Bpjs) CalculateBPJSTkJp(salary float64) (float64, float64, float64)
- type Firestore
- type SMTPSender
- func (s *SMTPSender) SendEmail(subject string, data interface{}, attachment []string) error
- func (s *SMTPSender) SendEmailWithTemplate(subject, message string, attachment []string) error
- func (s *SMTPSender) SetAddress(name string, email string) *SMTPSender
- func (s *SMTPSender) SetTemplate(layout string, template string) *SMTPSender
- func (s *SMTPSender) SetTls(tls bool)
- type SendFileURLRequest
- type SendImageURLRequest
- type SendMessageRequest
- type WatzapClient
Constants ¶
const WatzapURL = "https://api.watzap.id"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bpjs ¶
type Bpjs struct {
BpjsKesRateEmployer float64 // 4% BPJS Kesehatan dibayar oleh pemberi kerja
BpjsKesRateEmployee float64 // 1% BPJS Kesehatan dibayar oleh pekerja
BpjsTkJhtRateEmployer float64 // 3.7% Jaminan Hari Tua dibayar oleh pemberi kerja
BpjsTkJhtRateEmployee float64 // 2% Jaminan Hari Tua dibayar oleh pekerja
MaxSalaryKes float64 // Batas atas gaji untuk BPJS Kesehatan
MinSalaryKes float64 // Batas bawah gaji untuk BPJS Kesehatan
MaxSalaryTk float64 // Batas atas gaji untuk BPJS Ketenagakerjaan
BpjsTkJkkVeryLowRiskEmployee float64 // BPJS JKK resiko sangat rendah
BpjsTkJkkLowRiskEmployee float64 // BPJS JKK resiko rendah
BpjsTkJkkMiddleRiskEmployee float64 // BPJS JKK resiko menengah
BpjsTkJkkHighRiskEmployee float64 // BPJS JKK resiko tinggi
BpjsTkJkkVeryHighRiskEmployee float64 // BPJS JKK resiko sangat tinggi
BpjsTkJkmEmployee float64 // BPJS JKM
BpjsTkJpRateEmployer float64 // 2% Jaminan Pensiun dibayar oleh pemberi kerja
BpjsTkJpRateEmployee float64 // 1% Jaminan Pensiun dibayar oleh pekerja
BpjsKesEnabled bool
BpjsTkJhtEnabled bool
BpjsTkJkmEnabled bool
BpjsTkJpEnabled bool
BpjsTkJkkEnabled bool
}
func (Bpjs) CalculateBPJSKes ¶
func (Bpjs) CalculateBPJSTkJht ¶
CalculateBPJSTkJht menghitung iuran BPJS Ketenagakerjaan JHT berdasarkan upah yang diberikan.
Fungsi ini akan memastikan bahwa upah berada dalam batas yang ditentukan untuk BPJS Ketenagakerjaan.
Contoh penggunaan CalculateBPJSTkJht: bpjs := InitBPJS() employerContribution, employeeContribution, totalContribution := bpjs.CalculateBPJSTkJht(salary)
func (Bpjs) CalculateBPJSTkJkk ¶
CalculateBPJSTkJkk menghitung iuran BPJS Ketenagakerjaan Kkk berdasarkan upah yang diberikan dan resiko yang dihadapi.
Fungsi ini akan menghitung iuran BPJS Ketenagakerjaan Kkk yang dibayar oleh pekerja berdasarkan resiko yang dihadapi.
Contoh penggunaan CalculateBPJSTkJkk: bpjs := InitBPJS() employerContribution, employeeContribution := bpjs.CalculateBPJSTkJkk(salary, risk)
func (Bpjs) CalculateBPJSTkJkm ¶
CalculateBPJSTkJkm menghitung iuran BPJS Ketenagakerjaan Kmk berdasarkan upah yang diberikan.
Fungsi ini akan menghitung iuran BPJS Ketenagakerjaan Kmk yang dibayar oleh pekerja.
Contoh penggunaan CalculateBPJSTkJkm: bpjs := InitBPJS() employerContribution := bpjs.CalculateBPJSTkJkm(salary)
func (Bpjs) CalculateBPJSTkJp ¶
CalculateBPJSTkJp menghitung iuran BPJS Ketenagakerjaan Jp berdasarkan upah yang diberikan.
Fungsi ini akan menghitung iuran BPJS Ketenagakerjaan Jp yang dibayar oleh pemberi kerja dan pekerja, serta total iuran yang harus dibayar.
Contoh penggunaan CalculateBPJSTkJp: bpjs := InitBPJS() employerContribution, employeeContribution, totalContribution := bpjs.CalculateBPJSTkJp(salary)
type Firestore ¶
type Firestore struct {
// contains filtered or unexported fields
}
Firestore is a wrapper around the Firebase Firestore client.
It provides a convenient interface for interacting with the Firestore database, including uploading and downloading files.
func NewFirebaseApp ¶
NewFirebaseApp creates a new Firestore client from a Firebase credentials file and a bucket name.
func (*Firestore) DeleteFileFromFirebaseStorage ¶
DeleteFileFromFirebaseStorage deletes the specified object from Firebase Storage.
func (*Firestore) UploadFileToFirebaseStorage ¶
func (f *Firestore) UploadFileToFirebaseStorage(file []byte, folder string, fileName string) (string, string, error)
UploadFileToFirebaseStorage uploads a file to the specified bucket and folder in Firebase Storage.
It returns the object path and public URL for the uploaded file.
type SMTPSender ¶
type SMTPSender struct {
Tls bool
// contains filtered or unexported fields
}
SMTPSender SMTPSender
func NewSMTPSender ¶
func NewSMTPSender(smtpServer string, smtpPort int, smtpUsername, smtpPassword string, from mail.Address) *SMTPSender
NewSMTPSender creates a new instance of SMTPSender with the specified SMTP server details and sender address. It initializes the SMTP sender with the provided server, port, username, password, and from address. The recipient list is initialized as empty and can be set using methods like SetAddress.
func (*SMTPSender) SendEmail ¶
func (s *SMTPSender) SendEmail(subject string, data interface{}, attachment []string) error
SendEmail sends an email using the SMTP sender.
It takes a subject string, a data object to be passed to the template, and a slice of strings representing the paths to the files to attach.
It returns an error if something goes wrong.
func (*SMTPSender) SendEmailWithTemplate ¶
func (s *SMTPSender) SendEmailWithTemplate(subject, message string, attachment []string) error
SendEmailWithTemplate sends an email with the given subject, message, and attachment.
The message must be a complete HTML email message.
It returns an error if something goes wrong.
func (*SMTPSender) SetAddress ¶
func (s *SMTPSender) SetAddress(name string, email string) *SMTPSender
SetAddress sets the recipient address for the SMTP sender. It takes the recipient's name and email address and sets it as the to address. It returns the SMTPSender instance for method chaining.
func (*SMTPSender) SetTemplate ¶
func (s *SMTPSender) SetTemplate(layout string, template string) *SMTPSender
SetTemplate sets the template files for the SMTP sender. It sets the layout and body templates for the email message. If the file does not exist, it will use an empty template. The method returns the SMTPSender instance for method chaining.
func (*SMTPSender) SetTls ¶
func (s *SMTPSender) SetTls(tls bool)
SetTls sets the TLS setting for the SMTP sender. If tls is true, it will use a TLS connection when sending the email. If tls is false, it will use a non-TLS connection.
type SendFileURLRequest ¶
SendFileURLRequest represents the request payload for sending a file URL.
type SendImageURLRequest ¶
type SendImageURLRequest struct {
PhoneNo string `json:"phone_no"`
URL string `json:"url"`
Message string `json:"message"`
SeparateCaption int `json:"separate_caption"`
}
SendImageURLRequest represents the request payload for sending an image URL.
type SendMessageRequest ¶
SendMessageRequest represents the request payload for sending a message.
type WatzapClient ¶
type WatzapClient struct {
ApiKey string
NumberKey string
MockNumber string
RedisKey string
IsMock bool
}
WatzapClient is a client for interacting with the Watzap API.
func NewWatzapClient ¶
func NewWatzapClient(apiKey, numberKey, mockNumber string, isMock bool, redisKey string) *WatzapClient
NewWatzapClient creates a new instance of WatzapClient with the given parameters.
If redisKey is empty, it will be set to "watzap:notif".
func (*WatzapClient) SendFileURL ¶
func (c *WatzapClient) SendFileURL(phoneNo, url string) error
SendFileURL sends a file URL to the specified phone number using the Watzap API.
It returns an error if the file URL could not be sent.
func (*WatzapClient) SendImageURL ¶
func (c *WatzapClient) SendImageURL(phoneNo, url, message string, separateCaption int) error
SendImageURL sends an image URL with an optional message to the specified phone number using the Watzap API.
It returns an error if the image URL could not be sent.
func (*WatzapClient) SendMessage ¶
func (c *WatzapClient) SendMessage(phoneNo, message string) error
SendMessage sends a message to the specified phone number using the Watzap API.
It returns an error if the message could not be sent.