thirdparty

package
v1.0.68 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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 InitBPJS

func InitBPJS() *Bpjs

func (Bpjs) CalculateBPJSKes

func (m Bpjs) CalculateBPJSKes(salary float64) (float64, float64, float64)

func (Bpjs) CalculateBPJSTkJht

func (m Bpjs) CalculateBPJSTkJht(salary float64) (float64, float64, float64)

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

func (m Bpjs) CalculateBPJSTkJkk(salary float64, risk string) (float64, float64)

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

func (m Bpjs) CalculateBPJSTkJkm(salary float64) float64

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

func (m Bpjs) CalculateBPJSTkJp(salary float64) (float64, float64, float64)

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

func NewFirebaseApp(ctx context.Context, firebaseCredentialFile, bucket string) (*Firestore, error)

NewFirebaseApp creates a new Firestore client from a Firebase credentials file and a bucket name.

func (*Firestore) DeleteFileFromFirebaseStorage

func (f *Firestore) DeleteFileFromFirebaseStorage(objString string) error

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

type SendFileURLRequest struct {
	PhoneNo string `json:"phone_no"`
	URL     string `json:"url"`
}

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

type SendMessageRequest struct {
	PhoneNo string `json:"phone_no"`
	Message string `json:"message"`
}

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.

Directories

Path Synopsis
payment
oy

Jump to

Keyboard shortcuts

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