Skip to content

Commit

Permalink
Merge pull request #64 from tada-team/billing
Browse files Browse the repository at this point in the history
Billing
  • Loading branch information
igo95862 authored Nov 24, 2021
2 parents 53be95f + 065ce74 commit f5e37dd
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 3 deletions.
45 changes: 45 additions & 0 deletions billing_change_tariff.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package tdproto

import "time"

// ChangeTariffBilling struct of changes tariffs by personal account
type ChangeTariffBilling struct {
PersonalAccountId int64 `json:"personal_account_id"`
TariffId int64 `json:"tariff_id,omitempty"`
OpenDate time.Time `json:"open_date,omitempty"`
CloseDate time.Time `json:"close_date,omitempty"`
CreateDate time.Time `json:"create_date,omitempty"`
}

// GetChangesTariffsByPersonalAccountRequest request on get changes tariffs by personal account
type GetChangesTariffsByPersonalAccountRequest struct {
PersonalAccountId int64 `json:"personal_account_id"`
}

// GetChangesTariffsByPersonalAccountResponse response on get changes tariffs by personal account
type GetChangesTariffsByPersonalAccountResponse struct {
TariffsChanges []ChangeTariffBilling `json:"tariffs_changes,omitempty"`
}

// CreateChangeTariffOnPersonalAccountRequest request on create change tariff on personal account
type CreateChangeTariffOnPersonalAccountRequest struct {
PersonalAccountId int64 `json:"personal_account_id"`
TariffId int64 `json:"tariff_id"`
OpenDate time.Time `json:"open_date,omitempty"`
}

// CreateChangeTariffOnPersonalAccountResponse response on create change tariff on personal account
type CreateChangeTariffOnPersonalAccountResponse struct {
Success bool `json:"success,omitempty"`
}

// DeleteChangeTariffOnPersonalAccountRequest request on delete change tariff on personal account
type DeleteChangeTariffOnPersonalAccountRequest struct {
PersonalAccountId int64 `json:"personal_account_id"`
TariffId int64 `json:"tariff_id"`
}

// DeleteChangeTariffOnPersonalAccountResponse response on delete change tariff om personal account
type DeleteChangeTariffOnPersonalAccountResponse struct {
Success bool `json:"success,omitempty"`
}
27 changes: 27 additions & 0 deletions billing_personal_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,33 @@ type CreatePersonalAccountResponse struct {
PersonalAccountBilling
}

// UpdatePersonalAccountRequest request on update personal account
type UpdatePersonalAccountRequest struct {
PersonalAccountId int64 `json:"personal_account_id"`
FullName string `json:"full_name,omitempty"`
Phone string `json:"phone,omitempty"`
}

// UpdatePersonalAccountResponse response on update personal account
type UpdatePersonalAccountResponse struct {
Success bool `json:"success,omitempty"`
}

// CheckActivePersonalAccountRequest request on check active personal account
type CheckActivePersonalAccountRequest struct {
PersonalAccountId int64 `json:"personal_account_id"`
}

// CheckActivePersonalAccountResponse response on check active personal account
type CheckActivePersonalAccountResponse struct {
Success bool `json:"success,omitempty"`
}

// GetPersonalAccountByIDRequest request on get personal account by ID
type GetPersonalAccountByIDRequest struct {
PersonalAccountId int64 `json:"personal_account_id,omitempty"`
}

