diff --git a/docs/index.html b/docs/index.html index 6ed20f5d..88da069a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16868,7 +16868,8 @@

Array<CustomField> - + : 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. + @@ -16920,6 +16921,78 @@

+ + hasActiveSubscription + + boolean + + + : Indicates if the account has an active subscription. + + + + + + + hasCanceledSubscription + + boolean + + + : Indicates if the account has a canceled subscription. + + + + + + + hasFutureSubscription + + boolean + + + : Indicates if the account has a future subscription. + + + + + + + hasLiveSubscription + + boolean + + + : Indicates if the account has a subscription that is either active, canceled, future, or paused. + + + + + + + hasPastDueInvoice + + boolean + + + : Indicates if the account has a past due invoice. + + + + + + + hasPausedSubscription + + boolean + + + : Indicates if the account has a paused subscription. + + + + + hostedLoginToken @@ -17189,7 +17262,8 @@

AccountMini - + : Account mini details + @@ -17224,7 +17298,8 @@

AccountAcquisitionCost - + : Account balance + @@ -17548,7 +17623,8 @@

AccountMini - + : Account mini details + @@ -19679,7 +19755,16 @@

CouponDiscount - + : Details of the discount a coupon applies. Will contain a +type + property and one of the following properties: +percent +, +fixed +, +trial +. + @@ -20561,7 +20646,16 @@

CouponDiscount - + : Details of the discount a coupon applies. Will contain a +type + property and one of the following properties: +percent +, +fixed +, +trial +. + @@ -21173,7 +21267,8 @@

AccountMini - + : Account mini details + @@ -21208,7 +21303,8 @@

InvoiceMini - + : Invoice mini details + @@ -21281,7 +21377,8 @@

InvoiceMini - + : Invoice mini details + @@ -22301,7 +22398,8 @@

AccountMini - + : Account mini details + @@ -22609,7 +22707,8 @@

TaxInfo - + : Tax info + @@ -23439,7 +23538,8 @@

Array<CustomField> - + : 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. + @@ -23706,7 +23806,8 @@

AccountMini - + : Account mini details + @@ -23845,6 +23946,18 @@

+ + externalSku + + string + + + : Optional Stock Keeping Unit assigned to an item, when the Catalog feature is enabled. + + + + + id @@ -24177,7 +24290,8 @@

TaxInfo - + : Tax info + @@ -24594,6 +24708,30 @@

+ + gatewayCode + + string + + + : An identifier for a specific payment gateway. + + + + + + + gatewayToken + + string + + + : A token used in place of a credit card in order to perform transactions. + + + + + lastFour @@ -26883,7 +27021,8 @@

AccountMini - + : Account mini details + @@ -27066,7 +27205,8 @@

Array<CustomField> - + : 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. + @@ -27161,7 +27301,8 @@

SubscriptionChange - + : Subscription Change + @@ -27172,7 +27313,8 @@

PlanMini - + : Just the important parts. + @@ -27249,7 +27391,8 @@

SubscriptionShipping - + : Subscription shipping details + @@ -27487,7 +27630,8 @@

AddOnMini - + : Just the important parts. + @@ -27795,7 +27939,8 @@

PlanMini - + : Just the important parts. + @@ -27818,7 +27963,8 @@

SubscriptionShipping - + : Subscription shipping details + @@ -28292,7 +28438,8 @@

AccountMini - + : Account mini details + @@ -28510,7 +28657,8 @@

InvoiceMini - + : Invoice mini details + @@ -28725,7 +28873,8 @@

