Skip to content

Commit

Permalink
Merge pull request #157 from recurly/v3-v2019-10-10-1659465266
Browse files Browse the repository at this point in the history
Generated Latest Changes for v2019-10-10
  • Loading branch information
csampson authored Aug 3, 2022
2 parents a39d726 + 17a1f63 commit 2744d5f
Show file tree
Hide file tree
Showing 19 changed files with 552 additions and 3 deletions.
127 changes: 126 additions & 1 deletion openapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17259,7 +17259,7 @@ components:
title: Field value
description: Any values that resemble a credit card number or security code
(CVV/CVC) will be rejected.
maxLength: 100
maxLength: 255
required:
- name
- value
Expand Down Expand Up @@ -18828,6 +18828,22 @@ components:
renew its term at renewal. If `auto_renew` is `false`, then a subscription
will expire at the end of its term. `auto_renew` can be overridden on
the subscription record itself.
pricing_model:
title: Pricing Model
type: string
enum:
- fixed
- ramp
default: fixed
description: |
A fixed pricing model has the same price for each billing period.
A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on
a specified cadence of billing periods. The price change could be an increase or decrease.
ramp_intervals:
type: array
title: Ramp Intervals
items:
"$ref": "#/components/schemas/PlanRampInterval"
accounting_code:
type: string
title: Plan accounting code
Expand Down Expand Up @@ -19006,6 +19022,22 @@ components:
renew its term at renewal. If `auto_renew` is `false`, then a subscription
will expire at the end of its term. `auto_renew` can be overridden on
the subscription record itself.
pricing_model:
title: Pricing Model
type: string
enum:
- fixed
- ramp
default: fixed
description: |
A fixed pricing model has the same price for each billing period.
A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on
a specified cadence of billing periods. The price change could be an increase or decrease.
ramp_intervals:
type: array
title: Ramp Intervals
items:
"$ref": "#/components/schemas/PlanRampInterval"
revenue_schedule_type:
type: string
title: Revenue schedule type
Expand Down Expand Up @@ -19137,6 +19169,7 @@ components:
type: number
format: float
title: Unit price
description: This field should not be sent when the pricing model is 'ramp'.
minimum: 0
maximum: 1000000
tax_inclusive:
Expand Down Expand Up @@ -19214,6 +19247,11 @@ components:
renew its term at renewal. If `auto_renew` is `false`, then a subscription
will expire at the end of its term. `auto_renew` can be overridden on
the subscription record itself.
ramp_intervals:
type: array
title: Ramp Intervals
items:
"$ref": "#/components/schemas/PlanRampInterval"
revenue_schedule_type:
type: string
title: Revenue schedule type
Expand Down Expand Up @@ -19291,6 +19329,19 @@ components:
a non-default dunning campaign should be assigned to this plan. For sites
without multiple dunning campaigns enabled, the default dunning campaign
will always be used.
PlanRampInterval:
type: object
title: Plan Ramp Interval
properties:
starting_billing_cycle:
type: integer
description: Represents the first billing cycle of a ramp.
default: 1
currencies:
type: array
description: Represents the price for the ramp interval.
items:
"$ref": "#/components/schemas/PlanRampPricing"
AddOnPricing:
type: object
properties:
Expand All @@ -19314,6 +19365,24 @@ components:
required:
- currency
- unit_amount
PlanRampPricing:
type: object
properties:
currency:
type: string
title: Currency
description: 3-letter ISO 4217 currency code.
maxLength: 3
unit_amount:
type: number
format: float
title: Unit price
description: Represents the price for the Ramp Interval.
minimum: 0
maximum: 1000000
required:
- currency
- unit_amount
Pricing:
type: object
properties:
Expand Down Expand Up @@ -19899,6 +19968,13 @@ components:
default: true
title: Auto renew
description: Whether the subscription renews at the end of its term.
ramp_intervals:
type: array
title: Ramp Intervals
description: The ramp intervals representing the pricing schedule for the
subscription.
items:
"$ref": "#/components/schemas/SubscriptionRampIntervalResponse"
paused_at:
type: string
format: date-time
Expand Down Expand Up @@ -20362,6 +20438,13 @@ components:
readOnly: true
billing_info:
"$ref": "#/components/schemas/SubscriptionChangeBillingInfo"
ramp_intervals:
type: array
title: Ramp Intervals
description: The ramp intervals representing the pricing schedule for the
subscription.
items:
"$ref": "#/components/schemas/SubscriptionRampIntervalResponse"
SubscriptionChangeBillingInfo:
type: object
description: Accept nested attributes for three_d_secure_action_result_token_id
Expand Down Expand Up @@ -20501,6 +20584,12 @@ components:
- moto
billing_info:
"$ref": "#/components/schemas/SubscriptionChangeBillingInfoCreate"
ramp_intervals:
type: array
title: Ramp Intervals
description: The new set of ramp intervals for the subscription.
items:
"$ref": "#/components/schemas/SubscriptionRampInterval"
SubscriptionChangePreview:
type: object
allOf:
Expand Down Expand Up @@ -20652,6 +20741,12 @@ components:
default: true
title: Auto renew
description: Whether the subscription renews at the end of its term.
ramp_intervals:
type: array
title: Ramp Intervals
description: The new set of ramp intervals for the subscription.
items:
"$ref": "#/components/schemas/SubscriptionRampInterval"
revenue_schedule_type:
type: string
title: Revenue schedule type
Expand Down Expand Up @@ -20803,6 +20898,12 @@ components:
- evenly
- at_range_end
- at_range_start
ramp_intervals:
type: array
title: Ramp Intervals
description: The new set of ramp intervals for the subscription.
items:
"$ref": "#/components/schemas/SubscriptionRampInterval"
required:
- plan_code
SubscriptionUpdate:
Expand Down Expand Up @@ -20986,6 +21087,30 @@ components:
format: float
title: Assigns the subscription's shipping cost. If this is greater than
zero then a `method_id` or `method_code` is required.
SubscriptionRampInterval:
type: object
title: Subscription Ramp Interval
properties:
starting_billing_cycle:
type: integer
description: Represents how many billing cycles are included in a ramp interval.
default: 1
unit_amount:
type: integer
description: Represents the price for the ramp interval.
SubscriptionRampIntervalResponse:
type: object
title: Subscription Ramp Interval
properties:
starting_billing_cycle:
type: integer
description: Represents how many billing cycles are included in a ramp interval.
remaining_billing_cycles:
type: integer
description: Represents how many billing cycles are left in a ramp interval.
unit_amount:
type: integer
description: Represents the price for the ramp interval.
TaxInfo:
type: object
title: Tax info
Expand Down
8 changes: 8 additions & 0 deletions plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ type Plan struct {
// Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself.
AutoRenew bool `json:"auto_renew,omitempty"`

// A fixed pricing model has the same price for each billing period.
// A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on
// a specified cadence of billing periods. The price change could be an increase or decrease.
PricingModel string `json:"pricing_model,omitempty"`

// Ramp Intervals
RampIntervals []PlanRampInterval `json:"ramp_intervals,omitempty"`

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

Expand Down
8 changes: 8 additions & 0 deletions plan_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ type PlanCreate struct {
// Subscriptions will automatically inherit this value once they are active. If `auto_renew` is `true`, then a subscription will automatically renew its term at renewal. If `auto_renew` is `false`, then a subscription will expire at the end of its term. `auto_renew` can be overridden on the subscription record itself.
AutoRenew *bool `json:"auto_renew,omitempty"`

// A fixed pricing model has the same price for each billing period.
// A ramp pricing model defines a set of Ramp Intervals, where a subscription changes price on
// a specified cadence of billing periods. The price change could be an increase or decrease.
PricingModel *string `json:"pricing_model,omitempty"`

// Ramp Intervals
RampIntervals []PlanRampIntervalCreate `json:"ramp_intervals,omitempty"`

// Revenue schedule type
RevenueScheduleType *string `json:"revenue_schedule_type,omitempty"`

Expand Down
2 changes: 1 addition & 1 deletion plan_pricing.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type PlanPricing struct {
// Amount of one-time setup fee automatically charged at the beginning of a subscription billing cycle. For subscription plans with a trial, the setup fee will be charged at the time of signup. Setup fees do not increase with the quantity of a subscription plan.
SetupFee float64 `json:"setup_fee,omitempty"`

// Unit price
// This field should not be sent when the pricing model is 'ramp'.
UnitAmount float64 `json:"unit_amount,omitempty"`

// This field is deprecated. Please do not use it.
Expand Down
2 changes: 1 addition & 1 deletion plan_pricing_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type PlanPricingCreate struct {
// Amount of one-time setup fee automatically charged at the beginning of a subscription billing cycle. For subscription plans with a trial, the setup fee will be charged at the time of signup. Setup fees do not increase with the quantity of a subscription plan.
SetupFee *float64 `json:"setup_fee,omitempty"`

// Unit price
// This field should not be sent when the pricing model is 'ramp'.
UnitAmount *float64 `json:"unit_amount,omitempty"`

// This field is deprecated. Please do not use it.
Expand Down
100 changes: 100 additions & 0 deletions plan_ramp_interval.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// This file is automatically created by Recurly's OpenAPI generation process
// and thus any edits you make by hand will be lost. If you wish to make a
// change to this file, please create a Github issue explaining the changes you
// need and we will usher them to the appropriate places.
package recurly

import (
"context"
"net/http"
)

type PlanRampInterval struct {
recurlyResponse *ResponseMetadata

// Represents the first billing cycle of a ramp.
StartingBillingCycle int `json:"starting_billing_cycle,omitempty"`

// Represents the price for the ramp interval.
Currencies []PlanRampPricing `json:"currencies,omitempty"`
}

// GetResponse returns the ResponseMetadata that generated this resource
func (resource *PlanRampInterval) GetResponse() *ResponseMetadata {
return resource.recurlyResponse
}

// setResponse sets the ResponseMetadata that generated this resource
func (resource *PlanRampInterval) setResponse(res *ResponseMetadata) {
resource.recurlyResponse = res
}

// internal struct for deserializing accounts
type planRampIntervalList struct {
ListMetadata
Data []PlanRampInterval `json:"data"`
recurlyResponse *ResponseMetadata
}

// GetResponse returns the ResponseMetadata that generated this resource
func (resource *planRampIntervalList) GetResponse() *ResponseMetadata {
return resource.recurlyResponse
}

// setResponse sets the ResponseMetadata that generated this resource
func (resource *planRampIntervalList) setResponse(res *ResponseMetadata) {
resource.recurlyResponse = res
}

// PlanRampIntervalList allows you to paginate PlanRampInterval objects
type PlanRampIntervalList struct {
client HTTPCaller
requestOptions *RequestOptions
nextPagePath string
HasMore bool
Data []PlanRampInterval
}

func NewPlanRampIntervalList(client HTTPCaller, nextPagePath string, requestOptions *RequestOptions) *PlanRampIntervalList {
return &PlanRampIntervalList{
client: client,
requestOptions: requestOptions,
nextPagePath: nextPagePath,
HasMore: true,
}
}

// Fetch fetches the next page of data into the `Data` property
func (list *PlanRampIntervalList) FetchWithContext(ctx context.Context) error {
resources := &planRampIntervalList{}
err := list.client.Call(ctx, http.MethodGet, list.nextPagePath, nil, nil, list.requestOptions, resources)
if err != nil {
return err
}
// copy over properties from the response
list.nextPagePath = resources.Next
list.HasMore = resources.HasMore
list.Data = resources.Data
return nil
}

// Fetch fetches the next page of data into the `Data` property
func (list *PlanRampIntervalList) Fetch() error {
return list.FetchWithContext(context.Background())
}

// Count returns the count of items on the server that match this pager
func (list *PlanRampIntervalList) CountWithContext(ctx context.Context) (*int64, error) {
resources := &planRampIntervalList{}
err := list.client.Call(ctx, http.MethodHead, list.nextPagePath, nil, nil, list.requestOptions, resources)
if err != nil {
return nil, err
}
resp := resources.GetResponse()
return resp.TotalRecords, nil
}

// Count returns the count of items on the server that match this pager
func (list *PlanRampIntervalList) Count() (*int64, error) {
return list.CountWithContext(context.Background())
}
26 changes: 26 additions & 0 deletions plan_ramp_interval_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This file is automatically created by Recurly's OpenAPI generation process
// and thus any edits you make by hand will be lost. If you wish to make a
// change to this file, please create a Github issue explaining the changes you
// need and we will usher them to the appropriate places.
package recurly

import ()

type PlanRampIntervalCreate struct {
Params `json:"-"`

// Represents the first billing cycle of a ramp.
StartingBillingCycle *int `json:"starting_billing_cycle,omitempty"`

// Represents the price for the ramp interval.
Currencies []PlanRampPricingCreate `json:"currencies,omitempty"`
}

func (attr *PlanRampIntervalCreate) toParams() *Params {
return &Params{
IdempotencyKey: attr.IdempotencyKey,
Header: attr.Header,
Context: attr.Context,
Data: attr,
}
}
Loading

0 comments on commit 2744d5f

Please sign in to comment.