Skip to content

Commit

Permalink
Merge pull request #228 from recurly/v3-v2021-02-25-13120667328
Browse files Browse the repository at this point in the history
Generated Latest Changes for v2021-02-25
  • Loading branch information
btruncali1 authored Feb 3, 2025
2 parents df95a6d + 4a2ae5b commit afb29dd
Show file tree
Hide file tree
Showing 8 changed files with 215 additions and 8 deletions.
3 changes: 3 additions & 0 deletions billing_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type BillingInfo struct {
// The `backup_payment_method` field is used to indicate a billing info as a backup on the account that will be tried if the initial billing info used for an invoice is declined.
BackupPaymentMethod bool `json:"backup_payment_method,omitempty"`

// Array of Payment Gateway References, each a reference to a third-party gateway object of varying types.
PaymentGatewayReferences []PaymentGatewayReferences `json:"payment_gateway_references,omitempty"`

// When the billing information was created.
CreatedAt time.Time `json:"created_at,omitempty"`

Expand Down
5 changes: 4 additions & 1 deletion billing_info_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ type BillingInfoCreate struct {
// A token used in place of a credit card in order to perform transactions. Must be used in conjunction with `gateway_code`.
GatewayToken *string `json:"gateway_token,omitempty"`

// An identifier for a specific payment gateway. Must be used in conjunction with `gateway_token`.
// An identifier for a specific payment gateway.
GatewayCode *string `json:"gateway_code,omitempty"`

// Array of Payment Gateway References, each a reference to a third-party gateway object of varying types.
PaymentGatewayReferences []PaymentGatewayReferencesCreate `json:"payment_gateway_references,omitempty"`

// Additional attributes to send to the gateway.
GatewayAttributes *GatewayAttributesCreate `json:"gateway_attributes,omitempty"`

Expand Down
7 changes: 7 additions & 0 deletions client_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -2876,6 +2876,9 @@ type ListUniqueCouponCodesParams struct {
// EndTime - Inclusively filter by end_time when `sort=created_at` or `sort=updated_at`.
// **Note:** this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.
EndTime *time.Time

// Redeemed - Filter unique coupon codes by redemption status. `true` for redeemed, `false` for not redeemed.
Redeemed *string
}

func (list *ListUniqueCouponCodesParams) URLParams() []KeyValue {
Expand Down Expand Up @@ -2905,6 +2908,10 @@ func (list *ListUniqueCouponCodesParams) URLParams() []KeyValue {
options = append(options, KeyValue{Key: "end_time", Value: formatTime(*list.EndTime)})
}

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

return options
}

Expand Down
2 changes: 1 addition & 1 deletion coupon_bulk_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import ()

type CouponBulkCreate struct {

// The quantity of unique coupon codes to generate
// The quantity of unique coupon codes to generate. A bulk coupon can have up to 100,000 unique codes (or your site's configured limit).
NumberOfUniqueCodes *int `json:"number_of_unique_codes,omitempty"`
}
66 changes: 60 additions & 6 deletions openapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6265,8 +6265,7 @@ paths:
schema:
"$ref": "#/components/schemas/UniqueCouponCodeParams"
'400':
description: Invalid or unpermitted parameter; perhaps you tried to generate
more than 200 codes at a time?
description: Invalid or unpermitted parameter.
content:
application/json:
schema:
Expand Down Expand Up @@ -6348,6 +6347,7 @@ paths:
- "$ref": "#/components/parameters/sort_dates"
- "$ref": "#/components/parameters/filter_begin_time"
- "$ref": "#/components/parameters/filter_end_time"
- "$ref": "#/components/parameters/filter_redeemed"
responses:
'200':
description: A list of unique coupon codes that were generated
Expand Down Expand Up @@ -17184,6 +17184,13 @@ components:
- `type=legacy`, only legacy invoices will be returned.
schema:
"$ref": "#/components/schemas/FilterInvoiceTypeEnum"
filter_redeemed:
name: redeemed
in: query
description: Filter unique coupon codes by redemption status. `true` for redeemed,
`false` for not redeemed.
schema:
"$ref": "#/components/schemas/FilterRedeemedEnum"
export_date:
name: export_date
in: path
Expand Down Expand Up @@ -18733,6 +18740,12 @@ components:
description: The `backup_payment_method` field is used to indicate a billing
info as a backup on the account that will be tried if the initial billing
info used for an invoice is declined.
payment_gateway_references:
type: array
description: Array of Payment Gateway References, each a reference to a
third-party gateway object of varying types.
items:
"$ref": "#/components/schemas/PaymentGatewayReferences"
created_at:
type: string
format: date-time
Expand Down Expand Up @@ -18815,9 +18828,21 @@ components:
maxLength: 50
gateway_code:
type: string
title: An identifier for a specific payment gateway. Must be used in conjunction
with `gateway_token`.
title: An identifier for a specific payment gateway.
maxLength: 12
payment_gateway_references:
type: array
description: Array of Payment Gateway References, each a reference to a
third-party gateway object of varying types.
items:
"$ref": "#/components/schemas/PaymentGatewayReferences"
properties:
token:
type: strings
maxLength: 50
reference_type:
type: string
"$ref": "#/components/schemas/PaymentGatewayReferencesEnum"
gateway_attributes:
type: object
description: Additional attributes to send to the gateway.
Expand Down Expand Up @@ -19282,9 +19307,9 @@ components:
number_of_unique_codes:
type: integer
title: Number of unique codes
description: The quantity of unique coupon codes to generate
description: The quantity of unique coupon codes to generate. A bulk coupon
can have up to 100,000 unique codes (or your site's configured limit).
minimum: 1
maximum: 200
CouponMini:
type: object
properties:
Expand Down Expand Up @@ -21285,6 +21310,22 @@ components:
- currency
- unit_amount
- type
PaymentGatewayReferences:
type: object
title: Payment Gateway References Object
description: Array of Payment Gateway References, each a reference to a third-party
gateway object of varying types.
properties:
token:
type: string
title: Token
description: Reference value used when the external token was created. If
Stripe gateway is used, this value will need to be accompanied by its
reference_type.
reference_type:
type: string
title: Reference Type
"$ref": "#/components/schemas/PaymentGatewayReferencesEnum"
PlanMini:
type: object
title: Plan mini details
Expand Down Expand Up @@ -26430,6 +26471,11 @@ components:
- credit
- legacy
- non-legacy
FilterRedeemedEnum:
type: string
enum:
- true
- false
ChannelEnum:
type: string
enum:
Expand Down Expand Up @@ -26491,6 +26537,14 @@ components:
enum:
- email
- post
PaymentGatewayReferencesEnum:
type: string
description: The type of reference token. Required if token is passed in for
Stripe Gateway.
enum:
- stripe_confirmation_token
- stripe_customer
- stripe_payment_method
GatewayTransactionTypeEnum:
type: string
enum:
Expand Down
122 changes: 122 additions & 0 deletions payment_gateway_references.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// 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 PaymentGatewayReferences struct {
recurlyResponse *ResponseMetadata

// Reference value used when the external token was created. If Stripe gateway is used, this value will need to be accompanied by its reference_type.
Token string `json:"token,omitempty"`

// The type of reference token. Required if token is passed in for Stripe Gateway.
ReferenceType string `json:"reference_type,omitempty"`
}

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

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

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

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

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

// PaymentGatewayReferencesList allows you to paginate PaymentGatewayReferences objects
type PaymentGatewayReferencesList struct {
client HTTPCaller
requestOptions *RequestOptions
nextPagePath string
hasMore bool
data []PaymentGatewayReferences
}

func NewPaymentGatewayReferencesList(client HTTPCaller, nextPagePath string, requestOptions *RequestOptions) *PaymentGatewayReferencesList {
return &PaymentGatewayReferencesList{
client: client,
requestOptions: requestOptions,
nextPagePath: nextPagePath,
hasMore: true,
}
}

type PaymentGatewayReferencesLister interface {
Fetch() error
FetchWithContext(ctx context.Context) error
Count() (*int64, error)
CountWithContext(ctx context.Context) (*int64, error)
Data() []PaymentGatewayReferences
HasMore() bool
Next() string
}

func (list *PaymentGatewayReferencesList) HasMore() bool {
return list.hasMore
}

func (list *PaymentGatewayReferencesList) Next() string {
return list.nextPagePath
}

func (list *PaymentGatewayReferencesList) Data() []PaymentGatewayReferences {
return list.data
}

// Fetch fetches the next page of data into the `Data` property
func (list *PaymentGatewayReferencesList) FetchWithContext(ctx context.Context) error {
resources := &paymentGatewayReferencesList{}
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 *PaymentGatewayReferencesList) Fetch() error {
return list.FetchWithContext(context.Background())
}

// Count returns the count of items on the server that match this pager
func (list *PaymentGatewayReferencesList) CountWithContext(ctx context.Context) (*int64, error) {
resources := &paymentGatewayReferencesList{}
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 *PaymentGatewayReferencesList) Count() (*int64, error) {
return list.CountWithContext(context.Background())
}
16 changes: 16 additions & 0 deletions payment_gateway_references_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// 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 PaymentGatewayReferencesCreate struct {

// Reference value used when the external token was created. If Stripe gateway is used, this value will need to be accompanied by its reference_type.
Token *string `json:"token,omitempty"`

// The type of reference token. Required if token is passed in for Stripe Gateway.
ReferenceType *string `json:"reference_type,omitempty"`
}
2 changes: 2 additions & 0 deletions scripts/clean
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rm -f billing_info.go
rm -f payment_method.go
rm -f gateway_attributes.go
rm -f fraud_info.go
rm -f payment_gateway_references.go
rm -f billing_info_updated_by.go
rm -f custom_field.go
rm -f error_may_have_transaction.go
Expand Down Expand Up @@ -105,6 +106,7 @@ rm -f external_account_create.go
rm -f shipping_address_create.go
rm -f address_create.go
rm -f billing_info_create.go
rm -f payment_gateway_references_create.go
rm -f gateway_attributes_create.go
rm -f custom_field_create.go
rm -f account_update.go
Expand Down

0 comments on commit afb29dd

Please sign in to comment.