Documentation ¶
Index ¶
- Constants
- Variables
- func CreateAuthInfo(apiKey, apiSecret, user, pwd string) runtime.ClientAuthInfoWriter
- func GetProfilingRes(pctx context.Context) string
- func IsCriticalError(err error, kbCodeIgnore int, ignrDup bool, logger Logger) error
- func NewClientTransport(url string) *transport.Runtime
- func NewKillbillClient(trp *transport.Runtime, apiKey, apiSecret, user, pwd string) *kbclient.KillBill
- func WithProfilingInfo(parent context.Context, profInfo string) context.Context
- type Config
- type KillbillConfig
- type KillbillPolicy
- type Logger
- type PlanDescr
- type ProfCtxValue
- type RawClient
- func (cli *RawClient) AddAccountCustomFields(ctx context.Context, accountId strfmt.UUID, fields map[string]string) error
- func (cli *RawClient) AddAccountTags(ctx context.Context, accountId strfmt.UUID, tags ...string) error
- func (cli *RawClient) AddSubscriptionCustomFields(ctx context.Context, subscriptionId strfmt.UUID, fields map[string]string) error
- func (cli *RawClient) CancelSubscription(ctx context.Context, subscriptionId strfmt.UUID, date *strfmt.Date) error
- func (cli *RawClient) ChangePlan(ctx context.Context, subscriptionId strfmt.UUID, ...) error
- func (cli *RawClient) CommitInvoice(ctx context.Context, invoiceID strfmt.UUID) (*kbmodel.Invoice, error)
- func (cli *RawClient) CreateAccount(ctx context.Context, extKey string, currency string, locale string, bcd int32) (strfmt.UUID, error)
- func (cli *RawClient) CreateAccountFromBody(ctx context.Context, body *kbmodel.Account) (strfmt.UUID, error)
- func (cli *RawClient) CreateSubscription(ctx context.Context, accountId strfmt.UUID, extKey string, ...) (strfmt.UUID, error)
- func (cli *RawClient) CreateSubscriptions(pctx context.Context, accountId strfmt.UUID, date *strfmt.Date, ...) ([]*kbmodel.Bundle, error)
- func (cli *RawClient) CreateTenant(ctx context.Context, apiKey string, apiSecret string, extKey string) (*strfmt.UUID, error)
- func (cli *RawClient) DeleteAccountTags(ctx context.Context, accountId strfmt.UUID, tags ...string) error
- func (cli *RawClient) GetAccount(ctx context.Context, accountId strfmt.UUID, withBalance bool) (*kbmodel.Account, error)
- func (cli *RawClient) GetAccountByKey(ctx context.Context, externalKey string) (*kbmodel.Account, error)
- func (cli *RawClient) GetAccountTags(ctx context.Context, accountId strfmt.UUID) ([]*kbmodel.Tag, error)
- func (cli *RawClient) GetAllInvoices(ctx context.Context, accountID strfmt.UUID) ([]*kbmodel.Invoice, error)
- func (cli *RawClient) GetBundle(ctx context.Context, bundleId strfmt.UUID) (*kbmodel.Bundle, error)
- func (cli *RawClient) GetBundleByKey(ctx context.Context, extKey string) (*kbmodel.Bundle, error)
- func (cli *RawClient) GetInvoice(ctx context.Context, invoiceID strfmt.UUID) (*kbmodel.Invoice, error)
- func (cli *RawClient) GetInvoicesBetweenDates(ctx context.Context, accountID strfmt.UUID, from *strfmt.Date, to *strfmt.Date) ([]*kbmodel.Invoice, error)
- func (cli *RawClient) GetMonthlyInvoice(ctx context.Context, accountID strfmt.UUID, targetDt strfmt.Date) (*kbmodel.Invoice, error)
- func (cli *RawClient) GetSubscription(ctx context.Context, subId strfmt.UUID) (*kbmodel.Subscription, error)
- func (cli *RawClient) GetSubscriptionByKey(ctx context.Context, extKey string) (*kbmodel.Subscription, error)
- func (cli *RawClient) GetTenant(ctx context.Context, apiKey string) (*strfmt.UUID, error)
- func (cli *RawClient) InvalidateTenantCache(ctx context.Context) error
- func (cli *RawClient) IsInvoiceWrittenOff(ctx context.Context, invoiceID strfmt.UUID) (bool, string, error)
- func (cli *RawClient) PauseSubscription(ctx context.Context, subscriptionId strfmt.UUID, service string, state string, ...) error
- func (cli *RawClient) PayInvoice(ctx context.Context, invoiceID strfmt.UUID, accountID strfmt.UUID, ...) error
- func (cli *RawClient) ResumeSubscription(ctx context.Context, subscriptionId strfmt.UUID, service string, state string, ...) error
- func (cli *RawClient) TransferBundle(ctx context.Context, bundleId strfmt.UUID, destAccountId strfmt.UUID, ...) (strfmt.UUID, error)
- func (cli *RawClient) TriggerDryRunCancelSubscription(ctx context.Context, accountId strfmt.UUID, bundleId strfmt.UUID, ...) (*kbmodel.Invoice, error)
- func (cli *RawClient) TriggerDryRunChangePlan(ctx context.Context, accountId strfmt.UUID, bundleId strfmt.UUID, ...) (*kbmodel.Invoice, error)
- func (cli *RawClient) TriggerDryRunCreateSubscription(ctx context.Context, accountId strfmt.UUID, product string, priceList string, ...) (*kbmodel.Invoice, error)
- func (cli *RawClient) TriggerTargetInvoice(ctx context.Context, accountID strfmt.UUID, targetDate strfmt.Date) (*kbmodel.Invoice, error)
- func (cli *RawClient) UpdateSubscriptionBCD(ctx context.Context, subscriptionId strfmt.UUID, bcd int, ...) error
- func (cli *RawClient) UploadCatalogXML(ctx context.Context, path string) error
- func (cli *RawClient) VoidInvoice(ctx context.Context, invoiceID strfmt.UUID) (*kbmodel.Invoice, error)
- func (cli *RawClient) WriteOffInvoice(ctx context.Context, invoiceID strfmt.UUID, reason string) error
Constants ¶
const ( AUTO_PAY_OFF = "00000000-0000-0000-0000-000000000001" AUTO_INVOICING_OFF = "00000000-0000-0000-0000-000000000002" OVERDUE_ENFORCEMENT_OFF = "00000000-0000-0000-0000-000000000003" WRITTEN_OFF = "00000000-0000-0000-0000-000000000004" MANUAL_PAY = "00000000-0000-0000-0000-000000000005" TEST = "00000000-0000-0000-0000-000000000006" PARTNER = "00000000-0000-0000-0000-000000000007" AUTO_INVOICING_DRAFT = "00000000-0000-0000-0000-000000000008" AUTO_INVOICING_REUSE_DRAFT = "00000000-0000-0000-0000-000000000009" )
Kill Bill Control Tag
const ( SUB_CREATE_BP_EXISTS = 1015 ACCOUNT_ALREADY_EXISTS = 3000 ACCOUNT_DOES_NOT_EXIST_FOR_KEY = 3003 )
Kill Bill Error Codes
const Comment = ""
const CreatedBy = "go-client"
const DebugHttpRequests = false
const KB_PROFILING_RESP = "X-Killbill-Profiling-Resp"
Variables ¶
var NullDate = strfmt.Date(time.Time{})
Functions ¶
func CreateAuthInfo ¶
func CreateAuthInfo(apiKey, apiSecret, user, pwd string) runtime.ClientAuthInfoWriter
func GetProfilingRes ¶
Caller retrieves the profiling result through this method
func IsCriticalError ¶
Because of Kill Bill not always correctly returning the right error code on duplicate entry we need to add some dirty band-aid and specify 'ignrDup', 'logger' args to this function See https://github.com/killbill/killbill/issues/1344
func NewClientTransport ¶
Technically this could be shared across clients if needs to be
func NewKillbillClient ¶
Types ¶
type Config ¶
type Config struct { Url string Username string Password string ApiKey string ApiSecret string TimeoutSec int64 }
func (*Config) GetApiSecret ¶
func (*Config) GetPassword ¶
func (*Config) GetTimeout ¶
func (*Config) GetUsername ¶
type KillbillConfig ¶
type KillbillPolicy ¶
type KillbillPolicy string
const ( NONE KillbillPolicy = "" IMM KillbillPolicy = "IMMEDIATE" EOT KillbillPolicy = "END_OF_TERM" SOT KillbillPolicy = "START_OF_TERM" )
type ProfCtxValue ¶
type ProfCtxValue struct {
// contains filtered or unexported fields
}
type RawClient ¶
type RawClient struct { // Low level transport Trp *transport.Runtime // Cross tenant operations (e.g Create tenant) CrossTenantClient *kbclient.KillBill // Per-tenant client ApiKey string ApiSecret string TenantClient *kbclient.KillBill // Default timeout Timeout time.Duration }
func NewKBClient ¶
func NewKBClient(conf KillbillConfig) *RawClient
func (*RawClient) AddAccountCustomFields ¶
func (*RawClient) AddAccountTags ¶
func (*RawClient) AddSubscriptionCustomFields ¶
func (*RawClient) CancelSubscription ¶
func (*RawClient) ChangePlan ¶
func (*RawClient) CommitInvoice ¶
func (cli *RawClient) CommitInvoice(ctx context.Context, invoiceID strfmt.UUID) (*kbmodel.Invoice, error)
CommitInvoice commits an invoice. If the current invoice status is different from DRAFT, it returns an error.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) CreateAccount ¶
func (*RawClient) CreateAccountFromBody ¶
func (*RawClient) CreateSubscription ¶
func (*RawClient) CreateSubscriptions ¶
func (*RawClient) CreateTenant ¶
func (*RawClient) DeleteAccountTags ¶
func (*RawClient) GetAccount ¶
func (*RawClient) GetAccountByKey ¶
func (*RawClient) GetAccountTags ¶
func (*RawClient) GetAllInvoices ¶
func (cli *RawClient) GetAllInvoices(ctx context.Context, accountID strfmt.UUID) ([]*kbmodel.Invoice, error)
GetAllInvoices fetchs all invoice for the given account.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) GetBundleByKey ¶
func (*RawClient) GetInvoice ¶
func (cli *RawClient) GetInvoice(ctx context.Context, invoiceID strfmt.UUID) (*kbmodel.Invoice, error)
GetInvoice fetch an invoice using the given invoiceID.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) GetInvoicesBetweenDates ¶
func (cli *RawClient) GetInvoicesBetweenDates(ctx context.Context, accountID strfmt.UUID, from *strfmt.Date, to *strfmt.Date) ([]*kbmodel.Invoice, error)
GetInvoicesBetweenDates returns all invoices belonging to an account, whose invoice date is in between the given arguments.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) GetMonthlyInvoice ¶
func (cli *RawClient) GetMonthlyInvoice(ctx context.Context, accountID strfmt.UUID, targetDt strfmt.Date) (*kbmodel.Invoice, error)
GetMonthlyInvoice returns the invoice matching the given target
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) GetSubscription ¶
func (*RawClient) GetSubscriptionByKey ¶
func (*RawClient) InvalidateTenantCache ¶
func (*RawClient) IsInvoiceWrittenOff ¶
func (cli *RawClient) IsInvoiceWrittenOff(ctx context.Context, invoiceID strfmt.UUID) (bool, string, error)
IsInvoiceWrittenOff checks if the given invoice is written-off, returning true or false
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) PauseSubscription ¶
func (*RawClient) PayInvoice ¶
func (cli *RawClient) PayInvoice(ctx context.Context, invoiceID strfmt.UUID, accountID strfmt.UUID, amount float64, externalPayment bool) error
PayInvoice adds a full-amount payment to the given invoice.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) ResumeSubscription ¶
func (*RawClient) TransferBundle ¶
func (*RawClient) TriggerDryRunCancelSubscription ¶
func (*RawClient) TriggerDryRunChangePlan ¶
func (*RawClient) TriggerDryRunCreateSubscription ¶
func (*RawClient) TriggerTargetInvoice ¶
func (cli *RawClient) TriggerTargetInvoice(ctx context.Context, accountID strfmt.UUID, targetDate strfmt.Date) (*kbmodel.Invoice, error)
TriggerTargetInvoice creates a DRAFT invoice for the given account, using the given target date.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) UpdateSubscriptionBCD ¶
func (*RawClient) UploadCatalogXML ¶
func (*RawClient) VoidInvoice ¶
func (cli *RawClient) VoidInvoice(ctx context.Context, invoiceID strfmt.UUID) (*kbmodel.Invoice, error)
VoidInvoice voids an invoice. If the invoice was already paid, voiding it fails.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.
func (*RawClient) WriteOffInvoice ¶
func (cli *RawClient) WriteOffInvoice(ctx context.Context, invoiceID strfmt.UUID, reason string) error
WriteOffInvoice writes-off the given invoice.
In case of connection errors, the underlying error is returned. For other cases (HTTP status >= 400), a kbcommon.KillbillError is returned.