Skip to content

Commit

Permalink
Generated Latest Changes for v2021-02-25
Browse files Browse the repository at this point in the history
  • Loading branch information
Recurly Integrations authored Jul 2, 2024
1 parent 03615d8 commit 6b392c6
Show file tree
Hide file tree
Showing 24 changed files with 1,671 additions and 20 deletions.
15 changes: 15 additions & 0 deletions add_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ type AddOn struct {
// System-generated unique identifier for an measured unit associated with the add-on.
MeasuredUnitId string `json:"measured_unit_id,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
LiabilityGlAccountId string `json:"liability_gl_account_id,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
RevenueGlAccountId string `json:"revenue_gl_account_id,omitempty"`

// The ID of a performance obligation. Performance obligations are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
PerformanceObligationId string `json:"performance_obligation_id,omitempty"`

// Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code.
AccountingCode string `json:"accounting_code,omitempty"`

Expand Down
19 changes: 17 additions & 2 deletions add_on_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ()

type AddOnCreate struct {

// Unique code to identify an item. Available when the `Credit Invoices` feature are enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
// Unique code to identify an item. Available when the `Credit Invoices` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
ItemCode *string `json:"item_code,omitempty"`

// System-generated unique identifier for an item. Available when the `Credit Invoices` feature is enabled. If `item_id` and `item_code` are both present, `item_id` will be used.
Expand Down Expand Up @@ -43,6 +43,21 @@ type AddOnCreate struct {
// Plan ID
PlanId *string `json:"plan_id,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
LiabilityGlAccountId *string `json:"liability_gl_account_id,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
RevenueGlAccountId *string `json:"revenue_gl_account_id,omitempty"`

// The ID of a performance obligation. Performance obligations are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
PerformanceObligationId *string `json:"performance_obligation_id,omitempty"`

// Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If `item_code`/`item_id` is part of the request then `accounting_code` must be absent.
AccountingCode *string `json:"accounting_code,omitempty"`

Expand All @@ -68,7 +83,7 @@ type AddOnCreate struct {
TaxCode *string `json:"tax_code,omitempty"`

// * If `item_code`/`item_id` is part of the request and the item
// has a default currency then `currencies` is optional. If the item does
// has a default currency, then `currencies` is optional. If the item does
// not have a default currency, then `currencies` is required. If `item_code`/`item_id`
// is not present `currencies` is required.
// * If the add-on's `tier_type` is `tiered`, `volume`, or `stairstep`,
Expand Down
17 changes: 16 additions & 1 deletion add_on_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ type AddOnUpdate struct {
// Accounting code for invoice line items for this add-on. If no value is provided, it defaults to add-on's code. If an `Item` is associated to the `AddOn` then `accounting code` must be absent.
AccountingCode *string `json:"accounting_code,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
LiabilityGlAccountId *string `json:"liability_gl_account_id,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
RevenueGlAccountId *string `json:"revenue_gl_account_id,omitempty"`

// The ID of a performance obligation. Performance obligations are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
PerformanceObligationId *string `json:"performance_obligation_id,omitempty"`

// When this add-on is invoiced, the line item will use this revenue schedule. If `item_code`/`item_id` is part of the request then `revenue_schedule_type` must be absent in the request as the value will be set from the item.
RevenueScheduleType *string `json:"revenue_schedule_type,omitempty"`

Expand Down Expand Up @@ -67,7 +82,7 @@ type AddOnUpdate struct {
// `percentage_tiers` is an array of objects, which must have the set of tiers
// per currency and the currency code. The tier_type must be `volume` or `tiered`,
// if not, it must be absent. There must be one tier without an `ending_amount` value
// which represents the final tier. This feature is currently in development and
// which represents the final tier. This feature is currently in development and
// requires approval and enablement, please contact support.
PercentageTiers []PercentageTiersByCurrencyCreate `json:"percentage_tiers,omitempty"`
}
16 changes: 16 additions & 0 deletions business_entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ type BusinessEntity struct {
// Address information for the business entity that will be used for calculating taxes.
TaxAddress Address `json:"tax_address,omitempty"`

// The source of the address that will be used as the origin in determining taxes. Available only when the site is on an Elite plan. A value of "origin" refers to the "Business entity tax address". A value of "destination" refers to the "Customer tax address".
OriginTaxAddressSource string `json:"origin_tax_address_source,omitempty"`

// The source of the address that will be used as the destinaion in determining taxes. Available only when the site is on an Elite plan. A value of "destination" refers to the "Customer tax address". A value of "origin" refers to the "Business entity tax address".
DestinationTaxAddressSource string `json:"destination_tax_address_source,omitempty"`

// VAT number for the customer used on the invoice.
DefaultVatNumber string `json:"default_vat_number,omitempty"`

Expand All @@ -40,6 +46,16 @@ type BusinessEntity struct {
// List of countries for which the business entity will be used.
SubscriberLocationCountries []string `json:"subscriber_location_countries,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
DefaultLiabilityGlAccountId string `json:"default_liability_gl_account_id,omitempty"`

// The ID of a general ledger account. General ledger accounts are
// only accessible as a part of the Recurly RevRec Standard and
// Recurly RevRec Advanced features.
DefaultRevenueGlAccountId string `json:"default_revenue_gl_account_id,omitempty"`

// Created at
CreatedAt time.Time `json:"created_at,omitempty"`

Expand Down
221 changes: 218 additions & 3 deletions client_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ type ClientInterface interface {
GetCustomFieldDefinition(customFieldDefinitionId string, opts ...Option) (*CustomFieldDefinition, error)
GetCustomFieldDefinitionWithContext(ctx context.Context, customFieldDefinitionId string, opts ...Option) (*CustomFieldDefinition, error)

CreateGeneralLedgerAccount(body *GeneralLedgerAccountCreate, opts ...Option) (*GeneralLedgerAccount, error)
CreateGeneralLedgerAccountWithContext(ctx context.Context, body *GeneralLedgerAccountCreate, opts ...Option) (*GeneralLedgerAccount, error)

ListGeneralLedgerAccounts(params *ListGeneralLedgerAccountsParams, opts ...Option) (GeneralLedgerAccountLister, error)

GetGeneralLedgerAccount(generalLedgerAccountId string, opts ...Option) (*GeneralLedgerAccount, error)
GetGeneralLedgerAccountWithContext(ctx context.Context, generalLedgerAccountId string, opts ...Option) (*GeneralLedgerAccount, error)

UpdateGeneralLedgerAccount(generalLedgerAccountId string, body *GeneralLedgerAccountUpdate, opts ...Option) (*GeneralLedgerAccount, error)
UpdateGeneralLedgerAccountWithContext(ctx context.Context, generalLedgerAccountId string, body *GeneralLedgerAccountUpdate, opts ...Option) (*GeneralLedgerAccount, error)

GetPerformanceObligation(performanceObligationId string, opts ...Option) (*PerformanceObligation, error)
GetPerformanceObligationWithContext(ctx context.Context, performanceObligationId string, opts ...Option) (*PerformanceObligation, error)

GetPerformanceObligations(opts ...Option) (PerformanceObligationLister, error)

ListInvoiceTemplateAccounts(invoiceTemplateId string, params *ListInvoiceTemplateAccountsParams, opts ...Option) (AccountLister, error)

ListItems(params *ListItemsParams, opts ...Option) (ItemLister, error)
Expand Down Expand Up @@ -3088,7 +3104,7 @@ func (c *Client) GetCustomFieldDefinition(customFieldDefinitionId string, opts .
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/get_custom_field_definition
//
// Returns: An custom field definition.
// Returns: A custom field definition.
func (c *Client) GetCustomFieldDefinitionWithContext(ctx context.Context, customFieldDefinitionId string, opts ...Option) (*CustomFieldDefinition, error) {
return c.getCustomFieldDefinition(ctx, customFieldDefinitionId, opts...)
}
Expand All @@ -3107,6 +3123,205 @@ func (c *Client) getCustomFieldDefinition(ctx context.Context, customFieldDefini
return result, err
}

// CreateGeneralLedgerAccount wraps CreateGeneralLedgerAccountWithContext using the background context
func (c *Client) CreateGeneralLedgerAccount(body *GeneralLedgerAccountCreate, opts ...Option) (*GeneralLedgerAccount, error) {
ctx := context.Background()
return c.createGeneralLedgerAccount(ctx, body, opts...)
}

// CreateGeneralLedgerAccountWithContext Create a new general ledger account
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/create_general_ledger_account
//
// Returns: A new general ledger account.
func (c *Client) CreateGeneralLedgerAccountWithContext(ctx context.Context, body *GeneralLedgerAccountCreate, opts ...Option) (*GeneralLedgerAccount, error) {
return c.createGeneralLedgerAccount(ctx, body, opts...)
}

func (c *Client) createGeneralLedgerAccount(ctx context.Context, body *GeneralLedgerAccountCreate, opts ...Option) (*GeneralLedgerAccount, error) {
path, err := c.InterpolatePath("/general_ledger_accounts")
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &GeneralLedgerAccount{}
err = c.Call(ctx, http.MethodPost, path, body, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

type ListGeneralLedgerAccountsParams struct {

// Ids - Filter results by their IDs. Up to 200 IDs can be passed at once using
// commas as separators, e.g. `ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6`.
// **Important notes:**
// * The `ids` parameter cannot be used with any other ordering or filtering
// parameters (`limit`, `order`, `sort`, `begin_time`, `end_time`, etc)
// * Invalid or unknown IDs will be ignored, so you should check that the
// results correspond to your request.
// * Records are returned in an arbitrary order. Since results are all
// returned at once you can sort the records yourself.
Ids []string

// Limit - Limit number of records 1-200.
Limit *int

// Order - Sort order.
Order *string

// Sort - Sort field. You *really* only want to sort by `updated_at` in ascending
// order. In descending order updated records will move behind the cursor and could
// prevent some records from being returned.
Sort *string

// AccountType - General Ledger Account type by which to filter the response.
AccountType *string
}

func (list *ListGeneralLedgerAccountsParams) URLParams() []KeyValue {
var options []KeyValue

if list.Ids != nil {
options = append(options, KeyValue{Key: "ids", Value: strings.Join(list.Ids, ",")})
}

if list.Limit != nil {
options = append(options, KeyValue{Key: "limit", Value: strconv.Itoa(*list.Limit)})
}

if list.Order != nil {
options = append(options, KeyValue{Key: "order", Value: *list.Order})
}

if list.Sort != nil {
options = append(options, KeyValue{Key: "sort", Value: *list.Sort})
}

if list.AccountType != nil {
options = append(options, KeyValue{Key: "account_type", Value: *list.AccountType})
}

return options
}

// ListGeneralLedgerAccounts List a site's general ledger accounts
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/list_general_ledger_accounts
//
// Returns: A list of the site's general ledger accounts.
func (c *Client) ListGeneralLedgerAccounts(params *ListGeneralLedgerAccountsParams, opts ...Option) (GeneralLedgerAccountLister, error) {
path, err := c.InterpolatePath("/general_ledger_accounts")
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
path = BuildURL(path, params)
return NewGeneralLedgerAccountList(c, path, requestOptions), nil
}

// GetGeneralLedgerAccount wraps GetGeneralLedgerAccountWithContext using the background context
func (c *Client) GetGeneralLedgerAccount(generalLedgerAccountId string, opts ...Option) (*GeneralLedgerAccount, error) {
ctx := context.Background()
return c.getGeneralLedgerAccount(ctx, generalLedgerAccountId, opts...)
}

// GetGeneralLedgerAccountWithContext Fetch a general ledger account
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/get_general_ledger_account
//
// Returns: A general ledger account.
func (c *Client) GetGeneralLedgerAccountWithContext(ctx context.Context, generalLedgerAccountId string, opts ...Option) (*GeneralLedgerAccount, error) {
return c.getGeneralLedgerAccount(ctx, generalLedgerAccountId, opts...)
}

func (c *Client) getGeneralLedgerAccount(ctx context.Context, generalLedgerAccountId string, opts ...Option) (*GeneralLedgerAccount, error) {
path, err := c.InterpolatePath("/general_ledger_accounts/{general_ledger_account_id}", generalLedgerAccountId)
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &GeneralLedgerAccount{}
err = c.Call(ctx, http.MethodGet, path, nil, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

// UpdateGeneralLedgerAccount wraps UpdateGeneralLedgerAccountWithContext using the background context
func (c *Client) UpdateGeneralLedgerAccount(generalLedgerAccountId string, body *GeneralLedgerAccountUpdate, opts ...Option) (*GeneralLedgerAccount, error) {
ctx := context.Background()
return c.updateGeneralLedgerAccount(ctx, generalLedgerAccountId, body, opts...)
}

// UpdateGeneralLedgerAccountWithContext Update a general ledger account
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/update_general_ledger_account
//
// Returns: The updated general ledger account.
func (c *Client) UpdateGeneralLedgerAccountWithContext(ctx context.Context, generalLedgerAccountId string, body *GeneralLedgerAccountUpdate, opts ...Option) (*GeneralLedgerAccount, error) {
return c.updateGeneralLedgerAccount(ctx, generalLedgerAccountId, body, opts...)
}

func (c *Client) updateGeneralLedgerAccount(ctx context.Context, generalLedgerAccountId string, body *GeneralLedgerAccountUpdate, opts ...Option) (*GeneralLedgerAccount, error) {
path, err := c.InterpolatePath("/general_ledger_accounts/{general_ledger_account_id}", generalLedgerAccountId)
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &GeneralLedgerAccount{}
err = c.Call(ctx, http.MethodPut, path, body, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

// GetPerformanceObligation wraps GetPerformanceObligationWithContext using the background context
func (c *Client) GetPerformanceObligation(performanceObligationId string, opts ...Option) (*PerformanceObligation, error) {
ctx := context.Background()
return c.getPerformanceObligation(ctx, performanceObligationId, opts...)
}

// GetPerformanceObligationWithContext Get a single Performance Obligation.
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/get_performance_obligation
//
// Returns: A single Performance Obligation.
func (c *Client) GetPerformanceObligationWithContext(ctx context.Context, performanceObligationId string, opts ...Option) (*PerformanceObligation, error) {
return c.getPerformanceObligation(ctx, performanceObligationId, opts...)
}

func (c *Client) getPerformanceObligation(ctx context.Context, performanceObligationId string, opts ...Option) (*PerformanceObligation, error) {
path, err := c.InterpolatePath("/performance_obligations/{performance_obligation_id}", performanceObligationId)
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &PerformanceObligation{}
err = c.Call(ctx, http.MethodGet, path, nil, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

// GetPerformanceObligations Get a site's Performance Obligations
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/get_performance_obligations
//
// Returns: A list of Performance Obligations.
func (c *Client) GetPerformanceObligations(opts ...Option) (PerformanceObligationLister, error) {
path, err := c.InterpolatePath("/performance_obligations")
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
return NewPerformanceObligationList(c, path, requestOptions), nil
}

type ListInvoiceTemplateAccountsParams struct {

// Ids - Filter results by their IDs. Up to 200 IDs can be passed at once using
Expand Down Expand Up @@ -7174,11 +7389,11 @@ func (c *Client) GetExternalSubscriptionExternalPaymentPhase(externalSubscriptio
return c.getExternalSubscriptionExternalPaymentPhase(ctx, externalSubscriptionId, externalPaymentPhaseId, opts...)
}

// GetExternalSubscriptionExternalPaymentPhaseWithContext Fetch an external payment_phase
// GetExternalSubscriptionExternalPaymentPhaseWithContext Fetch an external payment phase
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/get_external_subscription_external_payment_phase
//
// Returns: Details for an external payment_phase.
// Returns: Details for an external payment phase.
func (c *Client) GetExternalSubscriptionExternalPaymentPhaseWithContext(ctx context.Context, externalSubscriptionId string, externalPaymentPhaseId string, opts ...Option) (*ExternalPaymentPhase, error) {
return c.getExternalSubscriptionExternalPaymentPhase(ctx, externalSubscriptionId, externalPaymentPhaseId, opts...)
}
Expand Down
3 changes: 0 additions & 3 deletions external_payment_phase.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ type ExternalPaymentPhase struct {
// Object type
Object string `json:"object,omitempty"`

// Subscription from an external resource such as Apple App Store or Google Play Store.
ExternalSubscription ExternalSubscription `json:"external_subscription,omitempty"`

// Started At
StartedAt time.Time `json:"started_at,omitempty"`

Expand Down
Loading

0 comments on commit 6b392c6

Please sign in to comment.