// GetPersonalAccountByIDResponse response on get personal account by ID
type GetPersonalAccountByIDResponse struct {
PersonalAccountBilling
Expand Down
27 changes: 24 additions & 3 deletions billing_tariff.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ type TariffBilling struct {
// Currency of tariff
Currency Currency `json:"currency"`

// Count of minimum workspaces on tariff
MinTariffWorkplaces int32 `json:"min_tariff_workplaces"`

// Minimum step of change count workspaces on tariff
MinStepWorkplaces int32 `json:"min_step_workplaces"`

// Disk space limit per user
DiskSpaceQuotaMb string `json:"disk_space_quota_mb"`

Expand All @@ -37,6 +43,9 @@ type TariffBilling struct {
// Maximum count of users in video conference
MaxVideoUser int32 `json:"max_video_user"`

// Bitrate of video in video co
VideoCallBitrate int32 `json:"video_call_bitrate"`

// Date of opening tariff
OpenDate *time.Time `json:"open_date"`

Expand Down Expand Up @@ -64,6 +73,12 @@ type CreateTariffRequest struct {
// Currency of tariff
Currency Currency `json:"currency"`

// Count of minimum workspaces on tariff
MinTariffWorkplaces int32 `json:"min_tariff_workplaces"`

// Minimum step of change count workspaces on tariff
MinStepWorkplaces int32 `json:"min_step_workplaces"`

// Disk space limit per user
DiskSpaceQuotaMb string `json:"disk_space_quota_mb,omitempty"`

Expand All @@ -76,9 +91,6 @@ type CreateTariffRequest struct {
// Flag of accounting without looking at the number of days before the billing period
IsBillingFullTime bool `json:"is_billing_full_time,omitempty"`

// Default tariff flag that is set when registering an account
IsDefaultTariff bool `json:"is_default_tariff,omitempty"`

// Flag for accounting for unspent days when switching to a new tariff
IsRecalcChangeTariff bool `json:"is_recalc_change_tariff,omitempty"`

Expand All @@ -88,6 +100,12 @@ type CreateTariffRequest struct {
// Maximum count of users in video conference
MaxVideoUser int32 `json:"max_video_user,omitempty"`

// Bitrate of video in video co
VideoCallBitrate int32 `json:"video_call_bitrate"`

// Default tariff flag that is set when registering an account
IsDefaultTariff bool `json:"is_default_tariff,omitempty"`

// Date of opening tariff
OpenDate *time.Time `json:"open_date,omitempty"`

Expand All @@ -100,6 +118,9 @@ type CreateTariffRequest struct {

// Request to update the tariff
type UpdateTariffRequest struct {
// Tariff id
TariffId string `json:"tariff_id"`

// Date of closing tariff
CloseDate *time.Time `json:"close_date,omitempty"`

Expand Down
40 changes: 40 additions & 0 deletions billing_workplace.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
package tdproto

// WorkplaceBilling struct of workplace on personal account
type WorkplaceBilling struct {
PersonalAccountId int64 `json:"personal_account_id"`
WorkplaceId int64 `json:"workplace_id,omitempty"`
UserId int64 `json:"user_id,omitempty"`
UserUuid string `json:"user_uuid,omitempty"`
}

// WorkplaceOptions struct for pagination
type WorkplaceOptions struct {
Limit int32 `json:"limit,omitempty"`
Offset int32 `json:"offset,omitempty"`
}

// GetWorkplacesByPersonalAccountRequest request on get workplaces by personal account
type GetWorkplacesByPersonalAccountRequest struct {
PersonalAccountId int64 `json:"personal_account_id"`
Options *WorkplaceOptions `json:"options,omitempty"`
}

// GetWorkplacesByPersonalAccountResponse response on get workplaces by personal account
type GetWorkplacesByPersonalAccountResponse struct {
Workplaces []WorkplaceBilling `json:"workplaces,omitempty"`
}

// GetUnpaidWorkplacesByPersonalAccountRequest request on get count unpaid workplaces by personal account
type GetUnpaidWorkplacesByPersonalAccountRequest struct {
PersonalAccountId int64 `json:"personal_account_id"`
}

// GetUnpaidWorkplacesByPersonalAccountResponse response on get count unpaid workplaces by personal account
type GetUnpaidWorkplacesByPersonalAccountResponse struct {
Count int32 `json:"count,omitempty"`
}

// GetWorkplaceByPersonalAccountResponse response on get workplace by personal account
type GetWorkplaceByPersonalAccountResponse struct {
WorkplaceBilling
}

// AddWorkplacesOnPersonalAccountRequest request on add workplace on personal account
type AddWorkplacesOnPersonalAccountRequest struct {
PersonalAccountId string `json:"personal_account_id,omitempty"` // TODO: must be int64
Expand Down

0 comments on commit f5e37dd

Please sign in to comment.