Skip to content

Commit

Permalink
Merge pull request #66 from tada-team/billing
Browse files Browse the repository at this point in the history
Billing
  • Loading branch information
igo95862 authored Nov 30, 2021
2 parents e6772e9 + 341701e commit 89dce0b
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 53 deletions.
13 changes: 3 additions & 10 deletions billing_change_tariff.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,15 @@ type ChangeTariffBilling struct {
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"`
TariffId int64 `json:"tariff_id"`
OpenDate time.Time `json:"open_date,omitempty"`
}

// CreateChangeTariffOnPersonalAccountResponse response on create change tariff on personal account
Expand All @@ -35,8 +29,7 @@ type CreateChangeTariffOnPersonalAccountResponse struct {

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

// DeleteChangeTariffOnPersonalAccountResponse response on delete change tariff om personal account
Expand Down
15 changes: 2 additions & 13 deletions billing_personal_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,20 @@ type CreatePersonalAccountResponse struct {

// 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"`
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
6 changes: 3 additions & 3 deletions billing_personal_account_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ type PersonalAccountStatus string

const (
// Personal account is active
ActiveAccount PersonalAccountStatus = "Active"
ActiveAccount PersonalAccountStatus = "PERSONAL_ACCOUNT_STATUS_ACTIVE"

// Personal account is under financial blocking
SuspendedAccount PersonalAccountStatus = "Suspended"
SuspendedAccount PersonalAccountStatus = "PERSONAL_ACCOUNT_STATUS_SUSPENDED"

// Personal account is under administrative blocking
BlockedAccount PersonalAccountStatus = "Blocked"
BlockedAccount PersonalAccountStatus = "PERSONAL_ACCOUNT_STATUS_BLOCKED"
)
6 changes: 6 additions & 0 deletions billing_tariff.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ type TariffBilling struct {
// Bitrate of video in video co
VideoCallBitrate int32 `json:"video_call_bitrate"`

// Bitrate of video in video sharing
VideoSharingBitrate int32 `json:"video_sharing_bitrate"`

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

Expand Down Expand Up @@ -103,6 +106,9 @@ type CreateTariffRequest struct {
// Bitrate of video in video co
VideoCallBitrate int32 `json:"video_call_bitrate"`

// Bitrate of video in video sharing
VideoSharingBitrate int32 `json:"video_sharing_bitrate"`

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

Expand Down
4 changes: 2 additions & 2 deletions billing_tariff_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type TariffStatus string

const (
// Tariff is active
ActiveTariff TariffStatus = "Active"
ActiveTariff TariffStatus = "TARIFF_STATUS_ACTIVE"

// Tariff in archive
ArchiveTariff TariffStatus = "Archive"
ArchiveTariff TariffStatus = "TARIFF_STATUS_ARCHIVE"
)
5 changes: 2 additions & 3 deletions billing_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import "time"

// TeamBilling struct of billing api
type TeamBilling struct {
PersonalAccountId string `json:"personal_account_id,omitempty"` // TODO: must be int64
TeamUuid string `json:"team_uuid,omitempty"`
DeleteDate time.Time `json:"delete_date,omitempty"`
TeamUuid string `json:"team_uuid,omitempty"`
DeleteDate time.Time `json:"delete_date,omitempty"`
}

// AddTeamOnPersonalAccountRequest request on add team on personal account
Expand Down
42 changes: 20 additions & 22 deletions billing_workplace.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import (

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

// UserInfo user information
type UserInfo struct {
Uuid string `json:"uuid"`
Fio string `json:"fio,omitempty"`
FullName string `json:"full_name,omitempty"`
Phone string `json:"phone,omitempty"`
Email string `json:"email,omitempty"`
LastActivity *time.Time `json:"last_activity,omitempty"`
Expand All @@ -29,20 +28,14 @@ type WorkplaceOptions struct {

// GetWorkplacesByPersonalAccountRequest request on get workplaces by personal account
type GetWorkplacesByPersonalAccountRequest struct {
PersonalAccountId string `json:"personal_account_id"`
Options *WorkplaceOptions `json:"options,omitempty"`
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 string `json:"personal_account_id"`
}

// GetUnpaidWorkplacesByPersonalAccountResponse response on get count unpaid workplaces by personal account
type GetUnpaidWorkplacesByPersonalAccountResponse struct {
Count int32 `json:"count,omitempty"`
Expand All @@ -55,8 +48,7 @@ type GetWorkplaceByPersonalAccountResponse struct {

// AddWorkplacesOnPersonalAccountRequest request on add workplace on personal account
type AddWorkplacesOnPersonalAccountRequest struct {
PersonalAccountId string `json:"personal_account_id"` // TODO: must be int64
CountWorkplaces int32 `json:"count_workplaces"`
CountWorkplaces int32 `json:"count_workplaces"`
}

// AddWorkplacesOnPersonalAccountResponse response on add workplace on personal account
Expand All @@ -66,8 +58,7 @@ type AddWorkplacesOnPersonalAccountResponse struct {

// ActivateWorkplacesOnPersonalAccountRequest request on activate workplace on personal account
type ActivateWorkplacesOnPersonalAccountRequest struct {
PersonalAccountId string `json:"personal_account_id"` // TODO: must be int64
CountWorkplaces int32 `json:"count_workplaces"`
CountWorkplaces int32 `json:"count_workplaces"`
}

// ActivateWorkplacesOnPersonalAccountResponse response on activate workplace on personal account
Expand All @@ -77,8 +68,7 @@ type ActivateWorkplacesOnPersonalAccountResponse struct {

// DeleteWorkplacesOnPersonalAccountRequest request on delete workplace on personal account
type DeleteWorkplacesOnPersonalAccountRequest struct {
PersonalAccountId string `json:"personal_account_id"` // TODO: must be int64
CountWorkplaces int32 `json:"count_workplaces"`
CountWorkplaces int32 `json:"count_workplaces"`
}

// DeleteWorkplacesOnPersonalAccountResponse response on delete workplace on personal account
Expand All @@ -88,8 +78,7 @@ type DeleteWorkplacesOnPersonalAccountResponse struct {

// AddUserInWorkplaceRequest request on add user in workplace on personal account
type AddUserInWorkplaceRequest struct {
PersonalAccountId string `json:"personal_account_id"` // TODO: must be int64
UserUuid string `json:"user_uuid"`
UserUuid string `json:"user_uuid"`
}

// AddUserInWorkplaceResponse response on add user in workplace on personal account
Expand All @@ -99,8 +88,7 @@ type AddUserInWorkplaceResponse struct {

// DeleteUserFromWorkplaceRequest request on delete user from workplace on personal account
type DeleteUserFromWorkplaceRequest struct {
PersonalAccountId string `json:"personal_account_id"` // TODO: must be int64
UserUuid string `json:"user_uuid"`
UserUuid string `json:"user_uuid"`
}

// DeleteUserFromWorkplaceResponse response on delete user from workplace on personal account
Expand Down Expand Up @@ -132,3 +120,13 @@ type GetUsersInfoByUserUUIDArrayExcludingTeamMembersRequest struct {
type GetUsersInfoByUserUUIDArrayExcludingTeamMembersResponse struct {
UserInfo []UserInfo `json:"user_info,omitempty"`
}

// AddUserInWorkplaceByJidRequest request on add user on workplace by contact JID
type AddUserInWorkplaceByJidRequest struct {
ContactUuid string `json:"contact_uuid,omitempty"`
}

// AddUserInWorkplaceByJidResponse response on add user on workplace by contact JID
type AddUserInWorkplaceByJidResponse struct {
UserInfo
}

0 comments on commit 89dce0b

Please sign in to comment.