Documentation ¶
Overview ¶
** Copyright [2013-2017] [Megam Systems] ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
** Copyright [2013-2017] [Megam Systems] ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
** Copyright [2013-2017] [Megam Systems] ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
** Copyright [2013-2017] [Megam Systems] ** ** Licensed under the Apache License, Version 2.0 (the "License"); ** you may not use this file except in compliance with the License. ** You may obtain a copy of the License at ** ** http://www.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License.
Index ¶
- Constants
- Variables
- func GetBase64(dummymap map[string]string) string
- func GetMD5Hash(text string) string
- func Register(name string, provider BillProvider)
- func SetField(obj interface{}, name string, value string) error
- type Accounts
- type ApiAccounts
- type ApiBalances
- type ApiOrganizations
- type ApiSkewsEvents
- type Approval
- type BalanceOpts
- type Balances
- type BillOpts
- type BillProvider
- type BilledHistories
- type BilledHistoriesOpts
- type Dates
- type EventsSkews
- func (s *EventsSkews) ActionEvents(o *BillOpts, currentBal string, mi map[string]string) error
- func (s *EventsSkews) Create(mi map[string]string, o *BillOpts) error
- func (s *EventsSkews) CreateEvent(o *BillOpts, ACTION string, mi map[string]string) error
- func (s *EventsSkews) DeactiveEvents(o *BillOpts, mi map[string]string) error
- func (s *EventsSkews) PushSkews(mi map[string]string, skew_action string) error
- func (s *EventsSkews) SkewsQuotaUnpaid(o *BillOpts, mi map[string]string) error
- type Name
- type Organization
- type Password
- type Phone
- type States
- type Suspend
Constants ¶
const ( ORGANIZATIONGET = "/organizations" ACCOUNTS_GET = "/accounts/" )
const ( UPDATE = "/update" BALANCE = "/balances/" EVENTBALANCEJSON = "Megam::Balances" )
const ( SCYLLADB = "scylladb" WHMCS = "whmcs" )
const ( EVENTSKEWS = "/eventsskews" EVENTSKEWS_NEW = "/eventsskews/content" EVENTSKEWS_UPDATE = "/eventsskews/update" EVENTEVENTSKEWSJSON = "Megam::Skews" HARDSKEWS = "terminate" SOFTSKEWS = "suspend" WARNING = "warning" ACTIVE = "active" RESUME = "start" )
const ( NEWBILLEDHISTORY = "/billedhistories/content" BILLJSONCLAZ = "Megam::Billedhistories" )
Variables ¶
var BillProviders map[string]BillProvider
Functions ¶
func GetMD5Hash ¶
func Register ¶
func Register(name string, provider BillProvider)
Register registers a new billing provider, that can be later configured and used.
Types ¶
type Accounts ¶
type Accounts struct { Id string `json:"id" cql:"id"` Name Name `json:"name" cql:"name"` Phone Phone `json:"phone" cql:"phone"` Email string `json:"email" cql:"email"` Dates Dates `json:"dates" cql:"dates"` ApiKey string `json:"api_key" cql:"api_key"` Password Password `json:"password" cql:"password"` Approval Approval `json:"approval" cql:"approval"` Suspend Suspend `json:"suspend" cql:"suspend"` RegIpAddress string `json:"registration_ip_address" cql:"registration_ip_address"` States States `json:"states" cql:"states"` }
type ApiAccounts ¶
type ApiBalances ¶
type ApiOrganizations ¶
type ApiOrganizations struct { JsonClaz string `json:"json_claz" cql:"json_claz"` Results Organization `json:"results" cql:"results"` }
type ApiSkewsEvents ¶
type ApiSkewsEvents struct { JsonClaz string `json:"json_claz"` Results []*EventsSkews `json:"results"` }
type BalanceOpts ¶
type Balances ¶
type Balances struct { Id string `json:"id" cql:"id"` AccountId string `json:"account_id" cql:"account_id"` Credit string `json:"credit" cql:"credit"` JsonClaz string `json:"json_claz" cql:"json_claz"` }
func NewBalances ¶
Temporary hack to create an assembly from its id. This is used by SetStatus. We need add a Notifier interface duck typed by Box and Carton ?
type BillOpts ¶
type BillOpts struct { AccountId string AssemblyId string AssembliesId string AssemblyName string Consumed string StartTime string EndTime string QuotaId string SkewsType string SoftGracePeriod string SoftLimit string HardGracePeriod string HardLimit string Resources string Timestamp string M map[string]string }
BillOpts represents a billtransaction managed by the provider
type BillProvider ¶
type BillProvider interface { IsEnabled() bool //is this billing provider enabled. Onboard(o *BillOpts, m map[string]string) error //onboard an user in the billing system Nuke(o *BillOpts) error //delete an user from the billing system Suspend(o *BillOpts) error //suspend an user from the billing system Deduct(o *BillOpts, m map[string]string) error //deduct the balance credit Transaction(o *BillOpts, m map[string]string) error //deduct the bill transaction Invoice(o *BillOpts) error //invoice for a range. Notify(o *BillOpts) error //notify an user AuditUnpaid(o *BillOpts, m map[string]string) error }
func Provider ¶
func Provider(providerName string) BillProvider
Provider returns the current configured manager, as defined in the configuration file.
type BilledHistories ¶
type BilledHistories struct { AccountId string `json:"-" cql:"account_id"` AssemblyId string `json:"assembly_id" cql:"assembly_id"` BillType string `json:"bill_type" cql:"bill_type"` BillingAmount string `json:"billing_amount" cql:"billing_amount"` StateDate string `json:"start_date" cql:"start_date"` EndDate string `json:"end_date" cql:"end_date"` CurrencyType string `json:"currency_type" cql:"currency_type"` }
func NewBilledHistories ¶
func NewBilledHistories(topts *BillOpts) (*BilledHistories, error)
func (*BilledHistories) BilledHistories ¶
func (bt *BilledHistories) BilledHistories(m map[string]string) error
type BilledHistoriesOpts ¶
type BilledHistoriesOpts struct { AccountId string AssemblyId string AssemblyName string Consumed string }
func (*BilledHistoriesOpts) String ¶
func (bt *BilledHistoriesOpts) String() string
type Dates ¶
type Dates struct { CreatedAt string `json:"created_at" cql:"created_at"` LastPostedAt string `json:"last_posted_at" cql:"last_posted_at"` LastEmailedAt string `json:"last_emailed_at" cql:"last_emailed_at"` PreviousVisitAt string `json:"previous_visit_at" cql:"previous_visit_at"` FirstSeenAt string `json:"first_seen_at" cql:"first_seen_at"` }
type EventsSkews ¶
type EventsSkews struct { Id string `json:"id"` AccountId string `json:"account_id"` CatId string `json:"cat_id"` Inputs pairs.JsonPairs `json:"inputs"` Outputs pairs.JsonPairs `json:"outputs"` Actions pairs.JsonPairs `json:"actions"` JsonClaz string `json:"json_claz"` Status string `json:"status"` EventType string `json:"event_type"` }
func NewEventsSkews ¶
func NewEventsSkews(email, cat_id string, mi map[string]string) ([]*EventsSkews, error)
func (*EventsSkews) ActionEvents ¶
func (*EventsSkews) CreateEvent ¶
func (*EventsSkews) DeactiveEvents ¶
func (s *EventsSkews) DeactiveEvents(o *BillOpts, mi map[string]string) error
func (*EventsSkews) PushSkews ¶
func (s *EventsSkews) PushSkews(mi map[string]string, skew_action string) error
func (*EventsSkews) SkewsQuotaUnpaid ¶
func (s *EventsSkews) SkewsQuotaUnpaid(o *BillOpts, mi map[string]string) error
type Organization ¶
type Organization struct { Id string `json:"id" cql:"id"` AccountsId string `json:"accounts_id" cql:"accounts_id"` CreatedAt string `json:"created_at" cql:"created_at"` JsonClaz string `json:"json_claz" cql:"json_claz"` Name string `json:"name" cql:"name"` }
func AccountsOrg ¶
func AccountsOrg(email string, m map[string]string) (*Organization, error)