Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated Latest Changes for v2019-10-10 (Custom Fields on Line Items) #739

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lib/recurly/resources/line_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class LineItem extends RecurlyResource
private $_credit_applied;
private $_credit_reason_code;
private $_currency;
private $_custom_fields;
private $_description;
private $_discount;
private $_end_date;
Expand Down Expand Up @@ -65,6 +66,7 @@ class LineItem extends RecurlyResource
private $_uuid;

protected static $array_hints = [
'setCustomFields' => '\Recurly\Resources\CustomField',
];


Expand Down Expand Up @@ -344,6 +346,29 @@ public function setCurrency(string $currency): void
$this->_currency = $currency;
}

/**
* Getter method for the custom_fields attribute.
* The custom fields will only be altered when they are included in a request. Sending an empty array will not remove any existing values. To remove a field send the name with a null or empty value.
*
* @return array
*/
public function getCustomFields(): array
{
return $this->_custom_fields ?? [] ;
}

/**
* Setter method for the custom_fields attribute.
*
* @param array $custom_fields
*
* @return void
*/
public function setCustomFields(array $custom_fields): void
{
$this->_custom_fields = $custom_fields;
}

/**
* Getter method for the description attribute.
* Description that appears on the invoice. For subscription related items this will be filled in automatically.
Expand Down
34 changes: 23 additions & 11 deletions openapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ paths:
code: accountCode,
firstName: 'Benjamin',
lastName: 'Du Monde',
preferredTimeZone: 'America/Chicago',
address: {
street1: '900 Camp St',
city: 'New Orleans',
Expand Down Expand Up @@ -714,6 +715,7 @@ paths:
"code": account_code,
"first_name": "Benjamin",
"last_name": "Du Monde",
"preferred_time_zone": "America/Chicago",
"acquisition": {
"campaign": "podcast-marketing",
"channel": "social_media",
Expand Down Expand Up @@ -749,6 +751,7 @@ paths:
Code = accountCode,
FirstName = "Benjamin",
LastName = "Du Monde",
PreferredTimeZone = "America/Chicago",
Address = new Address()
{
City = "New Orleans",
Expand Down Expand Up @@ -779,6 +782,7 @@ paths:
code: account_code,
first_name: "Benjamin",
last_name: "Du Monde",
preferred_time_zone: "America/Chicago",
acquisition: {
campaign: "podcast-marketing",
channel: "social_media",
Expand Down Expand Up @@ -817,6 +821,7 @@ paths:
accountReq.setCode(accountCode);
accountReq.setFirstName("Aaron");
accountReq.setLastName("Du Monde");
accountReq.setPreferredTimeZone("America/Chicago");

address.setStreet1("900 Camp St.");
address.setCity("New Orleans");
Expand All @@ -843,6 +848,7 @@ paths:
"code" => $account_code,
"first_name" => "Douglas",
"last_name" => "DuMonde",
"preferred_time_zone" => "America/Chicago",
"shipping_addresses" => [
[
"first_name" => "Douglas",
Expand Down Expand Up @@ -872,17 +878,17 @@ paths:
- lang: Go
source: "accountReq := &recurly.AccountCreate{\n\tCode: &accountCode,\n\tFirstName:
recurly.String(\"Isaac\"),\n\tLastName: recurly.String(\"Du Monde\"),\n\tEmail:
\ recurly.String(\"[email protected]\"),\n\tBillingInfo: &recurly.BillingInfoCreate{\n\t\tFirstName:
recurly.String(\"Isaac\"),\n\t\tLastName: recurly.String(\"Du Monde\"),\n\t\tAddress:
&recurly.AddressCreate{\n\t\t\tPhone: recurly.String(\"415-555-5555\"),\n\t\t\tStreet1:
\ recurly.String(\"400 Alabama St.\"),\n\t\t\tCity: recurly.String(\"San
Francisco\"),\n\t\t\tPostalCode: recurly.String(\"94110\"),\n\t\t\tCountry:
\ recurly.String(\"US\"),\n\t\t\tRegion: recurly.String(\"CA\"),\n\t\t},\n\t\tNumber:
recurly.String(\"4111111111111111\"),\n\t\tMonth: recurly.String(\"12\"),\n\t\tYear:
\ recurly.String(\"22\"),\n\t\tCvv: recurly.String(\"123\"),\n\t},\n}\n\naccount,
err := client.CreateAccount(accountReq)\nif e, ok := err.(*recurly.Error);
ok {\n\tif e.Type == recurly.ErrorTypeValidation {\n\t\tfmt.Printf(\"Failed
validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected
\ recurly.String(\"[email protected]\"),\n\tPreferredTimeZone: recurly.String(\"America/Los_Angeles\"),\n\tBillingInfo:
&recurly.BillingInfoCreate{\n\t\tFirstName: recurly.String(\"Isaac\"),\n\t\tLastName:
\ recurly.String(\"Du Monde\"),\n\t\tAddress: &recurly.AddressCreate{\n\t\t\tPhone:
\ recurly.String(\"415-555-5555\"),\n\t\t\tStreet1: recurly.String(\"400
Alabama St.\"),\n\t\t\tCity: recurly.String(\"San Francisco\"),\n\t\t\tPostalCode:
recurly.String(\"94110\"),\n\t\t\tCountry: recurly.String(\"US\"),\n\t\t\tRegion:
\ recurly.String(\"CA\"),\n\t\t},\n\t\tNumber: recurly.String(\"4111111111111111\"),\n\t\tMonth:
\ recurly.String(\"12\"),\n\t\tYear: recurly.String(\"22\"),\n\t\tCvv:
\ recurly.String(\"123\"),\n\t},\n}\n\naccount, err := client.CreateAccount(accountReq)\nif
e, ok := err.(*recurly.Error); ok {\n\tif e.Type == recurly.ErrorTypeValidation
{\n\t\tfmt.Printf(\"Failed validation: %v\", e)\n\t\treturn nil, err\n\t}\n\tfmt.Printf(\"Unexpected
Recurly error: %v\", e)\n\treturn nil, err\n}\nfmt.Printf(\"Created Account:
%s\", account.Id)"
"/sites/{site_id}/accounts/{account_id}":
Expand Down Expand Up @@ -6175,6 +6181,7 @@ paths:
- item
- plan
- subscription
- charge
responses:
'200':
description: A list of the site's custom field definitions.
Expand Down Expand Up @@ -17444,6 +17451,7 @@ components:
- item
- plan
- subscription
- charge
name:
type: string
title: Name
Expand Down Expand Up @@ -18696,6 +18704,8 @@ components:
format: date-time
title: End date
description: If this date is provided, it indicates the end of a time range.
custom_fields:
"$ref": "#/components/schemas/CustomFields"
created_at:
type: string
format: date-time
Expand Down Expand Up @@ -18890,6 +18900,8 @@ components:
format: date-time
title: End date
description: If this date is provided, it indicates the end of a time range.
custom_fields:
"$ref": "#/components/schemas/CustomFields"
required:
- currency
- unit_amount
Expand Down