Skip to content

Commit

Permalink
Merge pull request #215 from recurly/v3-v2021-02-25-8899612454
Browse files Browse the repository at this point in the history
Generated Latest Changes for v2021-02-25 (Auth & Capture)
  • Loading branch information
amandamfielding authored Apr 30, 2024
2 parents e35e390 + 0f02273 commit b3958f3
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 9 deletions.
96 changes: 96 additions & 0 deletions client_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,15 @@ type ClientInterface interface {
CreatePendingPurchase(body *PurchaseCreate, opts ...Option) (*InvoiceCollection, error)
CreatePendingPurchaseWithContext(ctx context.Context, body *PurchaseCreate, opts ...Option) (*InvoiceCollection, error)

CreateAuthorizePurchase(body *PurchaseCreate, opts ...Option) (*InvoiceCollection, error)
CreateAuthorizePurchaseWithContext(ctx context.Context, body *PurchaseCreate, opts ...Option) (*InvoiceCollection, error)

CreateCapturePurchase(transactionId string, opts ...Option) (*InvoiceCollection, error)
CreateCapturePurchaseWithContext(ctx context.Context, transactionId string, opts ...Option) (*InvoiceCollection, error)

Cancelpurchase(transactionId string, opts ...Option) (*InvoiceCollection, error)
CancelpurchaseWithContext(ctx context.Context, transactionId string, opts ...Option) (*InvoiceCollection, error)

GetExportDates(opts ...Option) (*ExportDates, error)
GetExportDatesWithContext(ctx context.Context, opts ...Option) (*ExportDates, error)

Expand Down Expand Up @@ -6738,6 +6747,93 @@ func (c *Client) createPendingPurchase(ctx context.Context, body *PurchaseCreate
return result, err
}

// CreateAuthorizePurchase wraps CreateAuthorizePurchaseWithContext using the background context
func (c *Client) CreateAuthorizePurchase(body *PurchaseCreate, opts ...Option) (*InvoiceCollection, error) {
ctx := context.Background()
return c.createAuthorizePurchase(ctx, body, opts...)
}

// CreateAuthorizePurchaseWithContext Authorize a purchase
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/create_authorize_purchase
//
// Returns: Returns the authorize invoice
func (c *Client) CreateAuthorizePurchaseWithContext(ctx context.Context, body *PurchaseCreate, opts ...Option) (*InvoiceCollection, error) {
return c.createAuthorizePurchase(ctx, body, opts...)
}

func (c *Client) createAuthorizePurchase(ctx context.Context, body *PurchaseCreate, opts ...Option) (*InvoiceCollection, error) {
path, err := c.InterpolatePath("/purchases/authorize")
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &InvoiceCollection{}
err = c.Call(ctx, http.MethodPost, path, body, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

// CreateCapturePurchase wraps CreateCapturePurchaseWithContext using the background context
func (c *Client) CreateCapturePurchase(transactionId string, opts ...Option) (*InvoiceCollection, error) {
ctx := context.Background()
return c.createCapturePurchase(ctx, transactionId, opts...)
}

// CreateCapturePurchaseWithContext Capture a purchase
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/create_capture_purchase
//
// Returns: Returns the captured invoice
func (c *Client) CreateCapturePurchaseWithContext(ctx context.Context, transactionId string, opts ...Option) (*InvoiceCollection, error) {
return c.createCapturePurchase(ctx, transactionId, opts...)
}

func (c *Client) createCapturePurchase(ctx context.Context, transactionId string, opts ...Option) (*InvoiceCollection, error) {
path, err := c.InterpolatePath("/purchases/{transaction_id}/capture", transactionId)
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &InvoiceCollection{}
err = c.Call(ctx, http.MethodPost, path, nil, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

// Cancelpurchase wraps CancelpurchaseWithContext using the background context
func (c *Client) Cancelpurchase(transactionId string, opts ...Option) (*InvoiceCollection, error) {
ctx := context.Background()
return c.cancelpurchase(ctx, transactionId, opts...)
}

// CancelpurchaseWithContext Cancel Purchase
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/cancelPurchase
//
// Returns: Returns the cancelled invoice
func (c *Client) CancelpurchaseWithContext(ctx context.Context, transactionId string, opts ...Option) (*InvoiceCollection, error) {
return c.cancelpurchase(ctx, transactionId, opts...)
}

func (c *Client) cancelpurchase(ctx context.Context, transactionId string, opts ...Option) (*InvoiceCollection, error) {
path, err := c.InterpolatePath("/purchases/{transaction_id}/cancel/", transactionId)
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &InvoiceCollection{}
err = c.Call(ctx, http.MethodPost, path, nil, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

// GetExportDates wraps GetExportDatesWithContext using the background context
func (c *Client) GetExportDates(opts ...Option) (*ExportDates, error) {
ctx := context.Background()
Expand Down
1 change: 0 additions & 1 deletion invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ type Invoice struct {
// Optionally supplied string that may be either `net` or `eom` (end-of-month).
// When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
// When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
// This field is only available when the EOM Net Terms feature is enabled.
NetTermsType string `json:"net_terms_type,omitempty"`

Address InvoiceAddress `json:"address,omitempty"`
Expand Down
1 change: 0 additions & 1 deletion invoice_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type InvoiceCreate struct {
// Optionally supplied string that may be either `net` or `eom` (end-of-month).
// When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
// When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
// This field is only available when the EOM Net Terms feature is enabled.
NetTermsType *string `json:"net_terms_type,omitempty"`

// For manual invoicing, this identifies the PO number associated with the subscription.
Expand Down
128 changes: 126 additions & 2 deletions openapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15470,6 +15470,132 @@ paths:
validation: %v\", e)\n\t\treturn nil, err\n\t}\n\n\tfmt.Printf(\"Unexpected
Recurly error: %v\", e)\n\treturn nil, err\n}\n\nfmt.Printf(\"Created ChargeInvoice
with UUID: %s.\\n\", collection.ChargeInvoice.Uuid)\n"
"/purchases/authorize":
post:
tags:
- purchase
operationId: create_authorize_purchase
summary: Authorize a purchase
description: |-
A purchase is a hybrid checkout containing at least one or more subscriptions or one-time charges (adjustments) and supports both coupon and gift card redemptions. All items purchased will be on one invoice and paid for with one transaction. A purchase is only a request data type and is not persistent in Recurly and an invoice collection will be the returned type.

The authorize endpoint will create a pending purchase that can be activated at a later time once payment has been completed on an external source.

For additional information regarding shipping fees, please see https://docs.recurly.com/docs/shipping
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/PurchaseCreate"
required: true
responses:
'200':
description: Returns the authorize invoice
content:
application/json:
schema:
"$ref": "#/components/schemas/InvoiceCollection"
'400':
description: Bad request; perhaps missing or invalid parameters.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
'422':
description: authorize purchase cannot be completed for the specified reason.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
default:
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples: []
"/purchases/{transaction_id}/capture":
post:
tags:
- purchase
parameters:
- "$ref": "#/components/parameters/transaction_id"
operationId: create_capture_purchase
summary: Capture a purchase
description: |-
A purchase is a hybrid checkout containing at least one or more
subscriptions or one-time charges (adjustments) and supports both coupon
and gift card redemptions. All items purchased will be on one invoice
and paid for with one transaction. A purchase is only a request data
type and is not persistent in Recurly and an invoice collection will be
the returned type.


Capture an open Authorization request
responses:
'200':
description: Returns the captured invoice
content:
application/json:
schema:
"$ref": "#/components/schemas/InvoiceCollection"
'400':
description: Bad request; perhaps missing or invalid parameters.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
'422':
description: Capture purchase cannot be completed for the specified reason.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
default:
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples: []
"/purchases/{transaction_id}/cancel/":
parameters:
- "$ref": "#/components/parameters/transaction_id"
post:
summary: Cancel Purchase
description: |
A purchase is a hybrid checkout containing at least one or more subscriptions or one-time charges (adjustments) and supports both coupon and gift card redemptions. All items purchased will be on one invoice and paid for with one transaction. A purchase is only a request data type and is not persistent in Recurly and an invoice collection will be the returned type.

Cancel an open Authorization request
tags:
- purchase
operationId: cancelPurchase
responses:
'200':
description: Returns the cancelled invoice
content:
application/json:
schema:
"$ref": "#/components/schemas/InvoiceCollection"
'400':
description: Bad request; perhaps missing or invalid parameters.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
'422':
description: Cancel purchase cannot be completed for the specified reason.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
default:
description: Unexpected error.
content:
application/json:
schema:
"$ref": "#/components/schemas/Error"
x-code-samples: []
"/export_dates":
get:
tags:
Expand Down Expand Up @@ -25178,8 +25304,6 @@ components:
Optionally supplied string that may be either `net` or `eom` (end-of-month).
When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.

This field is only available when the EOM Net Terms feature is enabled.
enum:
- net
- eom
Expand Down
1 change: 0 additions & 1 deletion purchase_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ type PurchaseCreate struct {
// Optionally supplied string that may be either `net` or `eom` (end-of-month).
// When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
// When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
// This field is only available when the EOM Net Terms feature is enabled.
NetTermsType *string `json:"net_terms_type,omitempty"`

// Terms and conditions to be put on the purchase invoice.
Expand Down
1 change: 0 additions & 1 deletion subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ type Subscription struct {
// Optionally supplied string that may be either `net` or `eom` (end-of-month).
// When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
// When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
// This field is only available when the EOM Net Terms feature is enabled.
NetTermsType string `json:"net_terms_type,omitempty"`

// Terms and conditions
Expand Down
1 change: 0 additions & 1 deletion subscription_change_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ type SubscriptionChangeCreate struct {
// Optionally supplied string that may be either `net` or `eom` (end-of-month).
// When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
// When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
// This field is only available when the EOM Net Terms feature is enabled.
NetTermsType *string `json:"net_terms_type,omitempty"`

// An optional type designation for the payment gateway transaction created by this request. Supports 'moto' value, which is the acronym for mail order and telephone transactions.
Expand Down
1 change: 0 additions & 1 deletion subscription_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ type SubscriptionCreate struct {
// Optionally supplied string that may be either `net` or `eom` (end-of-month).
// When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
// When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
// This field is only available when the EOM Net Terms feature is enabled.
NetTermsType *string `json:"net_terms_type,omitempty"`

// If present, this subscription's transactions will use the payment gateway with this code.
Expand Down
1 change: 0 additions & 1 deletion subscription_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type SubscriptionUpdate struct {
// Optionally supplied string that may be either `net` or `eom` (end-of-month).
// When `net`, an invoice becomes past due the specified number of `Net Terms` days from the current date.
// When `eom` an invoice becomes past due the specified number of `Net Terms` days from the last day of the current month.
// This field is only available when the EOM Net Terms feature is enabled.
NetTermsType *string `json:"net_terms_type,omitempty"`

// If present, this subscription's transactions will use the payment gateway with this code.
Expand Down

0 comments on commit b3958f3

Please sign in to comment.