InvoiceMini - + : Invoice mini details + diff --git a/lib/recurly.d.ts b/lib/recurly.d.ts index 2987b710..89994a21 100644 --- a/lib/recurly.d.ts +++ b/lib/recurly.d.ts @@ -130,6 +130,30 @@ export interface Account { * The shipping addresses on the account. */ shippingAddresses: ShippingAddress[] | null; + /** + * Indicates if the account has a subscription that is either active, canceled, future, or paused. + */ + hasLiveSubscription: boolean | null; + /** + * Indicates if the account has an active subscription. + */ + hasActiveSubscription: boolean | null; + /** + * Indicates if the account has a future subscription. + */ + hasFutureSubscription: boolean | null; + /** + * Indicates if the account has a canceled subscription. + */ + hasCanceledSubscription: boolean | null; + /** + * Indicates if the account has a paused subscription. + */ + hasPausedSubscription: boolean | null; + /** + * Indicates if the account has a past due invoice. + */ + hasPastDueInvoice: boolean | null; /** * When the account was created. */ @@ -187,6 +211,9 @@ export interface Account { billTo: string | null; address: Address | null; billingInfo: BillingInfo | null; + /** + * 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. + */ customFields: CustomField[] | null; } @@ -292,6 +319,14 @@ export interface PaymentMethod { * Expiration year. */ expYear: number | null; + /** + * A token used in place of a credit card in order to perform transactions. + */ + gatewayToken: string | null; + /** + * An identifier for a specific payment gateway. + */ + gatewayCode: string | null; /** * Billing Agreement identifier. Only present for Amazon or Paypal payment methods. */ @@ -404,6 +439,9 @@ export interface TransactionError { } export interface AccountAcquisition { + /** + * Account balance + */ cost: AccountAcquisitionCost | null; /** * The channel through which the account was acquired. @@ -422,6 +460,9 @@ export interface AccountAcquisition { * Object type */ object: string | null; + /** + * Account mini details + */ account: AccountMini | null; /** * When the account acquisition data was created. @@ -473,6 +514,9 @@ export interface AccountBalance { * Object type */ object: string | null; + /** + * Account mini details + */ account: AccountMini | null; pastDue: boolean | null; balances: AccountBalanceAmount[] | null; @@ -609,6 +653,9 @@ export interface Coupon { * Whether the discount is for all eligible charges on the account, or only a specific subscription. */ redemptionResource: string | null; + /** + * Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`. + */ discount: CouponDiscount | null; /** * Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. @@ -719,8 +766,17 @@ export interface CreditPayment { * The action for which the credit was created. */ action: string | null; + /** + * Account mini details + */ account: AccountMini | null; + /** + * Invoice mini details + */ appliedToInvoice: InvoiceMini | null; + /** + * Invoice mini details + */ originalInvoice: InvoiceMini | null; /** * 3-letter ISO 4217 currency code. @@ -791,8 +847,17 @@ export interface Transaction { * If this transaction is a refund (`type=refund`), this will be the ID of the original transaction on the invoice being refunded. */ originalTransactionId: string | null; + /** + * Account mini details + */ account: AccountMini | null; + /** + * Invoice mini details + */ invoice: InvoiceMini | null; + /** + * Invoice mini details + */ voidedByInvoice: InvoiceMini | null; /** * If the transaction is charging or refunding for one or more subscriptions, these are their IDs. @@ -936,6 +1001,9 @@ export interface Invoice { * Invoice state */ state: string | null; + /** + * Account mini details + */ account: AccountMini | null; /** * If the invoice is charging or refunding for one or more subscriptions, these are their IDs. @@ -995,6 +1063,9 @@ export interface Invoice { * The outstanding balance remaining on this invoice. */ balance: number | null; + /** + * Tax info + */ taxInfo: TaxInfo | null; /** * VAT registration number for the customer on this invoice. This will come from the VAT Number field in the Billing Info or the Account Info depending on your tax settings and the invoice collection method. @@ -1146,6 +1217,10 @@ export interface LineItem { * Available when the Catalog feature is enabled. */ itemId: string | null; + /** + * Optional Stock Keeping Unit assigned to an item, when the Catalog feature is enabled. + */ + externalSku: string | null; /** * Revenue schedule type */ @@ -1158,6 +1233,9 @@ export interface LineItem { * Category to describe the role of a line item on a legacy invoice: - "charges" refers to charges being billed for on this invoice. - "credits" refers to refund or proration credits. This portion of the invoice can be considered a credit memo. - "applied_credits" refers to previous credits applied to this invoice. See their original_line_item_id to determine where the credit first originated. - "carryforwards" can be ignored. They exist to consume any remaining credit balance. A new credit with the same amount will be created and placed back on the account. */ legacyCategory: string | null; + /** + * Account mini details + */ account: AccountMini | null; /** * If the line item is a charge or credit for a subscription, this is its ID. @@ -1255,6 +1333,9 @@ export interface LineItem { * Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. */ taxCode: string | null; + /** + * Tax info + */ taxInfo: TaxInfo | null; /** * When a line item has been prorated, this is the rate of the proration. Proration rates were made available for line items created after March 30, 2017. For line items created prior to that date, the proration rate will be `null`, even if the line item was prorated. @@ -1346,17 +1427,29 @@ export interface Subscription { * The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. */ uuid: string | null; + /** + * Account mini details + */ account: AccountMini | null; + /** + * Just the important parts. + */ plan: PlanMini | null; /** * State */ state: string | null; + /** + * Subscription shipping details + */ shipping: SubscriptionShipping | null; /** * Coupon redemptions */ couponRedemptions: CouponRedemptionMini[] | null; + /** + * Subscription Change + */ pendingChange: SubscriptionChange | null; /** * Current billing period started at @@ -1454,6 +1547,9 @@ export interface Subscription { * Expiration reason */ expirationReason: string | null; + /** + * 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. + */ customFields: CustomField[] | null; /** * Created at @@ -1562,6 +1658,9 @@ export interface CouponMini { * Indicates if the coupon is redeemable, and if it is not, why. */ state: string | null; + /** + * Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`. + */ discount: CouponDiscount | null; /** * Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. @@ -1587,6 +1686,9 @@ export interface SubscriptionChange { * The ID of the subscription that is going to be changed. */ subscriptionId: string | null; + /** + * Just the important parts. + */ plan: PlanMini | null; /** * These add-ons will be used when the subscription renews. @@ -1600,6 +1702,9 @@ export interface SubscriptionChange { * Subscription quantity */ quantity: number | null; + /** + * Subscription shipping details + */ shipping: SubscriptionShipping | null; /** * Activated at @@ -1637,6 +1742,9 @@ export interface SubscriptionAddOn { * Subscription ID */ subscriptionId: string | null; + /** + * Just the important parts. + */ addOn: AddOnMini | null; /** * Add-on quantity @@ -1810,6 +1918,9 @@ export interface Item { * `true` exempts tax on the item, `false` applies tax on the item. */ taxExempt: boolean | null; + /** + * 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. + */ customFields: CustomField[] | null; /** * Item Pricing diff --git a/lib/recurly/api_errors.js b/lib/recurly/api_errors.js index bc09453a..b8f19c7b 100644 --- a/lib/recurly/api_errors.js +++ b/lib/recurly/api_errors.js @@ -41,6 +41,8 @@ class ValidationError extends ApiError { } class MissingFeatureError extends ApiError { } +class RateLimitedError extends ApiError { } + module.exports = { BadRequestError: BadRequestError, @@ -73,5 +75,7 @@ module.exports = { ValidationError: ValidationError, - MissingFeatureError: MissingFeatureError + MissingFeatureError: MissingFeatureError, + + RateLimitedError: RateLimitedError } diff --git a/lib/recurly/resources/Account.js b/lib/recurly/resources/Account.js index 954d0bd2..ce91ef03 100644 --- a/lib/recurly/resources/Account.js +++ b/lib/recurly/resources/Account.js @@ -19,11 +19,17 @@ const Resource = require('../Resource') * @prop {string} code - The unique identifier of the account. This cannot be changed once the account is created. * @prop {string} company * @prop {Date} createdAt - When the account was created. - * @prop {Array.} customFields + * @prop {Array.} customFields - 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. * @prop {Date} deletedAt - If present, when the account was last marked inactive. * @prop {string} email - The email address used for communicating with this customer. The customer will also use this email address to log into your hosted account management pages. This value does not need to be unique. * @prop {string} exemptionCertificate - The tax exemption certificate number for the account. If the merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account. * @prop {string} firstName + * @prop {boolean} hasActiveSubscription - Indicates if the account has an active subscription. + * @prop {boolean} hasCanceledSubscription - Indicates if the account has a canceled subscription. + * @prop {boolean} hasFutureSubscription - Indicates if the account has a future subscription. + * @prop {boolean} hasLiveSubscription - Indicates if the account has a subscription that is either active, canceled, future, or paused. + * @prop {boolean} hasPastDueInvoice - Indicates if the account has a past due invoice. + * @prop {boolean} hasPausedSubscription - Indicates if the account has a paused subscription. * @prop {string} hostedLoginToken - The unique token for automatically logging the account in to the hosted management pages. You may automatically log the user into their hosted management pages by directing the user to: `https://{subdomain}.recurly.com/account/{hosted_login_token}`. * @prop {string} id * @prop {string} lastName @@ -52,6 +58,12 @@ class Account extends Resource { email: String, exemptionCertificate: String, firstName: String, + hasActiveSubscription: Boolean, + hasCanceledSubscription: Boolean, + hasFutureSubscription: Boolean, + hasLiveSubscription: Boolean, + hasPastDueInvoice: Boolean, + hasPausedSubscription: Boolean, hostedLoginToken: String, id: String, lastName: String, diff --git a/lib/recurly/resources/AccountAcquisition.js b/lib/recurly/resources/AccountAcquisition.js index 3d78f0b3..f05140ca 100644 --- a/lib/recurly/resources/AccountAcquisition.js +++ b/lib/recurly/resources/AccountAcquisition.js @@ -12,10 +12,10 @@ const Resource = require('../Resource') /** * AccountAcquisition * @typedef {Object} AccountAcquisition - * @prop {AccountMini} account + * @prop {AccountMini} account - Account mini details * @prop {string} campaign - An arbitrary identifier for the marketing campaign that led to the acquisition of this account. * @prop {string} channel - The channel through which the account was acquired. - * @prop {AccountAcquisitionCost} cost + * @prop {AccountAcquisitionCost} cost - Account balance * @prop {Date} createdAt - When the account acquisition data was created. * @prop {string} id * @prop {string} object - Object type diff --git a/lib/recurly/resources/AccountBalance.js b/lib/recurly/resources/AccountBalance.js index 7c4621cb..0efa33c1 100644 --- a/lib/recurly/resources/AccountBalance.js +++ b/lib/recurly/resources/AccountBalance.js @@ -12,7 +12,7 @@ const Resource = require('../Resource') /** * AccountBalance * @typedef {Object} AccountBalance - * @prop {AccountMini} account + * @prop {AccountMini} account - Account mini details * @prop {Array.} balances * @prop {string} object - Object type * @prop {boolean} pastDue diff --git a/lib/recurly/resources/Coupon.js b/lib/recurly/resources/Coupon.js index c4bb23c0..06239b3b 100644 --- a/lib/recurly/resources/Coupon.js +++ b/lib/recurly/resources/Coupon.js @@ -17,7 +17,7 @@ const Resource = require('../Resource') * @prop {string} code - The code the customer enters to redeem the coupon. * @prop {string} couponType - Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. * @prop {Date} createdAt - Created at - * @prop {CouponDiscount} discount + * @prop {CouponDiscount} discount - Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`. * @prop {string} duration - - "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes. * @prop {Date} expiredAt - The date and time the coupon was expired early or reached its `max_redemptions`. * @prop {number} freeTrialAmount - Sets the duration of time the `free_trial_unit` is for. diff --git a/lib/recurly/resources/CouponMini.js b/lib/recurly/resources/CouponMini.js index 293488c2..f926784c 100644 --- a/lib/recurly/resources/CouponMini.js +++ b/lib/recurly/resources/CouponMini.js @@ -14,7 +14,7 @@ const Resource = require('../Resource') * @typedef {Object} CouponMini * @prop {string} code - The code the customer enters to redeem the coupon. * @prop {string} couponType - Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint. - * @prop {CouponDiscount} discount + * @prop {CouponDiscount} discount - Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`. * @prop {Date} expiredAt - The date and time the coupon was expired early or reached its `max_redemptions`. * @prop {string} id - Coupon ID * @prop {string} name - The internal name for the coupon. diff --git a/lib/recurly/resources/CreditPayment.js b/lib/recurly/resources/CreditPayment.js index 4b051e98..8f644819 100644 --- a/lib/recurly/resources/CreditPayment.js +++ b/lib/recurly/resources/CreditPayment.js @@ -12,16 +12,16 @@ const Resource = require('../Resource') /** * CreditPayment * @typedef {Object} CreditPayment - * @prop {AccountMini} account + * @prop {AccountMini} account - Account mini details * @prop {string} action - The action for which the credit was created. * @prop {number} amount - Total credit payment amount applied to the charge invoice. - * @prop {InvoiceMini} appliedToInvoice + * @prop {InvoiceMini} appliedToInvoice - Invoice mini details * @prop {Date} createdAt - Created at * @prop {string} currency - 3-letter ISO 4217 currency code. * @prop {string} id - Credit Payment ID * @prop {string} object - Object type * @prop {string} originalCreditPaymentId - For credit payments with action `refund`, this is the credit payment that was refunded. - * @prop {InvoiceMini} originalInvoice + * @prop {InvoiceMini} originalInvoice - Invoice mini details * @prop {Transaction} refundTransaction * @prop {Date} updatedAt - Last updated at * @prop {string} uuid - The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. diff --git a/lib/recurly/resources/Invoice.js b/lib/recurly/resources/Invoice.js index 7de0e305..09962e4b 100644 --- a/lib/recurly/resources/Invoice.js +++ b/lib/recurly/resources/Invoice.js @@ -12,7 +12,7 @@ const Resource = require('../Resource') /** * Invoice * @typedef {Object} Invoice - * @prop {AccountMini} account + * @prop {AccountMini} account - Account mini details * @prop {InvoiceAddress} address * @prop {number} balance - The outstanding balance remaining on this invoice. * @prop {Date} closedAt - Date invoice was marked paid or failed. @@ -38,7 +38,7 @@ const Resource = require('../Resource') * @prop {Array.} subscriptionIds - If the invoice is charging or refunding for one or more subscriptions, these are their IDs. * @prop {number} subtotal - The summation of charges, discounts, and credits, before tax. * @prop {number} tax - The total tax on this invoice. - * @prop {TaxInfo} taxInfo + * @prop {TaxInfo} taxInfo - Tax info * @prop {string} termsAndConditions - This will default to the Terms and Conditions text specified on the Invoice Settings page in your Recurly admin. Specify custom notes to add or override Terms and Conditions. * @prop {number} total - The final total on this invoice. The summation of invoice charges, discounts, credits, and tax. * @prop {Array.} transactions - Transactions diff --git a/lib/recurly/resources/Item.js b/lib/recurly/resources/Item.js index 387d3f38..d47799b3 100644 --- a/lib/recurly/resources/Item.js +++ b/lib/recurly/resources/Item.js @@ -16,7 +16,7 @@ const Resource = require('../Resource') * @prop {string} code - Unique code to identify the item. * @prop {Date} createdAt - Created at * @prop {Array.} currencies - Item Pricing - * @prop {Array.} customFields + * @prop {Array.} customFields - 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. * @prop {Date} deletedAt - Deleted at * @prop {string} description - Optional, description. * @prop {string} externalSku - Optional, stock keeping unit to link the item to other inventory systems. diff --git a/lib/recurly/resources/LineItem.js b/lib/recurly/resources/LineItem.js index 21ee739b..3ccaf2bb 100644 --- a/lib/recurly/resources/LineItem.js +++ b/lib/recurly/resources/LineItem.js @@ -12,7 +12,7 @@ const Resource = require('../Resource') /** * LineItem * @typedef {Object} LineItem - * @prop {AccountMini} account + * @prop {AccountMini} account - Account mini details * @prop {string} accountingCode - Internal accounting code to help you reconcile your revenue to the correct ledger. Line items created as part of a subscription invoice will use the plan or add-on's accounting code, otherwise the value will only be present if you define an accounting code when creating the line item. * @prop {string} addOnCode - If the line item is a charge or credit for an add-on, this is its code. * @prop {string} addOnId - If the line item is a charge or credit for an add-on this is its ID. @@ -24,6 +24,7 @@ const Resource = require('../Resource') * @prop {string} description - Description that appears on the invoice. For subscription related items this will be filled in automatically. * @prop {number} discount - The discount applied to the line item. * @prop {Date} endDate - If this date is provided, it indicates the end of a time range. + * @prop {string} externalSku - Optional Stock Keeping Unit assigned to an item, when the Catalog feature is enabled. * @prop {string} id - Line item ID * @prop {string} invoiceId - Once the line item has been invoiced this will be the invoice's ID. * @prop {string} invoiceNumber - Once the line item has been invoiced this will be the invoice's number. If VAT taxation and the Country Invoice Sequencing feature are enabled, invoices will have country-specific invoice numbers for invoices billed to EU countries (ex: FR1001). Non-EU invoices will continue to use the site-level invoice number sequence. @@ -50,7 +51,7 @@ const Resource = require('../Resource') * @prop {number} tax - The tax amount for the line item. * @prop {string} taxCode - Used by Avalara, Vertex, and Recurly’s EU VAT tax feature. The tax code values are specific to each tax system. If you are using Recurly’s EU VAT feature you can use `unknown`, `physical`, or `digital`. * @prop {boolean} taxExempt - `true` exempts tax on charges, `false` applies tax on charges. If not defined, then defaults to the Plan and Site settings. This attribute does not work for credits (negative line items). Credits are always applied post-tax. Pre-tax discounts should use the Coupons feature. - * @prop {TaxInfo} taxInfo + * @prop {TaxInfo} taxInfo - Tax info * @prop {boolean} taxable - `true` if the line item is taxable, `false` if it is not. * @prop {string} type - Charges are positive line items that debit the account. Credits are negative line items that credit the account. * @prop {number} unitAmount - Positive amount for a charge, negative amount for a credit. @@ -72,6 +73,7 @@ class LineItem extends Resource { description: String, discount: Number, endDate: Date, + externalSku: String, id: String, invoiceId: String, invoiceNumber: String, diff --git a/lib/recurly/resources/PaymentMethod.js b/lib/recurly/resources/PaymentMethod.js index 6a6caee5..581156ff 100644 --- a/lib/recurly/resources/PaymentMethod.js +++ b/lib/recurly/resources/PaymentMethod.js @@ -18,6 +18,8 @@ const Resource = require('../Resource') * @prop {number} expMonth - Expiration month. * @prop {number} expYear - Expiration year. * @prop {string} firstSix - Credit card number's first six digits. + * @prop {string} gatewayCode - An identifier for a specific payment gateway. + * @prop {string} gatewayToken - A token used in place of a credit card in order to perform transactions. * @prop {string} lastFour - Credit card number's last four digits. Will refer to bank account if payment method is ACH. * @prop {string} object * @prop {string} routingNumber - The bank account's routing number. Only present for ACH payment methods. @@ -32,6 +34,8 @@ class PaymentMethod extends Resource { expMonth: Number, expYear: Number, firstSix: String, + gatewayCode: String, + gatewayToken: String, lastFour: String, object: String, routingNumber: String, diff --git a/lib/recurly/resources/Subscription.js b/lib/recurly/resources/Subscription.js index d60cc3e4..1a1def8a 100644 --- a/lib/recurly/resources/Subscription.js +++ b/lib/recurly/resources/Subscription.js @@ -12,7 +12,7 @@ const Resource = require('../Resource') /** * Subscription * @typedef {Object} Subscription - * @prop {AccountMini} account + * @prop {AccountMini} account - Account mini details * @prop {Date} activatedAt - Activated at * @prop {Array.} addOns - Add-ons * @prop {number} addOnsTotal - Total price of add-ons @@ -27,7 +27,7 @@ const Resource = require('../Resource') * @prop {Date} currentPeriodStartedAt - Current billing period started at * @prop {Date} currentTermEndsAt - When the term ends. This is calculated by a plan's interval and `total_billing_cycles` in a term. Subscription changes with a `timeframe=renewal` will be applied on this date. * @prop {Date} currentTermStartedAt - The start date of the term when the first billing period starts. The subscription term is the length of time that a customer will be committed to a subscription. A term can span multiple billing periods. - * @prop {Array.} customFields + * @prop {Array.} customFields - 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. * @prop {string} customerNotes - Customer notes * @prop {string} expirationReason - Expiration reason * @prop {Date} expiresAt - Expires at @@ -35,14 +35,14 @@ const Resource = require('../Resource') * @prop {number} netTerms - Integer representing the number of days after an invoice's creation that the invoice will become past due. If an invoice's net terms are set to '0', it is due 'On Receipt' and will become past due 24 hours after it’s created. If an invoice is due net 30, it will become past due at 31 days exactly. * @prop {string} object - Object type * @prop {Date} pausedAt - Null unless subscription is paused or will pause at the end of the current billing period. - * @prop {SubscriptionChange} pendingChange - * @prop {PlanMini} plan + * @prop {SubscriptionChange} pendingChange - Subscription Change + * @prop {PlanMini} plan - Just the important parts. * @prop {string} poNumber - For manual invoicing, this identifies the PO number associated with the subscription. * @prop {number} quantity - Subscription quantity * @prop {number} remainingBillingCycles - The remaining billing cycles in the current term. * @prop {number} remainingPauseCycles - Null unless subscription is paused or will pause at the end of the current billing period. * @prop {number} renewalBillingCycles - If `auto_renew=true`, when a term completes, `total_billing_cycles` takes this value as the length of subsequent terms. Defaults to the plan's `total_billing_cycles`. - * @prop {SubscriptionShipping} shipping + * @prop {SubscriptionShipping} shipping - Subscription shipping details * @prop {string} state - State * @prop {number} subtotal - Estimated total, before tax. * @prop {string} termsAndConditions - Terms and conditions diff --git a/lib/recurly/resources/SubscriptionAddOn.js b/lib/recurly/resources/SubscriptionAddOn.js index ad0e2c2d..9f13720e 100644 --- a/lib/recurly/resources/SubscriptionAddOn.js +++ b/lib/recurly/resources/SubscriptionAddOn.js @@ -12,7 +12,7 @@ const Resource = require('../Resource') /** * SubscriptionAddOn * @typedef {Object} SubscriptionAddOn - * @prop {AddOnMini} addOn + * @prop {AddOnMini} addOn - Just the important parts. * @prop {Date} createdAt - Created at * @prop {Date} expiredAt - Expired at * @prop {string} id - Subscription Add-on ID diff --git a/lib/recurly/resources/SubscriptionChange.js b/lib/recurly/resources/SubscriptionChange.js index a288215c..a3a9b889 100644 --- a/lib/recurly/resources/SubscriptionChange.js +++ b/lib/recurly/resources/SubscriptionChange.js @@ -19,9 +19,9 @@ const Resource = require('../Resource') * @prop {Date} deletedAt - Deleted at * @prop {string} id - The ID of the Subscription Change. * @prop {string} object - Object type - * @prop {PlanMini} plan + * @prop {PlanMini} plan - Just the important parts. * @prop {number} quantity - Subscription quantity - * @prop {SubscriptionShipping} shipping + * @prop {SubscriptionShipping} shipping - Subscription shipping details * @prop {string} subscriptionId - The ID of the subscription that is going to be changed. * @prop {number} unitAmount - Unit amount * @prop {Date} updatedAt - Updated at diff --git a/lib/recurly/resources/Transaction.js b/lib/recurly/resources/Transaction.js index 914b62a1..215fb408 100644 --- a/lib/recurly/resources/Transaction.js +++ b/lib/recurly/resources/Transaction.js @@ -12,7 +12,7 @@ const Resource = require('../Resource') /** * Transaction * @typedef {Object} Transaction - * @prop {AccountMini} account + * @prop {AccountMini} account - Account mini details * @prop {number} amount - Total transaction amount sent to the payment gateway. * @prop {string} avsCheck - When processed, result from checking the overall AVS on the transaction. * @prop {Address} billingAddress @@ -30,7 +30,7 @@ const Resource = require('../Resource') * @prop {number} gatewayResponseTime - Time, in seconds, for gateway to process the transaction. * @prop {Object} gatewayResponseValues - The values in this field will vary from gateway to gateway. * @prop {string} id - Transaction ID - * @prop {InvoiceMini} invoice + * @prop {InvoiceMini} invoice - Invoice mini details * @prop {string} ipAddressCountry - IP address's country * @prop {string} ipAddressV4 - IP address provided when the billing information was collected: - When the customer enters billing information into the Recurly.js or Hosted Payment Pages, Recurly records the IP address. - When the merchant enters billing information using the API, the merchant may provide an IP address. - When the merchant enters billing information using the UI, no IP address is recorded. * @prop {string} object - Object type @@ -47,7 +47,7 @@ const Resource = require('../Resource') * @prop {string} type - - `authorization` – verifies billing information and places a hold on money in the customer's account. - `capture` – captures funds held by an authorization and completes a purchase. - `purchase` – combines the authorization and capture in one transaction. - `refund` – returns all or a portion of the money collected in a previous transaction to the customer. - `verify` – a $0 or $1 transaction used to verify billing information which is immediately voided. * @prop {string} uuid - The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI. * @prop {Date} voidedAt - Voided at - * @prop {InvoiceMini} voidedByInvoice + * @prop {InvoiceMini} voidedByInvoice - Invoice mini details */ class Transaction extends Resource { static getSchema () { diff --git a/openapi/api.yaml b/openapi/api.yaml index 38890989..92c386fc 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -143,6 +143,23 @@ info: ## Change Log ### v2019-10-10 + Support `gateway_token` and `gateway_code` for Billing Infos + * `BillingInfoCreate` request format: + * Added `gateway_token` + * Added `gateway_code` + * `PaymentMethod` response format: + * Added `gateway_token` + * Added `gateway_code` + + Adding fields to the `Account` schema to view `Subscription` and `Invoice` statuses without making multiple requests: + * Subscription status fields: + * `has_live_subscription` + * `has_active_subscription` + * `has_future_subscription` + * `has_canceled_subscription` + * `has_paused_subscription` + * Invoice status fields: + * `has_past_due_invoice` Support `external_gift_card` origins for Line Items * Changed LineItemCreate request format: @@ -194,7 +211,8 @@ info: * `LineItem` response format updates * Added `item_code`. * Added `item_id`. - * `product_code` will be populated with `external_sku` of the `Item` when an `item_code` or `item_id` is passed in the request. + * Added `external_sku`. + * `product_code` will be populated with `item_code` of the `Item` when an `item_code` or `item_id` is passed in the request. Added support for Items in Purchases, when the Catalog feature is enabled * Changed PurchaseCreate request format: @@ -214,7 +232,8 @@ info: * Changed Purchase response format: * Added `line_items.item_code`. * Added `line_items.item_id`. - * `line_items.product_code` will be populated with the `external_sku` of the Item when an `item_code` or `item_id` is passed in the request. + * Added `line_items.external_sku`. + * `line_items.product_code` will be populated with the `item_code` of the Item when an `item_code` or `item_id` is passed in the request. Starting to improve support for shipping: * Added `GET /sites/:site_id/shipping_methods/`. @@ -781,11 +800,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - sites = client.list_sites(limit=200).items() - for site in sites: - print(site.subdomain) - lang: Java source: | QueryParams params = new QueryParams(); @@ -802,6 +816,12 @@ paths: { Console.WriteLine(site.Subdomain); } + - lang: Ruby + source: | + sites = @client.list_sites(limit: 200) + sites.each do |site| + puts "Site: #{site.subdomain}" + end - lang: Node.js source: | const sites = client.listSites({ limit: 200 }) @@ -809,12 +829,11 @@ paths: for await (const site of sites.each()) { console.log(site.subdomain) } - - lang: Ruby + - lang: Python source: | - sites = @client.list_sites(limit: 200) - sites.each do |site| - puts "Site: #{site.subdomain}" - end + sites = client.list_sites(limit=200).items() + for site in sites: + print(site.subdomain) "/sites/{site_id}": get: operationId: get_site @@ -842,6 +861,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/accounts": get: tags: @@ -885,11 +905,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - accounts = client.list_accounts(limit=200).items() - for account in accounts: - print(account.code) - lang: Java source: | QueryParams params = new QueryParams(); @@ -906,6 +921,12 @@ paths: { Console.WriteLine(account.Code); } + - lang: Ruby + source: | + accounts = @client.list_accounts(limit: 200) + accounts.each do |account| + puts "Account: #{account.code}" + end - lang: Node.js source: | const accounts = client.listAccounts({ limit: 200 }) @@ -913,12 +934,11 @@ paths: for await (const account of accounts.each()) { console.log(account.code) } - - lang: Ruby + - lang: Python source: | - accounts = @client.list_accounts(limit: 200) - accounts.each do |account| - puts "Account: #{account.code}" - end + accounts = client.list_accounts(limit=200).items() + for account in accounts: + print(account.code) post: tags: - account @@ -965,39 +985,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account_create = { - "code": account_code, - "first_name": "Benjamin", - "last_name": "Du Monde", - "acquisition": { - "campaign": "podcast-marketing", - "channel": "social_media", - "subchannel": "twitter", - "cost": {"currency": "USD", "amount": 0.50}, - }, - "shipping_addresses": [ - { - "nickname": "Home", - "street1": "1 Tchoupitoulas St", - "city": "New Orleans", - "region": "LA", - "country": "US", - "postal_code": "70115", - "first_name": "Aaron", - "last_name": "Du Monde", - } - ], - } - account = client.create_account(account_create) - print("Created Account %s" % account) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -1058,34 +1045,6 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - - lang: Node.js - source: | - try { - const accountCreate = { - code: accountCode, - firstName: 'Benjamin', - lastName: 'Du Monde', - address: { - street1: '900 Camp St', - city: 'New Orleans', - region: 'LA', - postalCode: '70115', - country: 'US' - } - } - const account = await client.createAccount(accountCreate) - console.log('Created Account: ', account.code) - } catch (err) { - if (err instanceof recurly.errors.ValidationError) { - // If the request was not valid, you may want to tell your user - // why. You can find the invalid params and reasons in err.params - console.log('Failed validation', err.params) - } else { - // If we don't know what to do with the err, we should - // probably re-raise and let our web framework and logger handle it - console.log('Unknown Error: ', err) - } - } - lang: Ruby source: | begin @@ -1122,6 +1081,67 @@ paths: # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Node.js + source: | + try { + const accountCreate = { + code: accountCode, + firstName: 'Benjamin', + lastName: 'Du Monde', + address: { + street1: '900 Camp St', + city: 'New Orleans', + region: 'LA', + postalCode: '70115', + country: 'US' + } + } + const account = await client.createAccount(accountCreate) + console.log('Created Account: ', account.code) + } catch (err) { + if (err instanceof recurly.errors.ValidationError) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in err.params + console.log('Failed validation', err.params) + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + account_create = { + "code": account_code, + "first_name": "Benjamin", + "last_name": "Du Monde", + "acquisition": { + "campaign": "podcast-marketing", + "channel": "social_media", + "subchannel": "twitter", + "cost": {"currency": "USD", "amount": 0.50}, + }, + "shipping_addresses": [ + { + "nickname": "Home", + "street1": "1 Tchoupitoulas St", + "city": "New Orleans", + "region": "LA", + "country": "US", + "postal_code": "70115", + "first_name": "Aaron", + "last_name": "Du Monde", + } + ], + } + account = client.create_account(account_create) + print("Created Account %s" % account) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}": parameters: - "$ref": "#/components/parameters/site_id" @@ -1145,15 +1165,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account = client.get_account(account_id) - print("Got Account %s" % account) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -1185,6 +1196,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account = @client.get_account(account_id: account_id) + puts "Got Account #{account}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -1201,16 +1222,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - account = @client.get_account(account_id: account_id) - puts "Got Account #{account}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + account = client.get_account(account_id) + print("Got Account %s" % account) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account @@ -1255,17 +1275,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account_update = {"first_name": "Aaron", "last_name": "Du Monde"} - account = client.update_account(account_id, account_update) - print("Updated Account %s" % account) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -1308,6 +1317,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account_update = { + first_name: "Aaron", + last_name: "Du Monde", + } + account = @client.update_account( + account_id: account_id, + body: account_update + ) + puts "Updated Account #{account}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -1328,23 +1354,17 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - account_update = { - first_name: "Aaron", - last_name: "Du Monde", - } - account = @client.update_account( - account_id: account_id, - body: account_update - ) - puts "Updated Account #{account}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + account_update = {"first_name": "Aaron", "last_name": "Du Monde"} + account = client.update_account(account_id, account_update) + print("Updated Account %s" % account) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account @@ -1374,15 +1394,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account = client.deactivate_account(account_id) - print("Deactivated Account %s" % account) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -1414,6 +1425,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account = @client.deactivate_account(account_id: account_id) + puts "Deactivated Account #{account}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -1429,16 +1450,15 @@ paths: // probably re-raise and let our web framework and logger handle it throw err } - - lang: Ruby + - lang: Python source: | - begin - account = @client.deactivate_account(account_id: account_id) - puts "Deactivated Account #{account}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + account = client.deactivate_account(account_id) + print("Deactivated Account %s" % account) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/acquisition": parameters: - "$ref": "#/components/parameters/site_id" @@ -1464,15 +1484,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - acquisition = client.get_account_acquisition(account_id) - print("Got AccountAcquisition %s" % acquisition) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -1504,6 +1515,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.get_account_acquisition(account_id: account_id) + puts "Got AccountAcquisition" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -1520,16 +1541,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.get_account_acquisition(account_id: account_id) - puts "Got AccountAcquisition" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + acquisition = client.get_account_acquisition(account_id) + print("Got AccountAcquisition %s" % acquisition) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account @@ -1568,22 +1588,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - acquisition_update = { - "campaign": "podcast-marketing", - "channel": "social_media", - "subchannel": "twitter", - "cost": {"currency": "USD", "amount": 0.50}, - } - acquisition = client.update_account_acquisition(account_id, acquisition_update) - print("Updated AccountAcquisition %s" % acquisition) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -1647,6 +1651,22 @@ paths: console.log('Unknown Error: ', err) } } + - lang: Python + source: | + try: + acquisition_update = { + "campaign": "podcast-marketing", + "channel": "social_media", + "subchannel": "twitter", + "cost": {"currency": "USD", "amount": 0.50}, + } + acquisition = client.update_account_acquisition(account_id, acquisition_update) + print("Updated AccountAcquisition %s" % acquisition) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account @@ -1663,15 +1683,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_account_acquisition(account_id) - print("Removed AccountAcquisition for Account id=%s" % account_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -1703,6 +1714,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + acquisition = @client.remove_account_acquisition(account_id: account_id) + puts "Removed AccountAcqusition #{acquisition}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -1719,16 +1740,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - acquisition = @client.remove_account_acquisition(account_id: account_id) - puts "Removed AccountAcqusition #{acquisition}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_account_acquisition(account_id) + print("Removed AccountAcquisition for Account id=%s" % account_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/reactivate": parameters: - "$ref": "#/components/parameters/site_id" @@ -1766,15 +1786,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - account = client.reactivate_account(account_id) - print("Reactivated Account %s" % account) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -1806,6 +1817,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + account = @client.reactivate_account(account_id: account_id) + puts "Reactivated account #{account}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -1821,16 +1842,15 @@ paths: // probably re-raise and let our web framework and logger handle it throw err } - - lang: Ruby + - lang: Python source: | - begin - account = @client.reactivate_account(account_id: account_id) - puts "Reactivated account #{account}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + account = client.reactivate_account(account_id) + print("Reactivated Account %s" % account) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/balance": parameters: - "$ref": "#/components/parameters/site_id" @@ -1860,15 +1880,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - balance = client.get_account_balance(account_id) - print("Got AccountBalance %s" % balance) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -1900,6 +1911,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + balance = @client.get_account_balance(account_id: account_id) + puts "Got AccountBalance #{balance}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -1916,16 +1937,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - balance = @client.get_account_balance(account_id: account_id) - puts "Got AccountBalance #{balance}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + balance = client.get_account_balance(account_id) + print("Got AccountBalance %s" % balance) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/billing_info": get: tags: @@ -1957,15 +1977,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - binfo = client.get_billing_info(account_id) - print("Got BillingInfo %s" % binfo) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -1997,6 +2008,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + billing = @client.get_billing_info(account_id: account_id) + puts "Got BillingInfo #{billing}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -2013,16 +2034,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - billing = @client.get_billing_info(account_id: account_id) - puts "Got BillingInfo #{billing}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + binfo = client.get_billing_info(account_id) + print("Got BillingInfo %s" % binfo) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account @@ -2039,6 +2059,13 @@ paths: - number - month - year + + For tokenized payments you'll need the following required fields: + + - first_name + - last_name + - gateway_token + - gateway_code parameters: - "$ref": "#/components/parameters/site_id" - "$ref": "#/components/parameters/account_id" @@ -2075,17 +2102,6 @@ paths: schema: "$ref": "#/components/schemas/ErrorMayHaveTransaction" x-code-samples: - - lang: Python - source: | - try: - billing_update = {"first_name": "Aaron", "last_name": "Du Monde"} - billing = client.update_billing_info(account_id, billing_update) - print("Updated BillingInfo %s" % billing) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -2125,6 +2141,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + billing_update = { + first_name: "Aaron", + last_name: "Du Monde", + } + billing = @client.update_billing_info( + account_id: account_id, + body: billing_update + ) + puts "Updated BillingInfo #{billing}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -2145,23 +2178,17 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - billing_update = { - first_name: "Aaron", - last_name: "Du Monde", - } - billing = @client.update_billing_info( - account_id: account_id, - body: billing_update - ) - puts "Updated BillingInfo #{billing}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + billing_update = {"first_name": "Aaron", "last_name": "Du Monde"} + billing = client.update_billing_info(account_id, billing_update) + print("Updated BillingInfo %s" % billing) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account @@ -2185,15 +2212,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_billing_info(account_id) - print("Removed BillingInfo for Account id=%s" % account_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -2225,6 +2243,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_billing_info(account_id: account_id) + puts "Removed BillingInfo #{account_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -2241,16 +2269,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_billing_info(account_id: account_id) - puts "Removed BillingInfo #{account_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_billing_info(account_id) + print("Removed BillingInfo for Account id=%s" % account_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/coupon_redemptions": get: tags: @@ -2281,15 +2308,10 @@ paths: default: description: Unexpected error. content: - application/json: - schema: - "$ref": "#/components/schemas/Error" - x-code-samples: - - lang: Python - source: | - redemptions = client.list_account_coupon_redemptions(account_id, limit=200).items() - for redemption in redemptions: - print(redemption.id) + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: - lang: Java source: | QueryParams params = new QueryParams(); @@ -2308,6 +2330,11 @@ paths: redemptions.each do |redemption| puts "CouponRedemption: #{redemption.id}" end + - lang: Python + source: | + redemptions = client.list_account_coupon_redemptions(account_id, limit=200).items() + for redemption in redemptions: + print(redemption.id) "/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active": get: tags: @@ -2338,15 +2365,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - redemption = client.get_active_coupon_redemption(account_id) - print("Got Redemption %s" % redemption) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -2378,6 +2396,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + redemption = @client.get_active_coupon_redemption(account_id: account_id) + puts "Got CouponRedemption #{redemption}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -2394,16 +2422,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - redemption = @client.get_active_coupon_redemption(account_id: account_id) - puts "Got CouponRedemption #{redemption}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + redemption = client.get_active_coupon_redemption(account_id) + print("Got Redemption %s" % redemption) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") post: tags: - account @@ -2445,17 +2472,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - redemption_create = {"currency": "USD", "coupon_id": coupon_id} - redemption = client.create_coupon_redemption(account_id, redemption_create) - print("Created Redemption %s" % redemption) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -2489,6 +2505,17 @@ paths: # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Python + source: | + try: + redemption_create = {"currency": "USD", "coupon_id": coupon_id} + redemption = client.create_coupon_redemption(account_id, redemption_create) + print("Created Redemption %s" % redemption) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account @@ -2518,15 +2545,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_coupon_redemption(account_id) - print("Removed Redemption from Account id=%s" % account_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -2550,6 +2568,15 @@ paths: # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + client.remove_coupon_redemption(account_id) + print("Removed Redemption from Account id=%s" % account_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/credit_payments": get: tags: @@ -2591,11 +2618,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - payments = client.list_account_credit_payments(account_id, limit=200).items() - for payment in payments: - print(payment.id) - lang: Java source: | QueryParams params = new QueryParams(); @@ -2612,13 +2634,6 @@ paths: { Console.WriteLine(payment.Uuid); } - - lang: Node.js - source: | - const payments = client.listAccountCreditPayments(accountId, { limit: 200 }) - - for await (const payment of payments.each()) { - console.log(payment.uuid) - } - lang: Ruby source: | payments = @client.list_account_credit_payments( @@ -2628,6 +2643,18 @@ paths: payments.each do |payment| puts "CreditPayment: #{payment.id}" end + - lang: Node.js + source: | + const payments = client.listAccountCreditPayments(accountId, { limit: 200 }) + + for await (const payment of payments.each()) { + console.log(payment.uuid) + } + - lang: Python + source: | + payments = client.list_account_credit_payments(account_id, limit=200).items() + for payment in payments: + print(payment.id) "/sites/{site_id}/accounts/{account_id}/invoices": get: tags: @@ -2671,11 +2698,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - invoices = client.list_account_invoices(account_id, limit=200).items() - for invoice in invoices: - print(invoice.number) - lang: Java source: | QueryParams params = new QueryParams(); @@ -2694,6 +2716,11 @@ paths: invoices.each do |invoice| puts "Invoice: #{invoice.number}" end + - lang: Python + source: | + invoices = client.list_account_invoices(account_id, limit=200).items() + for invoice in invoices: + print(invoice.number) post: tags: - invoice @@ -2742,17 +2769,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice_create = {"currency": "USD", "collection_method": "automatic"} - invoice_collection = client.create_invoice(account_id, invoice_create) - print("Created InvoiceCollection %s" % invoice_collection) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -2797,6 +2813,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice_create = { + currency: 'USD', + collection_method: 'automatic' + } + collection = @client.create_invoice( + account_id: account_id, + body: invoice_create + ) + puts "Created InvoiceCollection #{collection}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -2819,23 +2852,17 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice_create = { - currency: 'USD', - collection_method: 'automatic' - } - collection = @client.create_invoice( - account_id: account_id, - body: invoice_create - ) - puts "Created InvoiceCollection #{collection}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + invoice_create = {"currency": "USD", "collection_method": "automatic"} + invoice_collection = client.create_invoice(account_id, invoice_create) + print("Created InvoiceCollection %s" % invoice_collection) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/invoices/preview": post: tags: @@ -2884,17 +2911,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice_preview = {"currency": "USD", "collection_method": "automatic"} - invoice_collection = client.preview_invoice(account_id, invoice_preview) - print("Preview InvoiceCollection %s" % invoice_collection) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -2939,6 +2955,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice_preview = { + currency: "USD", + collection_method: "automatic" + } + collection = @client.create_invoice( + account_id: account_id, + body: invoice_preview + ) + puts "Created InvoiceCollection #{collection}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -2961,23 +2994,17 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice_preview = { - currency: "USD", - collection_method: "automatic" - } - collection = @client.create_invoice( - account_id: account_id, - body: invoice_preview - ) - puts "Created InvoiceCollection #{collection}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + invoice_preview = {"currency": "USD", "collection_method": "automatic"} + invoice_collection = client.preview_invoice(account_id, invoice_preview) + print("Preview InvoiceCollection %s" % invoice_collection) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/line_items": get: tags: @@ -3023,11 +3050,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_account_line_items(account_id, limit=200).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); @@ -3046,6 +3068,11 @@ paths: line_items.each do |line_item| puts "LineItem: #{line_item.id}" end + - lang: Python + source: | + line_items = client.list_account_line_items(account_id, limit=200).items() + for line_item in line_items: + print(line_item.id) post: tags: - account @@ -3087,21 +3114,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - line_item_create = { - "currency": "USD", - "unit_amount": 1000, - "type": "charge", # choose "credit" for a credit - } - line_item = client.create_line_item(account_id, line_item_create) - print("Created LineItem %s" % line_item) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -3145,6 +3157,24 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + line_item_create = { + currency: 'USD', + unit_amount: 1_000, + type: :charge + } + line_item = @client.create_line_item( + account_id: account_id, + body: line_item_create + ) + puts "Created LineItem #{line_item}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -3166,24 +3196,21 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - line_item_create = { - currency: 'USD', - unit_amount: 1_000, - type: :charge - } - line_item = @client.create_line_item( - account_id: account_id, - body: line_item_create - ) - puts "Created LineItem #{line_item}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + line_item_create = { + "currency": "USD", + "unit_amount": 1000, + "type": "charge", # choose "credit" for a credit + } + line_item = client.create_line_item(account_id, line_item_create) + print("Created LineItem %s" % line_item) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/notes": get: tags: @@ -3215,11 +3242,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_account_line_items(account_id, limit=200).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); @@ -3236,6 +3258,12 @@ paths: { Console.WriteLine(note.Message); } + - lang: Ruby + source: | + account_notes = @client.list_account_notes(account_id: account_id, limit: 200) + account_notes.each do |note| + puts "AccountNote: #{note.message}" + end - lang: Node.js source: | const notes = client.listAccountNotes(accountId, { limit: 200 }) @@ -3243,12 +3271,11 @@ paths: for await (const note of notes.each()) { console.log(note.message) } - - lang: Ruby + - lang: Python source: | - account_notes = @client.list_account_notes(account_id: account_id, limit: 200) - account_notes.each do |note| - puts "AccountNote: #{note.message}" - end + line_items = client.list_account_line_items(account_id, limit=200).items() + for line_item in line_items: + print(line_item.id) "/sites/{site_id}/accounts/{account_id}/notes/{account_note_id}": get: tags: @@ -3285,15 +3312,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - note = client.get_account_note(account_id, note_id) - print("Got AccountNote %s" % note) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -3325,6 +3343,19 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + note = @client.get_account_note( + account_id: account_id, + account_note_id: note_id + ) + puts "Got AccountNote #{note}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -3342,19 +3373,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - note = @client.get_account_note( - account_id: account_id, - account_note_id: note_id - ) - puts "Got AccountNote #{note}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + note = client.get_account_note(account_id, note_id) + print("Got AccountNote %s" % note) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/shipping_addresses": get: tags: @@ -3391,11 +3418,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - shipping_addresses = client.list_shipping_addresses(account_id).items() - for shipping_address in shipping_addresses: - print(shipping_address.id) - lang: Java source: | QueryParams params = new QueryParams(); @@ -3412,13 +3434,6 @@ paths: { Console.WriteLine(address.Street1); } - - lang: Node.js - source: | - const addresses = client.listShippingAddresses(accountId, { limit: 200 }) - - for await (const address of addresses.each()) { - console.log(address.street1) - } - lang: Ruby source: | shipping_addresses = @client.list_shipping_addresses( @@ -3428,6 +3443,18 @@ paths: shipping_addresses.each do |addr| puts "ShippingAddress: #{addr.nickname} - #{addr.street1}" end + - lang: Node.js + source: | + const addresses = client.listShippingAddresses(accountId, { limit: 200 }) + + for await (const address of addresses.each()) { + console.log(address.street1) + } + - lang: Python + source: | + shipping_addresses = client.list_shipping_addresses(account_id).items() + for shipping_address in shipping_addresses: + print(shipping_address.id) post: tags: - account @@ -3469,24 +3496,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - shipping_addr_create = { - "first_name": "Aaron", - "last_name": "Du Monde", - "street1": "900 Camp St.", - "city": "New Orleans", - "postal_code": "70115", - "country": "US", - } - shad = client.create_shipping_address(account_id, shipping_addr_create) - print("Created ShippingAddress %s" % shad) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -3562,6 +3571,24 @@ paths: console.log('Unknown Error: ', err) } } + - lang: Python + source: | + try: + shipping_addr_create = { + "first_name": "Aaron", + "last_name": "Du Monde", + "street1": "900 Camp St.", + "city": "New Orleans", + "postal_code": "70115", + "country": "US", + } + shad = client.create_shipping_address(account_id, shipping_addr_create) + print("Created ShippingAddress %s" % shad) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}": get: tags: @@ -3593,15 +3620,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.get_subscription(subscription_id) - print("Got Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -3633,6 +3651,19 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + address = @client.get_shipping_address( + account_id: account_id, + shipping_address_id: shipping_address_id + ) + puts "Got ShippingAddress #{address}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -3649,19 +3680,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - address = @client.get_shipping_address( - account_id: account_id, - shipping_address_id: shipping_address_id - ) - puts "Got ShippingAddress #{address}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.get_subscription(subscription_id) + print("Got Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - account @@ -3710,23 +3737,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - address_update = { - "first_name": "Aaron", - "last_name": "Du Monde", - "postal_code": "70130", - } - address = client.update_shipping_address( - account_id, shipping_address_id, address_update - ) - print("Updated ShippingAddress %s" % address) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -3767,26 +3777,6 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - - lang: Node.js - source: | - try { - const shadUpdate = { - firstName: "Benjamin", - lastName: "Du Monde" - } - const address = await client.updateShippingAddress(accountId, shippingAddressId, shadUpdate) - console.log('Updated shipping address: ', address.street1) - } catch (err) { - if (err instanceof recurly.errors.ValidationError) { - // If the request was not valid, you may want to tell your user - // why. You can find the invalid params and reasons in err.params - console.log('Failed validation', err.params) - } else { - // If we don't know what to do with the err, we should - // probably re-raise and let our web framework and logger handle it - console.log('Unknown Error: ', err) - } - } - lang: Ruby source: | begin @@ -3806,6 +3796,43 @@ paths: # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Node.js + source: | + try { + const shadUpdate = { + firstName: "Benjamin", + lastName: "Du Monde" + } + const address = await client.updateShippingAddress(accountId, shippingAddressId, shadUpdate) + console.log('Updated shipping address: ', address.street1) + } catch (err) { + if (err instanceof recurly.errors.ValidationError) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in err.params + console.log('Failed validation', err.params) + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + address_update = { + "first_name": "Aaron", + "last_name": "Du Monde", + "postal_code": "70130", + } + address = client.update_shipping_address( + account_id, shipping_address_id, address_update + ) + print("Updated ShippingAddress %s" % address) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - account @@ -3826,15 +3853,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_shipping_address(account_id, shipping_address_id) - print("Removed ShippingAddress %s" % shipping_address_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -3866,6 +3884,19 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_shipping_address( + account_id: account_id, + shipping_address_id: shipping_address_id + ) + puts "Removed ShippingAddress #{shipping_address_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -3882,19 +3913,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_shipping_address( - account_id: account_id, - shipping_address_id: shipping_address_id - ) - puts "Removed ShippingAddress #{shipping_address_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_shipping_address(account_id, shipping_address_id) + print("Removed ShippingAddress %s" % shipping_address_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/accounts/{account_id}/subscriptions": get: tags: @@ -4111,17 +4138,17 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - acquisitions = client.list_account_acquisition(limit=200).items() - for acquisition in acquisitions: - print(acquisition.id) - lang: Ruby source: | acquisitions = @client.list_account_acquisition(limit: 200) acquisitions.each do |acquisition| puts "AccountAcquisition: #{acquisition.cost}" end + - lang: Python + source: | + acquisitions = client.list_account_acquisition(limit=200).items() + for acquisition in acquisitions: + print(acquisition.id) "/sites/{site_id}/coupons": get: tags: @@ -4162,11 +4189,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - coupons = client.list_coupons(limit=200).items() - for coupon in coupons: - print(coupon.code) - lang: Java source: | QueryParams params = new QueryParams(); @@ -4183,6 +4205,12 @@ paths: { Console.WriteLine(coupon.Code); } + - lang: Ruby + source: | + coupons = @client.list_coupons(limit: 200) + coupons.each do |coupon| + puts "coupon: #{coupon.code}" + end - lang: Node.js source: | const coupons = client.listCoupons({ limit: 200 }) @@ -4190,12 +4218,11 @@ paths: for await (const coupon of coupons.each()) { console.log(coupon.code) } - - lang: Ruby + - lang: Python source: | - coupons = @client.list_coupons(limit: 200) - coupons.each do |coupon| - puts "coupon: #{coupon.code}" - end + coupons = client.list_coupons(limit=200).items() + for coupon in coupons: + print(coupon.code) post: tags: - coupon @@ -4241,22 +4268,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - coupon_create = { - "name": "Promotional Coupon", - "code": coupon_code, - "discount_type": "fixed", - "currencies": [{"currency": "USD", "discount": 10000}], - } - coupon = client.create_coupon(coupon_create) - print("Created Coupon %s" % coupon) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -4306,6 +4317,22 @@ paths: # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Python + source: | + try: + coupon_create = { + "name": "Promotional Coupon", + "code": coupon_code, + "discount_type": "fixed", + "currencies": [{"currency": "USD", "discount": 10000}], + } + coupon = client.create_coupon(coupon_create) + print("Created Coupon %s" % coupon) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/coupons/{coupon_id}": get: tags: @@ -4335,15 +4362,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - coupon = client.get_coupon(coupon_id) - print("Got Coupon %s" % coupon) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -4375,6 +4393,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + coupon = @client.get_coupon(coupon_id: coupon_id) + puts "Got Coupon #{coupon}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -4391,16 +4419,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - coupon = @client.get_coupon(coupon_id: coupon_id) - puts "Got Coupon #{coupon}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + coupon = client.get_coupon(coupon_id) + print("Got Coupon %s" % coupon) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - coupon @@ -4446,6 +4473,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/coupons/{coupon_id}/generate": post: tags: @@ -4489,6 +4517,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/coupons/{coupon_id}/unique_coupon_codes": get: tags: @@ -4524,6 +4553,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/credit_payments": get: tags: @@ -4579,6 +4609,12 @@ paths: { Console.WriteLine(payment.Uuid); } + - lang: Ruby + source: | + payments = @client.list_credit_payments(limit: 200) + payments.each do |payment| + puts "CreditPayment: #{payment.id}" + end - lang: Node.js source: | const payments = client.listCreditPayments({ limit: 200 }) @@ -4586,12 +4622,6 @@ paths: for await (const payment of payments.each()) { console.log(payment.uuid) } - - lang: Ruby - source: | - payments = @client.list_credit_payments(limit: 200) - payments.each do |payment| - puts "CreditPayment: #{payment.id}" - end "/sites/{site_id}/credit_payments/{credit_payment_id}": get: tags: @@ -4620,6 +4650,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/custom_field_definitions": get: tags: @@ -4669,11 +4700,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - custom_fields = client.list_custom_field_definitions(limit=200).items() - for custom_field in custom_fields: - print(custom_field.name) - lang: Java source: | QueryParams params = new QueryParams(); @@ -4690,6 +4716,12 @@ paths: { Console.WriteLine(def.DisplayName); } + - lang: Ruby + source: | + custom_fields = @client.list_custom_field_definitions(limit: 200) + custom_fields.each do |field| + puts "CustomFieldDefinition: #{field.name}" + end - lang: Node.js source: | const definitions = client.listCustomFieldDefinitions({ limit: 200 }) @@ -4697,12 +4729,11 @@ paths: for await (const definition of definitions.each()) { console.log(definition.displayName) } - - lang: Ruby + - lang: Python source: | - custom_fields = @client.list_custom_field_definitions(limit: 200) - custom_fields.each do |field| - puts "CustomFieldDefinition: #{field.name}" - end + custom_fields = client.list_custom_field_definitions(limit=200).items() + for custom_field in custom_fields: + print(custom_field.name) "/sites/{site_id}/custom_field_definitions/{custom_field_definition_id}": get: tags: @@ -4820,11 +4851,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - items = client.list_items(limit=200).items() - for item in items: - print(item.code) - lang: Java source: | QueryParams params = new QueryParams(); @@ -4841,6 +4867,12 @@ paths: { Console.WriteLine(item.Code); } + - lang: Ruby + source: | + items = @client.list_items(limit: 200) + items.each do |item| + puts "Item: #{item.code}" + end - lang: Node.js source: | const items = client.listItems({ limit: 200 }) @@ -4848,12 +4880,11 @@ paths: for await (const item of items.each()) { console.log(item.code) } - - lang: Ruby + - lang: Python source: | - items = @client.list_items(limit: 200) - items.each do |item| - puts "Item: #{item.code}" - end + items = client.list_items(limit=200).items() + for item in items: + print(item.code) post: tags: - item @@ -4884,43 +4915,21 @@ paths: description: Incorrect site ID. content: application/json: - schema: - "$ref": "#/components/schemas/Error" - '422': - description: Invalid request parameters. - content: - application/json: - schema: - "$ref": "#/components/schemas/Error" - default: - description: Unexpected error. - content: - application/json: - schema: - "$ref": "#/components/schemas/Error" - x-code-samples: - - lang: Python - source: | - try: - item_create = { - "code": item_code, - "name": "Item Name", - "description": "Item Description", - "external_sku": "a35JE-44", - "accounting_code": "item-code-127", - "revenue_schedule_type": "at_range_end", - "custom_fields": [{ - "name": "custom-field-1", - "value": "Custom Field 1 value" - }] - } - item = client.create_item(item_create) - print("Created Item %s" % item) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Invalid request parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: - lang: Java source: | try { @@ -4985,6 +4994,28 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + item_create = { + code: item_code, + name: "Item Name", + description: "Item Description", + external_sku: "a35JE-44", + accounting_code: "item-code-127", + revenue_schedule_type: "at_range_end", + custom_fields: [{ + name: "custom-field-1", + value: "Custom Field 1 value" + }] + } + item = @client.create_item(body: item_create) + puts "Created Item #{item}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -5013,28 +5044,28 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - item_create = { - code: item_code, - name: "Item Name", - description: "Item Description", - external_sku: "a35JE-44", - accounting_code: "item-code-127", - revenue_schedule_type: "at_range_end", - custom_fields: [{ - name: "custom-field-1", - value: "Custom Field 1 value" - }] - } - item = @client.create_item(body: item_create) - puts "Created Item #{item}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + item_create = { + "code": item_code, + "name": "Item Name", + "description": "Item Description", + "external_sku": "a35JE-44", + "accounting_code": "item-code-127", + "revenue_schedule_type": "at_range_end", + "custom_fields": [{ + "name": "custom-field-1", + "value": "Custom Field 1 value" + }] + } + item = client.create_item(item_create) + print("Created Item %s" % item) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/items/{item_id}": get: tags: @@ -5064,15 +5095,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - item = client.get_item(item_id) - print("Got Item %s" % item) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -5104,6 +5126,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + item = @client.get_item(item_id: item_id) + puts "Got Item #{item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -5120,16 +5152,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - item = @client.get_item(item_id: item_id) - puts "Got Item #{item}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + item = client.get_item(item_id) + print("Got Item %s" % item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - item @@ -5176,20 +5207,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - item_update = { - "name": "New Item Name", - "description": "New Item Description", - } - item = client.update_item(item_id, item_update) - print("Updated Item %s" % item) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -5232,6 +5249,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + item_update = { + name: "New Item Name", + description: "New Item Description" + } + item = @client.update_item( + item_id: item_id, + body: item_update + ) + puts "Updated Item #{item}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -5252,23 +5286,20 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - item_update = { - name: "New Item Name", - description: "New Item Description" - } - item = @client.update_item( - item_id: item_id, - body: item_update - ) - puts "Updated Item #{item}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + item_update = { + "name": "New Item Name", + "description": "New Item Description", + } + item = client.update_item(item_id, item_update) + print("Updated Item %s" % item) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - item @@ -5299,15 +5330,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - item = client.deactivate_item(item_id) - print("Deactivated Item %s" % item) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -5339,6 +5361,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + item = @client.deactivate_item(item_id: item_id) + puts "Deactivated Item #{item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -5354,16 +5386,15 @@ paths: // probably re-raise and let our web framework and logger handle it throw err } - - lang: Ruby + - lang: Python source: | - begin - item = @client.deactivate_item(item_id: item_id) - puts "Deactivated Item #{item}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + item = client.deactivate_item(item_id) + print("Deactivated Item %s" % item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/items/{item_id}/reactivate": parameters: - "$ref": "#/components/parameters/site_id" @@ -5401,15 +5432,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - item = client.reactivate_item(item_id) - print("Reactivated Item %s" % item) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -5441,6 +5463,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + item = @client.reactivate_item(item_id: item_id) + puts "Reactivated Item #{item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -5456,16 +5488,15 @@ paths: // probably re-raise and let our web framework and logger handle it throw err } - - lang: Ruby + - lang: Python source: | - begin - item = @client.reactivate_item(item_id: item_id) - puts "Reactivated Item #{item}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + item = client.reactivate_item(item_id) + print("Reactivated Item %s" % item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/invoices": get: tags: @@ -5507,11 +5538,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - invoices = client.list_invoices(limit=200).items() - for invoice in invoices: - print(invoice.number) - lang: Java source: | QueryParams params = new QueryParams(); @@ -5528,6 +5554,12 @@ paths: { Console.WriteLine(invoice.Number); } + - lang: Ruby + source: | + invoices = @client.list_invoices(limit: 200) + invoices.each do |invoice| + puts "Invoice: #{invoice.number}" + end - lang: Node.js source: | const invoices = client.listInvoices({ limit: 200 }) @@ -5535,12 +5567,11 @@ paths: for await (const invoice of invoices.each()) { console.log(invoice.number) } - - lang: Ruby + - lang: Python source: | - invoices = @client.list_invoices(limit: 200) - invoices.each do |invoice| - puts "Invoice: #{invoice.number}" - end + invoices = client.list_invoices(limit=200).items() + for invoice in invoices: + print(invoice.number) "/sites/{site_id}/invoices/{invoice_id}": get: tags: @@ -5570,15 +5601,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice = client.get_invoice(invoice_id) - print("Got Invoice %s" % invoice) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -5610,6 +5632,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.get_invoice(invoice_id: invoice_id) + puts "Got invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -5626,16 +5658,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice = @client.get_invoice(invoice_id: invoice_id) - puts "Got invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + invoice = client.get_invoice(invoice_id) + print("Got Invoice %s" % invoice) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - invoice @@ -5761,19 +5792,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice = client.get_invoice_pdf(invoice_id) - print("Got Invoice %s" % invoice) - filename = "%s/pythoninvoice-%s.pdf" % (download_directory, invoice_id) - with open(filename, 'wb') as file: - file.write(invoice.data) - print("Saved Invoice PDF to %s" % filename) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -5815,6 +5833,19 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.get_invoice_pdf(invoice_id: invoice_id) + puts "Got invoice #{invoice}" + filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf" + IO.write(filename, invoice.data) + puts "Saved Invoice PDF to #{filename}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -5839,19 +5870,19 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice = @client.get_invoice_pdf(invoice_id: invoice_id) - puts "Got invoice #{invoice}" - filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf" - IO.write(filename, invoice.data) - puts "Saved Invoice PDF to #{filename}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + invoice = client.get_invoice_pdf(invoice_id) + print("Got Invoice %s" % invoice) + filename = "%s/pythoninvoice-%s.pdf" % (download_directory, invoice_id) + with open(filename, 'wb') as file: + file.write(invoice.data) + print("Saved Invoice PDF to %s" % filename) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/invoices/{invoice_id}/collect": put: tags: @@ -5927,6 +5958,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.collect_invoice(invoice_id: invoice_id) + puts "Collected invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -5943,16 +5984,6 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - invoice = @client.collect_invoice(invoice_id: invoice_id) - puts "Collected invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/invoices/{invoice_id}/mark_failed": put: tags: @@ -6023,6 +6054,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.fail_invoice(invoice_id: invoice_id) + puts "Failed invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -6039,16 +6080,6 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - invoice = @client.fail_invoice(invoice_id: invoice_id) - puts "Failed invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/invoices/{invoice_id}/mark_successful": put: tags: @@ -6088,16 +6119,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice = client.mark_invoice_successful(invoice_id) - print("Marked Invoice successful %s" % invoice) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -6129,6 +6150,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.mark_invoice_successful(invoice_id: invoice_id) + puts "Marked invoice sucessful #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -6146,16 +6177,16 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice = @client.mark_invoice_successful(invoice_id: invoice_id) - puts "Marked invoice sucessful #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + invoice = client.mark_invoice_successful(invoice_id) + print("Marked Invoice successful %s" % invoice) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/invoices/{invoice_id}/reopen": put: tags: @@ -6223,6 +6254,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice = @client.reopen_invoice(invoice_id: invoice_id) + puts "Reopened invoice #{invoice}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -6239,16 +6280,6 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - invoice = @client.reopen_invoice(invoice_id: invoice_id) - puts "Reopened invoice #{invoice}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/invoices/{invoice_id}/void": put: tags: @@ -6285,6 +6316,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/invoices/{invoice_id}/line_items": get: tags: @@ -6329,6 +6361,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/invoices/{invoice_id}/coupon_redemptions": get: tags: @@ -6483,17 +6516,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - invoice_refund = {"type": "amount", "amount": 100} - invoice = client.refund_invoice(invoice_id, invoice_refund) - print("Refunded Invoice %s" % invoice) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -6535,6 +6557,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + invoice_refund = { + type: "amount", + amount: 100, + } + invoice = @client.refund_invoice( + invoice_id: invoice_id, + body: invoice_refund + ) + puts "Refunded invoice #{invoice}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -6558,23 +6597,17 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - invoice_refund = { - type: "amount", - amount: 100, - } - invoice = @client.refund_invoice( - invoice_id: invoice_id, - body: invoice_refund - ) - puts "Refunded invoice #{invoice}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + invoice_refund = {"type": "amount", "amount": 100} + invoice = client.refund_invoice(invoice_id, invoice_refund) + print("Refunded Invoice %s" % invoice) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/line_items": get: tags: @@ -6618,11 +6651,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_line_items(limit=200).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); @@ -6646,6 +6674,11 @@ paths: for await (const item of lineItems.each()) { console.log(`Item ${item.id} for ${item.amount}`) } + - lang: Python + source: | + line_items = client.list_line_items(limit=200).items() + for line_item in line_items: + print(line_item.id) "/sites/{site_id}/line_items/{line_item_id}": get: tags: @@ -6675,15 +6708,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - line_item = client.get_line_item(line_item_id) - print("Got LineItem %s" % line_item) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -6715,6 +6739,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + line_item = @client.get_line_item(line_item_id: line_item_id) + puts "Got LineItem #{line_item}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -6731,16 +6765,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - line_item = @client.get_line_item(line_item_id: line_item_id) - puts "Got LineItem #{line_item}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + line_item = client.get_line_item(line_item_id) + print("Got LineItem %s" % line_item) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") delete: tags: - line_item @@ -6771,15 +6804,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_line_item(line_item_id) - print("Removed LineItem %s" % line_item_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -6811,6 +6835,18 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_line_item( + line_item_id: line_item_id + ) + puts "Removed LineItem #{line_item_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -6827,18 +6863,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_line_item( - line_item_id: line_item_id - ) - puts "Removed LineItem #{line_item_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_line_item(line_item_id) + print("Removed LineItem %s" % line_item_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/plans": get: tags: @@ -6880,11 +6913,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - plans = client.list_plans(limit=200).items() - for plan in plans: - print(plan.code) - lang: Java source: | QueryParams params = new QueryParams(); @@ -6901,6 +6929,12 @@ paths: { Console.WriteLine(plan.Code); } + - lang: Ruby + source: | + plans = @client.list_plans(limit: 200) + plans.each do |plan| + puts "Plan: #{plan.code}" + end - lang: Node.js source: | const plans = client.listPlans({ limit: 200 }) @@ -6908,12 +6942,11 @@ paths: for await (const plan of plans.each()) { console.log(plan.code) } - - lang: Ruby + - lang: Python source: | - plans = @client.list_plans(limit: 200) - plans.each do |plan| - puts "Plan: #{plan.code}" - end + plans = client.list_plans(limit=200).items() + for plan in plans: + print(plan.code) post: tags: - plan @@ -6953,21 +6986,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - plan_create = { - "name": "Monthly Coffee Subscription", - "code": plan_code, - "currencies": [{"currency": "USD", "unit_amount": 10000}], - } - plan = client.create_plan(plan_create) - print("Created Plan %s" % plan) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -7023,32 +7041,6 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } - - lang: Node.js - source: | - try { - const planCreate = { - name: 'Monthly Coffee Subscription', - code: planCode, - currencies: [ - { - currency: 'USD', - unitAmount: 10000 - } - ] - } - const plan = await client.createPlan(planCreate) - console.log('Created Plan: ', plan.code) - } catch (err) { - if (err instanceof recurly.errors.ValidationError) { - // If the request was not valid, you may want to tell your user - // why. You can find the invalid params and reasons in err.params - console.log('Failed validation', err.params) - } else { - // If we don't know what to do with the err, we should - // probably re-raise and let our web framework and logger handle it - console.log('Unknown Error: ', err) - } - } - lang: Ruby source: | begin @@ -7076,6 +7068,47 @@ paths: # why. You can find the invalid params and reasons in e.recurly_error.params puts "ValidationError: #{e.recurly_error.params}" end + - lang: Node.js + source: | + try { + const planCreate = { + name: 'Monthly Coffee Subscription', + code: planCode, + currencies: [ + { + currency: 'USD', + unitAmount: 10000 + } + ] + } + const plan = await client.createPlan(planCreate) + console.log('Created Plan: ', plan.code) + } catch (err) { + if (err instanceof recurly.errors.ValidationError) { + // If the request was not valid, you may want to tell your user + // why. You can find the invalid params and reasons in err.params + console.log('Failed validation', err.params) + } else { + // If we don't know what to do with the err, we should + // probably re-raise and let our web framework and logger handle it + console.log('Unknown Error: ', err) + } + } + - lang: Python + source: | + try: + plan_create = { + "name": "Monthly Coffee Subscription", + "code": plan_code, + "currencies": [{"currency": "USD", "unit_amount": 10000}], + } + plan = client.create_plan(plan_create) + print("Created Plan %s" % plan) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/plans/{plan_id}": get: tags: @@ -7105,15 +7138,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - plan = client.get_plan(plan_id) - print("Got Plan %s" % plan) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -7145,6 +7169,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + plan = @client.get_plan(plan_id: plan_id) + puts "Got plan #{plan}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -7161,16 +7195,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - plan = @client.get_plan(plan_id: plan_id) - puts "Got plan #{plan}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + plan = client.get_plan(plan_id) + print("Got Plan %s" % plan) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - plan @@ -7379,11 +7412,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - add_ons = client.list_plan_add_ons(plan_id).items() - for add_on in add_ons: - print(add_on.code) - lang: Java source: | QueryParams params = new QueryParams(); @@ -7402,6 +7430,11 @@ paths: add_ons.each do |add_on| puts "AddOn: #{add_on.code}" end + - lang: Python + source: | + add_ons = client.list_plan_add_ons(plan_id).items() + for add_on in add_ons: + print(add_on.code) post: tags: - add-on @@ -7443,22 +7476,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - add_on_create = { - "code": "coffee_grinder", - "name": "A quality grinder for your beans", - "default_quantity": 1, - "currencies": [{"currency": "USD", "unit_amount": 10000}], - } - add_on = client.create_plan_add_on(plan_id, add_on_create) - print("Created PlanAddOn %s" % add_on) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -7515,6 +7532,22 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Python + source: | + try: + add_on_create = { + "code": "coffee_grinder", + "name": "A quality grinder for your beans", + "default_quantity": 1, + "currencies": [{"currency": "USD", "unit_amount": 10000}], + } + add_on = client.create_plan_add_on(plan_id, add_on_create) + print("Created PlanAddOn %s" % add_on) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}": get: tags: @@ -7546,15 +7579,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - shipping_addr = client.get_shipping_address(account_id, shipping_address_id) - print("Got ShippingAddress %s" % shipping_addr) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -7598,6 +7622,15 @@ paths: # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + shipping_addr = client.get_shipping_address(account_id, shipping_address_id) + print("Got ShippingAddress %s" % shipping_addr) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - plan @@ -7639,6 +7672,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] delete: tags: - plan @@ -7662,6 +7696,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/add_ons": get: tags: @@ -7747,6 +7782,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/shipping_methods": get: tags: @@ -7786,6 +7822,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/shipping_methods/{id}": get: tags: @@ -7820,6 +7857,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/subscriptions": get: tags: @@ -7861,11 +7899,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - subscriptions = client.list_subscriptions(limit=200).items() - for subscription in subscriptions: - print(subscription.uuid) - lang: Java source: | QueryParams params = new QueryParams(); @@ -7882,6 +7915,12 @@ paths: { Console.WriteLine(subscription.Uuid); } + - lang: Ruby + source: | + subscriptions = @client.list_subscriptions(limit: 200) + subscriptions.each do |subscription| + puts "Subscription: #{subscription.uuid}" + end - lang: Node.js source: | const subscriptions = client.listSubscriptions({ limit: 200 }) @@ -7889,12 +7928,11 @@ paths: for await (const subscription of subscriptions.each()) { console.log(subscription.uuid) } - - lang: Ruby + - lang: Python source: | - subscriptions = @client.list_subscriptions(limit: 200) - subscriptions.each do |subscription| - puts "Subscription: #{subscription.uuid}" - end + subscriptions = client.list_subscriptions(limit=200).items() + for subscription in subscriptions: + print(subscription.uuid) post: tags: - subscription @@ -7935,21 +7973,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_create = { - "plan_code": plan_code, - "currency": "USD", - "account": {"code": account_code}, - } - sub = client.create_subscription(sub_create) - print("Created Subscription %s" % sub) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -7998,6 +8021,27 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription_create = { + plan_code: plan_code, + currency: "USD", + # This can be an existing account or + # a new acocunt + account: { + code: account_code, + } + } + subscription = @client.create_subscription( + body: subscription_create + ) + puts "Created Subscription #{subscription}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -8021,27 +8065,21 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription_create = { - plan_code: plan_code, - currency: "USD", - # This can be an existing account or - # a new acocunt - account: { - code: account_code, + try: + sub_create = { + "plan_code": plan_code, + "currency": "USD", + "account": {"code": account_code}, } - } - subscription = @client.create_subscription( - body: subscription_create - ) - puts "Created Subscription #{subscription}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + sub = client.create_subscription(sub_create) + print("Created Subscription %s" % sub) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/subscriptions/{subscription_id}": get: tags: @@ -8071,15 +8109,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.get_subscription(subscription_id) - print("Got Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -8111,6 +8140,18 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.get_subscription( + subscription_id: subscription_id + ) + puts "Got Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -8127,18 +8168,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription = @client.get_subscription( - subscription_id: subscription_id - ) - puts "Got Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.get_subscription(subscription_id) + print("Got Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") put: tags: - subscription @@ -8170,17 +8208,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_update = {"customer_notes": "New Notes", "terms_and_conditions": "New TaC"} - subscription = client.modify_subscription(subscription_id, sub_update) - print("Modified Subscription %s" % subscription) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -8220,6 +8247,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription_update = { + customer_notes: "New Notes", + terms_and_conditions: "New ToC" + } + subscription = @client.modify_subscription( + subscription_id: subscription_id, + body: subscription_update + ) + puts "Modified Subscription #{subscription}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -8241,23 +8285,17 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription_update = { - customer_notes: "New Notes", - terms_and_conditions: "New ToC" - } - subscription = @client.modify_subscription( - subscription_id: subscription_id, - body: subscription_update - ) - puts "Modified Subscription #{subscription}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + sub_update = {"customer_notes": "New Notes", "terms_and_conditions": "New TaC"} + subscription = client.modify_subscription(subscription_id, sub_update) + print("Modified Subscription %s" % subscription) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - subscription @@ -8316,15 +8354,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.terminate_subscription(subscription_id) - print("Terminated Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -8358,6 +8387,18 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.terminate_subscription( + subscription_id: subscription_id, + ) + puts "Terminated Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -8374,18 +8415,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription = @client.terminate_subscription( - subscription_id: subscription_id, - ) - puts "Terminated Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.terminate_subscription(subscription_id) + print("Terminated Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/subscriptions/{subscription_id}/cancel": put: tags: @@ -8433,15 +8471,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.cancel_subscription(subscription_id) - print("Canceled Subscription %s" % subscription) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -8473,6 +8502,18 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.cancel_subscription( + subscription_id: subscription_id + ) + puts "Canceled Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -8489,18 +8530,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - subscription = @client.cancel_subscription( - subscription_id: subscription_id - ) - puts "Canceled Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + subscription = client.cancel_subscription(subscription_id) + print("Canceled Subscription %s" % subscription) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/subscriptions/{subscription_id}/reactivate": put: tags: @@ -8572,6 +8610,18 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + subscription = @client.reactivate_subscription( + subscription_id: subscription_id + ) + puts "Reactivated Canceled Subscription #{subscription}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -8589,18 +8639,6 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - subscription = @client.reactivate_subscription( - subscription_id: subscription_id - ) - puts "Reactivated Canceled Subscription #{subscription}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/subscriptions/{subscription_id}/pause": put: tags: @@ -8649,17 +8687,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_pause = {"remaining_pause_cycles": 10} - subscription = client.pause_subscription(subscription_id, sub_pause) - print("Paused Subscription %s" % subscription) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -8692,6 +8719,17 @@ paths: # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + sub_pause = {"remaining_pause_cycles": 10} + subscription = client.pause_subscription(subscription_id, sub_pause) + print("Paused Subscription %s" % subscription) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/subscriptions/{subscription_id}/resume": put: tags: @@ -8733,16 +8771,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - subscription = client.resume_subscription(subscription_id) - print("Resumed Subscription %s" % subscription) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Ruby source: | begin @@ -8755,6 +8783,16 @@ paths: # just return nil puts "Resource Not Found" end + - lang: Python + source: | + try: + subscription = client.resume_subscription(subscription_id) + print("Resumed Subscription %s" % subscription) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/subscriptions/{subscription_id}/change": get: tags: @@ -8798,15 +8836,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - change = client.get_subscription_change(subscription_id) - print("Got SubscriptionChange %s" % change) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -8838,6 +8867,18 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + change = @client.get_subscription_change( + subscription_id: subscription_id + ) + puts "Got SubscriptionChange #{change}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -8854,18 +8895,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - change = @client.get_subscription_change( - subscription_id: subscription_id - ) - puts "Got SubscriptionChange #{change}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + change = client.get_subscription_change(subscription_id) + print("Got SubscriptionChange %s" % change) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") post: tags: - subscription @@ -8909,17 +8947,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - sub_change_create = {"plan_code": new_plan_code, "timeframe": "now"} - change = client.create_subscription_change(subscription_id, sub_change_create) - print("Created SubscriptionChange %s" % change) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -8961,6 +8988,23 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + change_create = { + timeframe: "now", + plan_code: new_plan_code + } + change = @client.create_subscription_change( + subscription_id: subscription_id, + body: change_create + ) + puts "Created SubscriptionChange #{change}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -8982,23 +9026,17 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - change_create = { - timeframe: "now", - plan_code: new_plan_code - } - change = @client.create_subscription_change( - subscription_id: subscription_id, - body: change_create - ) - puts "Created SubscriptionChange #{change}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + sub_change_create = {"plan_code": new_plan_code, "timeframe": "now"} + change = client.create_subscription_change(subscription_id, sub_change_create) + print("Created SubscriptionChange %s" % change) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) delete: tags: - subscription @@ -9026,15 +9064,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - client.remove_subscription_change(subscription_id) - print("Removed SubscriptionChange from Subscription id=%s" % subscription_id) - except recurly.errors.NotFoundError: - # If the resource was not found, you may want to alert the user or - # just return nil - print("Resource Not Found") - lang: Java source: | try { @@ -9066,6 +9095,18 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + @client.remove_subscription_change( + subscription_id: subscription_id + ) + puts "Removed SubscriptionChange #{subscription_id}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -9082,18 +9123,15 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - @client.remove_subscription_change( - subscription_id: subscription_id - ) - puts "Removed SubscriptionChange #{subscription_id}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end + try: + client.remove_subscription_change(subscription_id) + print("Removed SubscriptionChange from Subscription id=%s" % subscription_id) + except recurly.errors.NotFoundError: + # If the resource was not found, you may want to alert the user or + # just return nil + print("Resource Not Found") "/sites/{site_id}/subscriptions/{subscription_id}/invoices": get: tags: @@ -9137,11 +9175,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - invoices = client.list_subscription_invoices(subscription_id).items() - for invoice in invoices: - print(invoice.number) - lang: Java source: | QueryParams params = new QueryParams(); @@ -9160,6 +9193,11 @@ paths: invoices.each do |invoice| puts "Invoice: #{invoice.number}" end + - lang: Python + source: | + invoices = client.list_subscription_invoices(subscription_id).items() + for invoice in invoices: + print(invoice.number) "/sites/{site_id}/subscriptions/{subscription_id}/line_items": get: tags: @@ -9204,11 +9242,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - line_items = client.list_subscription_line_items(subscription_id).items() - for line_item in line_items: - print(line_item.id) - lang: Java source: | QueryParams params = new QueryParams(); @@ -9227,6 +9260,11 @@ paths: line_items.each do |line_item| puts "LineItem: #{line_item.id}" end + - lang: Python + source: | + line_items = client.list_subscription_line_items(subscription_id).items() + for line_item in line_items: + print(line_item.id) "/sites/{site_id}/subscriptions/{subscription_id}/coupon_redemptions": get: tags: @@ -9257,15 +9295,10 @@ paths: default: description: Unexpected error. content: - application/json: - schema: - "$ref": "#/components/schemas/Error" - x-code-samples: - - lang: Python - source: | - redemptions = client.list_subscription_coupon_redemptions(subscription_id).items() - for redemption in redemptions: - print(redemption.uuid) + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: - lang: Java source: | QueryParams params = new QueryParams(); @@ -9284,6 +9317,11 @@ paths: coupon_redemptions.each do |redemption| puts "CouponRedemption: #{redemption.id}" end + - lang: Python + source: | + redemptions = client.list_subscription_coupon_redemptions(subscription_id).items() + for redemption in redemptions: + print(redemption.uuid) "/sites/{site_id}/transactions": get: tags: @@ -9326,11 +9364,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - transactions = client.list_transactions(limit=200).items() - for transaction in transactions: - print(transaction.uuid) - lang: Java source: | QueryParams params = new QueryParams(); @@ -9347,6 +9380,12 @@ paths: { Console.WriteLine(transaction.Uuid); } + - lang: Ruby + source: | + transactions = @client.list_transactions(limit: 200) + transactions.each do |transaction| + puts "Transaction: #{transaction.uuid}" + end - lang: Node.js source: | const transactions = client.listTransactions({ limit: 200 }) @@ -9354,12 +9393,11 @@ paths: for await (const transaction of transactions.each()) { console.log(transaction.uuid) } - - lang: Ruby + - lang: Python source: | - transactions = @client.list_transactions(limit: 200) - transactions.each do |transaction| - puts "Transaction: #{transaction.uuid}" - end + transactions = client.list_transactions(limit=200).items() + for transaction in transactions: + print(transaction.uuid) "/sites/{site_id}/transactions/{transaction_id}": get: tags: @@ -9420,6 +9458,16 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + transaction = @client.get_transaction(transaction_id: transaction_id) + puts "Got Transaction #{transaction}" + rescue Recurly::Errors::NotFoundError + # If the resource was not found, you may want to alert the user or + # just return nil + puts "Resource Not Found" + end - lang: Node.js source: | try { @@ -9436,16 +9484,6 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby - source: | - begin - transaction = @client.get_transaction(transaction_id: transaction_id) - puts "Got Transaction #{transaction}" - rescue Recurly::Errors::NotFoundError - # If the resource was not found, you may want to alert the user or - # just return nil - puts "Resource Not Found" - end "/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}": parameters: - "$ref": "#/components/parameters/site_id" @@ -9474,6 +9512,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] delete: tags: - unique_coupon_code @@ -9506,6 +9545,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}/restore": parameters: - "$ref": "#/components/parameters/site_id" @@ -9540,6 +9580,7 @@ paths: application/json: schema: "$ref": "#/components/schemas/Error" + x-code-samples: [] "/sites/{site_id}/purchases": post: tags: @@ -9583,27 +9624,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - purchase = { - "currency": "USD", - "account": { - "code": account_code, - "first_name": "Benjamin", - "last_name": "Du Monde", - "billing_info": {"token_id": rjs_token_id}, - }, - "subscriptions": [{"plan_code": plan_code}], - } - invoice_collection = client.create_purchase(purchase) - print("Created Charge Invoice %s" % invoice_collection.charge_invoice) - print("Created Credit Invoices %s" % invoice_collection.credit_invoices) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: Java source: | try { @@ -9674,6 +9694,33 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + purchase = { + currency: "USD", + account: { + code: account_code, + first_name: "Benjamin", + last_name: "Du Monde", + billing_info: { + token_id: rjs_token_id + }, + }, + subscriptions: [ + { plan_code: plan_code } + ] + } + invoice_collection = @client.create_purchase( + body: purchase + ) + puts "Created Charge Invoice #{invoice_collection.charge_invoice}" + puts "Created Credit Invoices #{invoice_collection.credit_invoices}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -9705,33 +9752,27 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - purchase = { - currency: "USD", - account: { - code: account_code, - first_name: "Benjamin", - last_name: "Du Monde", - billing_info: { - token_id: rjs_token_id - }, - }, - subscriptions: [ - { plan_code: plan_code } - ] - } - invoice_collection = @client.create_purchase( - body: purchase - ) - puts "Created Charge Invoice #{invoice_collection.charge_invoice}" - puts "Created Credit Invoices #{invoice_collection.credit_invoices}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + purchase = { + "currency": "USD", + "account": { + "code": account_code, + "first_name": "Benjamin", + "last_name": "Du Monde", + "billing_info": {"token_id": rjs_token_id}, + }, + "subscriptions": [{"plan_code": plan_code}], + } + invoice_collection = client.create_purchase(purchase) + print("Created Charge Invoice %s" % invoice_collection.charge_invoice) + print("Created Credit Invoices %s" % invoice_collection.credit_invoices) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) "/sites/{site_id}/purchases/preview": post: tags: @@ -9775,27 +9816,6 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: - - lang: Python - source: | - try: - purchase = { - "currency": "USD", - "account": { - "code": account_code, - "first_name": "Benjamin", - "last_name": "Du Monde", - "billing_info": {"token_id": rjs_token_id}, - }, - "subscriptions": [{"plan_code": plan_code}], - } - invoice_collection = client.preview_purchase(purchase) - print("Preview Charge Invoice %s" % invoice_collection.charge_invoice) - print("Preview Credit Invoices %s" % invoice_collection.credit_invoices) - except recurly.errors.ValidationError as e: - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.error.params - print("ValidationError: %s" % e.error.message) - print(e.error.params) - lang: ".NET" source: | try @@ -9832,6 +9852,33 @@ paths: // Use ApiError to catch a generic error from the API Console.WriteLine($"Unexpected Recurly Error: {ex.Error.Message}"); } + - lang: Ruby + source: | + begin + purchase = { + currency: "USD", + account: { + code: account_code, + first_name: "Benjamin", + last_name: "Du Monde", + billing_info: { + token_id: rjs_token_id + }, + }, + subscriptions: [ + { plan_code: plan_code } + ] + } + invoice_collection = @client.preview_purchase( + body: purchase + ) + puts "Preview Charge Invoice #{invoice_collection.charge_invoice}" + puts "Preview Credit Invoices #{invoice_collection.credit_invoices}" + rescue Recurly::Errors::ValidationError => e + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.recurly_error.params + puts "ValidationError: #{e.recurly_error.params}" + end - lang: Node.js source: | try { @@ -9863,33 +9910,27 @@ paths: console.log('Unknown Error: ', err) } } - - lang: Ruby + - lang: Python source: | - begin - purchase = { - currency: "USD", - account: { - code: account_code, - first_name: "Benjamin", - last_name: "Du Monde", - billing_info: { - token_id: rjs_token_id - }, - }, - subscriptions: [ - { plan_code: plan_code } - ] - } - invoice_collection = @client.preview_purchase( - body: purchase - ) - puts "Preview Charge Invoice #{invoice_collection.charge_invoice}" - puts "Preview Credit Invoices #{invoice_collection.credit_invoices}" - rescue Recurly::Errors::ValidationError => e - # If the request was invalid, you may want to tell your user - # why. You can find the invalid params and reasons in e.recurly_error.params - puts "ValidationError: #{e.recurly_error.params}" - end + try: + purchase = { + "currency": "USD", + "account": { + "code": account_code, + "first_name": "Benjamin", + "last_name": "Du Monde", + "billing_info": {"token_id": rjs_token_id}, + }, + "subscriptions": [{"plan_code": plan_code}], + } + invoice_collection = client.preview_purchase(purchase) + print("Preview Charge Invoice %s" % invoice_collection.charge_invoice) + print("Preview Credit Invoices %s" % invoice_collection.credit_invoices) + except recurly.errors.ValidationError as e: + # If the request was invalid, you may want to tell your user + # why. You can find the invalid params and reasons in e.error.params + print("ValidationError: %s" % e.error.message) + print(e.error.params) servers: - url: https://v3.recurly.com components: @@ -10583,6 +10624,25 @@ components: description: The shipping addresses on the account. items: "$ref": "#/components/schemas/ShippingAddress" + has_live_subscription: + type: boolean + description: Indicates if the account has a subscription that is either + active, canceled, future, or paused. + has_active_subscription: + type: boolean + description: Indicates if the account has an active subscription. + has_future_subscription: + type: boolean + description: Indicates if the account has a future subscription. + has_canceled_subscription: + type: boolean + description: Indicates if the account has a canceled subscription. + has_paused_subscription: + type: boolean + description: Indicates if the account has a paused subscription. + has_past_due_invoice: + type: boolean + description: Indicates if the account has a past due invoice. created_at: type: string format: date-time @@ -11333,6 +11393,16 @@ components: description: "*STRONGLY RECOMMENDED* Customer's IP address when updating their billing information." maxLength: 20 + gateway_token: + type: string + title: A token used in place of a credit card in order to perform transactions. + Must be used in conjunction with `gateway_code`. + maxLength: 50 + gateway_code: + type: string + title: An identifier for a specific payment gateway. Must be used in conjunction + with `gateway_token`. + maxLength: 12 amazon_billing_agreement_id: type: string title: Amazon billing agreement ID @@ -12760,6 +12830,12 @@ components: title: Item ID description: Available when the Catalog feature is enabled. maxLength: 13 + external_sku: + type: string + title: External SKU + description: Optional Stock Keeping Unit assigned to an item, when the Catalog + feature is enabled. + maxLength: 50 revenue_schedule_type: type: string title: Revenue schedule type @@ -15307,6 +15383,7 @@ components: - check - amazon_billing_agreement - paypal_billing_agreement + - gateway_token - other card_type: type: string @@ -15341,6 +15418,15 @@ components: type: integer description: Expiration year. maxLength: 4 + gateway_token: + type: string + description: A token used in place of a credit card in order to perform + transactions. + maxLength: 50 + gateway_code: + type: string + description: An identifier for a specific payment gateway. + maxLength: 13 billing_agreement_id: type: string description: Billing Agreement identifier. Only present for Amazon or Paypal @@ -15381,6 +15467,7 @@ components: - unknown_api_version - validation - missing_feature + - rate_limited message: type: string title: Message