Skip to content

Instantly share code, notes, and snippets.

@mgaffney
Created July 19, 2017 14:28
Show Gist options
  • Save mgaffney/cd0e537862ca5f225af3078d20643cbd to your computer and use it in GitHub Desktop.
Save mgaffney/cd0e537862ca5f225af3078d20643cbd to your computer and use it in GitHub Desktop.
Class Diagram of Recurly API objects
@startuml
skinparam defaultFontName Source Sans Pro
skinparam shadowing false
skinparam classAttributeIconSize 0
set namespaceSeparator none
note "The <b><<PoorDoc>></b> sterotype is used\nto denote classes which have not\nbeen well documented by Recurly." as N1
note "Attributes of type <b>float</b> are taken from the \nexamples shown in the sidebar of the Recurly\ndocumention. However, it is important to note\nthat the main documentation lists these\nattributes as string types." as N2
together {
class Account
class AccountAcquisition
class BillingInfo
class Address
}
together {
class GiftCard
class Delivery
}
Account *-- "1" BillingInfo : billing
class Account {
account_code : string (required) (unique) (created by us)
..
username : string
email : string
cc_emails : []string
..
first_name : string
last_name : string
company_name : string
address : Address
shipping_address : []Address
..
vat_number : string
tax_exempt : boolean
..
accept_language : string
..
hosted_login_token : string
state : string [active|closed]
..
created_at: datetime
updated_at: datetime
closed_at: datetime
..
has_live_subscription : boolean
has_active_subscription : boolean
has_future_subscription : boolean
has_canceled_subscription : boolean
has_past_due_invoice : boolean
..
adjustments : URL
account_balance : URL
billing_info : URL
invoices : URL
redemption : URL
transactions : URL
}
Account *--> "1" Address : address
Account *--> "0..20" Address : shipping_address
Account *-- "0..1" AccountAcquisition : acquisition
class AccountAcquisition {
account_code : string (required) (unique) (created by us)
..
cost_in_cents : integer
currency : string (3-letter ISO code)
..
channel : string [referral|social_media|email|paid_search|organic_search|direct_traffic|\n\tmarketing_content|blog|events|outbound_sales|advertising|public_relations|other]
subchannel : string
campaign : string
..
created_at : datetime
updated_at : datetime
..
account : URL
}
class Address {
address1 : string
address2 : string
city : string
state : string
zip : string
country : string
phone : string
}
note right of Address : Additional links to\nAddress are hidden.
class BillingInfo {
account_code : string (required) (unique) (created by us)
..
first_name : string
last_name : string
company_name : string
address1 : string
address2 : string
city : string
state : string
zip : string
country : string
..
vat_number : string
..
card_type : string
first_six : integer
last_four : integer
month : integer
year : integer
..
ip_address : string
ip_address_country : string
..
name_on_account : string
account_type : string [checking|savings]
account_number : integer
routing_number : integer
..
amazon_billing_agreement_id : string
braintree_payment_nonce : string
paypal_billing_agreement_id : string
roku_billing_agreement_id : string
..
updated_at : datetime
}
class Plan {
plan_code : string (required) (unique) (created by us)
name : string (required)
unit_amount_in_cents : []Currency (required)
..
description : string
success_url : string
..
plan_interval_unit : string [days|months]
plan_interval_length : integer
..
trial_interval_unit : string [days|months]
trial_interval_length : integer
trial_requires_billing_info : boolean
..
setup_fee_accounting_code : string
setup_fee_revenue_schedule_type : string [never|evenly|at_range_start|at_range_end]
setup_fee_in_cents : []Currency
..
accounting_code : string
revenue_schedule_type : string [never|evenly|at_range_start|at_range_end]
total_billing_cycles : string
display_quantity : boolean
..
tax_exempt : boolean
tax_code : string
}
class Currency {
currency_code : string (3-letter ISO code)
cents : integer
..
}
Plan *--> "1..*" Currency : unit_amount_in_cents
Plan *--> "0..*" Currency : setup_fee_in_cents
class PlanAddOn {
plan_code : string (required) (unique per plan) (created by us)
..
name : string
optional : boolean
..
add_on_code : string
add_on_type : string [fixed|usage]
..
default_quantity : integer
display_quantity_on_hosted_page : boolean
..
unit_amount_in_cents : []Currency
measured_unit_id : string
..
accounting_code : string
revenue_schedule_type : string [never|evenly|at_range_start|at_range_end]
..
usage_type : string [price|percentage]
usage_percentage : string [0.0000-100.0000]
..
tax_code : string
}
Plan *-- "0..*" PlanAddOn : available_add_ons
PlanAddOn "0..*" --> "0..1" MeasuredUnit
PlanAddOn *--> "0..*" Currency : unit_amount_in_cents
Subscription o-- "0..*" PlanAddOn : subscribed_to_add_ons
class Subscription {
uuid : string (created by recurly)
..
plan_code : string (required)
account : Account (required)
currency : string (required) (3-letter ISO code)
..
unit_amount_in_cents : integer
quantity : integer
starts_at : datetime
trial_ends_at : datetime
..
total_billing_cycles : integer
first_renewal_date : datetime
collection_method : string [automatic|manual]
net_terms : integer
po_number : string
..
terms_and_conditions : string
customer_notes : string
vat_reverse_charge_notes : string
..
bank_account_authorized_at : timestamp
revenue_schedule_type : string [never|evenly|at_range_start|at_range_end]
..
shipping_address : Address
shipping_address_id : string
..
coupon_code : string
gift_card : object
redemption_code : string
..
bulk : boolean
..
subscription_add_ons : []AddOn
}
Account *-- "0..*" Subscription : subscriptions
Subscription *-[hidden]-> "1" Address : shipping_address
Subscription o--> "1" Plan : plan
class MeasuredUnit {
id : integer (created by recurly)
..
name : string (required)
display_name : string (required)
description : string
}
class Transaction {
uuid : string (created by recurly)
..
action : string [purchase|verify|refund]
status : string [success|declined|void]
product_code : string
..
payment_method : string [credit_card|paypal|check|wire_transfer|money_order]
amount_in_cents : integer
tax_in_cents : integer
currency : string (3-letter ISO code)
source : string [transaction|subscription|billing_info]
origin : string [api|hpp|merchant|recurly_admin|recurlyjs|recurring|\n\ttransparent|force_collect|refunded_externally|chargeback]
..
recurring : boolean
test : boolean
voidable : boolean
refundable : boolean
..
ip_address : string
..
cvv_result : string
avs_result : string
avs_result_streat : string
avs_result_postal : string
..
reference : string
details : string
description : string
message : string
..
approval_code : string
gateway_type : string
..
error_code : string
error_category : string
merchant_message : string
customer_message : string
gateway_error_codes : string
..
created_at : datetime
updated_at : datetime
collected_at : datetime
..
account : URL
invoice : URL
subscription : URL
original_transaction : URL
}
Account *-- "0..*" Transaction
Transaction o--> Subscription : subscription
Transaction o--> "0..1" Transaction : original_transaction
class Invoice <<PoorDoc>> {
uuid : string (created by recurly)
..
state : string [collected|open|?]
..
invoice_number_prefix : string
invoice_number : integer
po_number : string
vat_number : string
..
subtotal_in_cents : integer
tax_in_cents : integer
total_in_cents : integer
currency : string (required) (3-letter ISO code)
..
terms_and_conditions : string
customer_notes : string
..
tax_type : string
tax_region : string
tax_rate : float
..
collection_method : string [automatic|manual]
net_terms : integer
..
created_at : datetime
updated_at : datetime
closed_at : datetime
..
line_items : []Adjustment
transactions : []Transaction
..
account : URL
subscription : URL
redemptions : URL
}
Account *- "0..*" Invoice
Account *-- "0..*" Adjustment
Invoice o--> Subscription : subscription
Invoice *-[hidden]-> "1" Address : address
Invoice *-[hidden]-> "0..1" Address : shipping_address
Invoice *-- "?..*" Adjustment : line_items
Invoice *-- "0..*" Transaction : transactions
class Adjustment {
uuid : string (created by recurly)
..
type : string [charge|credit]
state : string [pending|invoiced]
..
description : string
accounting_code : string
product_code : string
origin : string [plan|plan_trial|setup_fee|add_on|\n\tadd_on_trial|one_time|debit|credit|coupon|carryforward]
..
original_adjustment_uuid : string
..
unit_amount_in_cents : integer
quantity : integer
discount_in_cents : integer
tax_in_cents : integer
total_in_cents : integer
currency : string (3-letter ISO code)
..
taxable : boolean
tax_type : string
tax_region : string
tax_rate : float
tax_exempt : boolean
tax_code : string (VAT related)
tax_details : []TaxDetail
..
start_date : datetime
end_date : datetime
created_at : datetime
updated_at : datetime
..
account : URL
subscription : URL
invoice : URL
}
Adjustment *--> "0..*" TaxDetail : tax_details
class TaxDetail {
name : string
type : string
tax_rate : float
tax_in_cents : integer
..
}
Adjustment o--> Subscription
class Coupon {
coupon_code : string (required) (unique) (created by us)
name : string (required)
discount_type : string (required) [percent|dollars|free_trial]
..
discount_in_cents : []Currency
discount_percent : integer
..
description : string
invoice_description : string
..
redeem_by_date : datetime
max_redemptions : integer
max_redemptions_per_account : integer
applies_to_all_plans : boolean
applies_to_non_plan_charges : boolean
plan_codes : []string
redemption_resource : string [account|subscription]
..
duration : string [forever|single_use|temporal]
temporal_unit : string [day|week|month|year]
temporal_amount : integer
..
coupon_type : string [single_code|bulk]
unique_code_template : string
..
free_trial_amount : integer
free_trial_unit : string [day|week|month]
}
class Redemption {
account_code : string (required)
uuid : string (created by recurly)
coupon_code : string
..
single_use : boolean
state : string [active|inactive]
..
total_discounted_in_cents
currency : string (3-letter ISO code)
..
created_at : datetime
updated_at : datetime
..
coupon : URL
account : URL
subscription : URL
}
Account o-- "0..*" Redemption : redemptions
Subscription o-- "0..*" Redemption : redemptions
Invoice o-- "0..*" Redemption : redemptions
Redemption "0..*" --> "1" Coupon
class GiftCard {
id : integer|string (created by recurly)
redemption_code : string (created by recurly)
..
unit_amount_in_cents : integer
balance_in_cents : integer
currency : string (3-letter ISO code)
..
product_code : string
..
created_at : datetime
updated_at : datetime
delivered_at : datetime
redeemed_at : datetime
..
gifter_account : URL
recipient_account : URL
invoice : URL
}
GiftCard "1" o--> "1" Account : gifter_account
GiftCard "1" o--> "0..1" Account : recipient_account
GiftCard "1" *-> "1" Delivery
class Delivery {
method : string [email|post]
deliver_at : datetime
email_address : string
first_name : string
last_name : string
gifter_name : string
personal_message : string
..
address : Address
}
@enduml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment